RAG & Retrieval·Question 19 of 100Intermediate

When would you fine-tune your embedding model, and how would you actually do it?

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

Fine-tune when off-the-shelf embeddings misunderstand your domain's notion of relevance and you've already exhausted cheaper fixes (hybrid search, reranking, contextual retrieval, better chunking). Classic triggers: domain jargon where surface-similar terms mean different things (clinical, legal, hardware part taxonomies), asymmetric or unusual query→doc mappings (symptom description → runbook; error log → code file), and abundant behavioural signal - search logs with clicks - that generic models can't exploit. It's often the highest-ROI retrieval upgrade if you have data; without data it's a trap.

Full worked answer

Fine-tune when off-the-shelf embeddings misunderstand your domain's notion of relevance and you've already exhausted cheaper fixes (hybrid search, reranking, contextual retrieval, better chunking). Classic triggers: domain jargon where surface-similar terms mean different things (clinical, legal, hardware part taxonomies), asymmetric or unusual query→doc mappings (symptom description → runbook; error log → code file), and abundant behavioural signal - search logs with clicks - that generic models can't exploit. It's often the highest-ROI retrieval upgrade if you have data; without data it's a trap.

Mechanics: start from a strong open-weight embedder (BGE/GTE/E5 family or similar) and train contrastively on (query, positive, negatives) triples with an InfoNCE-style loss, typically using in-batch negatives plus mined hard negatives - the make-or-break detail. Easy negatives (random chunks) teach nothing; hard negatives (top BM25/dense hits that are not relevant) force the model to learn your domain's fine distinctions. Tooling like sentence-transformers makes the training loop a few dozen lines; LoRA keeps it cheap on a single GPU.

Where the pairs come from, in order of quality: production click/answer logs (query → chunk the user engaged with); human-labelled golden sets; and synthetic generation - have an LLM write realistic queries for sampled chunks, which works surprisingly well for bootstrapping and is standard practice now.

Operational costs people forget, and interviewers probe: fine-tuning couples your index to your model - every model update means re-embedding the entire corpus; you now own evaluation, regression testing, and serving of the embedder; and you risk regressions on out-of-domain queries, so keep a general-retrieval eval alongside the domain one. A frequent lighter alternative: fine-tune only the reranker (cross-encoder) on the same triples - no re-embedding, no index migration, most of the gain - or train a linear adapter over a frozen API embedding.

What a good answer covers

  • Fine-tune when off-the-shelf embeddings misunderstand your domain's notion of relevance and you've…
  • Classic triggers: domain jargon where surface-similar terms mean different things (clinical, legal,…
  • It's often the highest-ROI retrieval upgrade if you have data; without data it's a trap
  • Mechanics: start from a strong open-weight embedder (BGE/GTE/E5 family or similar) and train…
  • Easy negatives (random chunks) teach nothing; hard negatives (top BM25/dense hits that are not relevant)…

Key terms: domain jargon · asymmetric or unusual query→doc mappings · behavioural signal · (query, positive, negatives) · hard negatives · synthetic generation · re-embedding the entire corpus · reranker

Interviewer follow-ups to expect

  1. Why are hard negatives essential - what happens with only random negatives?

  2. Fine-tuned embedder vs fine-tuned reranker: how do you choose?

  3. How do you roll out a new embedding model against a 50M-chunk live index with zero downtime?

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep