feat(cognitive-shader-driver): add Σ-codebook-index column to FingerprintColumns (B2)#323
Merged
Merged
Conversation
…rintColumns (B2) Track-B PR 2. BindSpace SoA carries μ-fingerprints today (content / cycle / topic / angle) but no Σ. Per Pillar-6 (PR #289) and Σ-Codebook viability (#288, R²=0.9949 at k=256), every row should also carry a Σ codebook index alongside its μ. This PR allocates the index column only — one byte per row indexing into a 256-entry Σ codebook. The codebook itself is intentionally NOT loaded here; that is a B3 concern (the codebook static + boot-load-from-disk lives in `lance-graph-contract::sigma_propagation`, contributed by B1). Changes ------- - `FingerprintColumns` gains `pub sigma: Box<[u8]>`. - `FingerprintColumns::zeros(len)` allocates `vec![0u8; len].into_boxed_slice()` for sigma alongside the existing four planes. - New accessors `sigma_at(row) -> u8` and `write_sigma(row, idx)`. - `BindSpace::byte_footprint` includes the new sigma byte per row. - Existing `bindspace_zeros_shapes` / `bindspace_footprint_adds_columns` tests updated to cover sigma. Tests added ----------- - sigma_column_zeros_initialised_to_index_zero - sigma_column_round_trips_per_row - fingerprint_columns_sigma_len_matches_other_columns Cost ---- 1 byte / row on the existing ~6.2 KB row footprint = 0.02 % growth. For len = 1: 71776 → 71777 bytes (verified by byte_footprint test).
This was referenced May 1, 2026
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.
Summary
Track-B PR 2. BindSpace SoA carries μ-fingerprints today (
content/cycle (Vsa16kF32)/topic/angle) but no Σ. Per Pillar-6 (PR #289)and Σ-Codebook viability (#288, R²=0.9949 at k=256), every row should
also carry a Σ codebook index alongside its μ.
This PR adds the index column only — one byte per row indexing into a
256-entry Σ codebook.
What changes
FingerprintColumnsgainspub sigma: Box<[u8]>.FingerprintColumns::zeros(len)allocatesvec![0u8; len].into_boxed_slice()for sigma alongside the four existing planes.
pub fn sigma_at(&self, row: usize) -> u8pub fn write_sigma(&mut self, row: usize, idx: u8)BindSpace::byte_footprintincludes the new sigma byte per row.What does not change
The codebook static + boot-load-from-disk lives in
lance-graph-contract::sigma_propagation, contributed by B1.This PR only allocates the per-row index column so the SoA layout is
ready when B3 wires the lookup in.
BindSpace/BindSpaceBuilderchanges outside thenew struct field. Existing callers continue to work unmodified.
Cost
1 byte / row on the existing ~6.2 KB row footprint = 0.02 % growth.
Verified at
len = 1:The
bindspace_footprint_adds_columnstest asserts the new totalexactly so future drift trips a unit test.
Test plan
cargo test --manifest-path crates/cognitive-shader-driver/Cargo.toml --lib bindspace::— 12 / 12 pass on this branchsigma_column_zeros_initialised_to_index_zero— every row in a freshFingerprintColumns::zeros(8)reads back0sigma_column_round_trips_per_row— distinct indices (0,17,200,255) round-trip throughwrite_sigma/sigma_at; overwrite replaces (does not OR/accumulate)fingerprint_columns_sigma_len_matches_other_columns— implied row counts agree across all five planes forlen ∈ {0, 1, 7, 64, 1000}bindspace_zeros_shapes— extended to assertbs.fingerprints.sigma.len() == 10bindspace_footprint_adds_columns— updated to71777(was71776)References
lance-graph-contract::sigma_propagationhttps://claude.ai/code/session_01PjcbSTd9zdVPkta9qwkVKo