Abstract
Reasoning over tabular data remains a significant challenge for Large Language Models (LLMs) due to complex structures and implicit relational logic. This paper introduces LRTab (Learn then Retrieve), a framework that improves tabular understanding by learning from a model's own reasoning errors. LRTab generates "Prompt Conditions"—natural language rules derived from training-phase mistakes—and retrieves them at inference time to guide the model. This approach achieves state-of-the-art performance on major benchmarks like WikiTQ and TabFact without the need for computationally intensive finetuning.
Introduction
Tables are a primary format for structured data, yet LLMs often struggle with their nuances, such as "total" rows that disrupt aggregation or ambiguous headers. Existing approaches typically rely on either expensive finetuning, which can lead to brittle models, or standard in-context learning (ICL), which fails to systematically exploit patterns of error found in large training sets. LRTab addresses this gap by creating a mechanism for models to "remember" and avoid specific reasoning pitfalls.
Methods
LRTab operates through a three-stage pipeline designed to bridge the gap between simple prompting and full model finetuning:
- Training (Learning from Mistakes): A code-augmented LLM processes training data. When it errs, an "LLM Judge" analyzes the incorrect Chain-of-Thought (CoT) and generates a Prompt Condition. These are human-readable instructions (e.g., "Ensure that processing of 'totals' is accounted for") designed to prevent similar future mistakes.
- Validation (Learning to Retrieve): To ensure only helpful conditions are used, a validation set is used to train a cross-encoder reranker. This component identifies which Prompt Conditions are most effective for specific table-query pairs.
- Inference (Retrieval-Augmented Reasoning): For new tables, the system retrieves the most relevant Prompt Conditions and injects them into the prompt. The LLM then uses a flexible reasoning backbone, choosing between direct text response or Python/Pandas code execution.
Key Results
LRTab established new state-of-the-art (SOTA) benchmarks in tabular reasoning. On WikiTQ, it achieved 80.02% accuracy with GPT-4o, outperforming specialized models like CABINET (69.1%). On TabFact, it reached 93.38% accuracy, surpassing top finetuned baselines.
The results indicate that LRTab significantly boosts the performance of smaller models. For instance, GPT-4o-mini with LRTab often rivals the performance of much larger vanilla models, offering a cost-effective alternative for high-accuracy reasoning.
Insights and Discussion
- Negative Constraints: Unlike standard ICL that shows "what to do," LRTab demonstrates that "what not to do" is often more effective for structured data.
- Interpretability: Prompt Conditions are natural language strings, making the model's learned knowledge transparent and inspectable by developers.
- Flexible Reasoning: Allowing the LLM to choose between symbolic (code) and semantic (text) reasoning consistently outperforms forcing a single mode.
Limitations and Future Work
While effective, LRTab's performance may vary across highly specialized domains (e.g., medical) without domain-specific training. There is also a potential risk of overfitting if Prompt Conditions become too specific to training examples. Future work will explore unsupervised condition generation and adaptation for multi-turn data exploration.
Summary updated