---
kind: concept
slug: table-question-answering
title: Table question answering
summary: >-
  Answering a question from a table by selecting cells, generating text, running a program over the table, chaining table tools chosen by a planner, or encoding the table for a parser. Four papers cover six routes, from fine-tuned chart and text models to training-free program writing. Gold tables score far above extracted ones, so the table source matters most. All numbers are author-reported.
tags: [table-reasoning, question-answering, program-synthesis, chart-question-answering, semantic-parsing]
papers: ["2005.08314", "2203.10244", "2210.02875", "2304.09842"]
related: [neural-symbolic-integration, chart-data-extraction, knowledge-base-question-answering, in-context-learning, self-consistency, multi-hop-reasoning, semantic-parsing, language-model-pretraining, tool-use, llm-planning]
status: draft
updated_at: 2026-10-19
---

## Overview

Given a question and a table, return the answer. The answer is a cell value, a
number computed from cells, or a short text. Every variant reads the table
cells as input, either as flattened text, as encoded rows, or through a program
or table helpers that run over the table [arxiv:2203.10244 §4.2]
[arxiv:2005.08314 §3.1] [arxiv:2210.02875 §2.1] [arxiv:2304.09842 §4.3]. When only a chart image is given, a table must first be
recovered from it [arxiv:2203.10244 §4.1].

## Variants

### Fine-tuned cell selection and aggregation (TaPas-style)

A BERT-style encoder reads the question, then the flattened table with row and
column embeddings. Two heads predict an aggregation operation (count, sum,
average or none) and select cells. The model is trained on the task data
[arxiv:2203.10244 §4.2]. On ChartQA with extracted tables it reaches 41.28 test
accuracy, and 51.80 with gold tables [arxiv:2203.10244 tab. 5]. Card:
[ChartQA](/papers/2203.10244), which uses it as a baseline.

### Fine-tuned text generation (T5, VL-T5)

An encoder-decoder reads the question and the flattened table as text and
generates the answer [arxiv:2203.10244 §4.2]. VL-T5 adds visual features of the
chart marks to the same input. On ChartQA with extracted tables the two reach
41.04 (T5) and 41.56 (VL-T5) test accuracy. With gold tables they reach 59.80
and 59.12 [arxiv:2203.10244 tab. 5]. PlotQA pretraining raises VL-T5 to 51.84
on the same test set [arxiv:2203.10244 tab. 6]. Card:
[ChartQA](/papers/2203.10244).

### Chart image with an extracted table (VisionTaPas)

For questions about a chart. A ViT encodes the image, a TaPas encoder encodes
the question and table, and four cross-modality blocks let each branch attend to
the other. The operation head adds difference and ratio, and the cell heads sit
on the textual branch [arxiv:2203.10244 §4.2]. It is the best of the ChartQA
baselines, at 45.52 test accuracy with extracted tables and 61.84 with gold
tables [arxiv:2203.10244 tab. 5]. Removing the difference and ratio supervision
lowers overall accuracy by 1.80 points [arxiv:2203.10244 §5.3]. Card:
[ChartQA](/papers/2203.10244).

### Training-free program writing (Binder)

The LM writes a SQL or Python program for the question. Where the language
cannot express a step, the program contains a call back to the same LM over a
few cells or columns. Each program runs, and the most frequent answer wins. The
method uses 14 annotated exemplars and no training [arxiv:2210.02875 §2.1]
[arxiv:2210.02875 §3.1]. Author-reported results, WikiTQ test and TabFact small
test: Binder reaches 64.6 and 85.1 with fixed exemplars, and 86.0 on TabFact
with a retriever. SQL-only programs reach 61.1 and 80.7. Direct LM prompting
with the table reaches 48.7 and 72.6 [arxiv:2210.02875 §3.2]. Card:
[Binder](/papers/2210.02875).

### Planner-chosen table tools (Chameleon)

A planner LLM writes a short plan that names modules, and the modules run in
order, each passing its output on through an input update and a shared cache.
Nothing is trained; the planner works from module descriptions and a few
demonstrations [arxiv:2304.09842 §3] [arxiv:2304.09842 eq. 1]. For math word
problems over tables, the module set includes row and column lookups that cut
the table down, a table verbaliser, and Python program generation, verification
and execution [arxiv:2304.09842 §4.3] [arxiv:2304.09842 tab. 9]. The planner may
choose from these modules, and a plan that breaks the TabMWP ordering rules falls
back to a fixed program-writing sequence [arxiv:2304.09842 §4.3]. Author-reported
TabMWP test accuracy is 98.78 with GPT-4 and 93.28 with ChatGPT
[arxiv:2304.09842 tab. 4]. On a 500-example ChatGPT subset, disabling Program
Generator costs 7.4 points and disabling Table Verbalizer 0.2
[arxiv:2304.09842 tab. 5]. Card: [Chameleon](/papers/2304.09842).

### Table encoder inside a semantic parser (TaBERT)

Not a question answerer on its own. TaBERT is a BERT-initialized encoder,
pretrained on 26.6M tables with nearby text. It reads the question with K rows
of the table, and vertical self-attention lets those rows share information
[arxiv:2005.08314 §3.1] [arxiv:2005.08314 app. A.1]. A parser then consumes its
column and token vectors. In the paper the parser is MAPO for WikiTableQuestions
and TranX for Spider [arxiv:2005.08314 §4.1] [arxiv:2005.08314 §4.2]. On WTQ
with K = 3 and the Large encoder, the run that was best on dev reaches 52.3 test
accuracy. The mean over runs is 51.8 ± 0.6, against 46.9 for the previous
ensemble [arxiv:2005.08314 tab. 1] [arxiv:2005.08314 §5]. On Spider dev the same
setup reaches 64.5 ± 0.6 mean, below RyanSQL + BERT at 66.6
[arxiv:2005.08314 tab. 2]. Card: [TaBERT](/papers/2005.08314).

## When to use which

| Situation | Use | Why |
|---|---|---|
| Only a chart image, no table | Chart model with extraction (VisionTaPas-style) | The gap between gold (61.84) and extracted (45.52) tables is what extraction costs [arxiv:2203.10244 tab. 5]. Extraction accuracy on ChartQA is 83.85 [arxiv:2203.10244 tab. 9]. See [chart data extraction](/concepts/chart-data-extraction). |
| Labelled task data, single model pass wanted | Fine-tuned cell selection or text generation | Fine-tuned baselines on WikiTQ and TabFact reach 63.3 and 85.9 [arxiv:2210.02875 §3.2]. The cards give no latency or cost figures for these models, so no speed claim is made. |
| No labelled data, model API available, answer must be auditable | Training-free program writing (Binder-style) | The program shows each step, and no training is needed [arxiv:2210.02875 §2.1]. Binder reaches 64.6 on WikiTQ test with 14 exemplars [arxiv:2210.02875 §3.2]. |
| Question needs knowledge the table does not hold, such as category membership | Program with LM calls | On the WikiTQ dev subset that SQL cannot express, Binder reaches 41.3 against 31.2 for SQL-only programs [arxiv:2210.02875 §4.1]. |
| Multi-step arithmetic over chart values | Operation head with difference and ratio | Removing them costs 1.80 overall and 4.76 on ChartQA-H [arxiv:2203.10244 §5.3]. The weak labels were 24% noisy on a 100-question sample [arxiv:2203.10244 §4.2]. |
| Open-vocabulary answers | Generation or operation head, not a fixed-class classifier | PReFIL classifies over a fixed vocabulary and scores 4.8 on ChartQA test [arxiv:2203.10244 §5.2]. |
| Tight query budget | Fine-tuned model, not program sampling | Binder samples 20 programs per WikiTQ question and 50 per TabFact question [arxiv:2210.02875 app. A.2], and each program can make several LM calls [arxiv:2210.02875 §3.1]. |
| Math word problems over a table, planner LLM available, no labelled data | Planner-chosen table tools (Chameleon-style) | Reaches 98.78 TabMWP test with GPT-4 [arxiv:2304.09842 tab. 4]. The planner and each LLM-based module are separate model calls [arxiv:2304.09842 §3], so query cost grows with plan length. See the [Chameleon card](/papers/2304.09842), Pitfalls. |
| Semantic parser over a database or web tables, with labelled query data | TaBERT as the parser's encoder | Each snapshot row becomes its own input sequence [arxiv:2005.08314 §3.1], so cost grows with K. The K = 1 model gives 51.2 test→best on WTQ in the paper's table, against 49.2 for BERT-Base at K = 1 [arxiv:2005.08314 tab. 1]. Cell values help: dropping them lowers WTQ dev from 51.2 to 49.9 [arxiv:2005.08314 tab. 4]. |

Two cautions for Binder. Its reported numbers use code-davinci-002
[arxiv:2210.02875 §3.1], but the repository's default engine is a chat model
without logprobs, so the numbers may not transfer. Generated programs are
executed with Python `eval`, so run them in a sandbox. See the
[Binder card](/papers/2210.02875), Paper vs code and Pitfalls.

Chameleon parses its planner's output with Python `eval` too. Use a strict
parser with a whitelist of module names before reusing that design. See the
[Chameleon card](/papers/2304.09842), Pitfalls.

The TaBERT code is CC BY-NC 4.0, so it cannot be reused commercially. The
README links pretrained weights but states no separate licence for them.
Re-implement from the paper, and see the [TaBERT card](/papers/2005.08314),
Paper vs code and Pitfalls.

## Implementation sketch

The common core is one function with a branch per variant. The variants differ
only in the branches and in where the table comes from. The TaBERT route does
not return an answer: it returns column and token vectors for a parser, and its
pseudocode is on the [TaBERT card](/papers/2005.08314) [arxiv:2005.08314 §3.1].

```pseudocode
# Shared shape of table QA  [arxiv:2210.02875 §2.1] [arxiv:2203.10244 §4.1]
# Input:  question, table (or a chart image to extract it from)
# Output: answer

def table_qa(question, table, image=None, variant="program"):
    # Only a chart image is given: recover a table first  [arxiv:2203.10244 §4.1]
    if table is None:
        table = extract_table(image)
    # Cell selection and operation  [arxiv:2203.10244 §4.2]
    # VisionTaPas also encodes the image; omitted here
    if variant == "select":
        return apply_operation(predict_operation(question, table),
                               select_cells(question, table))
    # Answer text generated from the flattened table  [arxiv:2203.10244 §4.2]
    if variant == "generate":
        return generate(flatten(question, table))
    # Planner names a module chain, then the modules run in order  [arxiv:2304.09842 §3]
    if variant == "plan":
        modules = planner_llm(question, table, module_descriptions)
        return run_chain(modules, question, table)
    # Sample programs, run each one, and vote  [arxiv:2210.02875 §2.2]
    # n = 20 for WikiTQ  [arxiv:2210.02875 app. A.2]
    programs = lm_sample(question, table, n=20)
    return majority_vote([run_program(p, table) for p in programs])
```

## Contradictions

- **WikiTQ ranking.** Under the paper's semantic-match evaluator, Binder (64.6
  test) is above OmniTab (63.3 test) [arxiv:2210.02875 §3.2]. Under the
  official evaluator, Binder reaches 61.9 test and OmniTab 62.9 test
  [arxiv:2210.02875 app. C.2]. The ranking flips with the evaluator, so state
  which one a number uses.
- **Share of program-unsolvable questions.** The text says "about 20%"
  [arxiv:2210.02875 §3.1]. The authors' re-derived split gives 44.19% and the
  SQUALL annotation gives 22.08% [arxiv:2210.02875 app. C.4]. Subset results
  depend on which split is used.

The WTQ numbers of TaBERT and Binder come from different setups: a trained
MAPO parser against a training-free LM with exemplars. They are not one scale
and should not be ranked against each other. Likewise, the ChartQA figures
are not comparable with WTQ or TabFact. The TabMWP figures of Chameleon belong
to a third benchmark, and its scoring accepts a prediction that rounds to the
reference value [Chameleon card](/papers/2304.09842), Pitfalls. Do not rank
them against the WTQ or TabFact numbers above.

## Papers

- [Binding Language Models in Symbolic Languages](/papers/2210.02875): training-free SQL or Python programs with LM calls inside, voted over samples.
- [Chameleon: Plug-and-Play Compositional Reasoning with Large Language Models](/papers/2304.09842): frozen LLM planner that chains table, search, captioning and program modules, with few-shot prompts and no training.
- [ChartQA: A Benchmark for Question Answering about Charts with Visual and Logical Reasoning](/papers/2203.10244): chart QA benchmark with TaPas, T5, VL-T5 and VisionTaPas baselines on extracted and gold tables.
- [TaBERT: Pretraining for Joint Understanding of Textual and Tabular Data](/papers/2005.08314): BERT-style table encoder pretrained on tables with text, plugged into WTQ and Spider parsers.
