Views
No views yet


jina-embeddings-v5-text-small-classification outperforms existing state-of-the-art models of similar size across diverse embedding benchmarks.| Feature | Value |
|---|---|
| Parameters | 677M |
| Supported Tasks | classification |
| Max Sequence Length | 32768 |
| Embedding Dimension | 1024 |
| Matryoshka Dimensions | 32, 64, 128, 256, 512, 768, 1024 |
| Pooling Strategy | Last-token pooling |
| Base Model | jinaai/jina-embeddings-v5-text-small |

transformers>=5.1.0torch>=2.8.0peft>=0.15.2vllm>=0.15.1sentence-transformers interface, install this package as well.1PUT _inference/text_embedding/jina-v5
2{
3 "service": "elastic",
4 "service_settings": {
5 "model_id": "jina-embeddings-v5-text-small"
6 }
7}1from sentence_transformers import SentenceTransformer
2import torch
3
4model = SentenceTransformer(
5 "jinaai/jina-embeddings-v5-text-small-classification",
6 model_kwargs={"dtype": torch.bfloat16}, # Recommended for GPUs
7 config_kwargs={"_attn_implementation": "flash_attention_2"}, # Recommended but optional
8)
9# Optional: set truncate_dim in encode() to control embedding size
10
11texts = [
12 "My order hasn't arrived yet and it's been two weeks.",
13 "How do I reset my password?",
14 "I'd like a refund for my recent purchase.",
15 "Your product exceeded my expectations. Great job!",
16]
17
18# Encode texts
19embeddings = model.encode(texts)
20print(embeddings.shape)
21# (4, 1024)
22
23similarity = model.similarity(embeddings, embeddings)
24print(similarity)
25# tensor([[1.0000, 0.7347, 0.7988, 0.7523],
26# [0.7347, 1.0000, 0.7440, 0.7228],
27# [0.7988, 0.7440, 1.0000, 0.7321],
28# [0.7523, 0.7228, 0.7321, 1.0000]])1from vllm import LLM
2from vllm.config.pooler import PoolerConfig
3
4# Initialize model
5name = "jinaai/jina-embeddings-v5-text-small-classification"
6model = LLM(
7 model=name,
8 dtype="float16",
9 runner="pooling",
10 pooler_config=PoolerConfig(seq_pooling_type="LAST", normalize=True)
11)
12
13# Create text prompts
14document1 = "Overview of climate change impacts on coastal cities"
15document1_prompt = f"Document: {document1}"
16
17document2 = "The impacts of climate change on large cities"
18document2_prompt = f"Document: {document2}"
19
20# Encode all prompts
21prompts = [document1_prompt, document2_prompt]
22outputs = model.encode(prompts, pooling_task="embed")
23
24embed_document1 = outputs[0].outputs.data
25embed_document2 = outputs[1].outputs.data1docker run -p 8080:80 \
2 ghcr.io/huggingface/text-embeddings-inference:cpu-1.9 \
3 --model-id jinaai/jina-embeddings-v5-text-small-classification \
4 --dtype float32 --pooling last-token1docker run --gpus all --shm-size 1g -p 8080:80 \
2 ghcr.io/huggingface/text-embeddings-inference:cuda-1.9 \
3 --model-id jinaai/jina-embeddings-v5-text-small-classification \
4 --dtype float16 --pooling last-tokenAlternatively, you can also run withcargo, more information can be found in the Text Embeddings Inference documentation.
/v1/embeddings to generate embeddings via the OpenAI Embeddings API:1curl -X POST http://127.0.0.1:8080/v1/embeddings \
2 -H "Content-Type: application/json" \
3 -d '{
4 "model": "jinaai/jina-embeddings-v5-text-small-classification",
5 "input": [
6 "Document: The impacts of climate change on coastal cities are significant...",
7 ]
8 }'1curl -X POST http://127.0.0.1:8080/embed \
2 -H "Content-Type: application/json" \
3 -d '{
4 "inputs": "Overview of climate change impacts on coastal cities",
5 "prompt_name": "document",
6 }'llama-server -hf jinaai/jina-embeddings-v5-text-small-classification:F16 --embedding --pooling last -ub 32768curl -X POST "http://127.0.0.1:8080/v1/embeddings" \
-H "Content-Type: application/json" \
-d '{
"input": [
"Document: A beautiful sunset over the beach",
"Document: Un beau coucher de soleil sur la plage",
"Document: 海滩上美丽的日落",
"Document: 浜辺に沈む美しい夕日",
"Document: Golden sunlight melts into the horizon, painting waves in warm amber and rose, while the sky whispers goodnight to the quiet, endless sea."
]
}'optimum library. Make sure you have the required dependencies installed (e.g., pip install optimum[onnxruntime] transformers torch):1from optimum.onnxruntime import ORTModelForFeatureExtraction
2from transformers import AutoTokenizer
3import torch
4
5model_id = "jinaai/jina-embeddings-v5-text-small-classification"
6
7# 1. Load tokenizer and ONNX model
8# We specify the subfolder 'onnx' where the weights are located
9tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
10model = ORTModelForFeatureExtraction.from_pretrained(
11 model_id,
12 subfolder="onnx",
13 file_name="model.onnx",
14 provider="CPUExecutionProvider", # Or "CUDAExecutionProvider" for GPU
15 trust_remote_code=True,
16)
17
18# 2. Prepare input
19texts = ["Document: How do I use Jina ONNX models?", "Document: Information about semantic matching."]
20inputs = tokenizer(texts, padding=True, truncation=True, return_tensors="pt")
21
22
23# 4. Inference
24with torch.no_grad():
25 outputs = model(**inputs)
26
27# 5. Pooling (Crucial for Jina-v5)
28# Jina-v5 uses LAST-TOKEN pooling.
29# We take the hidden state of the last non-padding token.
30last_hidden_state = outputs.last_hidden_state
31# Find the indices of the last token (usually the end of the sequence)
32sequence_lengths = inputs.attention_mask.sum(dim=1) - 1
33embeddings = last_hidden_state[torch.arange(last_hidden_state.size(0)), sequence_lengths]
34
35print('embeddings shape:', embeddings.shape)
36print('embeddings:', embeddings)jina-embeddings-v5-text-small-classification useful in your research, please cite the following paper:@misc{akram2026jinaembeddingsv5texttasktargetedembeddingdistillation,
title={jina-embeddings-v5-text: Task-Targeted Embedding Distillation},
author={Mohammad Kalim Akram and Saba Sturua and Nastia Havriushenko and Quentin Herreros and Michael Günther and Maximilian Werk and Han Xiao},
year={2026},
eprint={2602.15547},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2602.15547},
}