AI GLOSSARY · AI CONCEPTS

Cross-encoder

Markdown version

Definition

A cross-encoder is a model that reads a query and a candidate text together as one input and outputs a single relevance score for the pair. It is usually run on a short list to reorder it.

Also called: cross encoder, cross-encoders, cross encoder reranker, CrossEncoder.

In plain language

Suppose you ask a librarian for books about growing tomatoes in cold climates. A fast helper pulls forty books by skimming titles. A cross-encoder is the careful reader who then takes your question and each book's description side by side and decides how well each one fits. Reading the question and the text together catches details a quick skim misses. The cost is time: the careful reader has to look at every pair afresh, so it is not practical for searching millions of items directly. It is used on the short list. It can still misjudge a pair, and it ranks what the first step found, not what was missed.

Technical definition

A cross-encoder scores a pair of inputs, such as a query and a candidate passage. The Sentence Transformers documentation says it "Calculates a similarity score given pairs of inputs", and that it is often slower than a bi-encoder because it computes per pair instead of per text. The usual pattern is retrieve and re-rank: a bi-encoder or keyword search fetches the top candidates, then the cross-encoder scores each (query, hit) pair. Nogueira and Cho (arXiv 1901.04085) adapted BERT for passage re-ranking in this way.

Worked examples in this catalogue

Catalogue examples point at a skill, guide or coding tool listed on this site, with what to run and what you see. An example marked illustrative describes the item from its own documentation; it was not executed for this page. Platform Scores are our assessment under a published method, not a safety guarantee.

  1. Guide · Illustrative, not executed

    What Is RAG? Retrieval-Augmented Generation Explained

    What you see
    The guide describes indexing documents and querying them, and advises logging the top retrieved chunks for each failing question to check whether the right passage reached the prompt.
    Why it exercises the concept
    A cross-encoder sits between retrieval and the prompt. The guide's habit of inspecting the retrieved list shows you where such a re-ranking step would act.
  2. Skill by Skill Almanac · Illustrative, not executed

    rag-chunking-planner 56/100 · Provisional, not yet measuredScored · Method v0.2 · How we score

    What you see
    Your documents chunked by three strategies, with defects and offline recall reported for each, so chunk settings are chosen with numbers.
    Why it exercises the concept
    A re-ranker can reorder only what the first search returns. Measuring recall of that first step tells you whether re-ranking is the right fix.
  3. Skill by Skill Almanac · Illustrative, not executed

    library-docs-lookup 52/100 · Provisional, not yet measuredScored · Method v0.2 · How we score

    What you see
    An answer to a library question drawn from the installed package's own files, with file and line cited.
    Why it exercises the concept
    It is retrieval for a coding agent. It shows a setting where a candidate list is produced first and could then be ordered by a finer relevance score.

How it shows up when you use agents

You may not call a cross-encoder yourself in Claude Code, Codex or Cursor. It appears inside retrieval pipelines that an agent or an MCP server relies on: a search step returns candidates, and a cross-encoder reorders them before the best few are placed in the prompt. The step is called reranking. In a retrieval-augmented generation system, it is one way to improve what reaches the model's context window.

What breaks when it is misunderstood: people try to use a cross-encoder as the first search over a whole collection. The Sentence Transformers documentation notes that cross-encoders do not scale well to large datasets, so they are used on a short list. Another failure is expecting it to find missing documents. It reorders what the first step returned, so if the right passage was never retrieved, the re-ranker cannot recover it.

A next action: log the top retrieved passages for a failing question. If the right passage is in the list but low, re-ranking can help. If it is absent, fix chunking or the first search. Re-ranking also adds a model call per candidate, so check the latency and cost it adds, and remember it needs pairs of query and text rather than single texts.

Common confusions

  • Cross-encoder versus bi-encoder. A bi-encoder embeds each text separately, so embeddings can be stored and compared quickly. A cross-encoder reads the pair together and produces a score, not an embedding.
  • Cross-encoder versus reranking. Reranking is the job. A cross-encoder is one kind of model that does it.
  • Myth. A cross-encoder replaces the vector search. In the pattern the documentation describes, a bi-encoder retrieves first and the cross-encoder re-ranks the hits.
  • Cross-encoder versus embedding model. The cross-encoder scores relevance for one pair. You cannot compare its output with other texts later, because there is no stored vector.

Terms that mention Cross-encoder

1 terms mention this one

More in AI concepts

Next steps

  1. What Is RAG? Retrieval-Augmented Generation Explained The long-form guide.
  2. rag-chunking-planner A skill that exercises it.
  3. Embedding Related term.
  4. Retrieval-augmented generation (RAG) Related term.
  5. All glossary terms A to Z and by family.

Sources

Definitions are written by Skill Almanac from these sources and were checked against them on 2026-11-24. Wikipedia is never the only source.

Review record

Last verified

Drafted by claude-sonnet-5-5; sources and example targets checked by claude-haiku-5-5 source check; claude-sonnet-5-5 editor pass on 2026-11-24. Last verified .

This entry is still in review, so it is not listed in search engines yet.

Change log (2)
  • : First version.
  • : Verifier pass: quoted the Sentence Transformers wording, cut the unsourced architecture description, removed comparison alias and query.