tapex-base-finetuned-wikisql

microsoft/tapex-base-finetuned-wikisql

microsoft 883K downloads mit Table Question Answering
Frameworkstransformerspytorch
Languagesen
Datasetswikisql
Tagsbarttext2text-generationtapextable-question-answering
Downloads
883K
License
mit
Pipeline
Table Question Answering
Author
microsoft

Run tapex-base-finetuned-wikisql locally on a Q4KM hard drive

Accelerate your deployments with Q4KM hard drives pre‑loaded with the microsoft/tapex-base-finetuned-wikisql model. These rugged, high‑capacity SSDs ship with the model weights, tokenizer, and a...

Shop Q4KM Drives

Technical Overview

Model ID: microsoft/tapex-base-finetuned-wikisql
Model name: tapex-base-finetuned-wikisql
Author: Microsoft

TAPEX (Table Pre‑training via Learning a Neural SQL Executor) is a table‑question‑answering system that converts a natural‑language query and a structured table into a SQL statement, executes it, and returns the answer. This particular checkpoint is the tapex‑base size (≈ 400 M parameters) that has been fine‑tuned on the WikiSQL dataset, a large collection of tables paired with SQL queries derived from Wikipedia infoboxes.

Key features and capabilities

  • End‑to‑end reasoning over semi‑structured data without an external SQL engine – the model learns a neural executor.
  • Supports uncased English input, simplifying preprocessing.
  • Works with any pandas.DataFrame or CSV‑style table, making integration into data‑science pipelines trivial.
  • Generates answers in a numeric or textual format, handling aggregation, filtering, and ordering.

Architecture highlights

  • Built on the BART base architecture (6‑layer encoder, 6‑layer decoder, 12‑head self‑attention, 768 hidden size).
  • The encoder processes the concatenated table‑column headers and row values, while the decoder autoregressively produces the answer token sequence.
  • During pre‑training, a synthetic corpus of tables and executable SQL queries teaches the model to “execute” SQL in a latent space.
  • Fine‑tuning on WikiSQL aligns the latent executor with real‑world queries and tables.

Intended use cases

  • Quick fact‑retrieval from small‑to‑medium tables (e.g., sports statistics, product catalogs, event schedules).
  • Chat‑bot or voice‑assistant features that need to answer questions about tabular data without a full database backend.
  • Data‑exploration tools for analysts who prefer natural language over SQL syntax.

Benchmark Performance

The primary benchmark for TAPEX‑base is the WikiSQL test set, which measures exact‑match accuracy of the generated answer against the ground‑truth SQL result. The original TAPEX paper reported a ~78 % exact‑match score for the base model after fine‑tuning on WikiSQL, outperforming earlier BERT‑based table QA systems by a wide margin. While the Hugging Face README does not list a new score, the fine‑tuned checkpoint inherits these results.

Why WikiSQL matters: it contains over 80 k natural‑language questions, each paired with a table and a SQL query, covering a broad range of aggregation, filtering, and ordering operations. High performance on this benchmark indicates strong generalization to unseen tables and queries.

Compared to other table‑QA models such as TaBERT or TableFormer, TAPEX‑base delivers higher exact‑match accuracy while keeping inference latency low because the neural executor lives inside the transformer, eliminating the need for an external SQL engine. This makes TAPEX‑base a competitive choice for real‑time applications.

Hardware Requirements

VRAM for inference – The tapex‑base checkpoint occupies roughly 1.6 GB of GPU memory when loaded in FP16 (half‑precision) mode. For safe batch‑size = 1 inference, a GPU with at least 4 GB VRAM (e.g., NVIDIA RTX 3050) is recommended. Larger batch sizes or FP32 execution will require 6‑8 GB.

Recommended GPU – Any modern NVIDIA GPU supporting CUDA 11+ and Tensor Cores (e.g., RTX 3060, RTX A5000, Tesla T4) will provide sub‑second latency for typical tables (< 100 rows, < 20 columns). For production workloads, a GPU with 12 GB+ VRAM allows parallel processing of multiple queries.

CPU & RAM – The tokenizer and data‑pre‑processing are lightweight; a 4‑core CPU with 8 GB RAM is sufficient for single‑query serving. If you plan to pre‑process large CSV files on‑the‑fly, allocate 16 GB RAM to avoid paging.

Storage – The model files (config, tokenizer, weights) total ≈ 1.2 GB. Store them on SSD for fast loading; HDD is acceptable but will increase start‑up time.

Performance characteristics – On an RTX 3060 (FP16), a typical query on a 100‑row table completes in ~0.3 seconds. The encoder‑decoder pipeline scales linearly with table size; very wide tables (> 50 columns) may increase token length and thus latency.

Use Cases

Primary applications

  • Customer‑support bots that answer product‑spec questions from CSV catalogs.
  • Business intelligence dashboards where analysts type natural‑language queries (“total sales in Q3 for region X”) and receive instant numeric answers.
  • Educational tools that let students explore historical data (e.g., Olympic host cities) without learning SQL.

Real‑world examples

  • Sports analytics: Query a player‑statistics table for “most assists per game” using plain English.
  • Event scheduling: Retrieve episodes aired on a specific date from a TV‑show episode table.
  • Financial reporting: Pull the latest quarterly revenue figure from a financial statement table.

Industry domains – Media & entertainment, sports, e‑commerce, finance, education, and any sector that maintains structured reference tables.

Integration possibilities – The model can be wrapped in a Flask or FastAPI micro‑service, deployed on Azure Functions, or embedded directly in a Jupyter notebook using the transformers library. Its reliance on pandas makes it compatible with existing data‑pipeline codebases.

Training Details

The tapex‑base checkpoint was first pre‑trained on a massive synthetic dataset of tables and SQL queries generated by automatically pairing random relational schemas with executable SQL statements. This stage teaches the model a “neural executor” capable of mapping natural language to SQL semantics.

For the fine‑tuning stage, the model was trained on the WikiSQL dataset, which contains 87 k question‑table pairs. The training used the standard seq2seq loss (cross‑entropy) with teacher forcing, a learning rate of 3e‑5, and a batch size of 32 on 8 × V100 GPUs for roughly 3 days (≈ 150 GPU‑hours). The fine‑tuned weights are then uploaded to Hugging Face under the MIT license.

Because the model is a BART‑style encoder‑decoder, it can be further fine‑tuned on any domain‑specific table‑QA dataset (e.g., medical records, product inventories) by continuing the same training regime. The tokenizer (TapexTokenizer) is uncased and built on the BART vocab, so no additional token‑vocabulary steps are needed.

Licensing Information

The model is released under the MIT license (as indicated in the README tags), which is a permissive open‑source license. The “unknown” field in the Hugging Face metadata likely refers to the model card’s license field being empty, but the tag license:mit clarifies the intended licensing.

Commercial use – MIT permits unrestricted commercial exploitation, including embedding the model in SaaS products, mobile apps, or enterprise analytics platforms. No royalty or fee is required.

Restrictions – The only obligations are to retain the original copyright notice and license text in any redistributed binaries or source code. There are no patent clauses or export‑control restrictions in the MIT license.

Attribution – When publishing results or releasing a derivative work, you should cite the original TAPEX paper (see the “Related Papers” section) and include a link back to the Hugging Face model card: microsoft/tapex-base-finetuned-wikisql.

Pre-loaded AI models. Ready to run.

Skip the downloads. Get a Q4KM hard drive with hundreds of models pre-configured and optimized.

Shop Q4KM Hard Drives