Skip to content

Ask the model as each word starts, and let it choose a typo's spelling - #3

Merged
drknowhow merged 2 commits into
mainfrom
feat/model-picks
Oct 21, 2026
Merged

drknowhow merged 2 commits into
mainfrom
feat/model-picks

Conversation

@drknowhow

Copy link
Copy Markdown
Owner

A guessed fix held the user's keys for 150-250 ms while the model was asked, and the model could only veto a fix. Now the app asks the model when each word starts, so the answer is usually ready by the space. The model can also choose a typo's spelling among its one-slip candidates, weighing its next-word probability against the typing cost, and the pick must be four times likelier than any rival, including the word as typed.

On 1,434 synthetic typos in Harper's test texts (examples/fix_eval.rs), 0.1.3 made 1,030 right fixes and 24 wrong ones; this branch makes 1,130 right and 22 wrong.

Risk: one model request per word typed. That's about 15-20 ms each on an idle GPU; when another job loads the GPU, answers can miss the 300 ms window and those fixes are skipped. cargo test --release --workspace --exclude cc-bench passes. The Chrome e2e passed 3 textbox runs and 1 bare-field run with 0 failed lines; a fourth run aborted when the test window lost focus.

https://claude.ai/code/session_01DiRshLaPboWShtRAdGazjy

Checker::typo_options lists the dictionary words a typed word may stand
for: one edit away (the first letter may change) or doubled keys, cheapest
typo first, with the typing-error cost. It offers nothing for a known word,
one under four letters, one with a capital, code, or an abbreviation. Two
slips are left out because they reach too many words (colud is could, not
would). rank_spelling now shares the scored pool with it.

Claude-Session: https://claude.ai/code/session_01DiRshLaPboWShtRAdGazjy
At the first letter of a word, the app asks the model for its likeliest
next tokens after the text before it, on the engine's runtime, and a new
question withdraws the one before. At the word's end the answer is usually
there, so a guessed fix no longer holds keys for 150-250 ms; it waits up to
300 ms only when it is not.

fixgate::model_pick chooses among the typo's one-slip spellings: each scores
the model's log probability of its whole-word token less twice its typing
cost, and the best must be four times likelier than any other option, a
token the typo starts with, and the word as typed. A misspelling the rules
leave open (S2) is fixed only by such a pick, logged as spell_context. A
guessed S0 fix may become the pick. A doubled-key fix takes the pick only
when the answer is already in.

examples/fix_eval.rs puts one slip in a word of each sentence of Harper's
test texts and runs the decision. On 1,434 typos, 0.1.3 made 1,030 right
fixes and 24 wrong ones. This change makes 1,130 right and 22 wrong.

Claude-Session: https://claude.ai/code/session_01DiRshLaPboWShtRAdGazjy
@drknowhow
drknowhow merged commit 8021e1e into main Oct 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant