Research
TabRAG: Improving Tabular Document Question Answering for Retrieval Augmented Generation via Structured Representations
Overview Research area: Natural Language Processing — retrieval-augmented generation (RAG) for visually rich documents, specifically question answering over tabular documents such as financial reports
- arXiv
- 2511.06582
- Published
- 2025-11-10
- Authors
- Jacob Si, Mike Qu, Michelle Lee, Marek Rei, Yingzhen Li
AI summary
Overview
Research area: Natural Language Processing — retrieval-augmented generation (RAG) for visually rich documents, specifically question answering over tabular documents such as financial reports and scanned forms.
Technical level: Intermediate. The paper builds on well-known RAG concepts but assumes familiarity with vision-language models, prompt engineering, in-context learning, and vector retrieval.
Scope: The paper proposes TabRAG, a parsing pipeline that converts document tables into hierarchically structured JSON representations before retrieval and generation, and shows it substantially improves answer accuracy over linear-text and markdown parsing baselines.
What This Paper Is About
Standard RAG systems parse documents into linear text and feed that text to a language model, but tables convey meaning through a two-dimensional layout where each cell only makes sense in the context of its row and column headers. Flattening a table into a sequence of characters destroys those relationships, so models asked about tabular documents frequently hallucinate or claim data is missing when it is plainly visible in the source. The paper's goal is to design a parsing and representation scheme that preserves a table's structural semantics all the way through to the generation step.
Key Contributions
-
A complete parsing-based RAG framework for tabular documents (TabRAG). It chains layout segmentation, a custom structured extraction prompt for a vision-language model, a self-generated in-context learning module, a fallback page-overview mechanism, and a standard embed-retrieve-generate loop.
-
A hierarchical JSON representation schema for tables. Instead of raster-scan text or markdown, every cell is emitted as an object containing its row name, column name, value, and unit, with explicit rules for punctuation, number normalization, multi-level headers, and empty cells.
-
A self-generated in-context learning module. The system autonomously mines the dataset for its largest and most complex tables, converts them into paired markdown/JSON demonstrations, filters them by token length, and uses them as text-only few-shot examples to guide extraction — avoiding the context cost of image-based demonstrations.
-
A broad empirical evaluation and ablation suite. Five tabular QA benchmarks, seven parsing baselines, leave-one-out ablations of each pipeline module, and a direct comparison of JSON versus markdown versus natural-language serialization.
Main Findings
-
Large generation gains under oracle retrieval. With the ground-truth document supplied, TabRAG-8B reaches 80.62% average exact-match accuracy across TAT-DQA, MP-DocVQA, WikiTQ, TableVQA, and ComTQA, versus 71.67% for GPT-5.2, 71.24% for Qwen3-VL-32B-Instruct, 64.04% for Deepseek-OCR, 63.16% for PyMuPDF, and 52.77% for PyTesseract. The largest single jump is on TAT-DQA (92.56% versus 68.54% for GPT-5.2).
-
The smaller model often matches the larger one. TabRAG-8B (80.62%) edges out TabRAG-32B (80.06%) on average, because the 32B variant drops noticeably on ComTQA (75.80% versus 82.60%). Gains come from the representation, not just model scale.
-
Retrieval is competitive but not state of the art. TabRAG scores 82.03 (8B) and 82.05 (32B) MRR@10 on average, slightly below GPT-5.2 (83.38) and the Qwen3-VL baselines (~83.1). The authors frame this as acceptable since the framework is designed for generation quality and could be paired with a stronger retriever.
-
Every module contributes, with layout segmentation mattering most. Removing layout segmentation drops the average to 74.92%, removing self-generated ICL to 75.63%, removing the page-overview fallback to 76.04%, and removing both the structured representation and self-generated ICL to 73.58% — all well below the full 80.62%.
-
JSON beats markdown and plain text. Switching the representation from JSON to markdown costs roughly 4.8 accuracy points on average (75.83%), and to natural-language description roughly 3.5 points (77.17%). Markdown degrades most on TableVQA (62.00% versus 70.60%) and WikiTQ (62.42% versus 68.49%).
-
Three in-context examples is the sweet spot. Performance rises sharply from zero to a few demonstrations, peaks at K=3, then flattens or slightly degrades as additional examples saturate the context window.
-
Failure mode of linearized tables is diagnosed qualitatively. With markdown or text serialization, the model loses the link between distant values and their headers, leading it to assert that figures like total assets "cannot be directly calculated" even though they appear in the source data.
Methodology in Plain English
The pipeline works in four stages:
1. Layout segmentation. A Document Image Transformer model detects bounding boxes and labels each region of a document page as a title, text block, figure, or table. This keeps chunks small enough to fit a model's context window and lets later stages focus on one region at a time, which the authors argue is essential because whole-page processing blurs fine-grained cell relationships.
2. Structured extraction. Each cropped table image is sent to a vision-language model (Qwen3-VL-8B or 32B) with a prompt that casts it as an "information extraction engine." The prompt asks it to output one JSON object per cell with four fields: row name, column name, value, and unit. Non-table regions get simpler prompts appropriate to their type. If layout detection fails or produces ambiguous boxes, a fallback pass runs the VLM over the full page to produce a coarse global description so information is not lost.
3. Self-generated in-context learning. Because tables come in wildly different formats, the extraction prompt alone is not enough. The system shuffles the dataset's pages, finds the largest table on each page by bounding-box area, and collects the twenty largest candidates overall. Each is processed into a paired markdown string and JSON object, and pairs whose combined token count falls within a set minimum and maximum are kept. The first three valid pairs become few-shot demonstrations that accompany every subsequent table extraction. This gives the model domain-specific formatting cues without spending context on example images.
4. Retrieval and generation. All representations are embedded (Qwen3-Embedding-8B) and stored in a FAISS vector index. At query time, a similarity search returns the top-k documents, which are passed as context to a language model (Qwen3-8B, no-think mode) that produces the answer. Evaluation uses exact-match accuracy for generation and MRR@10 for retrieval.
Why This Matters
Research impact. Most RAG work for documents focuses on improving the retriever or the embedding model. This paper argues the parser and the representation format are equally important, and provides evidence that a well-designed structured representation can lift generation accuracy by nearly 20 points on some benchmarks using a smaller model than competing baselines. It also reframes tabular QA as a localized, structure-preserving task rather than a sequence-modeling problem.
Real-world applications:
- Financial statement auditing and analysis, where a single misread cell can change a reported figure
- Personal and corporate tax filing, where values must be traced to specific rows and columns of official forms
- Scientific and clinical report analysis, where measurements are organized in dense multi-column tables
- Enterprise document search over contracts, invoices, and procurement records stored as scanned PDFs
Industry relevance. Commercial RAG products are routinely deployed over private document collections full of complex tables, and their weak spot is exactly the one this paper targets. The JSON output format also has an operational benefit the authors highlight: it makes answers traceable, since a user can inspect which row-column-value triple produced a response rather than trusting a black-box model that read the whole page at once.
Future Directions
-
Pairing TabRAG with state-of-the-art retrievers. The authors explicitly leave this to future work, noting that the current pipeline is optimized for generation and could adopt an external best-in-class retriever while keeping its own vector stores for downstream reasoning.
-
Tables that span pages or regions. The current design treats each page independently and extracts the largest single table per page, which does not address multi-page continuations common in financial filings.
-
More robust layout detection. The page-overview fallback exists because the layout model sometimes produces unreliable bounding boxes, and removing that fallback costs roughly 4.6 accuracy points. Better segmentation would reduce the need for this safety net.
-
Cost, latency, and scale. Running a vision-language model over every table region, plus a self-generated ICL discovery pass, is compute-heavy. Whether the accuracy gains justify the inference cost at production scale is an open question the paper does not quantify.
-
Beyond the JSON schema. The representation rules are hand-engineered. Whether a learned or task-adaptive schema could outperform the fixed four-field format is untested.
Target Audience
Researchers and engineers working on retrieval-augmented generation, document AI, or visually rich document understanding will get the most from this paper, particularly those building question-answering systems over financial, legal, or scientific PDFs. It is also useful for practitioners deploying enterprise search or document analysis products who need a concrete, reproducible recipe for table handling. Readers should be comfortable with vision-language models, prompting, and vector retrieval; those without that background will still follow the main argument but may need to consult the cited work for details on layout transformers and embedding models.
Authors’ abstract
Incorporating external knowledge bases in traditional retrieval-augmented generation (RAG) relies on parsing the document, followed by querying a language model with the parsed information via in-context learning. While effective for text-based documents, question answering on tabular documents often fails to generate plausible responses. Standard parsing techniques lose the two-dimensional structural semantics critical for cell interpretation. In this work, we present TabRAG, a parsing-based RAG framework designed to improve tabular document question answering via structured representations. Our framework consists of layout segmentation that decomposes the document inputs into a series of components, enabling fine-grained extraction. Subsequently, a vision language model parses and extracts the document tables into a hierarchically structured representation. In order to cater various table styles and formats, we integrate a self-generated in-context learning module that guides the table extraction process. Experimental results demonstrate that TabRAG outperforms existing popular parsing techniques across a broad suite of evaluation and ablation benchmarks. Code is available at: https://github.com/jacobyhsi/TabRAG.