feat(index): f64 centroids support in streaming coreset k-means - #8662
Open
a-erofeev wants to merge 1 commit into
Open
feat(index): f64 centroids support in streaming coreset k-means#8662a-erofeev wants to merge 1 commit into
a-erofeev wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implemented f64 centroid support for streaming coreset k-means.
Key changes:
Benchmark report.
Before changes:
Percentages are relative to LanceStream
stream=64, coreset=16, prefetch=1, refine=0at the same vector type andk. A baseline cannot be calculated for f64 because the old streaming path fails.After changes:
Percentages use the same per-type, per-
kLanceStream baseline.Direct after-versus-before comparison
These are the clean one-shot measurements above. Positive values mean the after revision is larger or slower.
Dataset and methodology:
Dimension: 128, matching the convention in the referenced
LanceStream benchmark report.
Datasets:
FixedSizeList<Float32, 128>vectors, 4.8 GiB on disk.FixedSizeList<Float64, 128>vectors, 9.6 GiB on disk.Generator: independent uniform random coordinates in
[0, 1), generated inthe dataset's native scalar type with
SmallRngseed2026082010000128. Both datasets report exactly 10,000,000 rows and containten Lance data files.
f32 generation took 9.52s and peaked at 169,472 KiB RSS; f64 generation took
17.61s and peaked at 298,572 KiB RSS.
Both algorithms use L2 distance,
sample_rate=256, andmax_iters=50.LanceStream uses
streaming_sample_rate=64,streaming_coreset_rate=16,LANCE_STREAMING_IVF_PREFETCH_DEPTH=1, andstreaming_refine_passes=0.Non-stream uses the same
k, sample rate, iteration budget, metric, anddataset, with streaming parameters unset.
Both revisions were built from isolated source archives with
release-with-debug, Thin-LTO, 16 codegen units, and default Lance featuresdisabled. The final binary SHA-256 values are
aed6884e...e5688(before) andea15c7e2...868c6(after).Train time is measured inside
build_ivf_model; centroid serialization isoutside the timer.
RSS is GNU
/usr/bin/time -vmaximum resident set size from a fresh processfor each configuration.
Exact loss is evaluated in a separate process over the first
k * 256rows:HNSW acceleration was explicitly disabled, so every evaluation vector was
compared with every centroid. Lance's current L2 API returns each distance
as
f32, including for f64 vectors, and these values were summed intof64.Thus “exact” means exhaustive assignment, not fully f64 loss arithmetic.
Streaming uses deterministic fixed sample ranges. Batch uses its normal
random sampler, so one-run batch timing and loss include sampling and
initialization variance.
The main tables contain one measured run per configuration. The additional
f32
k=1024repetitions were diagnostic and are reported separately.Host:
According to this benchmark, RSS is not very good, but seems it is not implementation problem.
So i repeated f64-centroid benchmark with more precise approach.
Five fresh-process repetitions were run for each configuration on each revision. Each
revision used its own isolated
release-with-debugbinary; processes were pinned toCPUs 0–7 with
RAYON_NUM_THREADS=8, and configuration order was shuffled perrepetition. RSS is
/usr/bin/time -vmaximum resident set size. Values below aremean ± sample standard deviation.
Raw measurements:
After vs before:
For configurations available on both revisions, percentage deltas use the revision
means. Streaming f32 changed by −7.9% time / −1.1% RSS at k=1024 and −0.8% /
−1.1% at k=4096. Batch f32 changed by +0.3% / +1.3% and −0.6% / −0.1%,
respectively. Batch f64 changed by +1.0% / −1.1% at k=1024 and −3.2% / −0.4%
at k=4096. The f64 streaming path is newly supported, so it has no before value.