The text embedding set trained by Jina AI, Finetuner team.
Intended Usage & Model Info
jina-embeddings-v2-base-en
is an English, monolingual embedding model supporting 8192 sequence length.
It is based on a Bert architecture (JinaBert) that supports the symmetric bidirectional variant of ALiBi to allow longer sequence length.
The backbone jina-bert-v2-base-en
is pretrained on the C4 dataset.
The model is further trained on Jina AI's collection of more than 400 millions of sentence pairs and hard negatives.
These pairs were obtained from various domains and were carefully selected through a thorough cleaning process.
The embedding model was trained using 512 sequence length, but extrapolates to 8k sequence length (or even longer) thanks to ALiBi. This makes our model useful for a range of use cases, especially when processing long documents is needed, including long document retrieval, semantic textual similarity, text reranking, recommendation, RAG and LLM-based generative search, etc.
With a standard size of 137 million parameters, the model enables fast inference while delivering better performance than our small model. It is recommended to use a single GPU for inference. Additionally, we provide the following embedding models:
V1 (Based on T5, 512 Seq)
jina-embeddings-v1-small-en
: 35 million parameters.jina-embeddings-v1-base-en
: 110 million parameters.jina-embeddings-v1-large-en
: 330 million parameters.
V2 (Based on JinaBert, 8k Seq)
jina-embeddings-v2-small-en
: 33 million parameters.jina-embeddings-v2-base-en
: 137 million parameters (you are here).jina-embeddings-v2-large-en
: 435 million parameters (releasing soon).
Data & Parameters
Jina Embeddings V2 technical report
Usage
You can use Jina Embedding models directly from transformers package:
!pip install transformers
from transformers import AutoModel
from numpy.linalg import norm
cos_sim = lambda a,b: (a @ b.T) / (norm(a)*norm(b))
model = AutoModel.from_pretrained('jinaai/jina-embeddings-v2-base-en', trust_remote_code=True) # trust_remote_code is needed to use the encode method
embeddings = model.encode(['How is the weather today?', 'What is the current weather like today?'])
print(cos_sim(embeddings[0], embeddings[1]))
If you only want to handle shorter sequence, such as 2k, pass the max_length
parameter to the encode
function:
embeddings = model.encode(
['Very long ... document'],
max_length=2048
)
Alternatively, you can use Jina AI's Embedding platform for fully-managed access to Jina Embeddings models.
Fine-tuning
Please consider Finetuner.
Plans
The development of new bilingual models is currently underway. We will be targeting mainly the German and Spanish languages.
The upcoming models will be called jina-embeddings-v2-base-de/es
.
Contact
Join our Discord community and chat with other community members about ideas.
Citation
If you find Jina Embeddings useful in your research, please cite the following paper:
@misc{günther2023jina,
title={Jina Embeddings 2: 8192-Token General-Purpose Text Embeddings for Long Documents},
author={Michael Günther and Jackmin Ong and Isabelle Mohr and Alaeddine Abdessalem and Tanguy Abel and Mohammad Kalim Akram and Susana Guzman and Georgios Mastrapas and Saba Sturua and Bo Wang and Maximilian Werk and Nan Wang and Han Xiao},
year={2023},
eprint={2310.19923},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
- Downloads last month
- 32
Dataset used to train DecisionOptimizationSystem/DeepFeatEmbeddingLargeContext
Spaces using DecisionOptimizationSystem/DeepFeatEmbeddingLargeContext 2
Evaluation results
- accuracy on MTEB AmazonCounterfactualClassification (en)test set self-reported74.731
- ap on MTEB AmazonCounterfactualClassification (en)test set self-reported37.765
- f1 on MTEB AmazonCounterfactualClassification (en)test set self-reported68.794
- accuracy on MTEB AmazonPolarityClassificationtest set self-reported88.544
- ap on MTEB AmazonPolarityClassificationtest set self-reported84.613
- f1 on MTEB AmazonPolarityClassificationtest set self-reported88.519
- accuracy on MTEB AmazonReviewsClassification (en)test set self-reported45.264
- f1 on MTEB AmazonReviewsClassification (en)test set self-reported43.779
- map_at_1 on MTEB ArguAnatest set self-reported21.693
- map_at_10 on MTEB ArguAnatest set self-reported35.487