Skip to content

test(align): pin saturation detection and index-capping behavior - #458

Merged
ivan-digital merged 1 commit into
mainfrom
test/aligner-saturation-coverage
Aug 19, 2026
Merged

test(align): pin saturation detection and index-capping behavior#458
ivan-digital merged 1 commit into
mainfrom
test/aligner-saturation-coverage

Conversation

@ivan-digital

Copy link
Copy Markdown
Member

Adds the missing coverage for the forced-aligner saturation handling that shipped in 435e280 (it landed alongside the Sortformer threshold change, so its rationale never made it into history).

What is pinned

  • findFirstSaturation: flags words stamped past the audio's end and plateau runs anywhere in the sequence (the old walk only saw trailing plateaus); sub-minSize runs and healthy alignments untouched; saturation at word zero reports index 0.
  • Cap-before-LIS: raw classify indices are capped to the audio's addressable range before monotonicity correction. The control test reproduces the original failure — an increasing drift of impossible indices wins the LIS anchor competition uncapped and drags genuine timestamps to garbage (words at 241.7s on a 222.7s recording).

Scope honesty: these changes make the aligner robust (no impossible outputs), not accurate on narrowband audio — on 8 kHz telephone material the classify head's per-word precision remains a model limitation; retraining with narrowband augmentation is the follow-up that would address it.

Regression risk: none — tests only. Full ForcedAlignerTests: 43/43; E2E CoreML fixture unchanged (align avg 216ms, RTF 0.011).

The saturation handling that shipped inside 435e280 (alongside the
Sortformer threshold change) had no coverage and its rationale never
made it into history. These tests pin both behaviors:

- findFirstSaturation flags a word stamped past the audio's end and a
  plateau run anywhere in the sequence, not only trailing; sub-minSize
  runs and healthy alignments stay untouched, and saturation at word
  zero reports index 0 so callers know there is no reliable prefix.
- Capping raw classify indices to the audio's addressable range BEFORE
  LIS correction is what keeps genuine timestamps as anchors: a slow
  upward drift of impossible indices is itself increasing, so uncapped
  it wins the anchor competition and drags real timestamps toward
  garbage. The control assertion reproduces that failure uncapped.

Observed in the wild on 8 kHz telephone audio, where the classify head
emits confident indices far past the file's end; the aligner returned
words at 241.7s on a 222.7s recording before the fix.

Tests only; no behavior change. Full ForcedAlignerTests: 43/43.
@ivan-digital
ivan-digital merged commit aa65817 into main Aug 19, 2026
5 checks passed
@ivan-digital
ivan-digital deleted the test/aligner-saturation-coverage branch August 19, 2026 10:50
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