Repository navigation
fix(lm): paragraph is a hard prediction boundary - #102
Merged
Merged
Conversation
willwade
force-pushed
the
fix/paragraph-hard-boundary
branch
3 times, most recently
from
October 15, 2026 22:12
3b7c35a to
de52c10
Compare
willwade
force-pushed
the
fix/paragraph-hard-boundary
branch
from
October 15, 2026 22:28
de52c10 to
203351e
Compare
"When you zoom an enter, the canvas is supposed to reset... but it doesn'"'"'t, it remembers the last punctuation you put. Then you have to zoom a capital letter." The PPM context chained THROUGH the paragraph symbol. The bundled English corpus breaks paragraphs as ".\r\n" (94% of lines start with a capital after CRLF), so the [.][para] context matched training and predicted sentence start - but any other predecessor of the newline (a zoomed space, a bare word, a comma, a blank line) produced a sequence the corpus never contains, and the escape mixture degraded the after-newline prediction to a mid-sentence blend (uppercase group 0.67 vs 0.92 after ". "; lowercase group 0.25). A paragraph now starts the canonical paragraph-start context: the alphabet default context (trailing whitespace stripped - the corpus has no [space][para] sequences) followed by the paragraph symbol. Measured: every predecessor variant now predicts identically to the known-good period+newline case. Sites, all paragraph-symbol-guarded: - CAlphabetManager::GetContextSymbols (seeded/rebuilt contexts): symbols before the last paragraph symbol are replaced by the canonical seed symbols; - CAlphabetManager::CreateSymbolNode (live zoom): the paragraph node'"'"'s context is the canonical seed context rather than the parent chain extended; CRoutingAlphMgr::CreateSymbolNode (which overrides it) applies the same reset, entering the BASE symbol; - CSymbolNode::SetFlag NF_COMMITTED (adaptive learn): the trie keeps the learned [x][para] chain, but the node'"'"'s prediction context becomes the canonical seed. Routing alphabets translate the route symbol down via the new CAlphabetManager::ContextSymbol virtual - EnterSymbol accepts base symbols only (greptile P1: passing the route number failed the range assertion in debug and lost the paragraph context in release). Training is unchanged - PPM vine learning already records after- paragraph statistics at every order. Alphabets without a paragraph symbol are untouched. Full suite green (47/47) incl. PPM goldens and LM correctness. Two regression tests, mapping-free: ten seeded predecessor variants must yield exactly the canonical distribution; and a LIVE zoom test steers the mouse into the actual paragraph node from a word+space state and requires the post-Enter distribution to equal the canonical one. Signed-off-by: will wade <willwade@gmail.com>
willwade
force-pushed
the
fix/paragraph-hard-boundary
branch
from
October 15, 2026 22:54
203351e to
0ad4902
Compare
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.
What this fixes
Dasher-Windows tester report (v0.1.33): "When you zoom an "enter", the canvas is supposed to reset right? But it doesn'"'"'t, it remembers the last punctuation you put. Then you have to zoom a capital letter."
Root cause
The PPM context chained through the paragraph symbol. The bundled English corpus breaks paragraphs as
.\r\n(94% of lines start with a capital after CRLF), so the[.][para]context matched training and predicted sentence start — but any other predecessor of the newline produced a sequence the corpus never contains, and the escape mixture degraded the after-newline prediction to a mid-sentence blend:.+ newline(Measured with
dasher_get_probabilitiesagainst the real engine + bundled corpus; "uppercase-group mass" = the share of the top-level Upper case Latin letters group in the crosshair distribution.)Fix
A paragraph now starts the canonical paragraph-start context: the alphabet default context (trailing whitespace stripped — the corpus has no
[space][para]sequences) followed by the paragraph symbol. Three sites, all inCAlphabetManager:GetContextSymbols(seeded/rebuilt contexts): symbols before the last paragraph symbol are replaced by the canonical seed symbolsCreateSymbolNode(live zoom): the paragraph node'"'"'s context is the canonical seed context rather than the parent chain extendedCSymbolNode::SetFlagNF_COMMITTED(adaptive learn): the trie keeps the learned[x][para]chain, but the node'"'"'s prediction context becomes the canonical seedTraining is unchanged — PPM vine learning already records after-paragraph statistics at every order. Alphabets without a paragraph symbol are untouched (
SymbolPrintsNewLineCharacterguards every site).Verification
test_paragraph_context.cpp): ten predecessor variants must yield exactly the canonical distribution, and it must differ from mid-word / bare-period contextsFollow-up needed on the Dasher-Windows side after this releases: bump the submodule pin.


Confidence Score: 5/5
The PR appears safe to merge; the remaining feedback is a non-blocking test gap.Findings
Summary
The PR makes newline predictions start from a consistent paragraph context.
No new actionable issues were found.
Reviews (5) · Last reviewed commit: "fix(lm): paragraph is a hard prediction ..." · Reviewed by Greptile