Skip to content

QVAC-22367 fix(parakeet): window the offline encoder for long audio#101

Draft
Zbig9000 wants to merge 1 commit into
tetherto:masterfrom
Zbig9000:QVAC-22367-parakeet-long-audio
Draft

QVAC-22367 fix(parakeet): window the offline encoder for long audio#101
Zbig9000 wants to merge 1 commit into
tetherto:masterfrom
Zbig9000:QVAC-22367-parakeet-long-audio

Conversation

@Zbig9000

@Zbig9000 Zbig9000 commented Jul 21, 2026

Copy link
Copy Markdown

QVAC-22367 — Parakeet long-audio OOM fix (engine)

Problem

Engine::transcribe_samples / transcribe_samples_stream run the FastConformer
encoder over the entire input in a single graph. Self-attention is O(T_enc²), so
long audio builds enormous score tensors — a ~90 min file needs ~100 GB and the
process is SIGKILLed. The 0.3.3 ONNX long-form windowing was never re-implemented
for the GGML batch path.

Fix

When the input would exceed the per-window encoder-frame ceiling (auto:
min(pos_emb_max_len, 3750)), slide the encoder over the audio in overlapping
windows, trim the shared context at the interior seams, and concatenate the
committed frames into the same [T_enc, d_model] buffer the decoder already
consumes — bounded peak memory, single decode, no mid-word cuts. Inputs that fit
one window keep the bit-identical single-pass path, so short/typical files are
unaffected. New EngineOptions.long_form_window_frames /
long_form_context_frames (0 = auto, <0 = disable) make it tunable/testable.

Tests

  • test-long-form-windows — model-free planner unit test (centre coverage, no
    seam gaps/duplicates, bounded window size incl. a 90-min case). Runs on every
    checkout.
  • test-long-form — fixture-gated windowed-vs-single-pass parity on CTC/TDT.

Built all 101 targets and ctest green locally (CPU); the model-gated parity
test runs on CI where the GGUF fixtures are staged.

Base / reorg note (draft)

This branch is based on ecac5bb7 (the commit the shipped parakeet-cpp
2026-07-13#2 registry port pins) to keep the bugfix isolated and fully
validated against the currently-shipping tree. master has since moved
parakeet-cpp/engines/parakeet/ (reorg PR #95); the change needs replaying
onto engines/parakeet/ (a mechanical relocation) before it can merge cleanly.
Opening as draft pending that rebase / a decision on the preferred base.

Companion PRs

transcribe_samples() / transcribe_samples_stream() ran the conformer
encoder over the whole input in a single graph. Self-attention is
O(T_enc^2) in encoder frames, so multi-hour inputs allocated tens of GB
of attention scores and OOMed the process (a ~90 min file needs ~100 GB
and was SIGKILLed). The 0.3.3 ONNX long-form windowing was never
re-implemented for the GGML batch path.

When the input would exceed the per-window encoder-frame ceiling (auto:
min(pos_emb_max_len, 3750)), slide the encoder over the audio in
overlapping windows, trim the shared context at the interior seams, and
concatenate the committed frames into the same [T_enc, d_model] buffer the
decoder already consumes -- bounded peak memory, single decode, no
mid-word cuts. Inputs that fit in one window keep the bit-identical
single-pass path, so short/typical files are unaffected.

New EngineOptions knobs long_form_window_frames / long_form_context_frames
(0 = auto, <0 = disable) make the window tunable and testable.

Tests:
- test-long-form-windows: model-free planner unit test (centre coverage,
  no seam gaps/dupes, bounded window size incl. a 90-min case). Runs on
  every checkout.
- test-long-form: fixture-gated windowed-vs-single-pass parity on CTC/TDT
  (auto-disabled when the GGUF/wav aren't staged).
@github-actions

Copy link
Copy Markdown

Review Status

Current Status: ❌ PENDING
Approvals so far: none

Pending reviews: Needs 1 Management or Team Lead, and 1 more from Management, Team Lead, or Member.

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.

2 participants