Repository navigation
feat(disfluency): the parser takes back self-corrections, off by default - #374
Merged
Merged
Conversation
scripts/disfluency-model-reference.py runs the measured path of the cut check in the training code: t-silver 42 parses the filler view in windows that fit 256 subwords, the tree cutter groups the reparandum arcs into candidates, and the cut filter scores each one on the text features and the parser's own block-11 vectors. It writes tests/disfluency-model-parity.json, one case per line. The filler view is the built-in `fillers` table and its tidy-up, the text the parser was measured on. Cuts map back to the input's words, with any filler inside a cut, and the output is assembled from the input, so fillers outside a cut stay for the `fillers` step. 146 cases: the disfluency case set, 43 written sentences and two inputs over 256 subwords. 90 candidates, 48 kept at 0.80. A case with a candidate within 0.002 of the threshold is left out, since float16 noise could flip it: one case. Signed-off-by: Nathan Zylbersztejn <[email protected]> Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01WfxPEjc1EEGqG2rHoJcLJ2
Parser.analyse returns the parse plus what the tree cutter reads per word: P(abandoned) and P(cue) from the tag head on the fused word features, and s_hidden10 pooled to words through float16. parse keeps its output. Signed-off-by: Nathan Zylbersztejn <[email protected]> Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01WfxPEjc1EEGqG2rHoJcLJ2
TreeCutter runs the measured Python on one text: the filler view, the windows that fit 256 subwords, the reparandum groups, the 7 text features and the three pooled vectors, then the cut filter's P(real). Kept cuts map back to the input's words and the output is assembled from the input. SyrinxModel loads the cut filter with the parser. Signed-off-by: Nathan Zylbersztejn <[email protected]> Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01WfxPEjc1EEGqG2rHoJcLJ2
Prints each candidate with its P(real) and the output. --batch reads many inputs in one loaded process and prints JSON lines. Signed-off-by: Nathan Zylbersztejn <[email protected]> Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01WfxPEjc1EEGqG2rHoJcLJ2
Runs --tree-cut --batch on tests/disfluency-model-parity.json and compares candidates, kept cuts, P(real) within 1e-3, the cut and the output. 146/146, largest P(real) difference 2.95e-05. Signed-off-by: Nathan Zylbersztejn <[email protected]> Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01WfxPEjc1EEGqG2rHoJcLJ2
`warm()` starts the load or the fetch in the background, with a five-minute backoff after a failure. `ready(within:)` is what a dictation asks: no cache returns at once and starts the fetch, a cached copy is waited for up to the cap and then left loading. The setup screen gets a row, and the first prediction runs inside the load. Signed-off-by: Nathan Zylbersztejn <[email protected]> Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01WfxPEjc1EEGqG2rHoJcLJ2
A fixed pass named `tree_cutter`, off by default. On, it runs after `vocabulary` and before the list, English only, and publishes every candidate with its P(real) and verdict, the counts, the threshold and why it declined. `threshold` must be 0 to 1. With the block off or absent nothing fetches or loads the model. Signed-off-by: Nathan Zylbersztejn <[email protected]> Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01WfxPEjc1EEGqG2rHoJcLJ2
Signed-off-by: Nathan Zylbersztejn <[email protected]> Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01WfxPEjc1EEGqG2rHoJcLJ2
|
Automatic reviews are disabled for this repository. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Owner
Author
|
/review |
Owner
Author
|
/agentic_review |
This was referenced Nov 2, 2026
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.
A new pass takes back self-corrections with the parser, not with rules: "ship it on Monday, no, on Tuesday" becomes "ship it on Tuesday". The parrotflow-syrinx tree cutter proposes each stretch its parse marks as a reparandum, and the cut filter keeps the ones it scores at P(real) ≥ 0.80. It is off by default, behind
transcription.disfluency.enabled, and English only. Off, nothing changes and nothing is downloaded. Review the port inTreeCutter.swiftagainst the Python spec, and the loading rule inSyrinxModel.ready(within:).Why
The cut check and the filter-vectors work measured the tree cutter plus the cut filter on the parser's own block-11 states (
training/syntax-parser/CUT_CHECK.md,FILTER_VECTORS.md). This PR ports exactly that path to Swift, so it can be tried on real dictations. P1 (the repeat, marker and cue rules) is not in this PR. The Pythondisfluencytransform stays as it is.Scope
TreeCutter.swift: the filler view (the built-infillerstable andReplacements.tidy, the text the parser was measured on), thecue_ruletokenizer,windows()(sentences, then commas, then 60-word runs, each window under 256 subwords), the candidates (audio_cue.candidates.groups), the 7 text features, the vectors pooled froms_hidden10, andassemble. Kept cuts map back to the input's words, with any filler inside a cut. Fillers outside a cut stay for thefillersstep.CutFilter: readscut-filter.safetensorsand checks its 1,159 feature names.Parser.analyse: the tree, plus the tag head's P(abandoned) and P(cue), pluss_hidden10pooled per word.tree_cutter, aftervocabularyand beforepipeline:, where spoken numbers are still words.context_spellingstill runs last, as the code already has it. The stage is not calleddisfluency, because that namespace belongs to the Python transform.tree_cutter.count,kept,dropped,threshold,candidates(each candidate's words, P(real) and kept or dropped),declined, and a part spantree cutter.--check-configvalidates both keys and refuses a threshold outside 0 to 1.--tree-cutruns the pass from the command line. Docs:config.example.yaml,configuration.md,pipelines.md,cli.md, the skill catalogue.Tradeoffs
text_cuereads the cut words in CPython's set order, as the measured code did, not in sorted order. The Swift code emulates that order, so its decisions match what was measured.Blast Radius
Off by default, so no user sees a change until they turn it on. With the block off or absent, 264 inputs through
--replacegive byte-identical output to the base branch, and no parser files appear in a fresh home. On, it costs a 533 MB download and about 12 to 30 ms per dictation.Verification
scripts/check-disfluency-model-parity.sh(Core ML, fp32, cpuAndGPU) againsttests/disfluency-model-parity.json(PyTorch, written byscripts/disfluency-model-reference.py): 146/146 cases have the same candidates, kept cuts, cut and output. Largest P(real) difference 2.95e-05.training/), Swift against the measured Python at 0.80: all candidates, kept cuts and outputs agree, and the scorer's fixed and false-cut counts are equal.scripts/check-parser-parity.sh121/121.swiftlint0 errors,ruff,shellcheck. check-schema 70/70, check-pipeline 134/134, check-pipeline-config 98/98, check-skill 29/29, check-catalogue 52/52. These ran under a scratch config and home.Public-set parity, per set
The texts are the cut-check sets' filler text, so the filler view equals the input. Fixed / partly / missed / damaged items, then false-cut words, with the cut-check scorer. Both sides give the same numbers on every set.
Candidates are counted by distinct word set. The reference script, run on CV dev, reproduces the stored cut-check candidates and P(real) to 5e-7.
Fixtures, flag off, live and cost
5a9db5da) and this branch ran--replaceon the 120 pipeline-case inputs and the 144 non-empty fixture texts, under fresh scratch configs and homes. The output is identical withenabled: false, and identical with the block removed.scripts/check-pipeline.shprints the same 134/134 on both. Noparrotflow-syrinxpath appears in either home.--check-configlists notree_cutter. On with no cache, the pass declines with "parser not downloaded".--tree-cutfetched the model from Hugging Face (f3f75830) in 26.5 s and matched every pin. Then--replacecut "on Monday, no,".--pipeline --varspublished"Can" 0.244 dropped; "you," 0.754 dropped; "on Monday, no," 0.889 kept. French text withlanguages: [en, fr]declined with "not English".--tree-cut --batch, model warm, 5 interleaved rounds per process, two processes. 20 words 11.7 / 11.8 ms, 60 words 13.7 / 13.3 ms, 200 words 29.5 / 29.0 ms. With the flag off the stage is not in the pipeline, so it adds nothing. A cached load took 0.8 to 1.3 s, under the 2 s wait.scripts/check-sound.shfails 12/13 under a fresh home, on this branch and on the base alike: the neural phoneme model is not in that home.🤖 Generated with Claude Code
https://claude.ai/code/session_01WfxPEjc1EEGqG2rHoJcLJ2