liveBook · Manning

Similarity metric

As explained in Machine Learning System Design

Vector similarity is a measure of how closely two numerical vectors correspond in direction, distance, or another defined geometric relationship.

A similarity metric supports search by comparing a user-query vector with vectors representing searchable items. Production design separates vector generation and index querying because they have different operational constraints. section 15.5.2

Treat the two sides of vector similarity as separate serving paths:

  • Update the index in batches, including daily refreshes and on-demand creation or recreation after a core-model update. section 15.5.2
  • Query the index in real time, minimizing latency and preparing for uneven traffic and sudden peaks. section 15.5.2
  • Reuse one model, converted to ONNX, for batch and real-time inference when simplifying the design is valuable. section 15.5.2

Photo search

A photo-search service refreshes its index daily, supports on-demand reindexing, processes large item volumes, and handles query spikes of roughly 100 requests per second. section 15.5.2

How Machine Learning System Design covers it

How deep it goes
Separates vector generation and index querying, then specifies serving constraints without detailing the similarity calculation.
Examples
Uses daily index updates, on-demand reindexing, and peak query loads of roughly 100 requests per second.
What you can do after
Operate vector search by separating index updates from real-time queries and sizing each path for its workload.
How it connects
Connects model inference, vector indexing, batch processing, real-time querying, and ONNX conversion.

Also explained in

Compare how 10 books explain similarity metric →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Machine Learning System Design. The section links point to the parts of the book it draws on.