Skip to content

feat: add Jina Embeddings v5 text-nano and text-small as alternative models#245

Open
hanxiao wants to merge 2 commits intotobi:mainfrom
hanxiao:feat/jina-v5-embedding-models
Open

feat: add Jina Embeddings v5 text-nano and text-small as alternative models#245
hanxiao wants to merge 2 commits intotobi:mainfrom
hanxiao:feat/jina-v5-embedding-models

Conversation

@hanxiao
Copy link

@hanxiao hanxiao commented Feb 22, 2026

Summary

Add Jina Embeddings v5 as alternative embedding models, configurable via LlamaCppConfig.embedModel.

Two models available as GGUF from HuggingFace:

MMTEB Multilingual Benchmark

MMTEB scores vs model size. jina-v5-text models outperform models 2-16x their size. (source)

MTEB English Benchmark

MTEB English v2 scores. v5-text-nano (239M) achieves 71.0, matching models with 2x+ parameters. (source)

Both v5 models use a different task prefix format (Query: / Document: ) compared to embeddinggemma's nomic-style format. The format functions auto-detect Jina v5 URIs and apply the correct prefix.

Changes

  • src/llm.ts: Add JINA_V5_NANO_EMBED_MODEL and JINA_V5_SMALL_EMBED_MODEL constants, isJinaV5Model() utility, model-aware formatQueryForEmbedding() / formatDocForEmbedding()
  • src/qmd.ts: Pass embedModelUri to format functions at all embed call sites
  • src/store.ts: Pass embedModelUri to format functions at all embed/query call sites
  • README.md: Document alternative models, add v5 prompt format section
  • CHANGELOG.md: Add entry under [Unreleased]

Usage

import { LlamaCpp, JINA_V5_SMALL_EMBED_MODEL } from "./llm.js";

const llm = new LlamaCpp({ embedModel: JINA_V5_SMALL_EMBED_MODEL });

Not changed

Default model remains embeddinggemma-300M. This is additive only.

Paper: arXiv:2602.15547 | Blog | MTEB Leaderboard

Add jina-embeddings-v5-text-nano (239M, 768d, 8K ctx) and
jina-embeddings-v5-text-small (677M, 1024d, 32K ctx) as configurable
alternatives to the default embeddinggemma-300M.

Format functions now auto-detect Jina v5 models and apply the correct
Query:/Document: prefix format instead of the nomic-style task/title
format used by embeddinggemma.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant