[KongchangAI]
Concept双塔模型 / Bi-Encoder

Bi-Encoder

A retrieval architecture in which queries and documents are encoded independently into vectors. Document vectors can be precomputed and indexed, enabling efficient approximate nearest-neighbor search, but there is no interaction between query and document, which limits accuracy.

Core Facts

Timeline (last 90 days)

Oct 12

Cross-Encoder and Bi-Encoder are fundamentally different: Bi-Encoder encodes the query and document independently, is fast but has limited accuracy, and is suitable for first-stage recall; Cross-Encoder concatenates [query, document] as input to a Transformer, has higher accuracy but cannot be precomputed, and is suitable for reranking a small candidate set of Top-20 to Top-100. ms-marco-MiniLM-L-6-v2 has a 6-layer structure, takes about tens of milliseconds per inference, and is a cost-effective reranking choice in production environments.

Unverified60%
Oct 4

A Cross-Encoder concatenates the query and candidate code snippet before feeding them together as input, achieving higher scoring accuracy than a Bi-Encoder but at greater computational cost, so it is typically used only to re-rank the Top-K candidates recalled by ANN.

Unverified50%
Aug 31

The bi-encoder model can pre-compute document vectors offline and build an index for fast retrieval, but the two texts cannot see each other during the encoding stage, making it impossible to model fine-grained word-level interactions.

Unverified50%

All Facts (6)

Verified

Rerankers typically adopt a Cross-Encoder architecture, in contrast to the Bi-Encoder architecture used in vector retrieval.

80%
Verified

Reranking uses a Cross-Encoder model to re-score and re-rank the candidate chunks recalled by Top-K, with precision far higher than that of a Bi-Encoder.

75%
Verified

A Bi-Encoder encodes the question and document independently into vectors and then computes similarity, while a Cross-Encoder concatenates the question and candidate document and inputs them together into the model for full interaction via the attention mechanism.

65%
Unverified

Cross-Encoder and Bi-Encoder are fundamentally different: Bi-Encoder encodes the query and document independently, is fast but has limited accuracy, and is suitable for first-stage recall; Cross-Encoder concatenates [query, document] as input to a Transformer, has higher accuracy but cannot be precomputed, and is suitable for reranking a small candidate set of Top-20 to Top-100. ms-marco-MiniLM-L-6-v2 has a 6-layer structure, takes about tens of milliseconds per inference, and is a cost-effective reranking choice in production environments.

60%
Unverified

A Cross-Encoder concatenates the query and candidate code snippet before feeding them together as input, achieving higher scoring accuracy than a Bi-Encoder but at greater computational cost, so it is typically used only to re-rank the Top-K candidates recalled by ANN.

50%
Unverified

The bi-encoder model can pre-compute document vectors offline and build an index for fast retrieval, but the two texts cannot see each other during the encoding stage, making it impossible to model fine-grained word-level interactions.

50%

Source Articles