You need one embedding space for your own domain: product photos, spec sheets as PDFs, and text queries. Off-the-shelf CLIP is not good enough. How do you build 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
First, prove the encoder is the problem. Build a labelled eval before touching training: real queries with relevance judgements, reported as Recall@k and nDCG. Very often the failure is data, not the model - bad crops, watermarked images, the wrong canonical photo per SKU. Fixing the catalogue is cheaper than fine-tuning.
Full worked answer
First, prove the encoder is the problem. Build a labelled eval before touching training: real queries with relevance judgements, reported as Recall@k and nDCG. Very often the failure is data, not the model - bad crops, watermarked images, the wrong canonical photo per SKU. Fixing the catalogue is cheaper than fine-tuning.
If you do need to train:
Start from a strong pretrained dual encoder (SigLIP-class). You do not have hundreds of millions of pairs and you are not training from scratch.
Mine pairs from your own logs. Query to clicked-or-purchased item is the highest-value signal you own: free, and matched to your actual query distribution. Title and description to image is the fallback.
Hard negatives are the whole game. In-batch random negatives become trivial after the first epoch, because a random other product is obviously wrong and the loss goes to zero while the model has learned nothing useful. Mine negatives with the current model: same category, different item; items shown and not clicked. That is what teaches "red running shoe, mesh upper" apart from "red running shoe, leather upper". Guard against false negatives - unclicked does not mean irrelevant, so cap negative hardness or apply a similarity ceiling.
Mechanics: InfoNCE with a learned temperature, and a large effective batch via gradient caching or cross-device negatives if you stay on softmax; sigmoid loss if you want to avoid the all-gather entirely. Freeze early encoder layers, use a low LR (~1e-5 scale), short schedules. Overfitting here destroys general features fast.
Mixing modalities in one space is the subtle part. For spec-sheet PDFs, decide per page whether it goes through the vision tower as a render or through text. Do not mix carelessly: the modality gap means a text query will preferentially retrieve text items over image items from a shared index. Either train explicitly with mixed-modality positives, or score per modality and fuse the lists.
Dimensionality: train Matryoshka-style so you can truncate for a cheap first-stage ANN and rescore at full width. Truncation typically costs a small amount of recall for a large storage saving.
Always rerank the top ~50-100 with a cross-encoder or VLM when precision matters. The dual encoder's job is recall.
Ship criteria: an offline Recall@k gate, then an online A/B. Offline gains frequently do not survive contact with real traffic.
What a good answer covers
- First, prove the encoder is the problem
- Build a labelled eval before touching training
- Very often the failure is data, not the model - bad crops, watermarked images, the wrong canonical photo…
- Fixing the catalogue is cheaper than fine-tuning
- Start from a strong pretrained dual encoder (SigLIP-class)
Key terms: Mechanics · Dimensionality · Always rerank
In the glossary: nDCG · InfoNCE · Modality gap · ANN · Cross-encoder · VLM
Interviewer follow-ups to expect
How would you detect and handle false negatives in click-mined data?
Your offline Recall@10 improves 8 points but the A/B is flat - what are the likely explanations?
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