truthful-qa-lance / README.md
tsmithv11's picture
Publish truthful-qa in Lance format (#1)
9dce9b0
|
Raw History Blame Contribute Delete
3.58 kB
metadata
pretty_name: TruthfulQA in Lance
license: apache-2.0
language:
  - en
task_categories:
  - question-answering
  - text-generation
  - multiple-choice
tags:
  - lance
  - benchmark
  - information-retrieval
  - truthfulness
size_categories:
  - 1K<n<10K
configs:
  - config_name: generation
    data_files:
      - split: validation
        path: viewer/generation/validation-00000-of-00001.parquet
  - config_name: multiple_choice
    data_files:
      - split: validation
        path: viewer/multiple_choice/validation-00000-of-00001.parquet

TruthfulQA in Lance

Find TruthfulQA benchmark questions by topic, then read their benchmark category and reference answers. Pinned original dataset

Data and splits

Source configuration Split Rows Lance table
generation validation 817 data/generation/validation.lance
multiple_choice validation 817 data/multiple_choice/validation.lance

Both configurations keep every original field, row, and row order. The generation configuration includes the question, category, reference answers, and intentionally incorrect benchmark answers. The multiple-choice configuration preserves both sets of choices and labels. The source_row column gives the original zero-based row position within each configuration. Conversion manifest and source checksums

Hugging Face Data Studio reads the byte-identical original Parquet files in viewer/. Open the preview

Search in Python

The release generates a 1024-dimensional, L2-normalized float32 vector from each original English question. It uses sentence-transformers/static-retrieval-mrl-en-v1 at revision f60985c706f192d45d218078e49e5a8b6f15283a. Search ranks by cosine distance and prints cosine similarity as 1 - distance. Pinned encoder

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

encoder = SentenceTransformer(
    "sentence-transformers/static-retrieval-mrl-en-v1",
    revision="f60985c706f192d45d218078e49e5a8b6f15283a",
    device="cpu",
)
query = "Common misconceptions about the planets and the motion of Earth."
vector = encoder.encode_query(query, normalize_embeddings=True)
dataset = lance.dataset("hf://datasets/lance-format/truthful-qa-lance/data/generation/validation.lance")
hits = dataset.to_table(
    columns=["source_row", "question", "category", "best_answer", "_distance"],
    nearest={"column": "embedding", "q": vector, "k": 5, "metric": "cosine"},
).to_pylist()
for hit in hits:
    print(f"{1.0 - hit['_distance']:.4f}  row={hit['source_row']}  {hit['category']}")
    print(hit["question"])
    print(f"Benchmark answer: {hit['best_answer']}")

Attribution and license

Credit Stephanie Lin, Jacob Hilton, and Owain Evans for TruthfulQA: Measuring How Models Mimic Human Falsehoods. The authors release the source under Apache 2.0. This conversion adds a split-local identifier and the retrieval embedding. License · Original dataset card · Authors' repository · Paper