/ Модель

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

Контекст
512 токенов
Параметры
138 млн
Лицензия
MIT
Архитектура
bert · dense
Базовая модель
bert-base-japanese-v3
Библиотека
RAGatouille
Опубликована
2 мар 2024

JaColBERTv2

Сходство предложенийТекст → score7 профессий

Японская ColBERT-модель для поиска релевантных документов и извлечения контекста в RAG-системах.

6 448скачиваний за 30 дней17лайковвеса обновлены29 апр 2024

Бенчмарки

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

Тесты пользователейпока нет

Никто ещё не опубликовал тест этой модели. Соберите бенчмарк из своих задач — результат появится здесь.

  1. Добавьте модель в бенчмарк

    Вместе с другими моделями категории «Эмбеддинги» — сравнение идёт внутри одной категории.

  2. Опишите свои задачи

    Напишите запросы, при необходимости приложите файлы и эталонные ответы.

  3. Запустите и опубликуйте

    Модели ответят на каждую задачу, судья оценит ответы. Опубликованный результат появится на этой странице.

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

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

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

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

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

JaColBERTv2 — японская модель поиска документов на архитектуре ColBERT, разработанная автором JaColBERT. Она предназначена для извлечения релевантных фрагментов по запросу и применения в поиске и RAG-системах. Модель использует позднее взаимодействие между представлениями токенов документов и запроса, что позволяет сочетать семантическое сопоставление с эффективным поиском по заранее построенному индексу.

Модель содержит 138,4 млн параметров, принимает текст и рассчитана на контекст до 512 токенов. Она основана на JaColBERT и cl-tohoku/bert-base-japanese-v3; README указывает на обучение дистилляцией на японской части MMARCO с 31 отрицательным примером на положительный. Для использования автор рекомендует RAGatouille. Лицензия — MIT.

В ранних оценках автор сообщает о результатах выше JaColBERT, multilingual-e5-large и BGE-M3 на JQaRa и JSQuAD, однако полная оценка ещё не завершена. Версия обозначена как ранний рабочий чекпойнт, веса могли обновляться; результаты следует считать предварительными.

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

  • поиск японских документов по естественно-языковому запросу
  • извлечение подходящих фрагментов из корпуса для RAG
  • построение поискового индекса японских текстов
  • ранжирование документов по релевантности запросу

Ограничения

README отмечает, что это ранний чекпойнт, полная оценка производительности ещё не завершена, а веса могли обновляться. Модель рассчитана на японский язык; для поиска требуется предварительно построить индекс.

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

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

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

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

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

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

Открыть на Hugging Face

First version of JaColBERTv2. Weights might be updated in the next few days.

Current early checkpoint is fully functional and outperforms multilingual-e5-large, BGE-M3 and JaColBERT in early results, but full evaluation TBD.# Intro

There is currently no JaColBERTv2 technical report. For an overall idea, you can refer to the JaColBERTv1 arXiv Report

If you just want to check out how to use the model, please check out the Usage section below!

Welcome to JaColBERT version 2, the second release of JaColBERT, a Japanese-only document retrieval model based on ColBERT.

JaColBERTv2 is a model that offers very strong out-of-domain generalisation. Having been only trained on a single dataset (MMarco), it reaches state-of-the-art performance.

JaColBERTv2 was initialised off JaColBERTv1 and trained using knowledge distillation with 31 negative examples per positive example. It was trained for 250k steps using a batch size of 32.

The information on this model card is minimal and intends to give a quick overview! It'll be updated once benchmarking is complete and a longer report is available.

Why use a ColBERT-like approach for your RAG application?

Most retrieval methods have strong tradeoffs:

  • Traditional sparse approaches, such as BM25, are strong baselines, but do not leverage any semantic understanding, and thus hit a hard ceiling.
  • Cross-encoder retriever methods are powerful, but prohibitively expensive over large datasets: they must process the query against every single known document to be able to output scores.
  • Dense retrieval methods, using dense embeddings in vector databases, are lightweight and perform well, but are not data-efficient (they often require hundreds of millions if not billions of training examples pairs to reach state-of-the-art performance) and generalise poorly in a lot of cases. This makes sense: representing every single aspect of a document, to be able to match it to any potential query, into a single vector is an extremely hard problem.

ColBERT and its variants, including JaColBERTv2, aim to combine the best of all worlds: by representing the documents as essentially bags-of-embeddings, we obtain superior performance and strong out-of-domain generalisation at much lower compute cost than cross-encoders.

Training

Training Data

The model is trained on the japanese split of MMARCO. It uses ColBERTv2 style training, meaning the model uses knowledge distillation from a cross-encoder model. We use the same cross-encoder scores as the original English ColBERTv2 training (as MMarco is a translated dataset, these are more or less well mapped). These scores are available here.

Unlike English ColBERTv2, we use nway=32 rather than nway=64, meaning that we provide the model with 31 negative examples per positive examples. Furthermore, we downsample the original sets of triplets from over 19 million to 8 million examples.

Training Method

JColBERT is trained for a single epoch (1-pass over every triplet, meaning 250000 trainings teps) on 8 NVidia A100 40GB GPUs. Total training time was around 30 hours.

JColBERT is initialised from JaColBERT, which itselfs builds upon Tohoku University's excellent bert-base-japanese-v3. Our experiments benefitted strongly from Nagoya University's work on building strong Japanese SimCSE models, among other work.

JaColBERT is trained with an overall batch size of 32 and a learning rate of 1e-5, and a warmup of 20000 steps. Limited exploration was performed but those defaults outperformed other experiments.

JaColBERT, as mentioned above, uses knowledge distillation using cross-encoder scores generated by a MiniLM cross-encoder on the English version of MS Marco. Please refer to the original ColBERTv2 paper for more information on this approach.

Results

We present the first results, on two datasets: JQaRa, a passage retrieval task composed of questions and wikipedia passages containing the answer, and JSQuAD, the Japanese translation of SQuAD. (Further evaluations on MIRACL and TyDi are running, but fairly slow due to how long it takes to run e5-large and bge-m3.)

JaColBERTv2 reaches state-of-the-art results on both datasets, outperforming models with 5x more parameters.

JQaRaJSQuAD
NDCG@10MRR@10NDCG@100MRR@100R@1R@5R@10
JaColBERTv20.5850.8360.7530.8380.9210.9770.982
JaColBERT0.5490.8110.7300.8140.9130.9720.978
bge-m3+all0.5760.8180.7450.820N/AN/AN/A
bg3-m3+dense0.5390.7850.7210.7880.8500.9590.976
m-e5-large0.5540.7990.7310.8010.8650.9660.977
m-e5-base0.4710.7270.6730.7310.8380.9550.973
m-e5-small0.4920.7290.6890.7330.8400.9540.973
GLuCoSE0.3080.5180.5640.5270.6450.8460.897
sup-simcse-ja-base0.3240.5410.5720.5500.6320.8490.897
sup-simcse-ja-large0.3560.5750.5960.5830.6030.8330.889
fio-base-v0.10.3720.6160.6080.6220.7000.8790.924

Usage

Installation

JaColBERT works using ColBERT+RAGatouille. You can install it and all its necessary dependencies by running:

pip install -U ragatouille

For further examples on how to use RAGatouille with ColBERT models, you can check out the examples section it the github repository.

Specifically, example 01 shows how to build/query an index, 04 shows how you can use JaColBERTv2 as a re-ranker, and 06 shows how to use JaColBERTv2 for in-memory searching rather than using an index.

Notably, RAGatouille has metadata support, so check the examples out if it's something you need!

Encoding and querying documents without an index

If you want to use JaColBERTv2 without building an index, it's very simple, you just need to load the model, encode() some documents, and then search_encoded_docs():

from ragatouille import RAGPretrainedModel
RAG = RAGPretrainedModel.from_pretrained("bclavie/JaColBERTv2")

RAG.encode(['document_1', 'document_2', ...])
RAG.search_encoded_docs(query="your search query")

Subsequent calls to encode() will add to the existing in-memory collection. If you want to empty it, simply run RAG.clear_encoded_docs().

Indexing

In order for the late-interaction retrieval approach used by ColBERT to work, you must first build your index. Think of it like using an embedding model, like e5, to embed all your documents and storing them in a vector database. Indexing is the slowest step retrieval is extremely quick. There are some tricks to speed it up, but the default settings work fairly well:

from ragatouille import RAGPretrainedModel

RAG = RAGPretrainedModel.from_pretrained("bclavie/JaColBERT")
documents = [ "マクドナルドのフライドポテトの少量のカロリーはいくつですか?マクドナルドの小さなフライドポテトのカロリーマクドナルドのウェブサイトには、次のように記載されています。フライドポテトの小さな注文で230カロリーケチャップで25カロリー、ケチャップパケットで15カロリー。",]
RAG.index(name="My_first_index", collection=documents)

The index files are stored, by default, at .ragatouille/colbert/indexes/{index_name}.

And that's it! Let it run, and your index and all its representations (compressed to 2bits by default) will have been generated.

Searching

Once you have created an index, searching through it is just as simple! If you're in the same session and RAG is still loaded, you can directly search the newly created index. Otherwise, you'll want to load it from disk:

RAG = RAGPretrainedModel.from_index(".ragatouille/colbert/indexes/My_first_index")

And then query it:

RAG.search(query="QUERY")
> [{'content': 'TEXT OF DOCUMENT ONE',
   'score': float,
   'rank': 1,
   'document_id': str,
   'document_metadata': dict},
  {'content': 'TEXT OF DOCUMENT TWO',
   'score': float,
   'rank': 2,
   'document_id': str,
   'document_metadata': dict},
  [...]
]

Citation

If you'd like to cite this work, please cite the JaColBERT technical report:

@misc{clavié2023jacolbert,
      title={JaColBERT and Hard Negatives, Towards Better Japanese-First Embeddings for Retrieval: Early Technical Report}, 
      author={Benjamin Clavié},
      year={2023},
      eprint={2312.16144},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}

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

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

GPU в ailist

Универсальный рантайм · RAGatouille

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

Подбираем GPU…

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

0 моделей