Skip to content

Commit a6b1b97

Browse files
tianjianjiangclaude
andcommitted
docs(requirements): add contextual user model requirements with scoring model rationale
Specify the shipped architecture as requirements: dynamic span length derived from LanguageModel::maxKeyLength() (PR #844), the ContextualUserModel with absolute-discounting interpolated Kneser-Ney over bigram contexts (PR #780), and the KeyHandler swap from UserOverrideModel at the existing observe/suggest call sites (PR #781). Key specifications: - Continuation probability normalized per reading: P_cont(w|r) = N1+(.,r,w) / sum over w' of N1+(.,r,w'), with generalization to unseen contexts gated on >= 2 distinct contexts and never force-boosted; minimum suggestion probability 0.25. - Wall-clock exponential decay count * 2^(-dt/halfLife) with the half-life unit in seconds (default 5400 s = 90 min); LRU capacity bound (default 500 contexts). - Two-level scoring with implicit base-LM fallback: insufficient evidence yields an empty suggestion and the walk falls back to base scores naturally; the model holds no base-LM pointer, eliminating the aliasing-shared_ptr lifetime hazard by construction. - TSV v1 persistence (atomic temp+rename save, validated load, serialize() snapshot for off-thread writes) confined to contextual-user-model.txt; user phrase files are never touched and UserOverrideModel had no persisted data, so no migration is needed. - The walk algorithm is untouched: the WalkStrategy/fixedSpans abstraction and the speculative algorithm variants from PR #779 are dropped per maintainer feedback; legacy UserOverrideModel removal is a follow-up after #781 bakes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 040097e commit a6b1b97

1 file changed

Lines changed: 1160 additions & 0 deletions

File tree

0 commit comments

Comments
 (0)