Text embedding model (small) for input of size up to 8192 tokens

embedding

1,650 6 months ago

Readme

The text embedding set trained by Jina AI.

Quick Start

The easiest way to starting using jina-embeddings-v2-small-en is to use Jina AI’s Embedding API.

Intended Usage & Model Info

jina-embeddings-v2-small-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-small-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.

This model has 33 million parameters, which enables lightning-fast and memory efficient inference, while still delivering impressive performance.

In ollama hub we provide the following set of models:

Ollama Usage

This model is an embedding model, meaning it can only be used to generate embeddings.

You can get it by doing ollama pull jina/jina-embeddings-v2-small-en

REST API

curl http://localhost:11434/api/embeddings -d '{
  "model": "jina/jina-embeddings-v2-snall-en",
  "prompt": "The sky is blue because of Rayleigh scattering"
}'

Python API

ollama.embeddings(model='jina/jina-embeddings-v2-small-en', prompt='The sky is blue because of rayleigh scattering')

Javascript API

ollama.embeddings({ model: 'jina/jina-embeddings-v2-small-en', prompt: 'The sky is blue because of rayleigh scattering' })

Use Jina Embeddings for RAG

According to the latest blog post from LLamaIndex,

In summary, to achieve the peak performance in both hit rate and MRR, the combination of OpenAI or JinaAI-Base embeddings with the CohereRerank/bge-reranker-large reranker stands out.

References

Technical Report

Jina Embeddings homepage