01 — Explore

Notebooks eliminate hypotheses before the architecture is fixed.

I compared CLIP ViT-B/32 and FashionCLIP, explored visual groups with K-means and principal component analysis (PCA), generated product descriptions, trained an image–text projection and tested several specialization and segmentation paths.

This phase identified the useful components for the target use case: generic CLIP was sufficient for raw visual similarity, image–text alignment was worth retaining, and several more complex components could remain in the toolbox without entering the first service.

02 — Build

A reproducible chain replaces a stack of experiments.

The pipeline loads images in batches, computes 512-dimensional vectors, applies L2 normalization and stores them in ClickHouse. A namespace isolates each catalogue. Two search strategies — database and in-memory computation — can be compared according to scale.

FastAPI exposes the service and components are deployed separately. The important decision was to preserve comparative measurement between strategies rather than choose early from an unverified traffic assumption.

03 — Harden

Silent errors require tests of outcomes, not only execution.

An incomplete migration had left the new tables outside the execution path. Another defect swapped metadata and distance columns: the query returned successfully, yet its ranking was wrong. Insertion tests, smoke tests — quick checks of essential functions — and output benchmarks exposed these cases.

Validation also covers latency, load, migrations and functional checks of returned neighbours.

04 — Operate

Security, observability and reproducibility make the service maintainable.

Credentials and service addresses were moved out of source code, software images were pinned to precise versions and debugging prints were replaced with structured logging. Dead code, unused dependencies and ambiguous configuration were removed.

A sub-200 ms latency target guided the vector schema and metadata denormalization. Decisions remain tied to their assumptions so they can be revisited as catalogue size and real traffic evolve.