Project 06
CLIP retrieval is usually shipped straight off the shelf. This project fine-tunes it first, and measures whether that fine-tuning actually did anything, on a genuinely held-out slice of a 44,412-image fashion catalog rather than the training distribution.
The vision encoder gets vision-only LoRA fine-tuning on the catalog's own product titles, 2 epochs, rank 16. Evaluated on a true id-level holdout, 10% of images never seen during training, scored against attribute-combo queries ("red tshirts") deliberately phrased differently from any training caption, it lifts Recall@10 from 14.0% to 17.2% and MRR from 0.704 to 0.745: a +23.0% relative Recall@10 uplift. The absolute number is modest, no hard-negative mining, a genuinely hard 44K-item target, but the relative uplift on a real holdout is what demonstrates the fine-tuning generalizes rather than memorizes.
The ANN benchmark asks a different question entirely: does the approximate index find what exact search would have found, not whether the embeddings are good. Flat, IVFFlat, and HNSW were compared on the same 44,412-vector corpus and 50 real text queries. HNSW's efSearch was tuned by measuring the recall/latency curve first, landing on 64: 14.1x faster than exact search (0.15ms vs. 2.11ms p50) at 93.6% of its recall, the honest operating point rather than an untuned default that would have made HNSW look strictly worse than IVFFlat.
Serving loads one CLIP model (LoRA-merged if a checkpoint exists), and the deployed container needed a second, less obvious fix to fit a 512MB free-tier host: casting the fp32 checkpoint to fp16 at load time doesn't free the fp32 bytes already allocated. Merging the LoRA weights and saving a native fp16 checkpoint fixed the real remaining OOM, verified by profiling the actual running container rather than guessing.
A known limitation, reported rather than hidden: CLIP-family models struggle with fine-grained compositional distinctions, a "red dress" query here also surfaces red nightdresses and camisoles, genuinely close in color and silhouette but not the specific category asked for, matching the general WINOGROUND finding that these models often match individual concepts without reliably composing them.
What I Learned
Tech Stack