Md. Asif Uddin

Proposition 5III.6.P0570 of 76 in the corpus

Retrieval learns a geometry, so the categories need not exist yet.

A classifier commits to a fixed label set at training time. An embedding commits only to a notion of similarity, and a new category costs one more indexed vector.

Retrieval is a metric, not a label setAn embedding space with three clusters. A query lands in it and the answer is its nearest neighbours. Nothing about the procedure requires the classes to have existed when the model was trained.embedding spacequeryThe output is an ordering,not a class. Add a newcategory tomorrow andnothing needs retraining —you index one more vector.Which is why the evaluation is recall@k and mAP rather than accuracy, and why the embedding's geometry —not its accuracy on any fixed label set — is the thing that has to be good.
Fig. 5 — Retrieval returns an ordering, not a class, so a category that did not exist at training time costs one more indexed vector.

Demonstration

A classifier’s final layer has one row per class. Adding a class means changing the architecture and retraining. That is fine for ten fixed categories and useless for a system that must handle people, products or species that did not exist when it was trained.

Retrieval avoids the commitment. Train an encoder so that similar images land close together, then answer queries by nearest neighbour. The output is an ordering, not a label, and the evaluation follows: recall@k, mean average precision, not accuracy.

FaceNet is the clean statement. Rather than classify identities, learn an embedding where distance encodes identity, trained with a triplet loss — anchor, positive, negative — with the requirement that the anchor be closer to the positive by a margin. Recognition becomes a threshold on a distance, and clustering and verification come free from the same vectors.

Two practical consequences.

Mining is most of the difficulty. Random triplets are almost all satisfied the moment training begins, and contribute no gradient. Which negatives you choose — hardest in the batch, semi-hard, or something in between — matters more than the margin, and choosing the hardest often destabilises training.

Zero-shot classification is retrieval in disguise. CLIP embeds an image and a set of text prompts into one space and takes the nearest. There is no classifier head anywhere; the label set is whatever you typed, and that is why it can be changed at inference.

Corollary

If the categories in a deployment will change — and in most real systems they will — an embedding is the architecture that survives it. The cost is that quality is now a property of the geometry, which is harder to state in one number than accuracy is.

Sources