transcribe.cpp icon indicating copy to clipboard operation
transcribe.cpp copied to clipboard

qwen3 asr max_new and k_max_new

Open jl opened this issue 4 months ago • 4 comments

https://github.com/handy-computer/transcribe.cpp/blob/8c7ae674ea7b26b0c9074529da99f938553db32f/src/arch/qwen3_asr/model.cpp#L1555

Should this be using k_max_new here instead of creating a new local max_new?

jl avatar Jul 20 '26 08:07 jl

it's quite possible yes

if you have any ideas to improve the code happy to review a pr

cjpais avatar Jul 20 '26 09:07 cjpais

OK, #106 is up. Looking forward to your review.

jl avatar Jul 22 '26 12:07 jl

Adding a real-world Handy v0.9.4 reproduction that confirms the fixed 256-token budget is user-visible in production.

Environment

  • Handy: 0.9.4
  • macOS 15.7.7 (24G720), arm64
  • Apple M1 Pro, 32 GB
  • Model: handy-computer/Qwen3-ASR-1.7B-gguf/Qwen3-ASR-1.7B-Q5_K_M.gguf
  • Backend: Metal MTL0
  • Push-to-talk with Handy post-processing enabled

Failing run

  • Captured audio: 1,702,080 samples after resampling, or exactly 106.38 seconds at 16 kHz
  • Audio capture and WAV persistence both completed normally
  • Qwen3-ASR then failed at the generation limit:
qwen3_asr run: output truncated at 256 tokens — decode reached the generation budget before end-of-stream; the transcript may be incomplete.
Transcription failed: transcribe-cpp transcription failed: output truncated before end-of-stream: run: output truncated: decode hit the context/generation cap before end-of-stream (status 18)
  • Handy saved a history entry with an empty transcript for this run.
  • LLM post-processing was not the cause: there is no post-processing request for the failing run because ASR returned OUTPUT_TRUNCATED first.

Control observations from the same log/session

  • 73.53 seconds: succeeded, then post-processing succeeded
  • 72.06 seconds: succeeded, then post-processing succeeded
  • 56.25 seconds: succeeded, then post-processing succeeded

This supports an output-token-density limit rather than a strict audio-duration threshold: lower-density ~72–74 second dictations can fit, while a denser 106.38 second dictation reaches exactly 256 generated tokens.

I also checked current transcribe.cpp main and it still declares constexpr int k_max_new = 256 for Qwen3-ASR. PR #74 plus cjpais/Handy#1633 appear to address both sides needed here: a configurable larger generation budget and preservation of non-empty partial output when truncation still occurs. PR #106 is another proposed default-allocation approach.

All local paths, transcript contents, shortcut details, microphone identity, and post-processing/API configuration have been omitted.

diligentpig avatar Aug 02 '26 16:08 diligentpig

Yeah, we definitely need to fix this

cjpais avatar Aug 03 '26 08:08 cjpais