Skip to content
ENExplore Calculators

Similarity Search Latency Calculator

Work out similarity search latency instantly with clear inputs, formula shown and shareable results.

About Similarity Search Latency Calculator

A dot-product comparison costs about 2d floating-point operations, so brute-force search over N vectors is 2Nd per query and scales linearly with index size. Approximate indexes change the comparison count rather than the per-comparison cost: HNSW visits roughly a constant multiple of log N nodes, and IVF probes a small fraction of the clusters, which is why they turn a linear scan into a near-constant-time lookup.

Formula

Search cost

comparisons: flat = N, HNSW ~ 64 log2(N), IVF ~ 1% of N; FLOPs = comparisons x 2d; latency = FLOPs / throughput

Worked example

With the default values below, Similarity Search Latency Calculator returns Latency per query of 0.004. Change any input above and every figure here is recalculated in your browser.

Inputs used

Vectors in the indexminimum 1
5,000,000
Dimensionsminimum 1
768
Effective compute throughputminimum 0.1 GFLOP/s
500 GFLOP/s
Index typeone of Flat / brute force, HNSW graph, IVF with 1% probe
HNSW graph

Results

Latency per query
0.004 ms
Vector comparisons per query
1,424
Floating-point operations per query
2,187,608
Single-worker throughput
228,560.2 q/s

Step by step

  1. 1Values used
  2. 2Search cost
  3. 3Latency per query= 0.004 ms
  4. 4Vector comparisons per query= 1,424
  5. 5Floating-point operations per query= 2,187,608
  6. 6Single-worker throughput= 228,560.2 q/s

Assumptions and limits

  • The result is derived only from the 4 inputs listed above. Anything not among them is not part of the calculation.
  • In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
  • Figures are rounded for display to 3 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.

How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.

Frequently Asked Questions

Why is brute force sometimes fine?

Below roughly a hundred thousand vectors, a vectorised flat scan runs in single-digit milliseconds and gives exact results with no index to build or tune.

What does HNSW trade away?

Recall. It finds the true nearest neighbours most but not all of the time, and the efSearch parameter buys recall back at a proportional latency cost.

Similarity Search Latency Calculator | Calcrivo