Skip to content

Cohere 1M measurement and fix for k=100 concurrent-search scaling - #30

Merged
matengo merged 1 commit into
masterfrom
benchmark-cohere-1m
Sep 16, 2026
Merged

matengo merged 1 commit into
masterfrom
benchmark-cohere-1m

Conversation

@matengo

@matengo matengo commented Sep 16, 2026

Copy link
Copy Markdown
Owner

Summary

Measures Cohere 1M in the configuration Zvec publishes (int8 / float, M = 15, efSearch = 180, recall@100, 12 concurrent clients), and fixes a scaling bottleneck that the measurement exposed.

Bug: result materialisation serialised concurrent searches

At k = 100 with 12 query threads, QPS was not monotonic in efSearch: efSearch 100 gave 1,883 QPS, efSearch 180 gave 3,129. Single-threaded and k = 10 sweeps were monotonic, so the per-hit work under concurrency was the suspect.

GetMetadata and ReadGuidFromDisk read through MemoryMappedViewAccessor, whose every ReadX/ReadArray call takes an interlocked reference on the shared SafeBuffer. At k = 100 that is a few hundred atomic operations per query on one cache line; twelve threads serialised on it. Both now read through the raw mapping pointer the distance computations already use.

Cohere 1M float, efSearch 100, 12 threads: 1,883 → 6,441 QPS. Single-threaded throughput unchanged (so the SIFT-1M numbers in the README did not move).

Harness

  • --passes N: repeat the query set N times per efSearch row. Cohere has only 1,000 queries; at several thousand QPS a row was over in under a second.
  • Warm-up now uses the measurement's thread count and runs ≥ 1 full pass and ≥ 2 s. A fresh process soft-faults every page of a 3.4 GB mapping into its working set even when the file is OS-cached; the first row of a sweep was 2–3× slower than the second before this.

Measured (12 cores, throttling exemption, 12 build threads, --concurrency 12 --passes 10)

mode build file efSearch recall@100 QPS 1 thread QPS 12 threads
float 419 s (2,385/s) 3,376 MiB 100 90.3 % 6,441
float 180 94.8 % 565 3,764
float 320 97.4 % 351 2,207
int8 181 s (5,516/s) 1,194 MiB 100 89.3 % 1,395 13,540
int8 180 93.2 % 839 6,841
int8 320 95.3 % 502 4,714

Zvec's chart for the same configuration on 16 vCPUs reads as roughly 8–9 k QPS at recall@100 ≈ 0.93–0.94 (image only, approximate). Per core the int8 row is in the same range — on different hardware, OS and day, which is as far as the comparison goes. The documentation says so explicitly. Note that Zvec's 1M run does not use its refiner (only 10M does); the earlier README sentence claiming otherwise is corrected.

Tests

Fast suite 333 + Slow 7 green, 0 warnings. The read-path change is covered by the existing metadata/Guid round-trip tests; no new test since the defect is a contention profile rather than a functional bug.

…alisation

Running Zvec's published Cohere 1M configuration (int8 / float, M = 15,
efSearch 180, recall@100, 12 concurrent clients) showed QPS that was not
monotonic in efSearch at k = 100 with 12 threads: efSearch 100 reached
1,883 QPS while efSearch 180 reached 3,129. Single-threaded and k = 10
runs were monotonic, so the problem was in the per-hit work under
concurrency.

GetMetadata and ReadGuidFromDisk went through MemoryMappedViewAccessor,
whose every ReadX/ReadArray call takes an interlocked reference on the
shared SafeBuffer. At k = 100 that is a few hundred atomic operations
per query on one cache line, and twelve threads serialised on it. Both
now read through the raw mapping pointer the distance code already
uses. Cohere 1M float, efSearch 100, 12 threads: 1,883 -> 6,441 QPS.
Single-threaded throughput is unchanged.

Benchmark harness:
  --passes N repeats the query set N times per efSearch row; Cohere has
  only 1,000 queries, which at several thousand QPS is over in under a
  second. Warm-up now uses the measurement's thread count and runs at
  least one full pass and at least two seconds, because a fresh process
  soft-faults every page of a multi-gigabyte mapping into its working
  set even when the OS has the file cached; the first row of a sweep
  was 2-3x slower than the second before this.

Measured (12 cores, throttling exemption, 12 build threads, 12 query
threads, --passes 10), efSearch 180:
  float  build 419 s (2,385/s)  3,376 MiB  recall@100 94.8 %  3,764 QPS (1 thread: 565)
  int8   build 181 s (5,516/s)  1,194 MiB  recall@100 93.2 %  6,841 QPS (1 thread: 839)

Documented in benchmarks/README.md with the caveats that apply to a
comparison against Zvec's 16-vCPU chart; a short table in README.md.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@matengo
matengo merged commit da7dde9 into master Sep 16, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant