/ Модель

Характеристики

Контекст
8 192 токена
Параметры
137 млн
Лицензия
Apache 2.0
Архитектура
bert · dense
Опубликована
23 янв 2024

jina-colbert-v1-en

Заполнение пропусковТекст → текст9 профессий

Англоязычная ColBERT-модель Jina AI для поиска и ранжирования фрагментов текста, включая длинные документы.

339скачиваний за 30 дней101лайквеса обновлены6 янв 2025

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

Jina-ColBERT-v1-en — англоязычная модель поиска по фрагментам документов, разработанная Jina AI. Она использует архитектуру ColBERT на основе JinaBERT и обучена на наборе MSMARCO для ранжирования пассажей. Модель создаёт представления запросов и документов для поиска релевантных фрагментов и может применяться для первичного поиска и переранжирования результатов BM25.

Модель насчитывает 136,7 млн параметров и поддерживает контекст до 8192 токенов благодаря JinaBERT с двунаправленным вариантом ALiBi. В README сообщается о сопоставимых с ColBERTv2 результатах на стандартных поисковых тестах и лучших результатах на наборах с длинными документами. Лицензия — Apache-2.0.

Сценарии применения

  • поиск релевантных фрагментов в коллекции документов
  • переранжирование результатов BM25
  • поиск по длинным документам с контекстом до 8192 токенов

Ограничения

Модель обучена на MSMARCO passage ranking; README описывает нулевые результаты вне домена, поэтому качество на других предметных областях может различаться. Поддержка контекста до 8192 токенов требует актуальной версии ColBERT и соответствующей инфраструктуры для индексирования и поиска.

Для каких профессий подходит9

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Также подходит для

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

Jina-ColBERT

Jina-ColBERT is a ColBERT-style model but based on JinaBERT so it can support both 8k context length, fast and accurate retrieval.

JinaBERT is a BERT architecture that supports the symmetric bidirectional variant of ALiBi to allow longer sequence length. The Jina-ColBERT model is trained on MSMARCO passage ranking dataset, following a very similar training procedure with ColBERTv2. The only difference is that we use jina-bert-v2-base-en as the backbone instead of bert-base-uncased.

For more information about ColBERT, please refer to the ColBERTv1 and ColBERTv2 paper, and the original code.

Usage

Installation

To use this model, you will need to install the latest version of the ColBERT repository:

pip install git+https://github.com/stanford-futuredata/ColBERT.git torch
conda install -c conda-forge faiss-gpu  # use conda to install the latest version faiss

Indexing

from colbert import Indexer
from colbert.infra import Run, RunConfig, ColBERTConfig

n_gpu: int = 1  # Set your number of available GPUs
experiment: str = ""  # Name of the folder where the logs and created indices will be stored
index_name: str = ""  # The name of your index, i.e. the name of your vector database

if __name__ == "__main__":
    with Run().context(RunConfig(nranks=n_gpu, experiment=experiment)):
        config = ColBERTConfig(
          doc_maxlen=8192  # Our model supports 8k context length for indexing long documents
        )
        indexer = Indexer(
          checkpoint="jinaai/jina-colbert-v1-en",
          config=config,
        )
        documents = [
          "ColBERT is an efficient and effective passage retrieval model.",
          "Jina-ColBERT is a ColBERT-style model but based on JinaBERT so it can support both 8k context length.",
          "JinaBERT is a BERT architecture that supports the symmetric bidirectional variant of ALiBi to allow longer sequence length.",
          "Jina-ColBERT model is trained on MSMARCO passage ranking dataset, following a very similar training procedure with ColBERTv2.",
          "Jina-ColBERT achieves the competitive retrieval performance with ColBERTv2.",
          "Jina is an easier way to build neural search systems.",
          "You can use Jina-ColBERT to build neural search systems with ease.",
          # Add more documents here to ensure the clustering work correctly
        ]
        indexer.index(name=index_name, collection=documents)

Searching

from colbert import Searcher
from colbert.infra import Run, RunConfig, ColBERTConfig

n_gpu: int = 0
experiment: str = ""  # Name of the folder where the logs and created indices will be stored
index_name: str = ""  # Name of your previously created index where the documents you want to search are stored.
k: int = 10  # how many results you want to retrieve

if __name__ == "__main__":
    with Run().context(RunConfig(nranks=n_gpu, experiment=experiment)):
        config = ColBERTConfig(
          query_maxlen=128  # Although the model supports 8k context length, we suggest not to use a very long query, as it may cause significant computational complexity and CUDA memory usage.
        )
        searcher = Searcher(
          index=index_name, 
          config=config
        )  # You don't need to specify the checkpoint again, the model name is stored in the index.
        query = "How to use ColBERT for indexing long documents?"
        results = searcher.search(query, k=k)
        # results: tuple of tuples of length k containing ((passage_id, passage_rank, passage_score), ...)

Creating Vectors

from colbert.modeling.checkpoint import Checkpoint

ckpt = Checkpoint("jinaai/jina-colbert-v1-en", colbert_config=ColBERTConfig(root="experiments"))
query_vectors = ckpt.queryFromText(["What does ColBERT do?", "This is a search query?"], bsize=16)
print(query_vectors)

Complete working Colab Notebook is here

Reranking Using ColBERT

from colbert.modeling.checkpoint import Checkpoint
from colbert.infra import ColBERTConfig

query = ["How to use ColBERT for indexing long documents?"]
documents = [
    "ColBERT is an efficient and effective passage retrieval model.",
    "Jina-ColBERT is a ColBERT-style model but based on JinaBERT so it can support both 8k context length.",
    "JinaBERT is a BERT architecture that supports the symmetric bidirectional variant of ALiBi to allow longer sequence length.",
    "Jina-ColBERT model is trained on MSMARCO passage ranking dataset, following a very similar training procedure with ColBERTv2.",
]

config = ColBERTConfig(query_maxlen=32, doc_maxlen=512)
ckpt = Checkpoint(args.reranker, colbert_config=colbert_config)
Q = ckpt.queryFromText([all_queries[i]])
D = ckpt.docFromText(all_passages, bsize=32)[0]
D_mask = torch.ones(D.shape[:2], dtype=torch.long)
scores = colbert_score(Q, D, D_mask).flatten().cpu().numpy().tolist()
ranking = numpy.argsort(scores)[::-1]
print(ranking)

Evaluation Results

TL;DR: Our Jina-ColBERT achieves the competitive retrieval performance with ColBERTv2 on all benchmarks, and outperforms ColBERTv2 on datasets in where documents have longer context length.

In-domain benchmarks

We evaluate the in-domain performance on the dev subset of MSMARCO passage ranking dataset. We follow the same evaluation settings in the ColBERTv2 paper and rerun the results of ColBERTv2 using the released checkpoint.

ModelMRR@10Recall@50Recall@1k
ColBERTv239.786.897.6
Jina-ColBERT-v139.085.696.2

Out-of-domain benchmarks

Following ColBERTv2, we evaluate the out-of-domain performance on 13 public BEIR datasets and use NDCG@10 as the main metric. We follow the same evaluation settings in the ColBERTv2 paper and rerun the results of ColBERTv2 using the released checkpoint.

Note that both ColBERTv2 and Jina-ColBERT-v1 only employ MSMARCO passage ranking dataset for training, so below results are the fully zero-shot performance.

datasetColBERTv2Jina-ColBERT-v1
ArguAna46.549.4
ClimateFEVER18.119.6
DBPedia45.241.3
FEVER78.879.5
FiQA35.436.8
HotPotQA67.565.6
NFCorpus33.733.8
NQ56.154.9
Quora85.582.3
SCIDOCS15.416.9
SciFact68.970.1
TREC-COVID72.675.0
Webis-touché202026.027.0
Average50.050.2

Long context datasets

We also evaluate the zero-shot performance on datasets where documents have longer context length and compare with some long-context embedding models. Here we use the LoCo benchmark, which contains 5 datasets with long context length.

ModelUsed context lengthModel max context lengthAvg. NDCG@10
ColBERTv251251274.3
Jina-ColBERT-v1 (truncated)512*819275.5
Jina-ColBERT-v18192819283.7
Jina-embeddings-v2-base-en8192819285.4

* denotes that we truncate the context length to 512 for documents. The context length of queries is all 512.

To summarize, Jina-ColBERT achieves the comparable retrieval performance with ColBERTv2 on all benchmarks, and outperforms ColBERTv2 on datasets in where documents have longer context length.

Reranking Performance

We evaluate the reranking performance of ColBERTv2 and Jina-ColBERT on BEIR. We use BM25 as the first-stage retrieval model. The full evaluation code can be found in this repo.

In summary, Jina-ColBERT outperforms ColBERTv2, even achieving comparable performance with some cross-encoder.

The best model, jina-reranker, will be open-sourced soon!

BM25ColBERTv2Jina-ColBERTMiniLM-L-6-v2BGE-reranker-base-v1BGE-reranker-large-v1Jina-reranker-base-v1
Arguana29.9933.4233.9530.6723.2625.42
Climate-Fever16.5120.6621.8724.7031.6031.98
DBPedia31.8042.1641.4343.9041.5643.79
FEVER65.1381.0783.4980.7787.0789.11
FiQA23.6135.6036.6834.8733.1737.70
HotpotQA63.3068.8468.6272.6579.0479.98
NFCorpus33.7536.6936.3836.4832.7136.57
NQ30.5551.2751.0152.0153.5556.81
Quora78.8685.1882.7582.4578.4481.06
SCIDOCS14.9015.3916.6716.2815.0616.84
SciFact67.8970.2370.9569.5370.6274.14
TREC-COVID59.4775.0076.8974.4567.4674.32
Webis-touche202044.2232.1232.5628.4034.3735.66
Average43.0849.8250.2549.7849.8452.57

ColBERT

Plans

We are planning to improve the performance of Jina-ColBERT by fine-tuning on more datasets in the future.

Other Models

Additionally, we provide the following embedding models, you can also use them for retrieval.

Contact

Join our Discord community and chat with other community members about ideas.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · fill-mask

Можно запустить

Подбираем GPU…

Класс архитектуры
HF_ColBERT
Ревизия весов
31bb5a4

0 моделей