| --- |
| license: cc-by-4.0 |
| task_categories: |
| - text-retrieval |
| language: |
| - en |
| size_categories: |
| - 1K<n<10K |
| tags: |
| - table-retrieval |
| - keyword-search |
| - data-discovery |
| - tables |
| - wikipedia |
| pretty_name: WikiTables |
| configs: |
| - config_name: metadata |
| data_files: |
| - split: all |
| path: metadata.csv |
| - config_name: queries |
| data_files: |
| - split: all |
| path: queries.csv |
| - config_name: qrels |
| data_files: |
| - split: all |
| path: qrels.csv |
| --- |
| |
| # WikiTables |
|
|
| ## Dataset Summary |
|
|
| WikiTables is a dataset for **keyword search over tables (KWS-over-tables)**: |
| given a short natural-language keyword query (e.g., *"2008 beijing olympics"*), |
| a retrieval system must rank the tables in a corpus by their relevance to the |
| query. The task is the table analog of text retrieval — instead of returning |
| documents, the system returns structured tables. |
|
|
| The corpus is a downsampled subset of the WikiTables corpus, a large |
| collection of HTML tables extracted from Wikipedia and originally assembled |
| for entity linking research. Tables in this corpus do **not** have schema-style |
| table names; instead, each table is identified by an opaque `table_id` and |
| described by the column names plus surrounding Wikipedia context (page title, |
| section title, caption). |
|
|
| Relevance judgments are **graded on a 0–2 scale** (`0` = non-relevant, |
| `1` = related, `2` = relevant), inherited unchanged from the original |
| WikiTables benchmark. This differs from the binary positive-only convention |
| used by the other datasets in the Polaris suite. |
|
|
| WikiTables is one of six datasets in an evaluation suite for the KWS-over-tables |
| task; each dataset is published as its own Hugging Face repo following a |
| shared schema (with the per-dataset variations noted below). |
|
|
| ## How to Use |
|
|
| WikiTables is an **evaluation-only** benchmark — there is no train/test split. |
| All rows live in a single split named `all`. (Hugging Face's `datasets` |
| library requires every config to declare a split; `all` is used here in place |
| of the default `train` label to avoid implying training data.) |
|
|
| ```python |
| from datasets import load_dataset |
| |
| # Tables, queries, and graded relevance judgments |
| metadata = load_dataset("anhaidgroup/wikitables", "metadata", split="all") # 3,361 tables |
| queries = load_dataset("anhaidgroup/wikitables", "queries", split="all") # 60 queries |
| qrels = load_dataset("anhaidgroup/wikitables", "qrels", split="all") # 3,120 judgments |
| ``` |
|
|
| For methods that consume tuple-level data, download the per-table tuples |
| archive separately: |
|
|
| ```python |
| from huggingface_hub import hf_hub_download |
| import zipfile, pandas as pd |
| |
| zip_path = hf_hub_download("anhaidgroup/wikitables", "tuples.zip", repo_type="dataset") |
| with zipfile.ZipFile(zip_path) as z: |
| with z.open("Tuples/table-0001-249.csv") as f: |
| df = pd.read_csv(f) |
| ``` |
|
|
| Methods that retrieve over table metadata (column names and Wikipedia |
| context) only need `metadata`, `queries`, and `qrels`. Methods that retrieve |
| over actual tuple values additionally need `tuples.zip`. |
|
|
| ## Dataset Structure |
|
|
| ### Files |
|
|
| | file | size | purpose | |
| |---|---|---| |
| | `metadata.csv` | 3,361 rows | one row per table; identifier, column names, Wikipedia context | |
| | `queries.csv` | 60 rows | one row per query; identifier and query text | |
| | `qrels.csv` | 3,120 rows | graded relevance judgments (0/1/2) | |
| | `tuples.zip` | 3,361 inner CSVs | per-table tuple data, one CSV per table | |
|
|
| ### Schema |
|
|
| `metadata.csv` |
|
|
| | column | type | description | |
| |---|---|---| |
| | `table_id` | str | unique identifier, e.g., `table-0001-249` | |
| | `column_names` | str | JSON-encoded list of column names; parse with `json.loads` | |
| | `table_context` | str | JSON-encoded object with Wikipedia context for the table; commonly contains `pgTitle` (page title), `secondTitle` (section title), and `caption`; parse with `json.loads` | |
|
|
| There is no `table_name` column. Wikipedia tables are not named in the source |
| data — the role usually played by a table name is filled by `table_context`, |
| which carries the page and section the table came from. |
|
|
| `queries.csv` |
|
|
| | column | type | description | |
| |---|---|---| |
| | `query_id` | int | unique identifier, e.g., `1`, `2`, ..., `60` | |
| | `query` | str | natural-language keyword query | |
|
|
| Note that `query_id` is an integer here, in contrast to the string form |
| (`q1`, `q2`, ...) used by the other Polaris datasets. This matches the |
| original WikiTables release. |
|
|
| `qrels.csv` — graded relevance, **not** positive-only. |
|
|
| | column | type | description | |
| |---|---|---| |
| | `query_id` | int | foreign key to `queries.csv` | |
| | `table_id` | str | identifier from the original WikiTables corpus (see note below) | |
| | `relevance_score` | int | `0` = non-relevant, `1` = related, `2` = relevant | |
|
|
| `tuples.zip` — archive of per-table CSV files. |
| - Inner layout: `Tuples/<table_id>.csv` (one file per table). |
| - Each inner CSV: header on row 0 (matching the `column_names` entry in |
| `metadata.csv` for that `table_id`), tuples on subsequent rows, RFC 4180 |
| quoting. |
| - Headers may contain duplicate or empty strings (Wikipedia tables sometimes |
| have repeated or unnamed columns). Use a CSV parser that returns headers |
| verbatim; `pandas.read_csv` will auto-suffix duplicates (`Foo` → `Foo.1`) |
| and rename blanks (`""` → `Unnamed: 0`). |
|
|
| ### Statistics |
|
|
| - **3,361** tables, after corpus downsampling (see below). |
| - **60** keyword queries (the full original WikiTables query set). |
| - **3,120** graded judgments: 2,269 non-relevant (`0`), 474 related (`1`), |
| 377 relevant (`2`). |
| - Per-query judgment counts range from 39 to 62 (median 52). |
|
|
| ## Dataset Creation |
|
|
| ### Source Data |
|
|
| The corpus is a downsampled subset of the WikiTables corpus, a collection of |
| roughly 1.6M HTML tables extracted from English Wikipedia, originally |
| assembled for entity linking research. The 60 keyword queries and the graded |
| (0–2) relevance judgments used here are from the ad hoc table retrieval |
| benchmark introduced by Zhang and Balog (2018) over that corpus. Tables |
| carry column names and surrounding page context (page title, section title, |
| caption) but no schema-style table names. |
|
|
| ### Downsampling |
|
|
| Generating LLM enrichments for the full 1.6M-table corpus is prohibitively |
| expensive. To make LLM-based KWS evaluation tractable while preserving task |
| difficulty, the corpus is downsampled as follows: |
|
|
| > For each query, retrieve the top-50 tables via BM25 and take the union |
| > with all tables judged relevant for that query. This focuses the corpus on |
| > hard cases (BM25-retrievable distractors) without removing relevant |
| > material. |
|
|
| This procedure yields **3,361 retained tables**, listed in `metadata.csv`, |
| with their full tuple content in `tuples.zip`. |
|
|
| ### Annotations |
|
|
| Relevance judgments are inherited unchanged from the Zhang and Balog (2018) |
| ad hoc table retrieval benchmark and were produced by manual inspection. The |
| 0–2 scale reflects three judgment levels (non-relevant / related / relevant) |
| and is preserved as-is in `qrels.csv` rather than being collapsed to binary, |
| so users can replicate prior published numbers and compute graded-relevance |
| metrics (e.g., nDCG) directly. |
|
|
| ## Considerations for Using the Data |
|
|
| ### Why `qrels.csv` references some tables not in `metadata.csv` |
|
|
| The original WikiTables qrels file contains 3,120 (query, table) judgments |
| covering tables in the full 1.6M-table source corpus. After downsampling, |
| 3,361 of those tables remain in `metadata.csv`. To preserve the full source |
| qrels file as published, **`qrels.csv` retains all 3,120 original rows**, |
| including rows whose `table_id` is not present in `metadata.csv`. |
|
|
| In practice: |
|
|
| - All `relevance_score = 1` and `relevance_score = 2` rows reference tables |
| that *are* in `metadata.csv`. Every relevant table was kept by the |
| downsampling procedure (it is in the union of "BM25 top-50 ∪ all relevant |
| tables"). |
| - Rows whose `table_id` is *not* in `metadata.csv` all have |
| `relevance_score = 0`. These judgments concern tables that were dropped |
| from the corpus during downsampling and cannot be retrieved by any system |
| evaluated on this release. |
|
|
| This is a deliberate choice to preserve the original WikiTables qrels file |
| verbatim. It does mean that **`qrels.csv` does not satisfy a strict foreign-key |
| constraint with `metadata.csv`**. Code that joins the two files should either |
| use a left join (and treat the gap as expected) or filter to in-corpus |
| judgments before evaluation: |
|
|
| ```python |
| import pandas as pd |
| md = pd.read_csv("metadata.csv") |
| ql = pd.read_csv("qrels.csv") |
| ql_in_corpus = ql[ql.table_id.isin(md.table_id)] # 1,141 rows: 290 zeros + 474 ones + 377 twos |
| ``` |
|
|
| For most retrieval evaluations the in-corpus subset is the right one to use, |
| since a system cannot retrieve a table that is not in the corpus. |
|
|
| ### Why `queries.csv` retains all 60 queries |
|
|
| Three queries (`12` *running shoes*, `52` *erp systems price*, `53` *cats |
| life span*) have no `relevance_score >= 1` row anywhere in the WikiTables |
| qrels file — i.e., they had no relevant tables even in the full 1.6M-table |
| source corpus. We retain these queries in `queries.csv` to preserve the |
| original WikiTables query set. Users who want to evaluate only on queries |
| with at least one relevant table in the downsampled corpus should filter: |
|
|
| ```python |
| qr = pd.read_csv("queries.csv") |
| ql = pd.read_csv("qrels.csv") |
| md = pd.read_csv("metadata.csv") |
| qids_with_relevant = ql[(ql.relevance_score >= 1) & (ql.table_id.isin(md.table_id))].query_id.unique() |
| qr_eval = qr[qr.query_id.isin(qids_with_relevant)] # 57 queries |
| ``` |
|
|
| ### Tuple downsampling |
|
|
| This release additionally caps each table's tuples at 500,000 rows |
| (`df.head(500_000)` against the source); tables with fewer rows are |
| unaffected. WikiTables tables are typically small (extracted from |
| single-page HTML), so this cap binds rarely if at all. |
|
|
| `metadata.csv` and `qrels.csv` were produced against the un-capped corpus. |
| Methods that rely only on metadata are unaffected; methods that inspect |
| tuple values may produce a slightly deflated score relative to the same |
| method evaluated on the un-capped corpus. |
|
|
| ## License |
|
|
| The dataset is released under |
| [CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/). You are free to |
| share and adapt the material with attribution. |
|
|
| The source WikiTables corpus is derived from English Wikipedia content; |
| attribution should be given to Wikipedia and to the original WikiTables |
| release. |
|
|
| ## Citation |
|
|
| A citation for this dataset release will be added once the associated paper |
| is published. |
|
|
| <!-- TODO: replace with BibTeX entry on publication --> |
|
|
| The queries and graded relevance judgments are from: |
|
|
| > Zhang, S., and Balog, K. (2018). Ad hoc table retrieval using semantic |
| > similarity. In *Proceedings of the 2018 World Wide Web Conference* (WWW '18), |
| > pp. 1553–1562. |
|
|
| ```bibtex |
| @inproceedings{zhang2018adhoc, |
| author = {Zhang, Shuo and Balog, Krisztian}, |
| title = {Ad Hoc Table Retrieval using Semantic Similarity}, |
| booktitle = {Proceedings of the 2018 World Wide Web Conference}, |
| series = {WWW '18}, |
| year = {2018}, |
| pages = {1553--1562} |
| } |
| ``` |
|
|
| ## Authors |
|
|
| Minh Phan, Ting Cai, AnHai Doan. |
|
|