Skip to content

Reranker is ~98% of search latency: jina-reranker-v3 is architecturally incompatible, and a 7-12x smaller cross-encoder is available #68

Description

@citron07r

Reranking is essentially all of Vera's search cost: roughly 6.4 s of a 6.5 s search on a
4790-chunk index, against 39 ms for embedding and 16 ms for BM25. Under CoreML it is CPU-only by
design (reranker_execution_provider), so that cost is structural rather than a misconfiguration.

This is a survey of whether the current default can be improved. All model facts below come from
each repo's config.json and file list via the Hugging Face API, not from model cards or
third-party summaries.

Current default: jinaai/jina-reranker-v2-base-multilingual, onnx/model_quantized.onnx,
279,577,152 bytes (~280 MB), XLMRobertaForSequenceClassification, num_labels: 1.

jina-reranker-v3 / v3.5 are not an upgrade path

Worth recording so nobody spends time on it. The blocker is architecture, not packaging.

jina-reranker-v3 reports architectures: ["JinaForRanking"], model_type: "qwen3", built on
Qwen3-0.6B with a custom modeling.py. Its card describes a "last but not late interaction"
listwise design: the query and up to 64 documents share one context window, and per-document
embeddings are taken from each document's last token through an MLP projector (1024 → 512 → 256).
The public API is model.rerank(query, documents) over the whole candidate set.

Vera's call site is a per-pair cross-encoder: (query, doc) in, one logit out. Adopting v3 would
mean reimplementing the projector head and restructuring the calling convention from a per-pair
loop to a batch-of-candidates-in-one-context call. Neither official repo ships ONNX at all, and the
two unofficial exports have 11 and 19 downloads, one of them self-flagged NG by its author.

bge-reranker-v2-m3 is a regression on the axis that matters

Architecture-compatible — XLMRobertaForSequenceClassification with a single-logit head, same shape
as the current model — but:

  • onnx/model_quantized.onnx is 570,727,094 bytes (~570 MB) against the current ~280 MB, so
    roughly 2x larger on the component that is already 98% of search latency.
  • It is not a clean quality win either. The BEIR table published in jina-reranker-v3's own README
    puts bge-reranker-v2-m3 at 56.51 against jina-reranker-v2's 57.06, though it leads on
    MIRACL (69.32 vs 63.65).

Slower, and behind on the general retrieval benchmark. Not recommended.

The available win is a smaller cross-encoder

reranker quantized ONNX vs current official ONNX languages
jina-reranker-v2-base-multilingual (current) 280 MB baseline yes multilingual
onnx-community/bge-reranker-v2-m3-ONNX 570 MB 2.0x larger community multilingual
jinaai/jina-reranker-v1-turbo-en 38 MB 7.3x smaller yes English
jinaai/jina-reranker-v1-tiny-en 33 MB 8.4x smaller yes English
cross-encoder/ms-marco-MiniLM-L6-v2 23 MB 12x smaller yes English

All three small candidates are ordinary cross-encoders with single-logit heads, so they fit the
existing interface without code changes beyond the constants in local_models/mod.rs.
ms-marco-MiniLM-L6-v2 ships official ONNX in its own repo and has 89M downloads;
jina-reranker-v1-turbo-en is the conservative option if staying in the Jina family matters.

What is not established

  • The latency figures are extrapolated from file size, not measured. Size tracks FLOPs
    reasonably for same-family quantized BERT-style encoders, but that is an assumption, not a
    benchmark. A real before/after on an indexed repo is the thing that should decide this.
  • The English-only tradeoff is untested. Plausibly fine for code, where identifiers and
    comments skew ASCII/English, but nobody has checked it against a realistic query mix, and the
    current model is multilingual.

Suggested outcome

Keep jina-reranker-v2-base-multilingual as the quality default — nothing surveyed beats it without
a regression elsewhere. Prototype ms-marco-MiniLM-L6-v2 or jina-reranker-v1-turbo-en behind the
existing VERA_LOCAL_* override mechanism and measure, since a 7-12x smaller reranker on a
component that is 98% of search latency is the single largest speed lever available.

Happy to do the prototype and post before/after numbers if that is wanted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions