Datasets:
Tasks:
Question Answering
Modalities:
Text
Formats:
parquet
Languages:
English
Size:
10K - 100K
License:
|
Download README.md from lance-format/commonsense-qa-lance: direct link, hf CLI and curl.
- Browser
- Download file 4.1 kB
-
https://huggingface.co/datasets/lance-format/commonsense-qa-lance/resolve/main/README.md
- Command line
-
hf download hf://datasets/lance-format/commonsense-qa-lance/README.md
-
curl -L -o README.md https://huggingface.co/datasets/lance-format/commonsense-qa-lance/resolve/main/README.md
4.1 kB
| 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](https://huggingface.co/datasets/tau/commonsense_qa/tree/94630fe30dad47192a8546eb75f094926d47e155) | |
| ## 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](https://huggingface.co/datasets/lance-format/commonsense-qa-lance/viewer/default/train) · [Split counts and provenance](conversion.json) | |
| ## 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](https://huggingface.co/sentence-transformers/static-retrieval-mrl-en-v1/tree/f60985c706f192d45d218078e49e5a8b6f15283a) | |
| ```bash | |
| python -m pip install 'pylance==14.0.3' 'sentence-transformers==6.3.0' | |
| ``` | |
| ```python | |
| 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](https://github.com/jonathanherzig/commonsenseqa/issues/5) · [MIT license](LICENSE) · [Original paper and citation](https://aclanthology.org/N19-1421/) · [Archived source card](source/README.original.md) | |
| 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](https://doi.org/10.1609/aaai.v31i1.11164) · [ConceptNet data license and contributor credits](https://github.com/commonsense/conceptnet5/wiki/Copying-and-sharing-ConceptNet) | |