Skip to content

feat(asr): expose beam_size and condition_on_previous_text (native) - #3704

Closed
BBC-Esq wants to merge 1 commit into
docling-project:mainfrom
BBC-Esq:expose-native-whisper-decode-params
Closed

feat(asr): expose beam_size and condition_on_previous_text (native)#3704
BBC-Esq wants to merge 1 commit into
docling-project:mainfrom
BBC-Esq:expose-native-whisper-decode-params

Conversation

@BBC-Esq

@BBC-Esq BBC-Esq commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Issue resolved by this Pull Request:
Resolves #3703

What

The native (openai-whisper) ASR backend forwarded only verbose and word_timestamps to transcribe() and exposed no decoding parameters on InlineAsrNativeWhisperOptions. With whisper's default greedy decoding (beam_size=None), long-form audio can spiral into runaway repetition and effectively hang, with no workaround available through the docling API. Root-cause isolation and benchmarks are in #3703.

This exposes two of whisper's decoding parameters on InlineAsrNativeWhisperOptions and forwards them in the native transcribe() call:

  • beam_size: Optional[int] = None
  • condition_on_previous_text: bool = True

Both default to whisper's own defaults, so existing behaviour is unchanged. Setting beam_size=5 (beam search) or condition_on_previous_text=False reliably avoids the repetition hang on long-form audio.

Modified files

  • docling/datamodel/pipeline_options_asr_model.py — added beam_size and condition_on_previous_text to InlineAsrNativeWhisperOptions.
  • docling/pipeline/asr_pipeline.py — read both in _NativeWhisperModel and forward them in transcribe().
  • tests/test_asr_pipeline.py — added test_native_whisper_forwards_decode_params.

Notes

  • Conservative defaults on purpose. I kept the defaults equal to whisper's rather than switching the default to beam search, to avoid changing existing output. Happy to default beam_size to a non-greedy value (e.g. 5) if you'd prefer the hang fixed out-of-the-box.
  • temperature and language were intentionally left out: forwarding temperature=0.0 would change transcription output, and the option's language="en" default would regress non-English audio. Glad to add them in a follow-up if wanted.

Checklist:

  • Documentation has been updated, if necessary. (The new options are self-documenting via their Field(description=...).)
  • Examples have been added, if necessary. (Not necessary — config-only change.)
  • Tests have been added, if necessary.

The native Whisper backend ran with whisper's defaults (greedy decoding, condition_on_previous_text=True) and exposed no way to change them, which can cause runaway-repetition hangs on long-form audio. Expose both as fields on InlineAsrNativeWhisperOptions and forward them in transcribe(); defaults match whisper's, so existing behaviour is unchanged.

Refs docling-project#3703

Signed-off-by: BBC, Esquire <bbc@chintellalaw.com>
@github-actions

Copy link
Copy Markdown
Contributor

DCO Check Passed

Thanks @BBC-Esq, all your commits are properly signed off. 🎉

@mergify

mergify Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 Merge protection satisfied — ready to merge.

Show 1 satisfied protection

🟢 Enforce conventional commit

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\(.+\))?(!)?:

@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@BBC-Esq BBC-Esq closed this Jun 27, 2026
@BBC-Esq
BBC-Esq deleted the expose-native-whisper-decode-params branch June 27, 2026 13:55
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.

[feat] Native Whisper: greedy decode default hangs on long-form audio - expose beam_size / condition_on_previous_text / temperature

1 participant