Skip to content

perf: bound multivector index build reads by bytes - #11809

Merged
Xuanwo merged 1 commit into
lance-format:mainfrom
wkalt:ticket/oss-3288/multivector-build-memory
Dec 2, 2026
Merged

Xuanwo merged 1 commit into
lance-format:mainfrom
wkalt:ticket/oss-3288/multivector-build-memory

Conversation

@wkalt

@wkalt wkalt commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Several steps of a multivector index build read a fixed number of rows, which for rows holding thousands of vectors is most of the table: the vectors-per-row estimate took 64 rows, the trainable-vector count scanned 1024 rows a batch, and the shuffle read 64 rows a batch on every core and transformed each row whole. They now size their reads in bytes, and the shuffle slices a row larger than one fetch.

A training sample was at least 128 whole rows, however few vectors were asked for. For rows of 1 MiB or more it is now the vectors asked for, drawn in equal shares from up to 64 rows with one row in memory at a time. This costs a read of those rows (up to 2 GiB) for each sample.

@wkalt

wkalt commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

Peak heap and time of an IVF_PQ build, 244 partitions on every build, local disk. The column is List<FixedSizeList<Float32, 512>>, 3.9 GB of vectors. The last column adds #11713, which this does not depend on: without it the reader still loads a whole 2 GB page to return one row.

rows main this branch this branch + #11713
200 rows of 10,000 vectors (20 MB each) 16.2 GB, 33 s 9.2 GB 2.8 GB, 14 s
20 rows of 100,000 vectors (205 MB each) 12.0 GB, 78 s 9.0 GB, 16 s 4.2 GB, 16 s
50,000 rows of 64 64-d vectors (16 KB each) 0.47 GB 0.46 GB 0.44 GB

Recall@10 on the 200-row table, single-vector queries, 100 queries, three builds each. The training sample goes from 1.28M vectors (128 whole rows) to the 62k asked for.

nprobes main this branch + #11713
8 0.65, 0.67, 0.86 0.69, 0.70, 0.71
default 0.74, 0.79, 0.87 0.72, 0.74, 0.74
128 0.86, 0.88, 0.88 0.87, 0.87, 0.88

@claude claude Bot 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.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added the K-changes Latest Gatekeeper recommendation requests changes. label Dec 2, 2026
@wkalt
wkalt force-pushed the ticket/oss-3288/multivector-build-memory branch from 6d11d52 to 1c60439 Compare December 2, 2026 20:00
@lance-gatekeeper lance-gatekeeper Bot removed the K-changes Latest Gatekeeper recommendation requests changes. label Dec 2, 2026
lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Dec 2, 2026
Several steps of a multivector index build read a fixed number of rows,
which for rows holding thousands of vectors is most of the table: the
vectors-per-row estimate took 64 rows, the trainable-vector count
scanned 1024 rows a batch, and the shuffle read 64 rows a batch on
every core and transformed each row whole. They now size their reads in
bytes, and the shuffle slices a row larger than one fetch.

A training sample was at least 128 whole rows, however few vectors were
asked for. For rows of 1 MiB or more it is now the vectors asked for,
drawn in equal shares from up to 64 rows with one row in memory at a
time. This costs a read of those rows (up to 2 GiB) for each sample.
@wkalt
wkalt force-pushed the ticket/oss-3288/multivector-build-memory branch from 1c60439 to c8a3894 Compare December 2, 2026 21:34
@lance-gatekeeper lance-gatekeeper Bot removed the K-approved Latest Gatekeeper recommendation permits acceptance. label Dec 2, 2026

@lance-gatekeeper lance-gatekeeper Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Gate recommendation: approve.

The byte-sized reads and vector slicing address the build-memory problem while preserving training on sparse nullable columns. The future-boxing follow-up preserves that behavior.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Dec 2, 2026
@Xuanwo
Xuanwo merged commit abf4499 into lance-format:main Dec 2, 2026
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

K-approved Latest Gatekeeper recommendation permits acceptance. performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants