Why do E5 and BGE prepend 'query:' / 'passage:' to inputs, and what breaks without them?
Models like multilingual-e5-large and BGE require an instruction prefix on inputs: 'query: ...' for the search side and 'passage: ...' for the document side. Explain the purpose of this asymmetry and what symptom appears if a user forgets one side.
Prefixes are training-contract tokens that route queries and passages into matched sub-regions of the embedding space; forgetting them silently drops recall by 5 to 15 percent with no error.
Think of two factories producing parts that must fit together. The prefix is a stamp telling each factory which kind of part it is making: 'this is the bolt side' vs 'this is the nut side.' Both stamps were used in training so the threads line up. Skip the stamp on the bolts and the factory still makes something cylindrical, but the threads do not match the nuts. Nothing breaks visibly, the parts just do not screw together as well, your recall drops.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
The 'why prefixes exist and what breaks without them' question maps onto one of the most common silent bugs in 2026 production RAG. Teams onboard a new embedding model from a Hugging Face card, copy a tutorial that omits the prefix, and absorb 5 to 15 percent of recall they never measure. The senior insight is that prefixes are not preprocessing; they are training contracts, and contracts leak.
This deep dive covers the architectural reason the asymmetry exists, how training enforces the contract, the three concrete failure patterns and their typical recall costs, how to detect the silent bug, and the 2026 model and API landscape that determines whether you handle prefixes yourself or trust the vendor to do it.
Mental model: the prefix is a routing token. It tells the encoder which sub-region of the embedding space the input belongs to. Get it right and the geometry aligns; get it wrong and the geometry is off by several degrees with no warning.
Why the asymmetry exists architecturally
The structural difference
Queries in retrieval systems are short, intent-bearing, often interrogative or imperative: 'what is mean pooling', 'find me legal documents about Section 230', '2024 election results'. They are typically 5 to 15 tokens.
Passages are long, declarative, content-bearing: paragraphs of explanation, sections of articles, chunks of legal text. Typically 50 to 500 tokens after chunking.
What a symmetric embedder has to do
A single encoder mapping both shapes into one uniform space has to reconcile the length and tone difference internally. Some of its representational capacity is spent on 'this is a short interrogative' vs 'this is a long declarative' distinctions that are not directly semantic, but the contrastive loss still has to fight through that to align matched pairs.
What asymmetric prefixes buy
Giving the encoder a routing signal ('query: ' vs 'passage: ') lets it project the two sides into matched but distinct sub-regions of the embedding space. The contrastive loss aligns matched pairs across the sub-regions. The capacity that was spent on shape reconciliation is now spent on semantic alignment within and across the sub-regions.
The empirical payoff
Asymmetric models like multilingual-e5-large typically outperform same-size symmetric models by 5 to 10 percent on retrieval benchmarks at equal parameter count. This is why every major open-weight encoder embedder family from 2022 onward uses the asymmetric prefix pattern.
Situations where this technique stops working.
2–4 min · Everything important, quickly.
Real products, models, and research that use this idea.
- multilingual-e5-large from Microsoft requires 'query: ' and 'passage: ' on every input and is widely deployed in 2026 RAG stacks.
- BGE-large-en-v1.5 from BAAI requires a task-specific instruction on the query side and bare passages on the document side.
What an interviewer would ask next. Try answering before peeking at the approach.
QHow would you migrate a production RAG pipeline from a no-prefix to a with-prefix embedding model without downtime?
Re-embed the corpus with the new model and its prefix into a new index. Maintain old and new indices in parallel. A/B test recall on real traffic. Cut over when the new index meets the recall bar. Do not mix old and new vectors in one index.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Adding the prefix at index time but forgetting it at query time. The query and passage embeddings live in misaligned sub-regions and recall drops 5 to 15 percent with no error.
60 second bullets to scan on the way to the call.
What an instruction prefix is and why it sits at the start of the input
Why prefixes are part of the training contract and not preprocessing
Primary sources. Browse if you want the original framing.
Same topic, related formats. Practice these next.