지식 기반 구축을 통한 지식 증강 텍스트-투-SQL
Knowledge Base Construction for Knowledge-Augmented Text-to-SQL
May 28, 2025
저자: Jinheon Baek, Horst Samulowitz, Oktie Hassanzadeh, Dharmashankar Subramanian, Sola Shirai, Alfio Gliozzo, Debarun Bhattacharjya
cs.AI
초록
Text-to-SQL은 자연어 질의를 SQL 문으로 변환하는 것을 목표로 하며, 이를 통해 누구나 데이터베이스에서 원하는 정보를 쉽게 검색할 수 있도록 하는 실용적인 기술이다. 최근에는 대규모 언어 모델(LLMs)을 활용하여 사용자 질의를 이해하고 해당 SQL 코드를 생성하는 강력한 능력을 바탕으로 이 문제를 해결하려는 다양한 접근법이 등장했다. 그러나 LLMs의 파라미터적 지식은 다양한 데이터베이스 스키마에 기반을 둔 도메인 특화 질의를 모두 포괄하기에는 한계가 있어, 생성된 SQL이 종종 부정확한 경우가 있다. 이를 해결하기 위해, 우리는 텍스트-to-SQL을 위한 지식 기반을 구축하여 주어진 질의에 필요한 지식을 검색하고 생성하는 기반 지식 소스를 제안한다. 특히, 기존 접근법이 수동으로 지식을 주석 처리하거나 각 질의에 대해 소수의 지식만을 생성하는 것과 달리, 우리의 지식 기반은 사용 가능한 모든 질문과 관련 데이터베이스 스키마, 그리고 관련 지식을 기반으로 구축되어 포괄적이며, 다양한 데이터셋과 도메인에서 보이지 않는 데이터베이스에 재사용될 수 있다. 우리는 중첩 및 비중첩 데이터베이스 시나리오를 고려하여 여러 텍스트-to-SQL 데이터셋에서 이 접근법을 검증하였으며, 관련 베이스라인을 크게 능가하는 성능을 보였다.
English
Text-to-SQL aims to translate natural language queries into SQL statements,
which is practical as it enables anyone to easily retrieve the desired
information from databases. Recently, many existing approaches tackle this
problem with Large Language Models (LLMs), leveraging their strong capability
in understanding user queries and generating corresponding SQL code. Yet, the
parametric knowledge in LLMs might be limited to covering all the diverse and
domain-specific queries that require grounding in various database schemas,
which makes generated SQLs less accurate oftentimes. To tackle this, we propose
constructing the knowledge base for text-to-SQL, a foundational source of
knowledge, from which we retrieve and generate the necessary knowledge for
given queries. In particular, unlike existing approaches that either manually
annotate knowledge or generate only a few pieces of knowledge for each query,
our knowledge base is comprehensive, which is constructed based on a
combination of all the available questions and their associated database
schemas along with their relevant knowledge, and can be reused for unseen
databases from different datasets and domains. We validate our approach on
multiple text-to-SQL datasets, considering both the overlapping and
non-overlapping database scenarios, where it outperforms relevant baselines
substantially.Summary
AI-Generated Summary