When and how do you fine-tune an embedding model?
hardAnswer
- Fine-tune when off-the-shelf embeddings underperform on your domain (specialized jargon, product names, code, non-English).
- Method: (1) collect (query, positive-doc) pairs from usage logs; (2) contrastive training (info-NCE loss) with in-batch negatives or hard negatives mined from a base retriever; (3) start from a strong base (E5, BGE, Nomic) — a few thousand pairs is often enough for LoRA-style fine-tuning.
- Gains: 5-20% recall@10 over base.
- Watch out for retraining bias — always eval on a held-out real-query set.
Check yourself — multiple choice
- Never fine-tune
- Contrastive fine-tune with (query, positive) pairs + hard negatives; base = strong pretrained encoder; 5-20% recall gain
- Same as LLM fine-tuning
- Only for images
Embedding fine-tune: contrastive on (query, positive) pairs + hard negatives → domain adaptation.
#embeddings#fine-tuning
Practise LLMs & GenAI
214 interview questions in this topic.
Related questions
- What are 'hard negatives' in embedding training?
- What are text embeddings and how are they used?
- Fine-tuning vs RAG — which do you use when?
- What is LoRA and why is it popular for fine-tuning LLMs?
- What is continual pretraining and when does it beat fine-tuning?
- What is supervised fine-tuning (SFT) and where does it fit in the alignment pipeline?