--- pretty_name: BEIR · NQ license: cc-by-nc-sa-3.0 language: - en multilinguality: - monolingual task_categories: - text-retrieval task_ids: - document-retrieval tags: - beir - mteb - retrieval - wikipedia configs: - config_name: corpus data_files: - split: test path: corpus/test-*.parquet - config_name: qrels data_files: - split: test path: qrels/test-*.parquet - config_name: queries data_files: - split: test path: queries/test-*.parquet --- # NQ — BEIR, unified schema A normalised copy of the dataset behind the `mteb` task **`NQ`**, one of the tasks of the [BEIR](https://github.com/beir-cellar/beir) benchmark as `mteb` defines it. Same queries, documents and relevance judgements as the benchmark evaluates — reshaped into one strict schema shared by every dataset in this collection. | | | |---|---| | Source | [`mteb/nq`](https://huggingface.co/datasets/mteb/nq/tree/b774495ed302d8c44a3a7ea25c90dbce03968f31) @ `b774495ed302` (the revision pinned in `mteb`) | | Domain · languages | wikipedia · eng | | Queries / documents / qrels | 3,452 / 2,681,468 / 4,201 | | Qrels per query | min 1 · mean 1.217 · max 4 | | Score values | 1 ×4,201 | | Layout | `queries` · `corpus` · `qrels`, split `test` | | License | `cc-by-nc-sa-3.0` | ## Schema | config | columns | rules | |---|---|---| | `queries` | `id: string`, `text: string` | ids unique and non-empty; every query has ≥ 1 qrel | | `corpus` | `id: string`, `title: string`, `text: string` | `title` is always present (`""` when the source has none) | | `qrels` | `query-id: string`, `corpus-id: string`, `score: int32` | referential integrity to both tables; no duplicate pairs; no floats | Files are Parquet, sorted by id, zstd-compressed, sharded at 500 MB. Every rule above is enforced by a validator before publishing; `provenance.json` records the source file hashes, what changed, and the output file hashes. ## What changed from the source - **byte-preserved** all text — no whitespace, newline, or control-character normalisation - cast `qrels.score` double -> int32 - kept 36,943 documents whose text is identical to another document's — a property of the source; note that models embed such documents identically and retrieval ties among them are broken by corpus order - renamed `_id` → `id` - renamed source splits (`queries`←`queries/queries`, `corpus`←`corpus/corpus`) to `test` ## Load it ```python from datasets import load_dataset queries = load_dataset("Hyukkyu/beir-nq", "queries", split="test") corpus = load_dataset("Hyukkyu/beir-nq", "corpus", split="test") qrels = load_dataset("Hyukkyu/beir-nq", "qrels", split="test") ``` ## Cross-check against the previous layout This repo previously held the same dataset in BEIR's raw two-repo form (`Hyukkyu/beir-nq` + `Hyukkyu/beir-nq-qrels`; that layout is kept under the git tag `legacy-layout`). Before replacing it, the build was compared against it: corpus id set **identical** (2,681,468 documents); qrels rows per split `test` 4,201 = 4,201. ## License and attribution The data is redistributed under the source's terms — `cc-by-nc-sa-3.0`. All credit belongs to the original authors; see the source repository and the references in `mteb`'s task metadata (https://ai.google.com/research/NaturalQuestions/). This repository is an independent repackaging and is not affiliated with the RTEB or MTEB maintainers.