Abstract
This study introduces a new long-form database question answering dataset designed to evaluate how Large Language Models (LLMs) interact with a SQL interpreter. The task necessitates LLMs to strategically generate multiple SQL queries to retrieve sufficient data from a database, to reason with the acquired context, and to synthesize them into a comprehensive analytical narrative. Our findings highlight that this task poses great challenges even for the state-of-the-art GPT-4 model. We propose and evaluate two interaction strategies, and provide a fine-grained analysis of the individual stages within the interaction. A key discovery is the identification of two primary bottlenecks hindering effective interaction: the capacity for planning and the ability to generate multiple SQL queries. To address the challenge of accurately assessing answer quality, we introduce a multi-agent evaluation framework that simulates the academic peer-review process, enhancing the precision and reliability of our evaluations. This framework allows for a more nuanced understanding of the strengths and limitations of current LLMs in complex retrieval and reasoning tasks.
Introduction
Large Language Models (LLMs) are increasingly deployed as agents to solve complex tasks that require interacting with external tools. However, a significant gap exists between an LLM's internal reasoning and its ability to act upon large-scale external data sources like enterprise databases. While LLMs excel at processing information within their context window, they often struggle when tasked with retrieving, reasoning over, and synthesizing data from "giant libraries" of structured information.
This paper addresses the challenge of evaluating the integration of reasoning and action. We focus on long-form database question answering, a task that requires an agent to plan a retrieval strategy, execute multiple SQL queries, and weave the results into a coherent narrative.
Methodology
The researchers developed a Long-form Database Question Answering Dataset consisting of 200 complex questions derived from the Spider benchmark. These questions are designed to be "multi-hop," requiring an average of three SQL queries to gather sufficient information for a complete answer.
Agent Interaction Strategies
The study evaluates two primary paradigms for agent-database interaction:
- Sequential Strategy: The agent follows a linear path: Planning $\rightarrow$ Action (SQL generation) $\rightarrow$ Synthesis.
- Iterative Strategy: The agent cyclically alternates between planning and acting, refining its information gathering until a final answer can be synthesized.
Multi-Agent Evaluation Framework
Traditional evaluation metrics like keyword matching are insufficient for long-form analytical answers. To provide a more robust assessment, the authors implemented a multi-agent framework that simulates the academic peer-review process. In this system, multiple GPT-4 "Reviewers" provide independent assessments, which are then synthesized by "Meta-Reviewers" to reach a final consensus. This hierarchical approach significantly reduces the stochastic noise and bias common in single-LLM evaluations.
Key Insights and Results
The evaluation revealed several critical bottlenecks in current LLM agent capabilities:
- The Planning Bottleneck: The most significant hurdle is not the final synthesis of information, but the initial planning and SQL generation. LLMs often struggle to determine exactly which data points are required to answer a complex query.
- Sequential vs. Iterative: Surprisingly, the sequential strategy often outperformed the iterative approach. Many models, particularly open-source ones, tended to "give up" or resort to internal knowledge (guessing) when the iterative loop became complex.
- Performance Gap: Even GPT-4, the top performer, achieved a "perfect" score on only approximately 30% of conclusive questions, highlighting the difficulty of the task. Open-source models like Llama-2 and Mistral-7b showed a massive performance chasm, frequently failing to generate valid plans or queries.
- Tool Augmentation: The study confirms that for databases exceeding the context window, providing agents with SQL access is essential, as they significantly outperform "vanilla" LLMs provided with raw data dumps.
Conclusion
This research underscores the complexity of integrating reasoning and action in LLM agents. While current models show promise, the planning and multi-step retrieval stages remain significant bottlenecks. The proposed multi-agent evaluation framework offers a more reliable method for assessing these complex interactions. Future work will focus on expanding the variety of symbolic tools available to agents and exploring parallel query generation to improve efficiency and accuracy.
Summary updated