API-Assisted Code Generation for Question Answering on Varied Table Structures
Yihan Cao, Shuyi Chen, Ryan Liu, Zhiruo Wang, Daniel Fried
Abstract
A persistent challenge to table question answering (TableQA) by generating executable programs has been adapting to varied table structures, typically requiring domain-specific logical forms. In response, this paper introduces a unified TableQA framework that: (1) provides a unified representation for structured tables as multi-index Pandas data frames, (2) uses Python as a powerful querying language, and (3) uses few-shot prompting to translate NL questions into Python programs, which are executable on Pandas data frames. Furthermore, to answer complex relational questions with extended program functionality and external knowledge, our framework allows customized APIs that Python programs can call. We experiment with four TableQA datasets that involve tables of different structures — relational, multi-table, and hierarchical matrix shapes — and achieve prominent improvements over past state-of-the-art systems. In ablation studies, we (1) show benefits from our multi-index representation and APIs over baselines that use only an LLM, and (2) demonstrate that our approach is modular and can incorporate additional APIs.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Cited by top-tier papers4
- TroVE: Inducing Verifiable and Efficient Toolboxes for Solving Programmatic TasksZhiruo Wang, Graham Neubig, Daniel FriedICML 2024 · 47 citations
- RoT: Enhancing Table Reasoning with Iterative Row-Wise TraversalsXuanliang Zhang, Dingzirui Wang, Keyan Xu, Qingfu Zhu et al.EMNLP 2025 · 2 citations
- HeGTa: Leveraging Heterogeneous Graph-enhanced Large Language Models for Few-shot Complex Table UnderstandingRihui Jin, Yu Li, Guilin Qi, Nan Hu et al.AAAI 2025 · 1 citation
- Triples as the Key: Structuring Makes Decomposition and Verification Easier in LLM-based TableQAZhen Yang, Ziwei Du, Minghan Zhang, Wei Du et al.ICLR 2025
Builds on12
- DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-CorrectionMohammadreza Pourreza, Davood RafieiNeurIPS 2023 · 909 citations
- ViperGPT: Visual Inference via Python Execution for ReasoningDídac Surís, Sachit Menon, Carl VondrickICCV 2023 · 732 citations
- PAL: Program-aided Language ModelsLuyu Gao, Aman Madaan, Shuyan Zhou, Uri Alon et al.ICML 2023 · 700 citations
- TAPEX: Table Pre-training via Learning a Neural SQL ExecutorQian Liu, Bei Chen, Jiaqi Guo, Morteza Ziyadi et al.ICLR 2022 · 347 citations
- Neural Module Networks for Reasoning over TextNitish Gupta, Kevin Lin, Dan Roth, Sameer Singh et al.ICLR 2020 · 134 citations
Related papers
- ReAcTable: Enhancing ReAct for Table Question AnsweringYunjia Zhang, Jordan Henkel, Avrilia Floratou, Joyce Cahoon et al.VLDB 2024 · 120 citations
- Generation-Focused Table-Based Intermediate Pre-training for Free-Form Question AnsweringPeng Shi, Patrick Ng, Feng Nan, Henghui Zhu et al.AAAI 2022 · 16 citations
- TaREx: Reinforcement Learning for Code-Driven Table ReasoningFangyu Lei, Jinxiang Meng, Yiming Huang, Shizhu He et al.AAAI 2026
- AutoPrep: Natural Language Question-Aware Data Preparation with a Multi-Agent FrameworkMeihao Fan, Ju Fan, Nan Tang, Lei Cao et al.VLDB 2025 · 10 citations
- TALON: A Multi-Agent Framework for Long-Table Exploration and Question AnsweringRuochun Jin, Xiyue Wang, Dong Wang, Haoqi Zheng et al.EMNLP 2025
