Skip to content

perf(batch): skip GPU work on silence and single-speaker audio - #22358

Merged
Git-on-my-level merged 3 commits into
mainfrom
lane/opus-silence-skip
Oct 19, 2026
Merged

Git-on-my-level merged 3 commits into
mainfrom
lane/opus-silence-skip

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

What

The batch GPU worker ran pyannote diarization over the whole unit, silence included (diarizer/batch_pipeline.py, self.diarize(state['samples'])). Meanwhile ASR already saw only padded VAD windows, and silence-only units already skipped both stages. Diarization is the main GPU cost per unit. This PR changes only the decision of whether, and on which samples, diarization runs. Batching, ASR and VAD are untouched.

  1. Speech-only diarization. BATCH_PIPELINE_DIARIZE_SPEECH_ONLY_ENABLED is a ship-on kill switch (Helm worker.diarizeSpeechOnlyEnabled).
    • The evidence set is unpadded VAD speech ∪ every emitted word clock, so a word that ASR found in context outside VAD is never withheld.
    • Each region is padded by 1 s. Regions less than 4 s apart keep the audio between them. Pieces are joined with 0.5 s of zeros, and turns and overlaps map back to capture clocks.
    • The full unit is diarized instead in two kinds of case, each recording omi_fallback_total{component="vad",from="batch_speech_only_diarization"}:
      • more than 80% of samples would be kept: reason="kept_over_80pct", outcome="recovered";
      • compaction or mapping errors, or compacted output with no turns while words exist: reason="other", outcome="degraded".
    • New Prometheus counters:
      • omi_batch_pipeline_diarization_decisions_total{decision}: one count per decision.
      • omi_batch_pipeline_diarization_audio_seconds_total{kind=unit|diarized}: unit seconds against diarized seconds, which gives the measured retained fraction in prod.
      • omi_batch_pipeline_compacted_unassigned_{units,words}_total: compacted results where a diarizer gap inside a retained piece leaves words with no turn.
  2. Short single-speaker skip, default OFF. BATCH_PIPELINE_SHORT_SPEECH_SINGLE_ENABLED (Helm worker.shortSpeechSingleEnabled=false). Only true turns it on, so an unset env means off.
    • When on: if all evidence forms one region of at most 2 s, the worker writes the existing skipped_single SPEAKER_00 payload plus single_evidence: short_speech. Pauses of at most 0.5 s (inclusive) join; a longer pause splits.
    • It labels without any model check, so it is held off.
    • Enablement precondition: a paired run on the prod pyannote revision 3533c8cf8e369892e6b79ff1bf80f7b0286a54ee. The run must show the full diarizer returning a single speaker on the gate's own evidence (VAD plus words), including two bursts at most 0.5 s apart.
  3. Silence (c) is unchanged: an empty VAD result already skips ASR and diarization and persists outcome: silence. The strict-speech guard is untouched (worker_silence disposition and no_recoverable_speech paths). Nothing new can mark speech-bearing audio as silence.

New pure module: utils/batch_pipeline/diarization_gate.py. The flags are registered in config/feature-flags.yaml, the deployment classification and the chart. Docs: diarizer/batch_pipeline_runtime.md and docs/listen_pusher_pipeline.mdx.

Equivalence evidence

Transcript. By construction, ASR inputs, words, word clocks and speech_spans are identical with either switch on or off. Unit test test_sparse_unit_diarizes_speech_only_with_identical_words_and_asr asserts identical ASR calls and an identical words payload. It also asserts that every word midpoint falls inside a mapped turn.

Speaker labels: public AMI fixtures.

  • Setup: 16 AMI test meetings with a headset mix. Community-1 runs at the public-mirror revision 8a52737, which is not prod's 3533c8c. VAD uses the prod construction (min_duration_on/off=0). Runs were on MPS (M5) at nice 19, comparing the full-unit path against the speech-only path. Fixtures insert -55 dBFS noise gaps to imitate wearable capture.
  • Pseudo-words are reference speech in 0.4 s tiles. Word accuracy is optimally mapped against the AMI reference.
Layout (16 each) Kept audio Diarization wall DER full → speech-only Word accuracy full → speech-only Unassigned words full → speech-only
sparse (3×40 s speech, 90 s gaps) 40.4% 40.5% 21.95% → 22.14% 82.26% → 82.71% 95 → 90 of 4,978
choppy (12×8 s, 20–40 s gaps) 26.3% 26.8% 23.79% → 26.86% (false alarm in padding +4.5 pts; confusion −1.0 pt) 81.94% → 83.17% 109 → 93 of 3,957
dense (native meeting) 100% (gate declines) 100% identical identical identical
  • Tolerance: word-level speaker accuracy must not drop, and unassigned words must not increase. Both hold in every aggregate.
  • 14 pseudo-words (of 8,935) were assigned on the full path and unassigned on the speech-only path. In the other direction, 35 fewer were unassigned overall.
  • The choppy DER rise is false alarm inside retained padding. assign_words labels only words, so the rise does not reach transcript labels.

Short single-speaker skip (shipped off). We built 357 isolated AMI excerpts of 1–3 s inside 28 s of quiet. Of these, 223 qualified for the skip. On the full path, pyannote returned more than one speaker on 0 of 223 (reference had 2 or more speakers on 50 of them). On those excerpts the skip changed no word label relative to the full path: 0 of 1,796 pseudo-words were off the full-path majority. This does not qualify the skip for prod, for three reasons:

  • the weights are not prod's revision;
  • every excerpt is one continuous slice, with no two-burst case joined by a pause of 0.5 s or less;
  • 50 of the 223 had two or more reference speakers.

That is why the switch ships off.

GPU-time estimate (estimate, from code structure)

  • Measured on MPS for 300 s: VAD takes 1.1 s and diarization 15.3 s, so VAD is about 7% of diarization.
  • Docs give pyannote RTF ~0.04 against Parakeet ~0.0025 on padded speech. That is cross-GPU, but it puts diarization at roughly 0.9 of chain GPU time.
  • Diarization wall time scales with retained audio (measured ratio 0.405 against a kept fraction of 0.404).
  • Kept fraction on wearable audio is unmeasured. Live-gated speech is 40.8% of capture, so with padding and joins the expected kept fraction is about 0.4–0.6.
  • Estimated saving is 0.9 × (1 − kept), or about 36–54% of batch GPU time (1.6–2.2× chain throughput), The short single-utterance skip would save one more full diarization call per short unit, but it ships off.
  • Not measured on L4. The virtual-clock sim (test(backend): virtual-clock batch-pipeline capacity simulation #22201) models GPU time as a constant per item with a stub diarizer, so it cannot model this change.

Verification

  • tests/unit/test_batch_pipeline_diarization_gate.py: 40 tests covering the pure gate, a 25-seed property test that every evidence sample is retained and maps back exactly, worker integration, fallbacks, fatal CUDA still fencing the chain, the short-single skip, silence, and the kill switches.
  • tests/unit/test_batch_pipeline_worker.py: the existing suite is pinned to the full-stage path.
  • tests/unit/test_batch_pipeline_chart.py: chart defaults and the false render.
  • The empty-disposition, terminal-empty and validation-disposition suites pass with the switches on by default.
  • All test runs used bin/omi-heavy with nice -n 19.
  • scripts/check_feature_flag_registry.py and the line-count ratchet are OK.
  • Bench scripts are at /Volumes/Ephemeral/scratch/opus-silence-skip/ (local workspace record).

Rollback: set Helm worker.diarizeSpeechOnlyEnabled=false. The short-single skip is already off.

Review (Grok, FIX-FIRST) is addressed in the merge commit: short-single now defaults off in both code and Helm, the dense fallback is counted, the pause boundary is documented as inclusive, and the Prometheus counters above are added. The branch was merged with origin/main (#22352), not rebased.

Product invariants affected

none

🤖 Generated with Claude Code

Diarize only padded VAD and word evidence, mapped back to capture clocks,
and take the existing skipped_single result for one short contiguous
utterance. Both decisions are ship-on kill switches
(BATCH_PIPELINE_DIARIZE_SPEECH_ONLY_ENABLED,
BATCH_PIPELINE_SHORT_SPEECH_SINGLE_ENABLED). ASR input and words are
unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T05:40:55.137088Z 71bba59 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Git-on-my-level and others added 2 commits October 19, 2026 12:01
- Short single-speaker skip ships off: unset env and Helm default are false;
  enable only after a paired prod-revision qualification (documented).
- Dense (>80% kept) fallback now records omi_fallback_total with
  reason=kept_over_80pct; error fallbacks keep reason=other.
- Docs and code agree: pauses up to 0.5 s (inclusive) join a short region.
- Prometheus counters for diarization decisions, unit vs diarized seconds,
  and compacted results with unassigned words.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Git-on-my-level
Git-on-my-level merged commit 64b082e into main Oct 19, 2026
58 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/opus-silence-skip branch October 19, 2026 06:00
Git-on-my-level added a commit that referenced this pull request Oct 19, 2026
…ker-gpu

Compose flight packing with speech-only diarization. When speech-only is
on, the compacted waveform keeps its serial pyannote apply: there is no
full-unit packed embedding or cached segmentation, and the uncached
get_embeddings hook uses the per-file shared trunk only. Packed
segmentation still feeds VAD.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Git-on-my-level added a commit that referenced this pull request Oct 19, 2026
…and GPU paired-run gates (#22426)

* feat(parity): contract (j) parity gate, (h) soak checks, F6 corpus and GPU paired-run gates

Lane 5 of the legacy-retire swarm (M1 slice):
- scripts/parity/parity_gate.py: rows 1-8 of contract (j) on --surface staging
  and --surface prod-shadow (rows 3-6 gate ladder ADVANCE), parity_report.json,
  PARITY_PASS/FAIL/PENDING last line, data_loss for rows 5/7 (ROLLBACK_ZERO).
- scripts/parity/soak_check.py: the ten 12h legacy-dark soak checks; the
  lost-recording census must start at draining; all four legacy queues
  including sync-backfill-fresh; read-only live collectors.
- scripts/parity/fleet_sample.py: rows 3/4 from the fleet gate's JSON sample
  (strict 121s dispatch breach) and the gate's data-loss tokens.
- testing/quality_corpus: pinned public corpus (AMI/LibriSpeech/VoxConverse +
  silence), production-chain runner, scorer, and the paired runs gating
  #22368 (flight batching: qualify receipt re-verified plus chain pair) and
  #22358 (short-speech skip: fired units vs full diarizer), with an L4 Job
  template for staging.

No GCP access in tests; reports carry aggregates and opaque keys only.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(parity): load scipy/jiwer at import so timed unit calls stay under the CPU guard

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
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