TaPas: Weakly Supervised Table Parsing via Pre-training

Jonathan Herzig, Pawel Krzysztof Nowak, Thomas Müller, Francesco Piccinno, Julian Martin Eisenschlos

Abstract

Jonathan Herzig, Pawel Krzysztof Nowak, Thomas Müller, Francesco Piccinno, Julian Eisenschlos. Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics.

2020.

TAPAS (Table Parser) is a BERT-based model designed to answer natural language questions over tables without generating formal logical forms like SQL. By utilizing table-aware embeddings and pre-training on millions of Wikipedia tables, it achieves state-of-the-art results on conversational table QA tasks using only weak supervision (the final answer).

Introduction

Answering questions over semi-structured data, such as Wikipedia tables, has traditionally been framed as a semantic parsing task. In this paradigm, a model translates a natural language question into a logical form (e.g., SQL). However, this approach faces significant hurdles: the high cost of annotating logical forms and the "spuriousness" problem in weak supervision, where a model might arrive at the correct answer through incorrect logic.

TaPas addresses these issues by asking: Is a logical form necessary? Instead of parsing, TaPas learns to reason over tables directly by extending the BERT architecture with structural awareness.

Architecture and Methods: Table-Aware Embeddings

To enable a Transformer to understand tabular structure, TaPas extends standard BERT embeddings with several specialized positional embeddings. These allow the model to distinguish between rows, columns, and numerical orders within the flattened input sequence.

TaPas specialized embeddings for table structure

The specialized embeddings include:

  • Column and Row IDs: Explicitly map each token to its respective cell coordinates.
  • Rank ID: For columns containing numbers or dates, this provides the numerical rank (e.g., 1st, 2nd), helping the model process superlatives like "most" or "earliest."
  • Previous Answer: In conversational settings, this marks cells that were part of the answer to the preceding question.

Model Output and Differentiable Training

TaPas avoids a text decoder, instead using two classification heads:

  1. Cell Selection: Predicts a probability for each cell indicating its relevance to the answer.
  2. Aggregation Prediction: Selects an operation (NONE, SUM, COUNT, or AVERAGE) to apply to the selected cells.
TaPas architecture and differentiable aggregation

To train on weak supervision—where only the final answer is known—the authors implemented a soft differentiable layer. The model calculates an "expected" answer by blending the results of all possible aggregation operators. This allows the model to learn via backpropagation even when the specific operation isn't explicitly labeled in the training data.

Evaluation and Results

The researchers evaluated TaPas on three major benchmarks: WIKITQ, SQA (conversational), and WIKISQL.

  • State-of-the-Art on SQA: TaPas significantly outperformed previous models on the SQA dataset, increasing accuracy from 55.1% to 67.2%.
  • Competitive Performance: On WIKISQL and WIKITQ, TaPas performed on par with or better than complex semantic parsers, despite its simpler encoder-only architecture.
  • Transfer Learning: Pre-training on the large-scale WIKISQL dataset followed by fine-tuning on WIKITQ yielded a substantial boost, reaching 48.7% accuracy.

Key Insights and Conclusion

The success of TaPas demonstrates that formal logic is not a prerequisite for mathematical reasoning over tables. By observing the relationship between questions and final results, the model implicitly learns operations like "summing" or "averaging."

Furthermore, pre-training on 6.2 million Wikipedia tables using a Masked Language Model (MLM) objective proved essential for teaching the model the "language of tables." While currently limited to single tables and basic aggregations, TaPas represents a significant step toward simpler, more robust table-based question answering.

Summary updated

BibTeX
@inproceedings{herzig2020tapas,
  author = {Jonathan Herzig and Pawel Krzysztof Nowak and Thomas Müller and Francesco Piccinno and Julian Martin Eisenschlos},
  title = {{TaPas: Weakly Supervised Table Parsing via Pre-training}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2020},
  url = {https://openreview.net/forum?id=1UWh2x7Dxyu},
}
Figure