Views
No views yet


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

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-nano"
6 }
7}1from sentence_transformers import SentenceTransformer
2import torch
3
4model = SentenceTransformer(
5 "jinaai/jina-embeddings-v5-text-nano-classification",
6 trust_remote_code=True,
7 model_kwargs={"dtype": torch.bfloat16}, # Recommended for GPUs
8 config_kwargs={"_attn_implementation": "flash_attention_2"}, # Recommended but optional
9)
10# Optional: set truncate_dim in encode() to control embedding size
11
12texts = [
13 "My order hasn't arrived yet and it's been two weeks.",
14 "How do I reset my password?",
15 "I'd like a refund for my recent purchase.",
16 "Your product exceeded my expectations. Great job!",
17]
18
19# Encode texts
20embeddings = model.encode(texts)
21print(embeddings.shape)
22# (4, 768)
23
24similarity = model.similarity(embeddings, embeddings)
25print(similarity)
26# tensor([[1.0000, 0.7152, 0.8378, 0.8101],
27# [0.7152, 1.0000, 0.7512, 0.6940],
28# [0.8378, 0.7512, 1.0000, 0.7741],
29# [0.8101, 0.6940, 0.7741, 1.0000]])1from vllm import LLM
2from vllm.config.pooler import PoolerConfig
3
4# Initialize model
5name = "jinaai/jina-embeddings-v5-text-nano-classification"
6model = LLM(
7 model=name,
8 dtype="float16",
9 runner="pooling",
10 trust_remote_code=True,
11 pooler_config=PoolerConfig(seq_pooling_type="LAST", normalize=True)
12)
13
14# Create text prompts
15query = "Overview of climate change impacts on coastal cities"
16query_prompt = f"Query: {query}"
17
18document = "The impacts of climate change on coastal cities are significant.."
19document_prompt = f"Document: {document}"
20
21# Encode all prompts
22prompts = [query_prompt, document_prompt]
23outputs = model.encode(prompts, pooling_task="embed")
24
25embed_query = outputs[0].outputs.data
26embed_document = outputs[1].outputs.datajinaai/jina-embeddings-v5-text-nano, which is not yet supported by llama.cpp, we provide our own branch of llama.cpp, which implements the necessary changes to support it for now.llama-server \
-hf jinaai/jina-embeddings-v5-text-nano-classification:F16 \
--embedding \
--pooling last \
--batch-size 8192 \
--ubatch-size 8192 \
--ctx-size 8192curl -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."
]
}'Document: prefix in front of your input as shown above.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-nano-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-nano-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},
}