AV-SQL: 에이전트 기반 뷰를 활용한 복잡한 텍스트-SQL 쿼리 분해
AV-SQL: Decomposing Complex Text-to-SQL Queries with Agentic Views
텍스트-SQL은 자연어 쿼리를 주어진 데이터베이스에 대한 실행 가능한 SQL로 변환하는 작업으로, 비전문 사용자가 SQL을 직접 작성하지 않고도 구조화된 데이터에 접근할 수 있도록 합니다. 대규모 언어 모델(LLM)의 발전으로 빠른 성장이 있었지만, 기존 접근 방식은 여전히 실제 환경에서 크고 복잡한 쿼리에 어려움을 겪고 있습니다. 데이터베이스 스키마가 크고 질문이 여러 테이블 간의 다단계 추론을 필요로 하는 경우, 전체 스키마를 제공하면 종종 컨텍스트 창을 초과하며, 한 번에 SQL을 생성하는 방식은 구문 오류 및 잘못된 스키마 연결로 인해 실행 불가능한 SQL을 자주 생성합니다. 이러한 문제를 해결하기 위해, 우리는 복잡한 텍스트-SQL을 전문화된 LLM 에이전트 파이프라인으로 분해하는 프레임워크인 AV-SQL을 소개합니다. AV-SQL의 핵심은 에이전트 기반 뷰의 개념으로, 에이전트가 생성하는 Common Table Expressions (CTE)는 중간 쿼리 로직을 캡슐화하고, 큰 스키마에서 관련 스키마 요소를 필터링합니다. AV-SQL은 세 단계로 작동합니다: (1) 재작성 에이전트는 입력 쿼리를 압축하고 명확하게 합니다; (2) 뷰 생성 에이전트는 스키마 조각을 처리하여 에이전트 기반 뷰를 생성합니다; (3) 계획, 생성, 수정 에이전트는 이러한 뷰를 협업하여 최종 SQL 쿼리를 구성합니다. 광범위한 실험 결과, AV-SQL은 어려운 Spider 2.0 벤치마크에서 70.38%의 실행 정확도를 달성하여 최첨단 모델보다 우수한 성능을 보였으며, 표준 데이터 세트에서도 Spider에서 85.59%, BIRD에서 72.16%, KaggleDBQA에서 63.78%의 경쟁력 있는 성능을 보였습니다. 저희의 소스 코드는 https://github.com/pminhtam/AV-SQL 에서 확인할 수 있습니다.
Text-to-SQL is the task of translating natural language queries into executable SQL for a given database, enabling non-expert users to access structured data without writing SQL manually. Despite rapid advances driven by large language models (LLMs), existing approaches still struggle with complex queries in real-world settings, where database schemas are large and questions require multi-step reasoning over many interrelated tables. In such cases, providing the full schema often exceeds the context window, while one-shot generation frequently produces non-executable SQL due to syntax errors and incorrect schema linking. To address these challenges, we introduce AV-SQL, a framework that decomposes complex Text-to-SQL into a pipeline of specialized LLM agents. Central to AV-SQL is the concept of agentic views: agent-generated Common Table Expressions (CTEs) that encapsulate intermediate query logic and filter relevant schema elements from large schemas. AV-SQL operates in three stages: (1) a rewriter agent compresses and clarifies the input query; (2) a view generator agent processes schema chunks to produce agentic views; and (3) a planner, generator, and revisor agent collaboratively compose these views into the final SQL query. Extensive experiments show that AV-SQL achieves 70.38% execution accuracy on the challenging Spider 2.0 benchmark, outperforming state-of-the-art baselines, while remaining competitive on standard datasets with 85.59% on Spider, 72.16% on BIRD and 63.78% on KaggleDBQA. Our source code is available at https://github.com/pminhtam/AV-SQL.
No Analysis Report Yet
This paper hasn't been analyzed by Gemini yet.
Log in to request an AI analysis.