Dataset Viewer
Auto-converted to Parquet Duplicate
_id
stringlengths
23
47
title
stringclasses
184 values
text
stringlengths
2
6.67k
emb
listlengths
1.02k
1.02k
test-environment-aeghhgwpe-pro02b
animals environment general health health general weight philosophy ethics
You don’t have to be vegetarian to be green. Many special environments have been created by livestock farming – for example chalk down land in England and mountain pastures in many countries. Ending livestock farming would see these areas go back to woodland with a loss of many unique plants and animals. Growing crops ...
[ 0.01519775390625, 0.027801513671875, 0.00833892822265625, 0.0272979736328125, 0.0071258544921875, -0.01200103759765625, 0.034515380859375, -0.0645751953125, -0.01146697998046875, 0.0159149169921875, 0.00576019287109375, -0.004947662353515625, -0.045013427734375, -0.044525146484375, -0.00...
test-environment-aeghhgwpe-pro02a
animals environment general health health general weight philosophy ethics
Being vegetarian helps the environment Becoming a vegetarian is an environmentally friendly thing to do. Modern farming is one of the main sources of pollution in our rivers. Beef farming is one of the main causes of deforestation, and as long as people continue to buy fast food in their billions, there will be a fina...
[ 0.005767822265625, 0.0080413818359375, -0.0100860595703125, 0.007160186767578125, -0.0109710693359375, -0.01132965087890625, 0.005889892578125, -0.0416259765625, -0.017547607421875, 0.0257415771484375, 0.0017986297607421875, -0.00875091552734375, 0.00241851806640625, -0.034027099609375, ...
test-environment-aeghhgwpe-pro03b
animals environment general health health general weight philosophy ethics
The key to good health is a balanced diet, not a meat- and fish-free diet. Meat and fish are good sources of protein, iron, and other vitamins and minerals. Most of the health benefits of a vegetarian diet derive from its being high in fibre and low in fat and cholesterol. These can be achieved by avoiding fatty and fr...
[ 0.043243408203125, 0.0200347900390625, 0.001659393310546875, -0.0035114288330078125, 0.00974273681640625, -0.02325439453125, 0.017425537109375, -0.055023193359375, -0.024322509765625, 0.051116943359375, 0.036651611328125, -0.0260009765625, -0.0019588470458984375, -0.03369140625, -0.01580...
test-environment-aeghhgwpe-pro01a
animals environment general health health general weight philosophy ethics
It is immoral to kill animals As evolved human beings it is our moral duty to inflict as little pain as possible for our survival. So if we do not need to inflict pain to animals in order to survive, we should not do it. Farm animals such as chickens, pigs, sheep, and cows are sentient living beings like us - they are...
[ 0.043212890625, 0.01207733154296875, 0.0305328369140625, 0.035919189453125, -0.011138916015625, -0.00905609130859375, 0.0259552001953125, -0.0888671875, -0.0242767333984375, 0.0095672607421875, 0.0176849365234375, 0.00020623207092285156, -0.057525634765625, -0.03741455078125, -0.00983428...
test-environment-aeghhgwpe-pro01b
animals environment general health health general weight philosophy ethics
There is a great moral difference between humans and animals. Unlike animals, humans are capable of rational thought and can alter the world around them. Other creatures were put on this earth for mankind to use, and that includes eating meat. For all these reasons we say that men and women have rights and that animals...
[ 0.051055908203125, -0.0038204193115234375, 0.01271820068359375, 0.071533203125, -0.002681732177734375, -0.033294677734375, 0.08953857421875, -0.055633544921875, -0.0255279541015625, 0.0112762451171875, -0.00689697265625, 0.0142974853515625, -0.049041748046875, -0.018035888671875, 0.01413...
test-environment-aeghhgwpe-pro04b
animals environment general health health general weight philosophy ethics
Food safety and hygiene are very important for everyone, and governments should act to ensure that high standards are in place particularly in restaurants and other places where people get their food from. But food poisoning can occur anywhere “People don't like to admit that the germs might have come from their own ho...
[ 0.0859375, 0.032958984375, 0.00024437904357910156, -0.0258941650390625, 0.034393310546875, -0.026458740234375, 0.0228424072265625, -0.03363037109375, -0.0304107666015625, 0.022796630859375, -0.0079803466796875, -0.0169830322265625, -0.046142578125, -0.0307464599609375, -0.024734497070312...
test-environment-aeghhgwpe-pro03a
animals environment general health health general weight philosophy ethics
Vegetarianism is healthier There are significant health benefits to 'going veggie'; a vegetarian diet contains high quantities of fibre, vitamins, and minerals, and is low in fat. (A vegan diet is even better since eggs and dairy products are high in cholesterol.) The risk of contracting many forms of cancer is increa...
[ 0.0543212890625, 0.01861572265625, 0.0059356689453125, -0.01192474365234375, 0.026123046875, -0.01335906982421875, 0.01513671875, -0.055267333984375, -0.036773681640625, 0.05181884765625, 0.07257080078125, 0.0010747909545898438, -0.0301361083984375, -0.048919677734375, -0.015701293945312...
test-environment-aeghhgwpe-pro04a
animals environment general health health general weight philosophy ethics
Being vegetarian reduces risks of food poisoning Almost all dangerous types of food poisoning are passed on through meat or eggs. So Campylobacter bacteria, the most common cause of food poisoning in England, are usually found in raw meat and poultry, unpasteurised milk and untreated water. Salmonella come from raw me...
[ 0.0843505859375, 0.0144805908203125, 0.0147705078125, -0.0222930908203125, 0.023406982421875, -0.0303497314453125, 0.02886962890625, -0.022308349609375, -0.03533935546875, 0.01422119140625, 0.0161285400390625, 0.0001405477523803711, -0.00753021240234375, -0.03863525390625, 0.007957458496...
test-environment-aeghhgwpe-con03b
animals environment general health health general weight philosophy ethics
To suggest that battery farms are in some way 'natural' is absurd - they are unnatural and cruel. To eat meat is to perpetuate animal suffering on a huge scale - a larger, crueler, and more systematic scale than anything found in the wild. Furthermore, the very fact of humanity's 'superiority' over other animals means ...
[ 0.07135009765625, -0.007129669189453125, 0.027557373046875, 0.047119140625, 0.004032135009765625, -0.025482177734375, 0.06488037109375, -0.05706787109375, -0.038909912109375, 0.0308380126953125, -0.015625, 0.004474639892578125, -0.0479736328125, -0.00600433349609375, -0.0258941650390625,...
test-environment-aeghhgwpe-con01b
animals environment general health health general weight philosophy ethics
"Human evolved as omnivores over thousands of years. Yet since the invention of farming there is no (...TRUNCATED)
[0.03887939453125,-0.01873779296875,0.0194244384765625,0.0191192626953125,-0.016326904296875,-0.0243(...TRUNCATED)
End of preview. Expand in Data Studio

BEIR embeddings with Cohere embed-english-v3.0 model

This datasets contains all query & document embeddings for BEIR, embedded with the Cohere embed-english-v3.0 embedding model.

Overview of datasets

This repository hosts all 18 datasets from BEIR, including query and document embeddings. The following table gives an overview of the available datasets. See the next section how to load the individual datasets.

Dataset nDCG@10 #Documents
arguana 53.98 8,674
bioasq 45.66 14,914,603
climate-fever 25.90 5,416,593
cqadupstack-android 50.01 22,998
cqadupstack-english 49.09 40,221
cqadupstack-gaming 60.50 45,301
cqadupstack-gis 39.17 37,637
cqadupstack-mathematica 30.38 16,705
cqadupstack-physics 43.82 38,316
cqadupstack-programmers 43.67 32,176
cqadupstack-stats 35.23 42,269
cqadupstack-text 30.84 68,184
cqadupstack-unix 40.59 47,382
cqadupstack-webmasters 40.68 17,405
cqadupstack-wordpress 34.26 48,605
fever 89.00 5,416,568
fiqa 42.14 57,638
hotpotqa 70.72 5,233,329
msmarco 42.86 8,841,823
nfcorpus 38.63 3,633
nq 61.62 2,681,468
quora 88.72 522,931
robust04 54.06 528,155
scidocs 20.34 25,657
scifact 71.81 5,183
signal1m 26.32 2,866,316
trec-covid 81.78 171,332
trec-news 50.42 594,977
webis-touche2020 32.64 382,545

Notes:

  • arguana: The task of arguana is to find for a given argument (e.g. Being vegetarian helps the environment ...), an argument that refutes it (e.g. Vegetarian doesn't have an impact on the environment). Naturally, embedding models work by finding the most similar texts, hence for the given argument it would find similar arguments first that support that vegetarian helps the environment, which would be treated as non-relevant. By embedding model prompting, the model can be steered to find arguments that refute the query. This will improve the nDCG@10 score from 53.98 to 61.5.
  • climate-fever: The task is to find evidence that support or refute a claim. As with arguana, with the default mode, the model will find the evidence primarily supporting the claim. By embedding model prompting, we can tell the model to find support and contra evidence for a claim. This improves the nDCG@10 score to 38.4.
  • Quora: As the corpus consists of questions, they have been encoded with the input_type='search_query' in order to find similar/duplicate questions.
  • cqadupstack: The datasets consists of several sub-datasets, where the nDCG@10 scores will be averaged in BEIR.
  • bioasq/robust04/trec-news/signal1m: For these datasets we just provide the IDs and the embeddings, but not title/text fields. See the BEIR repository how to obtain the respective text corpora. You can still evaluate search quality on these datasets.

Loading the dataset

Loading the document embeddings

The corpus split contains all document embeddings of the corpus.

You can either load the dataset like this:

from datasets import load_dataset
dataset_name = "hotpotqa"
docs = load_dataset("CohereLabs/beir-embed-english-v3", f"{dataset_name}-corpus", split="train")

Or you can also stream it without downloading it before:

from datasets import load_dataset
dataset_name = "hotpotqa"
docs = load_dataset("CohereLabs/beir-embed-english-v3", f"{dataset_name}-corpus", split="train", streaming=True)
for doc in docs:
    doc_id = doc['_id']
    title = doc['title']
    text = doc['text']
    emb = doc['emb']

Note, depending on the dataset size, the corpus split can be quite large.

Loading the query embeddings

The queries split contains all query embeddings. There might be up to three splits: train, dev, and test, depending which splits are available in BEIR. Evaluation is performed on the test split.

You can load the dataset like this:

from datasets import load_dataset
dataset_name = "hotpotqa"
queries = load_dataset("CohereLabs/beir-embed-english-v3", f"{dataset_name}-queries", split="test")

for query in queries:
    query_id = query['_id']
    text = query['text']
    emb = query['emb']

Loading the qrels

The qrels split contains the query relevance annotation, i.e., it contains the relevance score for (query, document) pairs.

You can load the dataset like this:

from datasets import load_dataset
dataset_name = "hotpotqa"
qrels = load_dataset("CohereLabs/beir-embed-english-v3", f"{dataset_name}-qrels", split="test")

for qrel in qrels:
    query_id = qrel['query_id']
    corpus_id = qrel['corpus_id']
    score = qrel['score']

Search

The following shows an example, how the dataset can be used to build a semantic search application.

Get your API key from cohere.com and start using this dataset.

#Run: pip install cohere datasets torch
from datasets import load_dataset
import torch
import cohere
dataset_name = "hotpotqa"
co = cohere.Client("<<COHERE_API_KEY>>")  # Add your cohere API key from www.cohere.com

#Load at max 1000 documents + embeddings
max_docs = 1000
docs_stream = load_dataset("CohereLabs/beir-embed-english-v3", f"{dataset_name}-corpus", split="train", streaming=True)
docs = []
doc_embeddings = []
for doc in docs_stream:
    docs.append(doc)
    doc_embeddings.append(doc['emb'])
    if len(docs) >= max_docs:
        break

doc_embeddings = torch.tensor(doc_embeddings)

query = 'What is an abstract' #Your query 
response = co.embed(texts=[query], model='embed-english-v3.0', input_type='search_query')
query_embedding = response.embeddings 
query_embedding = torch.tensor(query_embedding)

# Compute dot score between query embedding and document embeddings
dot_scores = torch.mm(query_embedding, doc_embeddings.transpose(0, 1))
top_k = torch.topk(dot_scores, k=3)

# Print results
print("Query:", query)
for doc_id in top_k.indices[0].tolist():
    print(docs[doc_id]['title'])
    print(docs[doc_id]['text'], "\n")

Running evaluations

This dataset allows to reproduce the BEIR performance results and to compute nDCG@10, Recall@10, and Accuracy@3.

You must have beir, faiss, numpy, and datasets installed. The following scripts loads all files, runs search and computes the search quality metrices.

import numpy as np
import faiss
from beir.retrieval.evaluation import EvaluateRetrieval
import time
from datasets import load_dataset

def faiss_search(index, queries_emb, k=[10, 100]):
    start_time = time.time()
    faiss_scores, faiss_doc_ids = index.search(queries_emb, max(k))
    print(f"Search took {(time.time()-start_time):.2f} sec")
    
    query2id = {idx: qid for idx, qid in enumerate(query_ids)}
    doc2id = {idx: cid for idx, cid in enumerate(docs_ids)}

    faiss_results = {}
    for idx in range(0, len(faiss_scores)):
        qid = query2id[idx]
        doc_scores = {doc2id[doc_id]: score.item() for doc_id, score in zip(faiss_doc_ids[idx], faiss_scores[idx])}
        faiss_results[qid] = doc_scores

    ndcg, map_score, recall, precision = EvaluateRetrieval.evaluate(qrels, faiss_results, k)
    acc = EvaluateRetrieval.evaluate_custom(qrels, faiss_results, [3, 5, 10], metric="acc")
    print(ndcg)
    print(recall)
    print(acc)

dataset_name = "<<DATASET_NAME>>" 
dataset_split = "test"
num_dim = 1024

#Load qrels
df = load_dataset("CohereLabs/beir-embed-english-v3", f"{dataset_name}-qrels", split=dataset_split)
qrels = {}
for row in df:
    qid = row['query_id']
    cid = row['corpus_id']
    
    if row['score'] > 0:
        if qid not in qrels:
            qrels[qid] = {}
        qrels[qid][cid] = row['score']

#Load queries
df = load_dataset("CohereLabs/beir-embed-english-v3", f"{dataset_name}-queries", split=dataset_split)

query_ids = df['_id']
query_embs = np.asarray(df['emb'])
print("Query embeddings:", query_embs.shape)

#Load corpus
df = load_dataset("CohereLabs/beir-embed-english-v3", f"{dataset_name}-corpus", split="train")

docs_ids = df['_id']

#Build index
print("Build index. This might take some time")
index = faiss.IndexFlatIP(num_dim)
index.add(np.asarray(df.to_pandas()['emb'].tolist()))

#Run and evaluate search
print("Seach on index")
faiss_search(index, query_embs)

Notes

  • This dataset was created with datasets==2.15.0. Make sure to use this or a newer version of the datasets library.
Downloads last month
933