MemotivaLLM Engineer Interview Questions: RAG Pipeline Design, Chunking Strategies, Hybrid Retrieval

What is the difference between a bi-encoder and a cross-encoder?

Nortren·

What is the difference between a bi-encoder and a cross-encoder?

0:19

A bi-encoder embeds the query and each document independently, then compares with cosine similarity. This is fast because document embeddings can be precomputed. A cross-encoder takes the query and document together as input and outputs a relevance score directly. Cross-encoders are more accurate but cannot precompute, making them suitable for reranking small candidate sets.
sbert.net