tsmithv11's picture
Publish the original CommonsenseQA splits in Lance (#1)
f327570
|
Raw History Blame Contribute Delete
4.1 kB
metadata
pretty_name: CommonsenseQA in Lance
license: mit
language:
  - en
task_categories:
  - question-answering
tags:
  - lance
  - commonsense-reasoning
  - multiple-choice
  - information-retrieval
size_categories:
  - 10K<n<100K
configs:
  - config_name: default
    default: true
    data_files:
      - split: train
        path: preview/train.parquet
      - split: validation
        path: preview/validation.parquet
      - split: test
        path: preview/test.parquet

CommonsenseQA in Lance

Find related English commonsense questions, then read their original multiple-choice options. This edition preserves all 12,102 questions, the original split assignments, and the five source fields from the published tau/commonsense_qa dataset. Pinned original release

Splits and schema

Source split Lance table Rows
train data/train.lance 9,741
validation data/validation.lance 1,221
test data/test.lance 1,140

The original id, question, question_concept, choices, and answerKey columns keep their values and order. choices contains the original label and text lists. The source test rows have empty answerKey strings, which this edition preserves. Each Lance row adds an embedding vector. The Data Studio preview uses byte-identical copies of the original split Parquet files. Open Data Studio · Split counts and provenance

Search related questions

This edition embeds the English question field alone. It uses sentence-transformers/static-retrieval-mrl-en-v1 at revision f60985c706f192d45d218078e49e5a8b6f15283a. Document and query encodings use the first 256 Matryoshka dimensions and L2 normalization. Lance searches float32 vectors by cosine distance. The example prints 1 - distance, where higher scores indicate more similar questions. Pinned encoder

python -m pip install 'pylance==14.0.3' 'sentence-transformers==6.3.0'
import lance
from sentence_transformers import SentenceTransformer

root = "hf://datasets/lance-format/commonsense-qa-lance"
split = "train"
encoder = SentenceTransformer(
    "sentence-transformers/static-retrieval-mrl-en-v1",
    revision="f60985c706f192d45d218078e49e5a8b6f15283a",
    truncate_dim=256,
    device="cpu",
)
query = "Where could I buy new pencils for school?"
vector = encoder.encode_query(query, normalize_embeddings=True)
questions = lance.dataset(f"{root}/data/{split}.lance")
matches = questions.to_table(
    columns=["id", "question", "question_concept", "_distance"],
    nearest={"column": "embedding", "q": vector, "k": 5, "metric": "cosine"},
).to_pylist()

for match in matches:
    print(f"{1 - match['_distance']:.4f}  {match['id']}  "
          f"concept={match['question_concept']}  {match['question']}")

Set split to validation or test to search the corresponding source split with the same encoder.

License and attribution

Alon Talmor, Jonathan Herzig, Nicholas Lourie, and Jonathan Berant created CommonsenseQA. The authors released their dataset under MIT. This conversion adds Lance tables and question embeddings. Author’s license confirmation · MIT license · Original paper and citation · Archived source card

The CommonsenseQA creators used ConceptNet to select concepts for the questions. Credit Robyn Speer, Joshua Chin, Catherine Havasi, and the Commonsense Computing Initiative for ConceptNet 5. The ConceptNet graph has its own CC BY-SA 4.0 terms. ConceptNet paper · ConceptNet data license and contributor credits