← Back to concept explainers

Concept Fable

Dual encoder

Conclusion first:Bi-Encoder encodes queries and documents separately, converting both into vectors and matching them by similarity. Because document vectors can be precomputed offline and stored in a vector database, it is well suited for large-scale semantic retrieval, first-stage recall in RAG, similar case search, and recommendation. Its weakness is that queries and documents have no joint interaction, and fine-grained conditional matching is usually inferior to Cross-Encoder, so enterprise systems commonly use Bi-Encoder for recall, then Cross-Encoder or a reranker for fine ranking.

Bi-Encoder · Retrieval

Read the story first. There is no rush to give a definition here; let the question grow on its own first.

Fable

The two warehouses first each did their own numbering

Archives originally relied on people to find materials. After a reader asked a question, the administrator flipped through books row by row, slipping a paper note between pages when similar content was found. This worked when there were few books, but as materials grew, the queue stretched out the door. The director had each book write a summary first. Readers' questions were also summarized, and then the summaries were compared for similarity. Speed improved a little, but summaries varied in length, making comparison still laborious. Someone suggested having the senior master carefully examine each question alongside every book every time. The results were accurate, but no one could afford to wait. The warehouse held a million pages, and the master could only review a few hundred pages a day. A young administrator tried a different approach. He had all the books measured once at night, each converted into a fixed-length number; when a reader's question arrived, it too was measured into a number. Books with similar numbers were retrieved first.

At first everyone worried: if the questions and the books are not examined closely together, how do we know they are truly relevant? The administrator said this step is only responsible for shrinking the ocean into a pond, not for making the final judgment.

An after-sales helper needed to check 'license invalid after motherboard replacement.' The number-based apparatus quickly pulled dozens of similar cases from tens of millions of knowledge items, some describing authorization rebinding and some describing hardware fingerprint changes.

Then the curator had the examiners look closely at those few dozen entries. Fast recall first, then precise judgment—the whole pipeline could finally cover the large library without stuffing the mechanism's context full.

Later, the archive stored book numbers in the index in advance and prepared different measuring rulers for different business lines. The general ruler could find the approximate location, and the domain ruler could find the details.

Everyone understood: the first step is not to review every piece of material to perfection, but to use a precomputable representation to compress the candidate range to a size the whole system can bear.

This method also makes mistakes. Similar numbers do not necessarily mean related; some books with different wording are pulled closer, and some old volumes with similar meaning are missed. So the head librarian never let the number system make the final decision alone.

The real benefit appeared on peak days. While readers queued, librarians first used numbers to compress a million pages into a small stack, then asked the examiners to read closely. Speed came from the numbers prepared in advance; reliability came from the fact that someone still looked carefully afterward.

Reveal

This story is about: dual encoders

Bi-Encoder encodes queries and documents separately, converting both into vectors and matching them by similarity. Because document vectors can be precomputed offline and stored in a vector database, it is well suited for large-scale semantic retrieval, first-stage recall in RAG, similar case search, and recommendation. Its weakness is that queries and documents have no joint interaction, and fine-grained conditional matching is usually inferior to Cross-Encoder, so enterprise systems commonly use Bi-Encoder for recall, then Cross-Encoder or a reranker for fine ranking.

What matters is that it is not just a term, but a structural problem that repeatedly appears in real AI / Agent systems. Understanding it lets you judge when to add a model, when to change a process, and when to add governance.

Metaphor mapping

  • Numbering books at night: offline computation of document embeddings
  • Reader questions are also numbered: online query embedding computation
  • Find similar numbers first: vector similarity retrieval
  • The ocean shrinks to a pond: Stage one, high-efficiency recall
  • The master craftsman examines it closely at the same table: cross-encoder fine ranking
  • After-sales Agent case: finding similar issues by semantics in an enterprise knowledge base
  • Different measuring rulers: different embedding models or domain fine-tuned models

Andy Ren Xu's judgment

The practical value of this concept is that it helps you break "AI features that look smart" into deliverable, verifiable, and governable units of work.

embeddingsdense retrieval

Related distinctions

This concept is easily confused with adjacent concepts; it is recommended to continue to the comparison page.

京ICP备2026014272号