Skip to content

perf: tune automatic probing for small centroid routers - #132

Merged
JingsongLi merged 1 commit into
apache:mainfrom
JingsongLi:codex/small-router-probe-width
Nov 19, 2026
Merged

JingsongLi merged 1 commit into
apache:mainfrom
JingsongLi:codex/small-router-probe-width

Conversation

@JingsongLi

Copy link
Copy Markdown
Contributor

Purpose

Use an automatic outer probe floor of 3 for a four-centroid router and 4 for an eight-centroid router. The floor enters the existing candidate-count and filter-selectivity calculation before expansion and clamping. The caller can still set an explicit probe width. The ordinary IVF reader keeps its existing floor of 8.

The behavior is shared by IVF and DiskANN shard layouts through the existing CentroidRouter.resolveNprobe API. The serialized model and JNI signatures are unchanged. Paimon integration and benchmark

Verification

Rust workspace tests, Clippy with warnings as errors, rustfmt and the Java API suite passed. Regression tests exercise 4 and 8 centroids, adjacent counts, large top-K, filtered searches, fixed probes and the ordinary IVF policy.

Compared two release JNI builds against the same pinned index snapshot for each pair. The baseline was e794291. The Paimon benchmark omits centroid.nprobe in both arms. The dataset contains 100,000 SIFT vectors (L2, 128 dimensions) in four disjoint row-ID ranges. Random masks retain exactly 80%, 50% or 5% of rows per range. Ground truth is exhaustive L2 within the eligible set. Each pair used the same 80–512 held-out queries and identical shard-local settings. Inputs came from original SIFT query positions 8000–9249. Fresh readers counted all logical bytes returned by Paimon streams, including the routers, on an Apple M4 Pro with four native threads.

All 32 paired scenarios met the existing recall criterion, an absolute mean difference of at most 1 percentage point and a paired 95% bootstrap lower bound above −1 point. The largest measured recall decrease was 0.111 points (IVF-FLAT, 8 centers, K=1000, 100% eligible). The lowest lower bound was -0.180 points. 10,944 paired query measurements were taken across scenarios. Scenarios can reuse query IDs. The table gives old → new.

Index Centroids per range Top-K Eligible rows Recall@K (%) Files/query Logical MiB/query
IVF-FLAT 4 100 100% 98.645 → 98.645 20 → 16 23.40 → 17.14
IVF-FLAT 4 100 80% 98.561 → 98.561 20 → 20 23.40 → 23.40
IVF-FLAT 8 100 80% 97.934 → 97.932 36 → 24 23.37 → 14.91
IVF-SQ 8 100 80% 97.781 → 97.779 36 → 24 6.74 → 4.32
IVF-PQ 8 100 80% 84.138 → 84.135 36 → 24 5.64 → 3.55
IVF-RQ 8 100 80% 95.320 → 95.318 36 → 24 6.52 → 4.12
DISKANN 8 100 80% 100.000 → 99.997 36 → 24 32.19 → 19.75
IVF-FLAT 8 10 5% 97.422 → 97.422 36 → 36 23.37 → 23.37
IVF-FLAT 8 1,000 100% 94.468 → 94.357 36 → 20 23.38 → 12.30
IVF-PQ 8 1,000 80% 80.648 → 80.645 36 → 24 5.64 → 3.55
DISKANN 8 1,000 80% 100.000 → 99.994 36 → 24 35.17 → 21.18
IVF-FLAT 4 5,000 100% 90.586 → 90.586 20 → 20 23.40 → 23.40
IVF-FLAT 8 5,000 100% 84.634 → 84.634 36 → 32 23.37 → 20.45

@github-actions

Copy link
Copy Markdown

Benchmark run · success · attempt 1

Vector index benchmark

🟢 No alerts (5/5 indexes)

Index Recall@10 (Δ) Single QPS Δ Batch QPS Δ Status
IVF_FLAT 100.00% (+0.00 pp) -0.4% -1.4% 🟢 OK
IVF_SQ 99.26% (+0.00 pp) -1.2% -0.8% 🟢 OK
IVF_PQ 46.60% (+0.00 pp) -0.3% +0.8% 🟢 OK
IVF_RQ 90.91% (+0.00 pp) +8.7% +7.9% 🟢 OK
DISKANN 78.32% (+0.00 pp) +1.1% +1.7% 🟢 OK

🟡 QPS ↓ >10% or Recall ↓ >1pp · 🔴 QPS ↓ >20% or Recall ↓ >3pp. Advisory only; QPS is measured after warmup.

Absolute metrics & environment

Medians, base → PR. QPS is timed after warmup; P95 uses the first warm sweep.

Index Single QPS Batch QPS P95 (µs) Build (ms) Process RSS (MiB) Size (MiB)
IVF_FLAT 122,498.80 → 121,987.12 120,798.42 → 119,159.40 9.78 → 9.91 19.50 → 22.50 19.83 → 19.83 2.47 → 2.47
IVF_SQ 93,571.51 → 92,429.24 166,371.27 → 164,957.77 12.27 → 11.80 13.00 → 12.50 19.83 → 19.83 0.67 → 0.67
IVF_PQ 21,121.22 → 21,054.86 179,791.31 → 181,221.90 83.64 → 102.17 152.00 → 155.00 19.83 → 19.83 0.17 → 0.17
IVF_RQ 11,881.15 → 12,915.50 63,496.71 → 68,515.38 163.35 → 138.54 27.50 → 26.00 19.83 → 19.83 0.52 → 0.52
DISKANN 14,158.02 → 14,308.76 25,225.93 → 25,645.29 104.01 → 107.74 816.50 → 831.00 19.92 → 19.92 3.22 → 3.22

Base e794291e492984d13303854dfdf60015ea283bd3 · PR merge f8015ad71523311394a317aa0bd7dcafdff0f1ad
rustc 1.100.0 (0ef1bc386 2026-11-09) · Linux-7.0.0-1017-azure-x86_64-with-glibc2.39 · AMD EPYC 9V45 96-Core Processor
6 samples/version/index, alternating execution order; 2 threads; 10k × 64D vectors; 2,048 queries; ≥1s per timed mode.
RSS is the process lifetime peak up to build completion, including dataset/ground truth.
Raw CSVs, sample ranges, workload settings and logs are in the workflow artifact.

@leaves12138 leaves12138 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JingsongLi
JingsongLi merged commit 4e45fba into apache:main Nov 19, 2026
10 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.

2 participants