Skip to content

ios: add Core ML Cleanup Tagger v2 container-app pipeline - #3075

Merged
kitlangton merged 1 commit into
devfrom
ios-cleanup-v2
Nov 29, 2026
Merged

kitlangton merged 1 commit into
devfrom
ios-cleanup-v2

Conversation

@kitlangton

Copy link
Copy Markdown
Collaborator

Container-app dictation on iPhone can now run the four-head Core ML Cleanup Tagger v2 with full Rust parity and zero extra keyboard extension memory.

Before: iOS only ran the v1 single-head deletion tagger (CleanupTagger), without v2's punct_after punctuation restoration, case head, BIO span ITN, Round 4 paired-phrase guard, or Cleanup v2.1 post-passes.

After: HEXMobile includes a complete Swift port of desktop src/dictation/cleanup/v2/ behind a Labs toggle (off by default) that runs strictly in the container app's DictationController and falls back cleanly when the 32.7 MB model bundle isn't installed.

- DictationController -> DictationPipeline -> CleanupTagger v1 only
+ DictationController -> DictationPipeline(cleanupOverride: CleanupV2Engine) ->
+   BpeTokenizer (512-tok windows) -> Core ML 4-head (.cpuOnly) ->
+   CleanupV2Decoder (GECToR bias + guards + punct_after/case + ITN + clock.rs) ->
+   CleanupV2Post (meridiem carry + compound vocab join + email surname alignment)

Key details

  • Zero extra RAM in HEXKeyboard: all Cleanup v2 code lives in ios/HEXMobile/CleanupV2/ (not compiled into HEXKeyboard). HEXShared/DictationPipeline.swift only accepts an optional cleanupOverride closure.
  • No model weights in git: CleanupV2ModelStore loads from the container app's Application Support/models/cleanup-v2/ (CleanupTaggerV2.mlpackage or pre-compiled CleanupTaggerV2.mlmodelc, tokenizer.json, optional runtime.json), excluded from iCloud backups. Next step: host the 32.7 MB INT8 bundle (e.g. GitHub Release asset with SHA-256 manifest, matching ParakeetUltraModel) and add a Settings › Labs download button.
  • Safe rollout: Settings › Labs › Clean up what I say v2 defaults to off and stays disabled until the local bundle is installed; missing model, errors, or budget timeouts return nil and fall back cleanly.

Verification

Suite Result
HEXMobileTests/CleanupV2Tests (17 tests, incl. 600/600 render-parity.json & all model-parity.json) 17 passed, 0 failed (0.47s)
Full HEXMobileTests suite (iOS Simulator) 1,035 passed, 0 failed (5 opt-in replay skips)
scripts/code-shape.py 0 hard problems; all new files < 800 lines

Read: ios/HEXMobile/CleanupV2/CleanupV2Engine.swift and ios/HEXMobile/DictationController.swift for lifecycle, budget gating, and fallback; CleanupV2Decoder.swift / CleanupV2ITN.swift / CleanupV2Post.swift are a direct port of src/dictation/cleanup/v2/.

@kitlangton
kitlangton merged commit 0062bc0 into dev Nov 29, 2026
1 check passed
@kitlangton
kitlangton deleted the ios-cleanup-v2 branch November 29, 2026 01:06
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