加载中…
加载中…
On-device English dictation cleanup for Kol, a macOS dictation app. The model takes a raw speech-recognition transcript plus context from the screen (vocabulary, conversation title, the focused text field, the user's custom spelling rules) and returns the same words with punctuation, capitalization, filler removal and context spellings fixed. It does not rephrase.
It is SmolLM2-360M-Instruct with a rank-16 LoRA merged in, converted to a Core ML ML Program (fp16, macOS 15+) with a stateful key-value cache.
| Path | What |
|---|---|
Cleanup.mlpackage |
The model. Compile it once on the Mac (MLModel.compileModel(at:)). |
tokenizer.json, tokenizer_config.json, vocab.json, merges.txt, special_tokens_map.json, chat_template.jinja, config.json |
SmolLM2 tokenizer and configuration. |
cleanup-manifest.json |
Input and output contract, prompt version (compact-en-v2), checkpoint digest. |
input_ids int32 [1, q]: the next q tokens (1 to 1,024).cache_position int32 [1]: where those tokens start in the cache.causal_mask float16 [1, 1, q, 1024]: 0 where a query may attend, -10000 elsewhere.key_cache, value_cache: the 1,024-token cache.token_ids int32 [1, q]: the greedy next token after each input position. Kol uses this to verify up to
32 drafted tokens per call, copied ahead from the transcript, so most of a cleanup takes a few calls.The chat has Kol's system prompt (compact-en-v2, in KolCore/LocalCleanupPrompt.swift) and one user message: a
JSON object with text, category, vocabulary, conversation_name, focused, ide, custom_rules,
mentions_enabled and language. The reply is the cleaned text, or EMPTY.
LoRA fine-tune (rank 16, 5,500 steps, batch 8, learning rate 2e-4) starting from an adapter trained on Kol's fictional generated cleanup data. The mix:
No user dictations were used for training.
English only. Up to 1,024 tokens of prompt and output together. It sometimes still drops or misspells a word ("erred" written "errred"). Kol checks every output against the transcript and pastes the transcript when a context name appears where the speech does not support it.