FluidVoice icon indicating copy to clipboard operation
FluidVoice copied to clipboard

[BUG] Qwen3-ASR: long dictation is lost entirely when transcribe.cpp throws outputTruncated (partial transcript discarded, nothing in History)

Open mxwmnn opened this issue 3 weeks ago • 5 comments

Describe the bug

A long dictation with Qwen3-ASR 1.7B (Whisper (Universal) / transcribe.cpp provider) is lost completely. transcribe.cpp hits its decode cap and throws outputTruncated, which carries a usable partial transcript, but FluidVoice treats it as a plain failure: nothing is inserted, nothing is written to History, and the partial text exists only inside the error line in ~/Library/Logs/Fluid/Fluid.log. The recording is not kept, so the rest cannot be re-transcribed.

In my case the recording was 2:45 min (German). The partial in the log held roughly the first ~1,000 characters. My longest successful Qwen3 dictation so far was ~89 s / ~1,600 chars, so the cap is hit somewhere between 1.5 and 3 minutes of speech.

Related but different: #736 (Cohere truncates, but at least inserts the truncated text). Here the whole dictation is gone.

Reproduction steps

  1. Settings → Voice Engine → select Qwen3-ASR 1.7B (Whisper (Universal) provider), language German.
  2. Start a normal dictation (toggle hotkey) into any text field.
  3. Speak continuously for ~3 minutes, then stop.
  4. Observe: nothing is pasted, History has no new entry, "Copy latest transcription" copies the previous (older) entry.

Expected behavior

  • At minimum: when session.run throws outputTruncated with a partial transcript, use the partial (insert it and save it to History, ideally with a "truncated" marker / notification) instead of discarding it.
  • Better: chunk long audio for Qwen3-ASR (as is done for Cohere), so the cap is never hit.
  • Optionally: keep the last recording's audio until the transcript is delivered, so a failed run can be retried.

Actual behavior

The dictation ends with outcome=asr_failed, chars=0, nothing is inserted or stored. Only the log contains the partial text.

Code path (at b00eeb18c3): WhisperProvider.transcribe(_:languageCode:) calls try await session.run(...) in Sources/Fluid/Services/WhisperProvider.swift:327 and has no handling for TranscribeError.outputTruncated, so the error and its partial propagate up and the transcript is dropped.

App Version

1.6.13-beta.2

macOS Version

macOS 27.0.1

Architecture

Apple Silicon

Logs or crash report

[11:40:29.594] [INFO] [ASRService] ✅ START() completed successfully
[11:43:14.459] [INFO] [ASRService] pipelineID=40A49393-… 🛑 STOP() called - beginning shutdown sequence
[11:43:18.160] [ERROR] [ASRService] pipelineID=40A49393-… ASR transcription failed: outputTruncated(message: "run: output truncated: decode hit the context/generation cap before end-of-stream", partial: Optional(TranscribeCpp.Transcript(text: "<~1,000 chars of German partial transcript, omitted>", language: Optional("de"), timestampKind: TranscribeCpp.TimestampKind.none, segments: [TranscribeCpp.Segment(t0Ms: 0, t1Ms: 164864, …)], words: [], tokens: [], timings: TranscribeCpp.Timings(loadMs: 651.426, melMs: 52.402, encodeMs: 595.556, decodeMs: 2839.54))))
[11:43:18.161] [ERROR] [ASRService] pipelineID=40A49393-… Error domain: TranscribeCpp.TranscribeError, code: 10
[11:43:18.164] [INFO] [ContentView] pipelineID=40A49393-… Stop transcription result | chars=0 | empty=true
[11:43:18.164] [INFO] [AppBenchmark] pipelineID=40A49393-… DICTATION_SUMMARY asrMs=-1 aiMs=-1 appOverheadMs=3706 readyMs=3706 slowest=app_overhead outcome=asr_failed
[11:43:22.092] [INFO] [MenuBarManager] Menu action: Copied latest transcription to clipboard   <- copies the previous, unrelated entry

Model setting: SelectedSpeechModel = "qwen3-asr-1.7b".

mxwmnn avatar Nov 06 '26 10:11 mxwmnn

Transcribe.cpp is 3rd party that I use - will look into the issue!

altic-dev avatar Nov 07 '26 02:11 altic-dev

I looked into this and would like to take it, if that works for you.

Root cause

The pinned transcribe.cpp release (v0.1.2) stops every Qwen3-ASR run after a fixed 256 generated tokens. In src/arch/qwen3_asr/model.cpp at that tag:

// Per-run generation budget (matches the reference dumper default).
constexpr int k_max_new = 256;

When the decode loop reaches that count before end-of-stream, the run returns TRANSCRIBE_ERR_OUTPUT_TRUNCATED, which is the error in the log above. The limit counts output tokens, so the recording length at which it is reached depends on the language and the speaking rate. RunOptions in the 0.1.2 Swift bindings has no field for this budget, so the app cannot raise it.

Upstream replaced the fixed value in v0.2.4. From that release on, the budget comes from a function that takes a predicted transcript length for the audio. I checked which releases contain that function, and I have not read its body.

I have not reproduced the failure locally yet. This is from reading the runtime source at the pinned tag, the FluidVoice code on main, and the log in this report.

Other paths

WhisperProvider uses the protocol's default transcribeFinal, so file transcription, the Local API transcribe route and the legacy meeting backend also send one run per chunk or turn through the same call. From reading the code, they should reach the same limit. Whisper models are not affected, because the runtime windows Whisper audio internally.

Proposed fix

One pull request, limited to qwen3Asr17B:

  1. Split a long recording at pauses and transcribe each chunk in its own run, following the quiet-point search that NemotronProvider already uses. A recording under the chunk length stays a single run, so short dictations do not change.
  2. If the runtime still reports a chunk as truncated, split that chunk in two and retry. If a chunk cannot be split further, use the partial transcript instead of failing.
  3. Change the failure log in ASRService.stop so it cannot write transcript text. Today "ASR transcription failed: \(error)" writes the partial transcript into Fluid.log, because the error carries it.

I would choose the chunk length by measuring truncation at 20, 30 and 45 seconds in English and German, and I would cover the planner and the retry logic with unit tests that need no model.

Questions

  1. Is an upgrade of the transcribe.cpp mirror to v0.2.4 or later already planned? If it lands soon, chunking becomes a fallback and you may prefer a smaller change.
  2. Would you accept the pull request described above, and do you want the log change in the same pull request or a separate one?

akar016012 avatar Nov 10 '26 17:11 akar016012

@akar016012 Yes, please go ahead with the Qwen3-ASR fix.

Please include a clear before-and-after using the same audio: reproduce the lost long dictation on the current code, then show that the fix preserves the transcript, saves it to History, and inserts it correctly. English and German examples would be helpful, especially around chunk boundaries so we can check for missing or duplicated words.

Include regression tests for truncation/retry handling and confirm short dictations and Whisper models still work as before.

Once the before-and-after demonstrates the fix and the review and required checks pass, we'll be happy to merge it. Thanks for taking this on!

altic-dev avatar Nov 12 '26 23:11 altic-dev

This issue has been marked stale because it has had no activity for 7 days. It will be closed in 3 days if there is no further activity. Add the keep-open or pinned label to prevent automatic closure.

github-actions[bot] avatar Nov 20 '26 00:11 github-actions[bot]

I’m seeing this on FluidVoice 1.6.13 stable (build 34) on Apple Silicon, running macOS 27.2.1, with Qwen3 ASR 1.7B and the toggle shortcut.

I found four failures in my local logs. The recordings lasted 1:42, 2:07, 2:24, and 2:37.

In each case, FluidVoice registered the stop, then logged outputTruncated and outcome=asr_failed about 3–4 seconds later. No text was inserted and no History entry appeared. All four error lines contained a partial transcript.

adamdanielczyk avatar Nov 23 '26 10:11 adamdanielczyk