Skip to content

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

Merged
freddy311082 merged 2 commits into
tetherto:masterfrom
Zbig9000:QVAC-22367-parakeet-long-audio
Jul 22, 2026
Merged

QVAC-22367 fix(parakeet): window the offline encoder for long audio#101
freddy311082 merged 2 commits 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

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Status

Current Status: ✅ APPROVED
Approvals so far: Team Lead: 1, Member: 1

Comment thread parakeet-cpp/src/parakeet_engine.cpp Outdated
Comment thread engines/parakeet/test/test_long_form.cpp
Comment thread engines/parakeet/src/parakeet_engine.cpp
Comment thread parakeet-cpp/src/parakeet_engine.cpp Outdated
Comment thread parakeet-cpp/src/parakeet_engine.cpp Outdated
Comment thread parakeet-cpp/test/test_long_form.cpp Outdated
Comment thread engines/parakeet/src/parakeet_engine.cpp
Comment thread parakeet-cpp/src/parakeet_engine.cpp Outdated
@Zbig9000

Copy link
Copy Markdown
Author

/review

Rebased the long-form windowed-encoder work onto master's engines/parakeet
layout (post-reorg) to resolve the PR conflicts. Combines the original fix,
the pos_emb hard-ceiling change, and the review fixups into one commit on
the new layout.

Bounds offline-transcription memory on long audio: transcribe_samples /
transcribe_samples_stream used to run the conformer encoder over the whole
input in a single graph (O(T_enc^2) self-attention, ~100 GB / SIGKILL on a
~90 min file). The mel is now computed once (so per-feature CMVN stays
global, matching single-pass) and the encoder is slid over it in overlapping
windows, with the shared context trimmed at the seams; inputs that fit one
window keep the bit-identical single-pass path.

- pos_emb_max_len is a hard ceiling on the per-window frame count
  (resolve_long_form_window_frames); auto window = min(pos_emb_max_len, 3750).
- Pure planner + seam trim + bounds-checked append in long_form.h, covered
  model-free by test-long-form-windows (planner, resolver, stitch, append).
- append_committed_frames fails loud (rc -6) instead of reading past the
  buffer; n_enc_frames advances only on a successful append.
- test-long-form parity test varies per-repetition gain (fixture-gated).

New EngineOptions knobs long_form_window_frames / long_form_context_frames
(0 = auto, < 0 = disable).
@Zbig9000
Zbig9000 force-pushed the QVAC-22367-parakeet-long-audio branch from e5f2255 to e58ff4b Compare July 22, 2026 14:41
@Zbig9000
Zbig9000 requested a review from GustavoA1604 July 22, 2026 16:42
@Zbig9000
Zbig9000 marked this pull request as ready for review July 22, 2026 16:47
@Zbig9000
Zbig9000 requested review from a team as code owners July 22, 2026 16:47
@freddy311082
freddy311082 merged commit 88b690c into tetherto:master Jul 22, 2026
15 of 16 checks passed
Zbig9000 added a commit to Zbig9000/qvac-registry-vcpkg that referenced this pull request Jul 22, 2026
…rto tetherto#101)

Repoint the port from the fork branch to the merged upstream commit now that
tetherto/qvac-ext-lib-whisper.cpp#101 has landed:
- REPO -> tetherto/qvac-ext-lib-whisper.cpp
- REF -> 88b690c0 (master; PR tetherto#101, long-form windowed encoder on
  engines/parakeet)
- HEAD_REF -> master
- SHA512 recomputed for the upstream tarball; versions git-tree updated.

SOURCE_PATH stays engines/parakeet. version-date/port-version unchanged
(2026-07-21#0); ggml-speech floor unchanged (>= 2026-07-15).
Zbig9000 added a commit to Zbig9000/qvac that referenced this pull request Jul 22, 2026
…e at merged-upstream port

Follow the registry PR after it was repointed to the merged upstream commit
(tetherto/qvac-ext-lib-whisper.cpp#101, engines/parakeet). default-registry
baseline -> 5a4aa57, whose parakeet-cpp 2026-07-21#0 port now builds from the
merged upstream master (88b690c0) instead of the fork branch. Still resolving
from the fork registry until the registry PR merges; once it does, switch
default-registry back to tetherto and keep the version>= / overrides pin.
GustavoA1604 pushed a commit to tetherto/qvac-registry-vcpkg that referenced this pull request Jul 22, 2026
…der) (#254)

* QVAC-22367 bump[parakeet-cpp]: 2026-07-21#0 (long-audio windowed encoder)

Points parakeet-cpp at the QVAC-22367 fix that bounds offline-transcription
memory on long audio: the conformer encoder now slides over the input in
overlapping windows instead of running the whole file through a single
O(T_enc^2) attention graph (which OOMed on multi-hour audio). ggml-speech
floor is unchanged (>= 2026-07-15); this is a source-only bump.

WIP until the upstream source PR merges: portfile REPO/REF/HEAD_REF point at
Zbig9000/qvac-ext-lib-whisper.cpp @ 963b28db (branch
QVAC-22367-parakeet-long-audio); SHA512 is that fork tarball's hash. master
has since moved parakeet-cpp/ -> engines/parakeet/ (reorg PR #95); this pin
stays on the pre-reorg ecac5bb7 line so the bugfix does not also adopt the
layout migration. On merge, repoint REPO -> tetherto, REF -> the merge
commit, HEAD_REF -> master, adjust SOURCE_PATH if it lands on the reorged
tree, and recompute SHA512 + the versions git-tree.

* QVAC-22367 review[parakeet-cpp]: repoint to review-fixed source + drop ticket refs

Address review on the addon/source PRs:
- Repoint REF to the review-fixed fork commit e5f22556 (global CMVN, model-free
  seam tests, fail-loud append) and update SHA512 + the versions git-tree.
- Drop the ticket identifier from the portfile header and vcpkg.json
  description.

Still WIP until the upstream source PR merges: REPO/REF/HEAD_REF point at the
Zbig9000 fork branch; on merge, repoint REPO -> tetherto, REF -> the merge
commit, HEAD_REF -> master, adjust SOURCE_PATH if it lands on the reorged
engines/parakeet tree, and recompute SHA512 + git-tree.

* QVAC-22367 review[parakeet-cpp]: repoint to engines/parakeet fork commit

Follow the ext-lib PR after it was rebased onto master's engines/parakeet
layout (reorg): REF -> fork commit e58ff4b0, SOURCE_PATH -> engines/parakeet,
updated SHA512 + versions git-tree, and the subfolder references in the
portfile/vcpkg.json. Still WIP (fork REPO/REF/HEAD_REF) until the upstream
source PR merges; on merge repoint REPO -> tetherto, REF -> the merge commit,
HEAD_REF -> master, recompute SHA512 + git-tree.

* QVAC-22367 bump[parakeet-cpp]: 2026-07-21#0 -> merged upstream (tetherto #101)

Repoint the port from the fork branch to the merged upstream commit now that
tetherto/qvac-ext-lib-whisper.cpp#101 has landed:
- REPO -> tetherto/qvac-ext-lib-whisper.cpp
- REF -> 88b690c0 (master; PR #101, long-form windowed encoder on
  engines/parakeet)
- HEAD_REF -> master
- SHA512 recomputed for the upstream tarball; versions git-tree updated.

SOURCE_PATH stays engines/parakeet. version-date/port-version unchanged
(2026-07-21#0); ggml-speech floor unchanged (>= 2026-07-15).
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.

3 participants