perf(memory): store holographic vectors as float32 (#30499 salvage) - #76917
Merged
kshitijk4poor merged 2 commits intoAug 2, 2026
Merged
Conversation
When hrr_dim=1 the prefixed float32 blob (4+4=8 bytes) collides in size with a raw float64 blob (1×8=8 bytes), making the format discriminator in bytes_to_phases ambiguous — a legacy blob starting with HRR1 would be misread as a prefixed float32 vector. - phases_to_bytes now accepts an optional dim and falls back to writing raw float64 when the two blob sizes are equal. - bytes_to_phases prefers the legacy float64 interpretation when sizes collide and dim is provided, since phases_to_bytes never writes a prefixed float32 blob at dim=1. - Three regression tests cover dim=1 write, round-trip, and the legacy-prefix collision case. Addresses hermes-sweeper review on PR NousResearch#30499.
kshitijk4poor
enabled auto-merge (rebase)
August 2, 2026 17:03
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.
Salvage of #30499 by @JabberELF — both commits cherry-picked to preserve authorship; one conflict resolved against current main.
Context — what this changes for users
The holographic memory plugin stores one HRR phase vector per fact as raw float64 bytes — 8KB per fact at the default dim=1024. Phase angles don't need float64: float32's ~1e-7 relative error is far below the similarity noise floor. This PR halves vector storage (4KB/fact; a 10k-fact store shrinks ~40MB) with a versioned format: new blobs carry an HRR1 magic prefix, and the decoder promotes everything to float64 on read so downstream math is unchanged.
Migration story (the risky part — independently audited)
Salvage notes
Verification
Closes #30499.