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.
Detailed answer & concept explanation~6 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
7 to 8 min: training contract framing + query-passage asymmetry + three failure patterns + recall@K detection recipe + 2026 vendor split + operational discipline.
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.
- Nomic Embed v1.5 uses 'search_query: ' and 'search_document: ' prefixes with documented task variants.
- OpenAI text-embedding-3-large abstracts any prefix behind the API; users do not configure it.
- Voyage v3-large and Cohere embed-v4 take an `input_type` parameter ('query' vs 'document') and apply the right behavior internally.
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?
QWhy is the failure invisible without a recall benchmark?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes 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.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.