Describe what the 'query:' and 'passage:' prefixes do for models like E5 and BGE
The prefixes are part of the training contract, they tell the encoder to project queries and passages into matched but distinct sub-regions of the embedding space; forgetting them silently drops recall.
Imagine a sommelier who studied under two strict instructors. One taught them how to taste short, sharp questions like a customer at the bar. The other taught them how to taste long, descriptive passages like a wine label. The sommelier was always told before each tasting which mode to switch into. Now picture you walk up and hand them a sip without saying which mode. They guess, and they often guess wrong, and the pairings they recommend at the end of the night no longer line up. The little phrase like query colon or passage colon is that whispered hint. Skip it and the recommendations quietly fall apart, with no error message, no warning, only worse matches.
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.
5 to 7 min: training-contract framing + query-passage asymmetry + silent-recall failure mode + detection via recall benchmark + 2026 model landscape.
Real products, models, and research that use this idea.
- multilingual-e5-large from Microsoft requires 'query: ' and 'passage: ' prefixes for asymmetric retrieval.
- BGE-large-en-v1.5 from BAAI requires task-specific instructions like 'Represent this sentence for searching relevant passages: ' on the query side.
- BGE-M3 supports multiple retrieval modes (dense, sparse, multi-vector) and each has its own prefix convention.
- e5-mistral-7b-instruct uses task-specific instructions like 'Instruct: Given a question, retrieve relevant passages. Query: ...'.
- OpenAI text-embedding-3-large and Voyage v3-large abstract any prefix behind the API, you do not configure it yourself.
What an interviewer would ask next. Try answering before peeking at the approach.
QHow do you verify the right prefix to use for a given model?
QWhat is the geometric intuition behind why misapplied prefixes drop recall by 5 to 15 percent?
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.
Treating the prefix as optional preprocessing. It is part of the training contract, omitting it produces silent recall degradation 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.