Repository navigation
Make personal learning incremental - #28
Merged
Merged
Conversation
Each learn cloned the full baseline and reloaded every personal count, about 190 ms per sentence on the production baseline. When PRAGMA data_version shows no other connection has committed since the snapshot, add only the new counts with the existing weight. Otherwise reload and validate as before. Predictions and scores stay bit-identical to a full reload. Median cost is now about 9 ms. Closes #27 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A trigger can give the connection's own write side effects that only a full reload validates, so learning takes the reload path whenever one exists, as before. A failed commit clears the recorded data_version, so the next write reloads. Unit tests show the fast path runs, and when it does not. Refs #27 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Constraints such as UNIQUE ... ON CONFLICT REPLACE, foreign-key actions or a missing CHECK can also give the connection's own write effects beyond its counts. Learning adds counts in place only when the personal database has exactly the schema initialize creates; anything else reloads and validates. Refs #27 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 12, 2026
enaboapps
pushed a commit
that referenced
this pull request
Oct 12, 2026
The in-place update test now covers words the baseline trusts, an import and a duplicate import. The timing test also times a learn that makes a new word usable. Measured against #28 on the same workload, prediction and learning costs match within noise, so the docs say so. Refs #29 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 12, 2026
Closed
Merged
enaboapps
marked this pull request as ready for review
October 12, 2026 15:53
Contributor
Author
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.
Closes #27
Predictor::learnandimportused to clone the whole baseline and reload every personal count on each call. Now, whenPRAGMA data_versionshows that no other connection has committed since this predictor's snapshot, they add only the new counts to the in-memory snapshot, with the same 5× weight. Otherwise they reload and validate everything, as before. The fast path also requires the personal database to have exactly the schemainitializecreates. Triggers, replacing constraints, foreign-key actions and other changes can give the connection's own write side effects that only the full reload validates. A failed commit clears the recorded version, so the next write reloads. A connection's own commits leave itsdata_versionunchanged. The version is read inside the transaction, so no fallible work follows the commit.refresh_personalandreset_personalrecord the version too. The schema, API and prediction maths are unchanged.Results
Production
en-aac-oanc-v1baseline, release build, 50 sentences (ignored testlearning_cost_on_production_baseline):Validation
incremental_learning_matches_a_full_reload: after each learned text, the ranked words and score bits match a freshly opened predictor.learning_after_another_writer_includes_its_counts: a second writer's counts, and a reset by another instance, are picked up through the full-reload path. Results match a reload throughout.a_trigger_side_effect_is_still_validated_before_commitanda_replacing_constraint_is_still_validated_before_commitcheck that both schema-based cases are still refused and rolled back, as on main.duplicate_imports_and_empty_text_match_a_full_reload.cargo fmt --check,cargo clippy --locked --all-targets -D warningsandcargo test --lockedpass.This is independent of #26. Switchify PC needs this before it can learn while someone types.
🤖 Generated with Claude Code