ACTS-SQL: Agentic and Critic-Oriented Tree-Structured SQL Correctness with Large Language Models

Xinmei Huang, Jie Song, Peng Li, Fuxin Jiang, Jing Zhang, Tieying Zhang, Jianjun Chen, Chenming Liu, Tao Yang, Maoyin Liu, Wenda Li, Hong Chen, Cuiping LiarXiv 2026

TL;DR

ACTS-SQL is a training-free framework that treats SQL error correction as a plan-guided, tree-structured debugging process rather than a linear, single-path sequence. By allowing the system to branch out when encountering ambiguous user intents and backtrack when errors accumulate, it mitigates semantic drift and achieves a 9.42% improvement over previous state-of-the-art methods on public benchmarks, while significantly boosting accuracy in real-world production environments.

What Problem Does This Paper Address?

While Large Language Models (LLMs) have revolutionized Text-to-SQL systems, generating flawless SQL queries in a single pass remains incredibly difficult. Minor errors—like incorrect join conditions or misplaced filters—can silently lead to completely wrong data outputs.

Existing automated SQL correction methods fall into two camps, both with major drawbacks:

  1. Training-based approaches: These require massive amounts of high-quality, verified training data and struggle to generalize across different SQL dialects.
  2. Linear agentic workflows: These training-free methods use an LLM to iteratively fix a query based on execution errors. However, they follow a single, irreversible path. If the agent makes an incorrect assumption early on, errors accumulate, causing "semantic drift" where the query veers further away from the user's actual intent (as illustrated in Linear Failure Mode).
Figure 1: A failure mode of linear SQL correction, illustrating how early implicit assumptions and error accumulation lead to semantic drift, causing the final query to deviate from the user’s intent.

ACTS-SQL addresses this fragility by introducing a tree-structured exploration space that mimics how human developers debug: exploring multiple hypotheses, validating them against the database, and rolling back when a path hits a dead end.

Methods

The core innovation of ACTS-SQL is shifting from a linear correction loop to a plan-guided, tree-structured debugging process.

Figure 2: Overview of our framework.

The framework consists of two main components:

  • Central Agent: The "brain" of the system. It generates an initial tree-structured revision plan (represented as a JSON object), dynamically chooses which node to execute next based on tool feedback, and decides whether to accept a query or backtrack.
  • Specialized Operator Space (Tools):
    • Detect Ambiguities (LLM-based): Analyzes the user query to find ambiguous terms (e.g., defining what "active users" means) and generates 2–3 plausible interpretations, creating distinct branches in the debugging tree.
  • Inspect Columns & Run SQL (Execution-based): Interacts directly with the database to sample column values and run sub-queries, grounding the LLM's reasoning in actual data distributions.
  • Split and Fix Syntax Error SQL (Hybrid): Instead of rewriting a broken query from scratch, this tool breaks down a syntactically invalid query into clause-level units, runs them in parallel using empty temporary tables to isolate the syntax error, and fixes it locally.
  • Generate SQL (Hybrid): The leaf node tool that minimally edits the query based on the accumulated history and evidence.

An example of this tree-based execution trace, showcasing branching and backtracking, can be seen in Tree-Based Correction Trace.

Figure 3: An example of the tree-based SQL correction pro- cess. Starting from ambiguity detection, the system branches into alternative semantic interpretations of “overlapping”. The incorrect interpretation (total booking count) is pruned after semantic validation based on evidence obtained from the inspect_columns tool, triggering backtracking. The cor- rect branch (concurrent time overlap) proceeds through SQL generation and syntax repair, ultimately producing a vali- dated query. Each node corresponds to a tool invocation, and branching, backtracking, and acceptance decisions are made by Central Agent based on execution feedback.

Datasets

The authors evaluated ACTS-SQL on two primary datasets:

  1. BIRD-Critic: A challenging public benchmark specifically designed for SQL debugging, derived from real-world user-reported errors. It includes a PostgreSQL subset and a multi-dialect subset spanning MySQL, SQL Server, and Oracle.
  2. Torch Log Service (TLS) Dataset: A real-world industrial dataset collected from ByteDance's Volcano Engine. TLS uses a highly customized, domain-specific SQL-like language for large-scale log analysis, making it an excellent testbed for cross-dialect generalization.

Key Insights and Ideas

  • Local Changes Have Global Impacts: In SQL, adding a single WHERE clause or changing an aggregation function alters the entire result set. Linear agents fail because they try to layer local fixes on top of fundamentally flawed initial assumptions.
  • Explicit Ambiguity Handling is Crucial: Many SQL errors stem from underspecified natural language queries. By forcing the LLM to explicitly list out ambiguous interpretations before writing code, the system preserves the correct solution space.
  • Clause-Level Deconstruction Saves Semantics: When a query throws a syntax error, regenerating the whole thing often introduces new semantic bugs. Isolating syntax errors to specific clauses via parallelized sub-query execution maintains the integrity of the already-validated parts of the query.

Key Results

  • Benchmark Superiority: On the BIRD-Critic benchmark, ACTS-SQL consistently outperformed raw LLMs (including GPT-o3 and DeepSeek-R1) and existing agent baselines, beating the previous state-of-the-art fine-tuned model (Xiyan Model) by 9.42% on average.
  • Production Impact: When deployed within ByteDance's Torch Log Service pipeline using a GPT-5 backbone, ACTS-SQL boosted execution accuracy on real user queries from 36.77% to 53.61% (a 16.84 percentage point absolute gain).
  • Cross-Dialect Robustness: Unlike fine-tuned models that degrade when moving away from their training dialect, ACTS-SQL maintained high performance across PostgreSQL, MySQL, SQL Server, Oracle, and the custom TLS language without any extra training.

Limitations and Future Work

Despite its impressive accuracy gains, the primary trade-off of ACTS-SQL is latency and cost. Because the framework explores multiple branches and relies on iterative tool interactions, the average end-to-end runtime is around 3 minutes for models like GPT-5, and up to 4–5 minutes for reasoning models like GPT-o3.

While this latency profile is perfectly acceptable for offline data curation, automated data cleaning, or asynchronous copilot features, future work will need to focus on optimizing the tree-search efficiency to make it highly responsive for real-time, interactive user interfaces.

Summary updated

BibTeX
@misc{huang2026acts,
  author = {Xinmei Huang and Jie Song and Peng Li and Fuxin Jiang and Jing Zhang and Tieying Zhang and Jianjun Chen and Chenming Liu and Tao Yang and Maoyin Liu and Wenda Li and Hong Chen and Cuiping Li},
  title = {{ACTS-SQL: Agentic and Critic-Oriented Tree-Structured SQL Correctness with Large Language Models}},
  year = {2026},
  eprint = {2608.15145},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2608.15145},
}
Figure