docs(embedding): record issue #35 relevance-floor investigation (negative result) - #36
Conversation
Measured the wallet corpus's Windows-only auto-lock wiring chunk (Platforms/Windows/App.xaml.cs's OnAppWindowChanged) directly against Ollama for both reported phrasings, bypassing the floor entirely: - "what fires when the auto-lock timeout elapses" -> cosine 0.4184, 0.13 below MinCosineSimilarity and squarely inside the measured noise band (0.3321-0.5402), not a borderline miss. - "how does the app lock on resume" -> cosine 0.5880 for the exact same chunk, comfortably above the floor. The method body never mentions "lock", "auto", or "timeout", and the file-path lexical signal RoslynChunker already embeds does not help here because the path itself carries no lock/timeout vocabulary either. This is a phrasing-sensitive content gap in one chunk's embedding, not a systemic threshold miscalibration -- lowering the floor far enough to admit 0.4184 would re-admit several of the genuinely off-topic queries the constant was measured against. No production behavior changes; the 0.55 default is left as-is. This records the measurement and reasoning on MinCosineSimilarity itself, matching how the constant's original derivation is already documented there.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
The #35 investigation is recorded on MinCosineSimilarity, where a maintainer deciding whether to move that constant will find it. The finding generalises past that constant, though, and the generalisation belongs where a user deciding which tool to reach for will see it. Similarity is computed against a chunk's own text, so code that takes part in a feature without naming it has nothing to match on. Grep reaches it in two hops -- find the symbol, then find its callers -- and embedding similarity has no equivalent second hop. That is a capability boundary rather than a tuning problem, and it is the concrete mechanism behind the coverage gap the benchmark measured (82% vs 88% of required facts), since platform-guarded variants and parallel code paths are precisely the shapes that participate without naming. Ends with the actionable form: for completeness questions, use Grep, or use code_search to find the symbol and Grep to find its callers.
|
Добавил обобщение в README, в раздел «Known limitations» — ваш разбор его вполне заслуживает, а комментарий к константе видит мейнтейнер, решающий двигать ли 0.55, но не пользователь, решающий каким инструментом искать. Формулировка такая: код, участвующий в фиче только тем, что вызывает её, здесь почти невидим. Похожесть считается по собственному тексту чанка, поэтому методу, который делает своё дело не называя его, не на чем совпасть. И это же объясняет разрыв покрытия из бенчмарка (82% против 88%): платформенные ветки, альтернативные реализации и параллельные пути — ровно те формы, которые участвуют не называя. Отдельно ценю два решения в вашей работе. Первое — вы отказались вводить относительный порог и добор подпороговых с пометкой, потому что для обоснования именно этого случая данных не хватало; предложить непроверенное было бы легче, чем сказать «недостаточно измерений». Второе — вы поймали ошибку в моём тексте issue: я написал |
Summary
Investigates #35 (semantic search misses
Platforms/Windows/App.xaml.csfor auto-lock queries on thewalletcorpus). Reproduced both reported phrasings and measured the chunk's actual cosine similarity directly against Ollama, bypassingMinCosineSimilarityentirely.Finding: this is not a threshold-calibration bug.
what fires when the auto-lock timeout elapses-> the relevant chunk (OnAppWindowChanged) scores 0.4184 -- 0.13 below the 0.55 floor, squarely inside the noise band (0.3321-0.5402) the floor was measured against, not a borderline miss.how does the app lock on resume-> the same chunk scores 0.5880 for the same file/chunk, comfortably above the floor. (This phrasing's ranking/crowding was already fixed by fix(search): cap per-file hits so a small limit spans more files #34.)The method body (
OnAppWindowChanged) never mentions "lock", "auto", or "timeout" -- it only callsGetAuthStateProvider()?.OnAppSleep()/OnAppResume()on window minimize/restore.RoslynChunker.BuildEmbedTextalready prepends the file's path as a lexical signal (File: {path}), but that doesn't help here: the path (Platforms/Windows/App.xaml.cs) has no lock/timeout vocabulary either. This is a genuine, phrasing-sensitive content gap in one chunk's embedding, not a systemic miscalibration -- lowering the floor far enough to admit 0.4184 would re-admit several of the genuinely off-topic queries the 0.55 default was measured against (noise tops out at 0.5402).Decision
Left
MinCosineSimilarity(0.55) unchanged. No relative-floor or below-floor-backfill redesign was implemented either: both would need their own measurement against the golden suite to justify, and neither is evidenced to help this specific case (the gap to the top hit for this query is also large, not a near-miss). Recorded the full measurement and reasoning as a<remarks>addendum onEmbeddingOptions.MinCosineSimilarity, matching how the constant's original derivation is already documented there, so the data point survives for whoever revisits this threshold next.What this costs: the miss described in #35 remains -- a query phrased exactly as "what fires when the auto-lock timeout elapses" still won't surface this one Windows-only wiring file. The underlying auto-lock feature is still found via more central chunks (
AuthService.SetAutoLockDate,IAuthServicedocs), and the cross-platform-completeness framing ("how does the app lock on resume") already clears the floor and (post-#34) ranks reasonably. Any fix for the narrower miss belongs on the indexing/chunking side (e.g. enriching platform-glue chunks with cross-referenced call-target context) -- a larger, separate change, not attempted here for lack of measurement.Test plan
dotnet build CodeIndexMcp.slnx -c Release-- clean, 0 warnings/errorsdotnet test CodeIndexMcp.slnx -c Release --no-build-- 419/419 passed (360CodeIndex.Core.Tests+ 59CodeIndex.Server.Tests), no regressions (expected: doc-only change)walletindex viacode_search/path_filter, matching the measured scores' pass/fail pattern exactly