DbRAG improves answering complex questions using multiple database tables

DBRAG: Multi-Table Retrieval-Augmented Generation for Complex Database Queries

Information Retrieval

Summary

Complex questions about data often need information from many database tables, but most tools only handle one table or assume the right tables are already known. The authors developed DBRAG, a system that first finds likely useful tables across a whole database and then uses a smart language model to pick and combine data from those tables. This helps answer complicated queries better by looking at multiple sources at once. They tested DBRAG on several standard datasets and found it works better at finding relevant tables and producing accurate answers.

What this means in practice

  • For database application developers: Enhance apps with better support for answering complex user questions that require retrieving and reasoning across multiple tables in a database.
  • For business intelligence teams: Improve automated report generation by retrieving and combining relevant database tables dynamically for complex data exploration queries.

Authors

Prince Larbi Ampofo, Ryoji Kubo, Djellel Difallah

Abstract

Recent advancements in large language models have introduced new capabilities for reasoning over structured data, particularly through program-aided tools that can analyze tables. However, many existing methods address single-table scenarios or assume that the relevant tables are already provided. In practice, users often issue complex data exploration queries over entire databases, where relevant information may be distributed across multiple relations. In this work, we introduce DBRAG, a retrieval-augmented generation framework tailored for multi-table question answering. DBRAG first retrieves candidate tables using an offline table index, enriches their summaries with query-relevant rows, and uses an LLM to rerank the candidates. A program-aided reasoner then selects the required tables and executes operations over their full contents, keeping the initial prompt context compact. Experiments on the Spider, GeoQuery, and ATIS datasets used in this study demonstrate improvements in table retrieval and multi-table question answering.