RAISE: Reasoning Agent for Interactive SQL Exploration

Fernando Granado, Roberto Lotufo, Jayr Pereira · 2025

Read RAISE: Reasoning Agent for Interactive SQL Exploration by Fernando Granado, Roberto Lotufo, Jayr Pereira (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2506-01273.txt.

Introduction

Granado, Lotufo, and Pereira present RAISE, an agent that turns plain questions into database queries by exploring the data as it works. Most current systems split the task into fixed stages, which can fail on vague questions. Their 2025 framework keeps linking, query writing, and revision inside one component that reasons as a person would.

The agent forms a guess, runs a query to test it, reads the result, and revises. Letting it explore more deeply at test time raised accuracy on a hard public dataset from about 45 to about 57 in 100. With several candidate answers, its best pick score nearly matched the top published system. The authors stress the simpler design as part of the gain. The authors stress the simpler design as part of the gain.

Catalog record

CREATORFernando Granado, Roberto Lotufo, Jayr Pereira
YEAR2025
COLLECTIONPAPERS
FORMATTXT
FILE SIZE26 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2506-01273

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

RAISE: Reasoning Agent for Interactive SQL Exploration Fernando Granado, Roberto Lotufo, Jayr Pereira Abstract Recent advances in large language models (LLMs) have propelled research in natural language interfaces to databases. However, most state-of-the-art text-to-SQL systems still depend on complex, multi-stage pipelines. This work proposes a novel agentic framework that unifies schema linking, query generation, and iterative refinement within a single, end-to-end component. By leveraging the intrinsic reasoning abilities of LLMs, our method emulates how humans answer questions when working with unfamiliar databases: understanding the data by formulating hypotheses, running dynamic queries to validate them, reasoning over the results, and revising outputs based on observed results. Crucially, our approach introduces a new strategy for scaling test-time computation in text-to-SQL: we scale the depth of interactive database exploration and reflection. This shift enables the model to allocate computation dynamically to better understand the data, especially useful in ambiguous and underspecified scenarios. Our experiments show that it improved the Execution Accuracy (EX) from 44.8% to 56.5% on the challenging BIRD dataset using DeepSeek-R1-Distill-Llama-70B . Furthermore, when equipped with steps to add more diversity to the answers, our agent achieves a Best-of-N accuracy of 81.8% with 8 rounds of candidate generation, rivaling the 82.79% achieved by the top-ranked published solution, while reducing engineering complexity. These findings position our unified framework as a promising alternative for building natural language interfaces to databases. keywords Text-to-SQL, NL2SQL, Reasoning Agents, Test-Time Compute 1 Introduction Answering natural language questions using information stored in databases is a critical task across many sectors of the economy, playing a central role in data-driven decision-making. The recent advances in large language models (LLMs) have opened new possibilities in automating the text-to-SQL task, as these models exhibit strong reasoning abilities and extensive common-sense knowledge Brown et al. 2020 ; Bubeck et al. 2023 ; Wei et al. 2022 ; Androutsopoulos et al. 1995 ; Li et al. 2023 ; Liu et al. 2024 ; Gu et al. 2023 . However, even integrating LLMs into sophisticated pipelines, recent benchmarks still reveal a performance gap between machines and humans in this domain Li et al. 2023 ; Talaei et al. 2024 ; Pourreza et al. 2024 ; Pourreza and et al. 2024 . Contemporary text-to-SQL systems often rely on complex multi-component pipelines, delegating tasks such as schema linking, query structuring, and result validation to specialized modules Liu et al. 2024 ; Chakraborty et al. 2025 ; Dong et al. 2023 ; Wang et al. 2023 ; Talaei et al. 2024 ; Pourreza et al. 2024 ; Pourreza and et al. 2024 . In addition, despite the successful use of test-time compute in the broader AI landscape Jaech et al. 2024 ; Snell et al. 2024 , current pipelines mostly restrict their application to iterative query refinement and query selection strategies such as self-consistency or best-of-N Pourreza et al. 2024 ; Pourreza and et al. 2024 ; Chakraborty et al. 2025 ; Cao et al. 2024 ; Lee et al. 2024 . Humans, on the other hand, often spend significant time exploring the database to better understand what data is available, how the data is stored, interpret ambiguous column names, and identify inconsistencies in the data. These systems, however, do not scale compute to support such behavior. Although modular pipelines can enhance accuracy, they also increase engineering complexity. Given the reasoning and generalization capabilities of LLMs, an important question arises: Can we simplify these pipelines by allowing the model to handle more of these tasks autonomously? Specifically, can an end-to-end agent dynamically reason about schema linking, formulate queries, iterate over results, identify and handle ambiguities, and allocate more time to these steps when needed, all without extensive manual design? Aiming to answer this question, this paper presents a novel agentic approach that unifies schema linking, query composition, and query refinement in a single component. Our approach leverages the model’s internal reasoning traces to guide interactions with the database—exploring tables, interpreting results, and revising hypotheses in a manner reminiscent of human analysts. This introduces a new strategy for scaling test-time compute: increasing database exploration and reflection on query results to improve the model’s understanding. Without any fine-tuning, our agent is capable of generating the correct solution in 81.8% of the questions on the BIRD dataset Li et al. 2024 , rivaling the performance of leading multi-stage pipelines for candidate generation, such as the 82.79% achieved by the start-of-the-art end-to-end solution Pourreza et al. 2024 . This challenges the prevailing view that LLMs require extensive external support to perform competitively on text-to-SQL tasks. The main contributions of this paper are: [1.] 1. A unified agentic framework that performs schema linking, query generation, and refinement within a single LLM-based component 1 1 1 All prompts and a sample of the generated data are available in this Dropbox folder . ; 2. A new strategy of scaling test-time computation in Text-to-SQL: deeper database exploration through increased model interactions; The remainder of this paper is structured as follows: Section 2 reviews related work in modular pipelines for text-to-SQL. Section 3 introduces our proposed agentic framework, describing its reasoning process, database interaction tools, control mechanisms, and strategies for generating diverse outputs. Section 4 then presents our experimental setup, including the evaluation framework and controlled comparisons between agents. Results are analyzed in Section 5 , highlighting the impact of dynamic exploration and pipeline enhancements. Finally, Section 6 concludes the paper. 2 Related Work Modern text-to-SQL solutions rely on a complex arrangement of independent components assembled to generate the final SQL query Liu et al. 2024 ; Talaei et al. 2024 ; Pourreza et al. 2024 ; Pourreza and et al. 2024 ; Dong et al. 2023 ; Pourreza and Rafiei 2023 ; Wang et al. 2023 ; Lee et al. 2024 ; Xie et al. 2025 ; Pourreza et al. 2025 . Some of the most important components are: 1) the schema linking, responsible for filtering the relevant tables and columns to answer the question; 2) a generation module, responsible for generating many high-quality and diverse set of candidate solutions; and 3) a selection module, responsible for selecting the most appropriate SQL among the generated candidates. This architecture underpins some of the best-performing solutions on the BIRD benchmark 2 2 2 https://bird-bench.github.io/ . CHESS Talaei et al. 2024 introduced a sophisticated schema linking module that inspired many following works Pourreza et al. 2024 ; Pourreza and et al. 2024 ; Xie et al. 2025 . It follows a multi-stage pipeline that begins with preprocessing and proceeds through a three-step funnel that incrementally narrows down the relevant schema elements. During preprocessing, CHESS detects entities mentioned in the input question and uses Locality-Sensitive Hashing Datar et al. 2004 and edit distance to match them to similar column values. Embedding-based similarity is used to retrieve relevant descriptions from the database catalog, and heuristics, such as always including foreign keys, ensure the inclusion of essential schema elements. These outputs condition the prompts used by each stage of the funnel. The generation phase is often implemented as an iterative process: candidate queries are generated, executed, and refined based on the observed results until satisfactory answers are reached. This is also the main place where test-time compute is scaled by

Read the complete text