fix(memory): reduce hybrid noise with cosine floor and tighter RRF - #212
Merged
Conversation
Expanded-100 semantic benchmark: hit@1/3/5 88/97/98, judged irrelevant top-3 4.0% (baseline 4.7%), coverage 42.0%, zero results 0%.
This reverts commit 3b705f5.
Expanded-100 semantic benchmark: hit@1/3/5 86/97/98, judged irrelevant top-3 4.0% (baseline 4.7%), coverage 41.7%, zero results 0%.
This reverts commit 2b444e5.
Expanded-100 semantic benchmark: hit@1/3/5 88/97/98, judged irrelevant top-3 3.3% (baseline 4.7%), coverage 55.5%, zero results 1%.
Expanded-100 semantic benchmark: hit@1/3/5 88/97/98, judged irrelevant top-3 2.5% (baseline 4.7%), coverage 55.0%, zero results 1%.
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
k=60tok=10Semantic search improved expanded-100 hit@1/3/5 from 81/91/96 to 88/97/98, but judged-irrelevant top-three results increased from 2.9% to 4.7%. Explained-query diagnosis found two weak semantic-only fillers and four lexical distractors reinforced by semantic rank. The selected combination addresses both mechanisms without adding configuration, inference, schema, or API surface.
Evidence
k=10The go/no-go gate allowed at most a 1 percentage-point hit@3 regression. The selected policy has no hit@1/3/5 regression and halves the raw known-bad count from 6 to 3.
The 1% zero-result rate is deliberate: the lexical-zero
169.254.169.254query previously received five semantic results with cosine 0.14-0.18 and no relevant top-five answer.Judgment coverage caveat
The irrelevant metric is conditional on explicitly judged returned slots. Lexical search had 3 irrelevant results among 104 judged and 207 returned top-three slots. The semantic baseline had 6 among 127 judged and 300 returned slots. Coverage therefore fell from 50.2% to 42.3% despite hybrid producing 23 more judged slots in absolute terms.
Across the pooled lexical/hybrid top-three results, only 127 of 360 unique query/result pairs are judged; 233 remain unjudged. The table reports raw known-bad counts, conditional judged rate, returned-slot rate, and coverage together so unjudged results are not silently treated as relevant or irrelevant.
Benchmark provenance
Candidate verification used the expanded-100 fixture with
AI_DEVKIT_BINpointed at this worktree's built CLI in dev mode:No experiment row was added to the benchmark README. A released-version leaderboard row will follow the next ai-devkit npm release.
Validation
npm run build- 6/6 projects builtnpm test- 174 files, 2,165 tests passed across 6 projectsnpm run lint- 6/6 projects passed, 0 errors; 3 pre-existing CLI warningsnpx vitest run --config e2e/vitest.config.ts- 1 file, 41 tests passedRisk and rollback
The fixed 0.50 threshold is calibrated on the current fixture, whose pooled judgments are incomplete. The guard applies only to semantic-only candidates; lexical matches are never filtered by cosine. Reverting the two final ranking commits restores the prior fusion behavior without data migration.