TLDR: CHAIN-OF-QUERY (CoQ) is a new multi-agent framework that significantly improves how Large Language Models (LLMs) understand tabular data with SQL. It achieves this by using natural-language table schemas, generating SQL queries clause-by-clause for better accuracy, and dividing reasoning tasks between SQL (for mechanical operations) and LLMs (for logical inference). CoQ boosts accuracy and reduces invalid SQL rates across various benchmarks and LLMs, demonstrating robust and efficient table understanding.
Large Language Models (LLMs) have transformed many areas of natural language processing, but they often encounter difficulties when tasked with understanding tabular data. This challenge arises from the inherent structural complexity of tables, which organize information in rows and columns with hierarchical relationships and implicit semantics, differing significantly from plain text. Traditional methods, including fine-tuning LLMs or using agent-based pipelines with predefined tools, have shown limitations in handling multi-step, structured reasoning operations required for table understanding, such as aggregation and comparison.
Existing SQL generation frameworks for table understanding also face issues like LLMs’ inability to fully grasp table structures for reliable SQL, error propagation leading to invalid queries, and an over-reliance on the exact correctness of SQL execution for final answers. These limitations often result in suboptimal performance and fragile systems.
Introducing CHAIN-OF-QUERY (CoQ)
To address these critical challenges, researchers have developed CHAIN-OF-QUERY (CoQ), a novel multi-agent framework designed to enhance SQL-aided table understanding. CoQ introduces several innovative strategies to improve accuracy, reduce invalid SQL queries, and make the reasoning process more robust.
One of CoQ’s core innovations is the use of natural-language-style representations of table schemas. Instead of feeding raw, complex table structures to LLMs, CoQ abstracts the schema into a concise, natural language format, including the table name, headers (with value types), and a few example rows. This allows LLMs to focus on the high-level semantics of the table, bypassing the need to interpret noisy or irregular layouts, which is a common struggle for these models.
Another key strategy is Clause-by-Clause SQL Generation. Complex table understanding tasks often require intricate SQL queries with multiple clauses or nested structures. Generating such queries in a single attempt is prone to errors that can cascade and lead to query failures. CoQ tackles this by incrementally building SQL queries, one clause at a time (e.g., SELECT-FROM, WHERE, GROUP BY, ORDER BY, WITH AS). Each intermediate query is validated, and if an error occurs, it can be traced back to the most recently added clause, allowing for targeted correction and improved robustness. This forms a chain of progressively refined and validated queries.
CoQ also features a Hybrid Reasoning Division Strategy. Unlike approaches that treat SQL outputs as final answers, CoQ separates mechanical reasoning (like filtering and arithmetic, handled by SQL) from logical inference (like comparison and abstraction, handled by LLMs). SQL execution results are considered intermediate data, over which LLMs apply their powerful inference capabilities to derive the final natural language answer. This division leverages the strengths of both SQL for precise data manipulation and LLMs for flexible, high-level reasoning, preventing LLMs from generating overly complex and fragile SQL queries.
Furthermore, CoQ incorporates Parallel Decomposition, which breaks down complex questions into independent sub-questions that can be processed concurrently. This avoids inter-step dependencies common in traditional sequential reasoning, simplifying SQL generation and enhancing overall robustness.
Also Read:
- A Collaborative AI Approach to Multimodal Entity Linking
- Text-to-Table Generation: When Does Structured Decoding Help or Hinder?
Performance and Impact
Extensive experiments conducted across five widely used benchmarks (WikiTQ, TabFact, FeTaQA, IM-TQA, and Open-WikiTable) and with various LLMs (GPT-3.5, GPT-4.1, LLaMA 2, LLaMA 3.1, DeepSeek-V3) demonstrate CoQ’s superior effectiveness. The framework significantly improves accuracy, for instance, from 61.11% to 74.77% on WikiTQ with GPT-3.5, and drastically reduces the invalid SQL rate from 9.48% to 3.34%. These results highlight CoQ’s ability to handle diverse reasoning types, table structures, and domains, showcasing strong generalization capabilities.
CoQ also proves scalable with stronger LLMs, consistently outperforming other methods. Even with GPT-3.5, CoQ achieves higher accuracy than some baselines using GPT-4.1, indicating that the framework’s design contributes more to performance than just using a more powerful model. Its natural-language-style schema also enables strong performance on real-world, structurally complex, and multi-table datasets like IM-TQA and Open-WikiTable.
Moreover, CoQ is efficient in its use of LLMs, requiring an average of only 7.63 LLM calls per instance on WikiTQ, significantly fewer than many other multi-agent baselines. This efficiency is a direct result of its hybrid reasoning and early stopping mechanisms, which prevent over-generation of SQL and minimize error correction needs.
In conclusion, CHAIN-OF-QUERY offers a robust and effective paradigm for SQL-aided table understanding. By abstracting table schemas, generating SQL clause-by-clause, and intelligently dividing reasoning tasks between SQL and LLMs, CoQ unleashes the full potential of LLMs in complex tabular data environments. You can find more details about this research paper here.


