ai2-arc-lance / README.md
tsmithv11's picture
Publish ai2-arc in Lance format (#1)
5f03418
|
Raw History Blame Contribute Delete
3.84 kB
---
pretty_name: AI2 Reasoning Challenge in Lance
license: cc-by-sa-4.0
language:
- en
task_categories:
- question-answering
- text-retrieval
tags:
- lance
- science
- multiple-choice-qa
- information-retrieval
arxiv: 1803.05457
configs:
- config_name: ARC-Easy
default: true
data_files:
- split: train
path: viewer/ARC-Easy/train.parquet
- split: validation
path: viewer/ARC-Easy/validation.parquet
- split: test
path: viewer/ARC-Easy/test.parquet
- config_name: ARC-Challenge
data_files:
- split: train
path: viewer/ARC-Challenge/train.parquet
- split: validation
path: viewer/ARC-Challenge/validation.parquet
- split: test
path: viewer/ARC-Challenge/test.parquet
---
# AI2 Reasoning Challenge in Lance
Search 7,787 English grade-school science questions and retrieve their original multiple-choice records by ID. This is a Lance conversion of the question data in the [pinned Allen Institute for AI source](https://huggingface.co/datasets/allenai/ai2_arc/tree/210d026faf9955653af8916fad021475a3f00453).
## Data and splits
| Configuration | Train | Validation | Test | Lance path |
|---|---:|---:|---:|---|
| `ARC-Easy` | 2,251 | 570 | 2,376 | `data/ARC-Easy/<split>.lance` |
| `ARC-Challenge` | 1,119 | 299 | 1,172 | `data/ARC-Challenge/<split>.lance` |
The conversion verified an exact round-trip of `id`, `question`, `choices`, and `answerKey` in original row order, including each option's text and label. The added `question_embedding` column is indexed separately in each split. The Data Studio preview uses byte-identical copies of the six original Parquet files under `viewer/`. [Browse the preview](https://huggingface.co/datasets/lance-format/ai2-arc-lance/viewer/ARC-Easy/train) · [Row counts and preview checksums](meta/info.json)
## Search in Python
This release generates 256-dimensional `float32` vectors from `question` using the English retrieval model `sentence-transformers/static-retrieval-mrl-en-v1` at revision `f60985c706f192d45d218078e49e5a8b6f15283a`. It uses the model's first 256 Matryoshka dimensions with L2 normalization. The query uses the same encoding, and each Lance `IVF_FLAT` index uses cosine distance. The code below prints cosine similarity, the original question ID, and the question text for five matches. [Pinned encoder](https://huggingface.co/sentence-transformers/static-retrieval-mrl-en-v1/tree/f60985c706f192d45d218078e49e5a8b6f15283a)
```bash
pip install pylance==14.0.3 sentence-transformers==6.3.0
```
```python
import lance
from sentence_transformers import SentenceTransformer
encoder = SentenceTransformer(
"sentence-transformers/static-retrieval-mrl-en-v1",
revision="f60985c706f192d45d218078e49e5a8b6f15283a",
device="cpu",
truncate_dim=256,
)
query = "Why does the Sun appear to move across the sky over the course of a day?"
vector = encoder.encode(query, normalize_embeddings=True)
questions = lance.dataset("hf://datasets/lance-format/ai2-arc-lance/data/ARC-Easy/train.lance")
hits = questions.to_table(
columns=["id", "question", "_distance"],
nearest={"column": "question_embedding", "q": vector, "k": 5, "metric": "cosine"},
).to_pylist()
for hit in hits:
print(f"{1.0 - hit['_distance']:.4f}\t{hit['id']}\t{hit['question']}")
```
## Source, license, and changes
Credit the Allen Institute for AI and Peter Clark, Isaac Cowhey, Oren Etzioni, Tushar Khot, Ashish Sabharwal, Carissa Schoenick, and Oyvind Tafjord for the AI2 Reasoning Challenge. The source and this release use CC BY-SA 4.0. The conversion adds search vectors, indices, and Parquet previews. The original Hugging Face card is included in `source/`. Allen AI's project page provides the separate ARC Corpus. [Project page](https://allenai.org/data/arc) · [Paper](https://arxiv.org/abs/1803.05457) · [License text](LICENSE.txt)