shuttie's picture
update hf datasets example
eb49f3e
---
language:
- en
license: apache-2.0
tags:
- text
pretty_name: MTEB/BEIR eval hard negatives
size_categories:
- "100K<n<1M"
source_datasets:
- "BeIR"
task_categories:
- sentence-similarity
dataset_info:
config_name: default
features:
- name: query
dtype: string
- name: positive
sequence: string
- name: negative
sequence: string
splits:
- name: test
num_bytes: 226515502
num_examples: 3679
train-eval-index:
- config: default
task: sentence-similarity
splits:
eval_split: test
configs:
- config_name: default
data_files:
- split: test
path: "data/test/*"
---
# BEIR/MTEB hard negatives dataset
A dataset for quick evaluation of embedding models during their training.
The problem: running a full MTEB evaluation on a single GPU may take 10-20 hours. Most of this time is spent on embedding all 30M docs in all 10+ corpora. This dataset solves this problem by unwrapping a "retrieval" style benchmark into the "reranking" style:
* We compute embeddings for all documents in the corpora with the [intfloat/e5-base-v2](todo) model.
* For each corpus in BEIR/MTEB benchmark we build a Lucene index with text documents and their embeddings.
* For each eval query we do a hybrid [RRF](todo)-based retrieval for top-32 negatives
As BEIR testset is size-unbalanced (TREC-COVID is 42 queries, and MS MARCO is ~4000) we sample top-300 random queries from each dataset.
It takes around 30-60 seconds to perform eval using Nixietune on a single RTX 4090.
A dataset in a [nixietune](https://github.com/nixiesearch/nixietune) compatible format:
```json
{
"query": ")what was the immediate impact of the success of the manhattan project?",
"pos": [
"The presence of communication amid scientific minds was equally important to the success of the Manhattan Project as scientific intellect was. The only cloud hanging over the impressive achievement of the atomic researchers and engineers is what their success truly meant; hundreds of thousands of innocent lives obliterated."
],
"neg": [
"Abstract. The pivotal engineering and scientific success of the Twentieth century was the Manhattan Project. The Manhattan Project assimilated concepts and leaders from all scientific fields and engineering disciplines to construct the first two atomic bombs.",
"The pivotal engineering and scientific success of the Twentieth century was the Manhattan Project. The Manhattan Project assimilated concepts and leaders from all scientific fields and engineering disciplines to construct the first two atomic bombs."
]
}
```
## Usage
To use with HF datasets:
```bash
pip install datasets zstandard
```
```python
from datasets import load_dataset
data = load_dataset('nixiesearch/beir-eval-hard-negatives')
print(data["test"].features)
```
## License
Apache 2.0