juliuslipp's picture
Update README.md
5c8386d verified
|
raw
history blame
45.7 kB
metadata
license: apache-2.0



The crispy rerank family from mixedbread ai.

mxbai-colbert-v1

This is our first English ColBERT model, which is built upon our sentence embedding model mixedbread-ai/mxbai-embed-large-v1. You can learn more about the models in our blog post.

Quickstart

We recommend using the RAGatouille for using our ColBERT model.

pip install ragatouille
from ragatouille import RAGPretrainedModel

# Let's create a ragatouille instance 
RAG = RAGPretrainedModel("mixedbread-ai/mxbai-colbert-v1")

documents = [
    "'To Kill a Mockingbird' is a novel by Harper Lee published in 1960. It was immediately successful, winning the Pulitzer Prize, and has become a classic of modern American literature.",
    "The novel 'Moby-Dick' was written by Herman Melville and first published in 1851. It is considered a masterpiece of American literature and deals with complex themes of obsession, revenge, and the conflict between good and evil.",
    "Harper Lee, an American novelist widely known for her novel 'To Kill a Mockingbird', was born in 1926 in Monroeville, Alabama. She received the Pulitzer Prize for Fiction in 1961.",
    "Jane Austen was an English novelist known primarily for her six major novels, which interpret, critique and comment upon the British landed gentry at the end of the 18th century.",
    "The 'Harry Potter' series, which consists of seven fantasy novels written by British author J.K. Rowling, is among the most popular and critically acclaimed books of the modern era.",
    "'The Great Gatsby', a novel written by American author F. Scott Fitzgerald, was published in 1925. The story is set in the Jazz Age and follows the life of millionaire Jay Gatsby and his pursuit of Daisy Buchanan."
]

# index documents
RAG.index(documents, index_name="mockingbird")

# search
query = "Who wrote 'To Kill a Mockingbird'?"
results = RAG.search(query)

The result looks like this:

[
  {
    'content': "'To Kill a Mockingbird' is a novel by Harper Lee published in 1960. It was immediately successful, winning the Pulitzer Prize, and has become a classic of modern American literature.",
    'score': 28.453125,
    'rank': 1,
    'document_id': '9d564e82-f14f-433a-ab40-b10bda9dc370',
    'passage_id': 0
  },
 {
    'content': "Harper Lee, an American novelist widely known for her novel 'To Kill a Mockingbird', was born in 1926 in Monroeville, Alabama. She received the Pulitzer Prize for Fiction in 1961.",
    'score': 27.03125,
    'rank': 2,
    'document_id': 'a35a89c3-b610-4e2e-863e-fa1e7e0710a6',
    'passage_id': 2
  },
  ...
]

Using API

You’ll be able to use the models through our API as well. The API is coming soon and will have some exciting features. Stay tuned!

Evaluation

1. Reranking Performance

Setup: we use BM25 as the first-stage retrieval model, and then use ColBERT for reranking. We evaluate the out-of-domain performance on 13 public BEIR datasets. Following common practice, we report NDCG@10 as the metrics.

Here, we compare our model with two widely used ColBERT models, as follows:

Dataset ColBERTv2 Jina-ColBERT-v1 mxbai-colbert-large-v1
ArguAna 29.99 33.42 33.11
ClimateFEVER 16.51 20.66 20.85
DBPedia 31.80 42.16 40.61
FEVER 65.13 81.07 80.75
FiQA 23.61 35.60 35.86
HotPotQA 63.30 68.84 67.62
NFCorpus 33.75 36.69 36.37
NQ 30.55 51.27 51.43
Quora 78.86 85.18 86.95
SCIDOCS 14.90 15.39 16.98
SciFact 67.89 70.2 71.48
TREC-COVID 59.47 75.00 81.04
Webis-touché2020 44.22 32.12 31.70
Average 43.08 49.82 50.37

Find more in our blog-post and on this spreadsheet.

2. Retrieval Performance

We also test our model's performance on retrieval tasks on a subset of the BEIR benchmarks. We'll be providing the full results for the benchmark soon (actively working on it).

Due to resource limitations, we only test our model on three beir tasks. NDCG@10 servers as the main metric.

Model ColBERTv2 Jina-ColBERT-V1 mxbai-colbert-large-v1
NFCorpus 33.7 33.8 36.5
SciFact 68.9 70.1 71.3
TREC-COVID 72.6 75.0 80.5

Although our ColBERT also performs well on retrieval tasks, we still recommend using our flagship embedding model mixedbread-ai/mxbai-embed-large-v1 for that.

Community

Please join our Discord Community and share your feedback and thoughts! We are here to help and also always happy to chat.

License

Apache 2.0