Skip to content

fix(asr): pass the sampling temperature to mlx-whisper - #4873

Open
YHC66 wants to merge 1 commit into
docling-project:mainfrom
YHC66:fix-mlx-whisper-temperature
Open

YHC66 wants to merge 1 commit into
docling-project:mainfrom
YHC66:fix-mlx-whisper-temperature

Conversation

@YHC66

@YHC66 YHC66 commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

_MlxWhisperModel did not forward InlineAsrOptions.temperature to mlx_whisper.transcribe. On Apple Silicon the option had no effect, and mlx-whisper always used its default schedule (0.0, 0.2, …, 1.0). The native Whisper backend already forwards it (#3717). This PR forwards it in the same way.

Note on behavior: the default temperature=0.0 is now passed to mlx-whisper, so its temperature fallback is off by default. This is the same behavior as the native Whisper backend and matches the field description ("0.0 uses greedy decoding (deterministic)").

Issue resolved by this Pull Request:
Resolves #4872

Checklist:

  • Documentation has been updated, if necessary.
  • Examples have been added, if necessary.
  • Tests have been added, if necessary.

Review evidence:

Before / after, end to end on macOS arm64 (M4 Pro), real model mlx-community/whisper-tiny-mlx, tests/data/audio/sources/sample_10s.mp3, mlx-whisper 0.4.3:

  • Before: mlx_whisper.transcribe gets no temperature. The transcripts for temperature 0.0, 1.0 and 2.0 are identical.
  • After: it gets the configured value. 0.0 gives the same transcript as before; 1.0 and 2.0 give different transcripts.

Tests and checks:

  • tests/test_asr_mlx_whisper.py::TestMlxWhisperIntegration::test_mlx_whisper_transcribe now sets temperature=0.7 and expects it in the mlx_whisper.transcribe call. It fails on main and passes with this change (file: 9 passed).
  • tests/test_asr_mlx_whisper.py, tests/test_asr_pipeline.py, tests/test_asr_api.py, tests/test_asr_whisper_s2t.py: 52 passed, 8 failed, with the same 8 failures on main (openai-whisper is not installed in my local environment, so those tests fail with ImportError).
  • ruff check, ruff format --check, tach check: pass.
  • Not run: the full test suite.

_MlxWhisperModel did not forward InlineAsrOptions.temperature to
mlx_whisper.transcribe, so the setting was ignored on Apple Silicon and
mlx-whisper always used its own temperature fallback schedule. The native
Whisper backend already forwards it.

Signed-off-by: Yihang Chen <yhc0720@berkeley.edu>
@github-actions

Copy link
Copy Markdown
Contributor

✅ DCO Check Passed

Thanks @YHC66, all your commits are properly signed off. 🎉

@mergify

mergify Bot commented Oct 17, 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)(?:\(.+\))?(!)?:

@github-actions github-actions Bot added ai:ci-safe AI triage found no CI-safety concern (advisory) asr Issues related to ASR (Automatic Speech Recognition) bug Something isn't working labels Oct 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

AI triage (advisory)

Checked commit f4c03e37f9. The analysis read the diff only. It did not run code from this pull request.

The PR makes _MlxWhisperModel pass InlineAsrOptions.temperature to mlx_whisper.transcribe. It also updates the MLX Whisper unit test to check the new argument.

Topic labels added: bug, asr.

CI safety: no concern found. A maintainer must still approve CI.

3 related pull request(s) in the same code
PR State Signal Assessment
#4771 open changes the same code related: This open PR adds Transformers ASR support and changes MLX model loading in the same file. It does not forward temperature to mlx_whisper.transcribe, so both PRs can be merged.
#3600 open changes the same code related: This open PR only adds assert checks for _backend in the run methods of the same file. It does not touch temperature.
#3717 merged referenced as #3717 related: This merged PR forwarded decoding options, including temperature, in the native Whisper backend. This PR applies the same idea to the MLX backend, which the merged PR did not change.

The ai:* labels are advisory. They do not approve CI and they do not add tests:full. A new push runs this check again.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI first review (advisory): no blocker found

This review covers the full diff at f4c03e37f9. It read the code and did not run it.

The changes forward temperature from InlineAsrMlxWhisperOptions to mlx_whisper.transcribe, matching the native Whisper backend. I checked _MlxWhisperModel in docling/pipeline/asr_transcriber.py and the updated unit test in tests/test_asr_mlx_whisper.py.

A maintainer makes the merge decision. This review never approves the pull request.

@github-actions github-actions Bot added the ai:review-lgtm AI first review found no blocker or major issue (advisory) label Oct 17, 2026
@codecov

codecov Bot commented Oct 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai:ci-safe AI triage found no CI-safety concern (advisory) ai:review-lgtm AI first review found no blocker or major issue (advisory) asr Issues related to ASR (Automatic Speech Recognition) bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ASR: MLX Whisper ignores the temperature option

1 participant