Skip to content

Use model-only word prediction - #881

Merged
enaboapps merged 3 commits into
mainfrom
codex/880-model-only-prediction
Sep 25, 2026
Merged

enaboapps merged 3 commits into
mainfrom
codex/880-model-only-prediction

Conversation

@enaboapps

@enaboapps enaboapps commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Closes #880

Change

  • Use the pinned on-device model as the sole word prediction engine. The saved enhancedWordPrediction field remains compatible but no longer changes engines.
  • Load it in the worker asynchronously; leave suggestion slots empty while loading and show an unavailable status on failure or slow inference while keeping keyboard input usable.
  • Remove the bundled lookup, SQLite source, converter, package entry, and CI checks. Keep the tokenizer and blocklist.
  • Use one Word prediction control and update its help text.

Validation

  • Node 24: npm run lint, npm test (224 UI tests, 5 feed tests), npm run build passed.
  • Rust 1.97.1: cargo fmt --manifest-path src-tauri/Cargo.toml --check, cargo clippy --manifest-path src-tauri/Cargo.toml --all-targets -- -D warnings, cargo test --manifest-path src-tauri/Cargo.toml (552 unit tests, 7 config tests) passed.
  • Model quality comparison, 6 synthetic contexts: model-only returned 5 suggestions for w, wa, cup of, ket, wh, and fa; tea, kettle, WhatsApp, and water remained present. Model-only inference took 60–353 ms; prior combined model samples took 32–156 ms and lookup-only median was 0.01 ms after a 6.7 s startup. The ket tail differs (model-only includes ketogenic, keto, kets rather than lookup words), while its top kettle result remains. More real-use validation is pending.
  • Windows 11 Parallels ARM64: built src-tauri/target/aarch64-pc-windows-msvc/debug/switchify-pc.exe from this branch and launched it in the interactive desktop session. The existing Space Select assignment started scanning. A temporary F8 Open keyboard assignment opened the native scanned keyboard; its first frame showed Loading predictions · Keyboard ready and five empty suggestion positions. On resuming the scan, the status advanced to Letters · Select a row, which means model loading completed without a failure status. Escape closed the overlay. The temporary F8 assignment was removed. The VM test used injected keyboard switch events; no physical switch device was connected. It did not verify a completed model suggestion in a Windows text app.
  • Independent review of bd33b340e9806478c40917bfd8516799f8448e87: no actionable findings. All required CI passed, including frontend, macOS native, Windows native, CodeQL, JavaScript/TypeScript analysis, and dependency audit.

Follow-up: prediction feedback and retry

  • The keyboard header now shows a passive prediction badge alongside the scan prompt: loading, ready for input, no suggestions, suggestion count, paused tracking, or unavailable. It contains no typed text and cannot be scanned or selected.
  • On failure, the toolbar adds Retry predictions. Selecting it discards the old worker and private context, starts loading a fresh worker, and keeps the keyboard open. The setting and help text explain this.
  • Node 24 lint, tests (224 UI + 5 feed), and build passed. Rust 1.97.1 fmt, clippy with warnings denied, and tests (555 unit + 7 config) passed. Native frame, retry state, and private-state cleanup tests were added.
  • The new badge and retry tile were verified with native-frame and fake-state tests; the earlier Windows VM interaction above was on the preceding head. No additional live VM interaction has been performed for this follow-up.
  • Independent review of latest head 772ba6e: no actionable findings. All latest-head CI passed, including Windows UI Access and macOS native packaging.

@enaboapps
enaboapps marked this pull request as ready for review September 25, 2026 10:01
@enaboapps
enaboapps marked this pull request as draft September 25, 2026 10:37
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.

Use the on-device model as the sole word prediction engine

1 participant