Large Language Models are Complex Table Parsers

Bowen Zhao, Changkai Ji, Yuejie Zhang, Wen He, Yingwen Wang, Qing Wang, Rui Feng, Xiaobo Zhang · DOI

Abstract

While Large Language Models (LLMs) have demonstrated remarkable capabilities in natural language understanding, their performance on complex, hierarchical tables remains a significant challenge. This paper introduces a novel framework designed to enhance LLM performance on Complex Table Question Answering (QA). By reconstructing tables into a structured tuple format and employing a specialized multi-turn prompting strategy—including a Python-based "Code Assistant"—the proposed method achieves state-of-the-art results on the HiTAB and AIT-QA benchmarks, significantly outperforming previous supervised models.

1. Introduction

Most research in Table QA has historically focused on "flat" tables: simple grids characterized by a single row of column headers and no merged cells. However, real-world data in financial reports, scientific papers, and statistical databases often resides in complex tables. These structures feature multi-level hierarchical headers and merged cells that create intricate spatial and logical relationships.

Existing models struggle with these structures for two primary reasons. First, standard serialization formats like Markdown or JSON often obscure the hierarchical dependencies between cells. Second, complex tables are inherently verbose, frequently exceeding the token limits of models like GPT-3.5. This research addresses these gaps by improving how LLMs perceive table structures and manage long-context constraints.

2. Methodology

The authors propose a two-pronged approach: Table Reconstruction to improve structural awareness and Prompt Engineering to handle reasoning and context limits.

2.1 Table Reconstruction

To move beyond the limitations of raw JSON or HTML, the framework converts tables into a set of concise, coordinate-based tuples. This format explicitly encodes the hierarchical "parent-child" relationships of the headers while reducing token redundancy:

  • Header Tuples (5-tuple): Formatted as (Type, Level, Start, End, Value). For example, a tuple (T, 1, 0, 0, "2018") indicates a column header at level 1, spanning column index 0, with the value "2018".
  • Data Tuples (4-tuple): Formatted as (C, Row_Idx, Col_Idx, Value). This explicitly links every data cell to its exact spatial coordinates within the grid.

2.2 Dialogue Schemes and the Code Assistant

The framework utilizes two distinct prompting strategies based on the table's size:

  1. Single-Turn Prompting: For tables that fit within the token limit, the model is provided with specific "Regulations" (defining its role as a statistical analyst), a "Table Description" (explaining the tuple format), and Chain-of-Thought (CoT) instructions to guide the reasoning process.
  2. Multi-Turn Prompting with Code Assistant: For tables exceeding the token limit, the task is decomposed into four modules:
  3. Keyword Extraction: The model identifies key terms from the user's question.
  4. Header Selection: The model identifies only the relevant row and column header tuples.
  5. Code Assistant: A Python script uses the selected headers to programmatically filter and retrieve only the relevant data tuples from the full dataset.
  6. Final Answer: The model generates the final response using only the targeted subset of the table, effectively bypassing the context window limit.

3. Experimental Evaluation

The approach was evaluated on two major complex table benchmarks:

  • HiTAB: A large-scale, open-domain dataset containing 3,597 complex tables and over 10,000 QA pairs derived from statistical reports and Wikipedia.
  • AIT-QA: A domain-specific dataset focused on the aviation industry, featuring 116 tables and 515 human-annotated QA pairs.

3.1 Key Results

The proposed method achieved State-of-the-Art (SOTA) performance on both datasets:

  • HiTAB: Reached 50.0% accuracy on the test set, representing a 9.3% absolute improvement over the previous best-performing supervised model (MAPO).
  • AIT-QA: Achieved 76.26% overall accuracy, significantly outperforming previous benchmarks like TaPas (49.32%) and RCI (51.84%).
  • Ablation Study: When the table reconstruction was removed and replaced with raw JSON, accuracy on HiTAB dropped to approximately 20%, confirming that the tuple format is the primary driver of the model's success.

4. Discussion and Insights

4.1 Spatial Mapping and Structure Awareness

A key finding of this research is that LLMs do not inherently "see" a table; they process it as a sequence of tokens. By transforming the table into a coordinate-based tuple system, the authors provide the model with a "spatial map." This allows the LLM to navigate hierarchies much more effectively than it can with raw text or standard markup.

4.2 The "Code Assistant" as a Precision Filter

Rather than relying on the LLM to summarize a massive table—which often leads to information loss—using Python code to filter data based on LLM-selected headers acts as a high-precision retrieval mechanism. This approach solves the token limit problem without sacrificing the integrity of the underlying data.

4.3 Addressing Column Bias

The researchers noted that GPT-3.5 exhibits a natural bias toward column headers, likely due to its training on Markdown tables where columns are more prominent. To counteract this, the authors found it necessary to explicitly define row hierarchies in the prompt to ensure the model treated both axes with equal importance.

5. Limitations and Future Work

Despite its success, the framework faces challenges common to LLM-based systems. GPT-3.5 still occasionally produces hallucinations or provides incorrect logical explanations for its answers. Furthermore, the multi-turn scheme is susceptible to error propagation; if the model fails to extract the correct keywords or headers in the initial steps, the Code Assistant will retrieve incorrect data, leading to an inevitable failure in the final answer. Future work will focus on improving historical context maintenance across multi-turn dialogues and exploring more advanced retrieval-augmented generation (RAG) techniques for massive datasets.

Summary updated

BibTeX
@inproceedings{zhao2023large,
  author = {Bowen Zhao and Changkai Ji and Yuejie Zhang and Wen He and Yingwen Wang and Qing Wang and Rui Feng and Xiaobo Zhang},
  title = {{Large Language Models are Complex Table Parsers}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2023},
  doi = {10.18653/v1/2023.emnlp-main.914},
}
Figure