Skip to content

fix(adaptive): guard None history in convergence improvement delta - #541

Merged
wilke0818 merged 1 commit into
alphafrom
fix/adaptive-convergence-none-history
Jul 28, 2026
Merged

fix(adaptive): guard None history in convergence improvement delta#541
wilke0818 merged 1 commit into
alphafrom
fix/adaptive-convergence-none-history

Conversation

@wilke0818

@wilke0818 wilke0818 commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Problem

apply_convergence_marks (adaptive/convergence.py) computed the per-bucket round-over-round improvement as hist[-2]["aggregated_uncertainty"] - hist[-1]["aggregated_uncertainty"] with no None guard.

aggregated_uncertainty is float | None — a bucket is None when the axis can't score that round. The utterance axis marks a bucket comparison_status="incomparable" (→ None) when a window has no comparable ASR words, common on sparse/gappy speech. A bucket can flip Nonefloat across adaptive rounds (reprocessing adds/removes words), so its history can hold a None next to a float, and the subtraction raises TypeError: unsupported operand type(s) for -: 'NoneType' and 'float' — crashing the loop for the whole clip, even though the current value is already guarded a few lines up (if u is None: continue).

Impact: adaptive_loop failed on 5/30 clips in a real batch — all sparse-speech (Word-color-Stroop, Random-Item-Generation, Story-recall, Picture-description), which have many incomparable utterance buckets.

Fix

Guard both history entries; if either round was None, improvement is unmeasurable across it, so leave improvement=None (bucket stays open, not stalled) instead of crashing. No behavior change when both rounds are scored.

Testing gap

Same blind spot as the recent subprocess-venv fixes: the adaptive tests don't exercise a clip whose cross-round history contains incomparable (None) buckets. A fixture with a Nonefloat history transition would regression-cover it.

Base: alpha.

🤖 Generated with Claude Code

Version

Published prerelease version: 1.3.1-alpha.37

Changelog

🐛 Bug Fix

  • fix(adaptive): guard None history in convergence improvement delta #541 (@wilke0818)
  • refactor(cache): cached-inference layer out of analyze_audio.py (T051, parts 1-2) #538 (@satra)
  • Scene-aware presence/quality axis + ASR transcription overhaul (CrisperWhisper 2.0, Qwen) #536 (@satra @claude)
  • feat(canary): split long audio at pauses to avoid the ~40s truncation #534 (@wilke0818)
  • ScriptLine: accept empty text as "model produced no transcript" signal #520 (@wilke0818)
  • Feat/pii subprocess venv #519 (@wilke0818)
  • subprocess_venv: route torch/torchaudio via CUDA-aware PyTorch index #516 (@satra @wilke0818)
  • subprocess_venv: two-stage install to fix torch/torchaudio CUDA-tag s… #518 (@wilke0818)
  • Fix/ser wav2vec2 regression head #511 (@satra @wilke0818 @claude)
  • comparison & uncertainty stage for analyze_audio.py #512 (@satra)
  • audio analysis script + multilingual MMS aligner + 4 new ASR backends #510 (@satra)

Authors: 3

apply_convergence_marks computed the per-bucket round-over-round improvement as
`hist[-2]["aggregated_uncertainty"] - hist[-1]["aggregated_uncertainty"]` with no
None guard. aggregated_uncertainty is `float | None`: a bucket is None when the
axis can't score that round — e.g. the utterance axis marks buckets
comparison_status="incomparable" (-> None) when a window has no comparable ASR
words, common on sparse/gappy speech. A bucket can flip None<->float across
adaptive rounds (reprocessing adds/removes words), so its history can hold a None
next to a float and the subtraction raises `TypeError: unsupported operand
type(s) for -: 'NoneType' and 'float'`, crashing the loop for the whole clip even
though the *current* value is guarded a few lines up.

Observed: adaptive_loop failed on 5/30 clips in a real batch — all sparse-speech
(Word-color-Stroop, Random-Item-Generation, Story-recall, Picture-description),
which have many incomparable utterance buckets.

Fix: guard both history entries; if either is None we can't measure improvement
across that round, so leave improvement=None (bucket stays open, not "stalled")
rather than crashing. No behavior change when both rounds are scored.

Same test blind spot as the sibling venv fixes: the adaptive tests don't exercise
a clip with incomparable (None) buckets in the cross-round history.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@wilke0818
wilke0818 merged commit da62055 into alpha Jul 28, 2026
10 checks passed
@wilke0818
wilke0818 deleted the fix/adaptive-convergence-none-history branch July 28, 2026 21:31
github-actions Bot added a commit that referenced this pull request Jul 28, 2026
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