[MOD-14957] Normalize FLAT overwrites (1/3) - #1034
Open
dor-forer wants to merge 1 commit into
Open
Conversation
This was referenced Sep 7, 2026
4 tasks
alonre24
approved these changes
Sep 7, 2026
dor-forer
force-pushed
the
dor-forer-fix-flat-cosine-overwrite
branch
from
September 8, 2026 15:48
c26aa25 to
22533ce
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1034 +/- ##
==========================================
+ Coverage 97.40% 97.42% +0.02%
==========================================
Files 141 141
Lines 8698 8699 +1
==========================================
+ Hits 8472 8475 +3
+ Misses 226 224 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Describe the changes in the pull request
Single-value FLAT overwrites bypassed storage preprocessing. A cosine vector such as
[2, 2, 2, 2]could replace an existing vector without being normalized. Run the replacement throughpreprocessForStorage, as insertion already does, while keeping the label's internal ID.Stack 1/3, based on
main. #1035 adds tiered SQ8 with an immediate backend; #1029 adds accumulation and deferred backend creation on top. Merge #1034, then #1035, then #1029.Which issues this PR fixes
Main objects this PR modified
BruteForceIndex_Single::addVectorand its cosine overwrite regression test.Validation
Built and tested on SSH
dorer-intelatc26aa251: all 138test_bruteforcetests passed, including the new regression. No local build was run.GitHub validation checked on 2026-09-07: the sanitizer check passed. The coverage job failed after its self-hosted runner lost contact with GitHub. The underlying cause is not yet diagnosed, and coverage validation remains incomplete.
Mark if applicable
Note
Low Risk
Small, localized fix to the overwrite branch in
BruteForceIndex_Single::addVector; behavior aligns with existing insert preprocessing and is covered by a new regression test.Overview
Single-label brute-force (FLAT) updates now run replacement vectors through
preprocessForStoragebeforeupdateElement, matching the insert path inappendVector. Previously, re-adding under an existing label wrote raw input, so cosine indexes could store unnormalized values and return wrong distances.A unit test asserts that overwriting a cosine label with
[2,2,2,2]leaves one normalized vector in storage.Reviewed by Cursor Bugbot for commit 22533ce. Bugbot is set up for automated code reviews on this repo. Configure here.