fix(activation): prevent boost saturation under rapid queries#8
Merged
Merged
Conversation
The spreading activation accumulation was vulnerable to saturation: any note reachable within 2 hops would hit the 1.0 ceiling after ~11 queries (hop-1) or ~19 queries (hop-2). The 7-day half-life decay couldn't compensate because within-session queries share the same timestamp, so boosts accumulated at full strength. This affects not just machine-speed evaluation runs but any bulk ingestion scenario (conversation logs, note migration, backfills) where many queries arrive faster than the decay timescale. Two complementary fixes: 1. Per-query cap (PER_QUERY_CAP = 0.05): limits how much a single query can contribute to any one note, regardless of RRF score. This makes accumulation rate-independent -- 30 queries in 30 seconds or 30 days contribute the same bounded amount each. 2. Log-scale accumulation: replaces linear `existing + new` with `1 - (1 - existing) * (1 - new)`. Each successive boost has diminishing returns as the value approaches 1.0. After 20 rapid queries, a note reaches ~0.64 instead of saturating. After 100 queries, still under 0.995. The 7-day half-life decay is completely unchanged -- human-pace usage (queries spread across days/weeks) still accumulates meaningfully, and inter-session decay works as before. Math for the chosen cap value (0.05): - 5 queries -> ~0.23 (noticeable but not dominant) - 10 queries -> ~0.40 (a focused research session) - 30 queries -> ~0.79 (heavy use, still not saturated) - 100 queries -> ~0.994 (bulk ingestion, asymptotic)
aayoawoyemi
approved these changes
Mar 21, 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.
Fixes #7.
Two complementary fixes:
Per-query cap (0.05): limits how much a single query can contribute to any one note, making accumulation rate-independent.
Log-scale accumulation: replaces linear
existing + newwith1 - (1 - existing) * (1 - new). Each successive boost has diminishing returns as the value approaches 1.0.After 20 rapid queries a note reaches ~0.64 instead of saturating at 1.0. The 7-day half-life decay is unchanged, so human-pace usage still accumulates meaningfully.
Includes tests covering per-query cap, diminishing returns, bulk ingestion, and human-pace accumulation.