Skip to content

[ENH] Wire up quantized reader in new orchestrator#6409

Merged
Sicheng-Pan merged 5 commits intomainfrom
02-11-_enh_wire_up_quantized_reader_in_new_orchestrator
Feb 14, 2026
Merged

[ENH] Wire up quantized reader in new orchestrator#6409
Sicheng-Pan merged 5 commits intomainfrom
02-11-_enh_wire_up_quantized_reader_in_new_orchestrator

Conversation

@Sicheng-Pan
Copy link
Copy Markdown
Contributor

@Sicheng-Pan Sicheng-Pan commented Feb 11, 2026

Description of changes

Summarize the changes made by this PR.

  • Improvements & Bug fixes
    • N/A
  • New functionality
    • Wire up the quantized reader in a new quantized spann orchestrator.

Test plan

How are these changes tested?

  • Tests pass locally with pytest for python, yarn test for js, cargo test for rust

Migration plan

Are there any migrations, or any forwards/backwards compatibility changes needed in order to make sure this change deploys reliably?

Observability plan

What is the plan to instrument and monitor this change?

Documentation Changes

Are all docstrings for user-facing APIs updated if required? Do we need to make documentation changes in the docs section?

@github-actions
Copy link
Copy Markdown

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

Copy link
Copy Markdown
Contributor Author

Sicheng-Pan commented Feb 11, 2026

@Sicheng-Pan Sicheng-Pan force-pushed the 02-10-_enh_quantized_spann_segment_reader branch from ff6baf8 to 9a26a8f Compare February 11, 2026 21:07
@Sicheng-Pan Sicheng-Pan force-pushed the 02-11-_enh_wire_up_quantized_reader_in_new_orchestrator branch 2 times, most recently from be396bb to 06f50fa Compare February 11, 2026 22:35
@blacksmith-sh

This comment has been minimized.

@Sicheng-Pan Sicheng-Pan force-pushed the 02-11-_enh_wire_up_quantized_reader_in_new_orchestrator branch from 06f50fa to 50beaff Compare February 12, 2026 01:32
@Sicheng-Pan Sicheng-Pan marked this pull request as ready for review February 12, 2026 01:34
@propel-code-bot
Copy link
Copy Markdown
Contributor

propel-code-bot bot commented Feb 12, 2026

Quantized SPANN KNN orchestrator with load/merge pipeline wiring

Adds a dedicated quantized SPANN KNN orchestrator and operator set that load the quantized reader, navigate cluster centers, fetch clusters, and run a bruteforce step before merging with log-derived distances. The segment reader API was expanded with get_cluster, get_version, and distance-function access so that workers can materialize cluster payloads, and the shared Merge operator now deduplicates results via hashing to support the quantized flow. Worker request routing now selects QuantizedSpannKnnOrchestrator whenever the vector segment type is QuantizedSpann, and knn filter/orchestrator error enums were extended to surface the new operator failures.

Key Changes

• Introduced quantized_spann_knn orchestrator that sequences knn_log, center search/load, per-cluster load, bruteforce, and merge tasks with state tracking for readers, rotated queries, and active brute-force count
• Added QuantizedSpannLoadCenter, QuantizedSpannCenterSearch, QuantizedSpannLoadCluster, and QuantizedSpannBruteforce operators plus supporting structs and errors
• Extended QuantizedSpannSegmentReader with get_cluster, get_version, and distance_function helpers (replacing in-reader bruteforce) and removed the previous asynchronous bruteforce API
• Updated worker server orchestration to dispatch the quantized orchestrator for SegmentType::QuantizedSpann requests and tightened KnnFilter error taxonomy
• Changed operator::Merge to require Clone + Eq + Hash + Ord, deduplicate records via a HashSet, and added tests covering duplicate suppression

Possible Issues

• No automated tests cover the new quantized orchestration path, so regressions (e.g., misordered pipeline, dedup edge cases) will go unnoticed
QuantizedSpannLoadClusterOperator fails entire queries when any ID lacks a version record, which is stricter than the previous behavior and may surface in production with WAL-only or deleted points
initial_tasks still awaits read_quantized_usearch before returning, meaning no work is queued until the full reader has loaded, hurting concurrency on large segments

This summary was automatically generated by @propel-code-bot

@Sicheng-Pan Sicheng-Pan force-pushed the 02-10-_enh_quantized_spann_segment_reader branch from 9a26a8f to a601921 Compare February 12, 2026 01:40
@Sicheng-Pan Sicheng-Pan force-pushed the 02-11-_enh_wire_up_quantized_reader_in_new_orchestrator branch 2 times, most recently from 3f3ff93 to ce47c0b Compare February 12, 2026 01:41
@blacksmith-sh

This comment has been minimized.

@Sicheng-Pan Sicheng-Pan force-pushed the 02-10-_enh_quantized_spann_segment_reader branch from 80a5af5 to 514208a Compare February 12, 2026 21:27
@Sicheng-Pan Sicheng-Pan force-pushed the 02-11-_enh_wire_up_quantized_reader_in_new_orchestrator branch 2 times, most recently from 2acf8f0 to 588f737 Compare February 12, 2026 21:33
@Sicheng-Pan Sicheng-Pan force-pushed the 02-10-_enh_quantized_spann_segment_reader branch from 514208a to 939cc61 Compare February 12, 2026 21:33

// State tracking.
num_bruteforces: Option<usize>,
records: Vec<Vec<RecordMeasure>>,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

TODO: bruteforce_results

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

shall we knock this rename out?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed

@Sicheng-Pan Sicheng-Pan force-pushed the 02-10-_enh_quantized_spann_segment_reader branch from 939cc61 to 833b8cc Compare February 13, 2026 00:43
@Sicheng-Pan Sicheng-Pan force-pushed the 02-11-_enh_wire_up_quantized_reader_in_new_orchestrator branch 2 times, most recently from b64d5d2 to 9debc15 Compare February 13, 2026 01:39
@Sicheng-Pan Sicheng-Pan force-pushed the 02-11-_enh_wire_up_quantized_reader_in_new_orchestrator branch from 96c6e0e to 1a1b6e8 Compare February 13, 2026 19:19
@Sicheng-Pan Sicheng-Pan force-pushed the 02-11-_enh_wire_up_quantized_reader_in_new_orchestrator branch 2 times, most recently from 7cefa67 to 8f4b1ec Compare February 14, 2026 00:09
@Sicheng-Pan Sicheng-Pan changed the base branch from 02-10-_enh_quantized_spann_segment_reader to graphite-base/6409 February 14, 2026 02:31
Comment on lines +53 to +61
let versions =
try_join_all(cluster.ids.iter().map(|&id| self.reader.get_version(id))).await?;

let global_versions = cluster
.ids
.iter()
.copied()
.zip(versions)
.collect::<HashMap<_, _>>();
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.

Critical

[Logic] The new load‑cluster path now assumes every ID in the cluster has an associated version row. try_join_all(cluster.ids.iter().map(|&id| self.reader.get_version(id))) will now return an error as soon as one get_version call returns None, which bubbles up as a QuantizedSpannLoadClusterError and aborts the entire query. In the previous in‑reader bruteforce implementation we deliberately tolerated missing versions by flattening them away (future::try_join_all(...).await?.into_iter().flatten()), so stale WAL entries or partially compacted points were simply skipped instead of failing the request. This regression means a single dangling ID can now make every quantized query return 500.

Please make get_version return an Option<u32> (or interpret the "version not found" case as a skip) and only insert IDs whose version is present when building global_versions, restoring the old behavior of ignoring stale points rather than treating them as fatal.

Context for Agents
The new load‑cluster path now assumes every ID in the cluster has an associated version row. `try_join_all(cluster.ids.iter().map(|&id| self.reader.get_version(id)))` will now return an error as soon as one `get_version` call returns `None`, which bubbles up as a `QuantizedSpannLoadClusterError` and aborts the entire query. In the previous in‑reader `bruteforce` implementation we deliberately tolerated missing versions by flattening them away (`future::try_join_all(...).await?.into_iter().flatten()`), so stale WAL entries or partially compacted points were simply skipped instead of failing the request. This regression means a single dangling ID can now make every quantized query return `500`.

Please make `get_version` return an `Option<u32>` (or interpret the "version not found" case as a skip) and only insert IDs whose version is present when building `global_versions`, restoring the old behavior of ignoring stale points rather than treating them as fatal.

File: rust/worker/src/execution/operators/quantized_spann_load_cluster.rs
Line: 61

Copy link
Copy Markdown
Contributor Author

Sicheng-Pan commented Feb 14, 2026

Merge activity

  • Feb 14, 3:39 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Feb 14, 3:41 AM UTC: Graphite rebased this pull request as part of a merge.
  • Feb 14, 4:15 AM UTC: @Sicheng-Pan merged this pull request with Graphite.

@Sicheng-Pan Sicheng-Pan changed the base branch from graphite-base/6409 to main February 14, 2026 03:39
@Sicheng-Pan Sicheng-Pan force-pushed the 02-11-_enh_wire_up_quantized_reader_in_new_orchestrator branch from 8f4b1ec to dafbf0f Compare February 14, 2026 03:40
@Sicheng-Pan Sicheng-Pan merged commit 5a1ef3f into main Feb 14, 2026
67 checks passed
tanujnay112 added a commit that referenced this pull request Feb 18, 2026
- **[ENH]: Cache rust git submodules in mounted volume (#6424)**
- **[CHORE](k8s) increase dev CPU limits from 100m to 200-300m (#6435)**
- **[ENH] replace live cloud tests with k8s integration tests (#6434)**
- **[ENH] Make dirty_log_collections metric mcmr-aware. (#6353)**
- **[ENH] Quantized Spann Segment Writer (#6397)**
- **[ENH] Wire up quantized writer in compaction (#6399)**
- **[ENH] Quantized Spann Segment Reader (#6405)**
- **[ENH] Wire up quantized reader in new orchestrator (#6409)**
- **[ENH] Garbage collect usearch index files (#6416)**
- **[ENH] Trace quantized spann implementation (#6425)**
- **[ENH]: Precompute data chunk len() (#6442)**
- **[BUG]: Compaction version file flush was incomplete on MCMR
(#6423)**
- **[DOC]: Fixed broken links in Readme (#6440)**
- **[DOC] Fix link to Rust documentation (#6443)**
- **[ENH]: Allow users to disable FTS in schema (#6214)**

---------

Co-authored-by: Robert Escriva <[email protected]>
Co-authored-by: Macronova <[email protected]>
Co-authored-by: Nilpotent <[email protected]>
Co-authored-by: anderk222 <[email protected]>
Co-authored-by: Sanket Kedia <[email protected]>
@Sicheng-Pan Sicheng-Pan deleted the 02-11-_enh_wire_up_quantized_reader_in_new_orchestrator branch February 25, 2026 23:47
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