ml-explore / ml-explore/mlx-examples
Unexpected processing times for short vs. long audio files with mLX-whisper with clip_timestamps enabled
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 9k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
Issue: Unexpected Processing Time Behavior with clip_timestamps Parameter
Description:
I'm observing unexpected processing times when using MLX-Whisper on audio files, particularly when the clip_timestamps parameter is enabled. For example, processing a 40‑second audio file takes significantly longer (~27-28 seconds) with clip_timestamps enabled compared to just 3-4 seconds when disabled. This behavior was brought up in discussions previously, but I am seeing this consistently in my environment, so I am raising this as an issue.
https://github.com/ml-explore/mlx-examples/discussions/1275
-
40‑second audio file:
- With
clip_timestampsenabled: ~27-28 seconds processing time. - With
clip_timestampsdisabled: ~3-4 seconds processing time.
- With
-
7‑second test file (
ls_test.flac):- Processing time remains ~1-2 seconds, regardless of the
clip_timestampssetting.
- Processing time remains ~1-2 seconds, regardless of the
-
5‑minute audio file (small model):
- Processing time is ~27 seconds with or without
clip_timestamps.
- Processing time is ~27 seconds with or without
-
5‑minute audio file (V3 Large Turbo/Turbo models):
- Processing time increases to ~40 seconds.
This behavior seems inconsistent:
- The
7‑secondand5‑minutetest files perform similarly regardless of whetherclip_timestampsis enabled, but the40‑secondfile shows a dramatic increase in processing time when clip_timestamps is enabled. This suggests that processing times do not scale linearly with audio length when using clip_timestamps.
Environment:
- Hardware: M1 Pro with 32GB RAM
- Models Tested:
- MLX-Whisper Small (observed ~27 seconds for 5‑minute audio)
- V3 Large Turbo/Turbo (observed ~40 seconds for 5‑minute audio)
- Additional Settings:
- Using
clip_timestamps - VAD timestamps obtained via
silero-vad
- Using
Code Snippet:
result = whisper.transcribe(
chunk_path,
path_or_hf_repo=self.model_path,
word_timestamps=True,
language=self.language,
fp16=False,
condition_on_previous_text=False,
clip_timestamps=clip_times,
)
Steps to Reproduce:
-
40‑Second File Test:
- Process a 40‑second audio file with
clip_timestampsenabled. - Observe processing time of ~27-28 seconds.
- Process the same file with
clip_timestampsdisabled. - Observe processing time of ~3-4 seconds.
- Process a 40‑second audio file with
-
7‑Second Test File (
[ls_test.flac](https://github.com/ml-explore/mlx-examples/blob/main/whisper/mlx_whisper/assets/ls_test.flac)):- Process with and without
clip_timestamps. - Observe similar processing times (~1-2 seconds) in both cases.
- Process with and without
-
5‑Minute File Test:
- Process with the small model; observe ~27 seconds regardless of the
clip_timestampssetting. - Process with V3 Large Turbo/Turbo models; observe ~40 seconds.
- Process with the small model; observe ~27 seconds regardless of the
Questions/Concerns:
-
Unexpected Slowdown:
- Is it expected that a 40‑second audio file takes ~27-28 seconds to process with
clip_timestampsenabled, compared to just 3-4 seconds when disabled?
- Is it expected that a 40‑second audio file takes ~27-28 seconds to process with
-
Bottlenecks and Optimizations:
- Are there any known bottlenecks or configuration parameters in MLX-Whisper that can be adjusted to boost processing speed when
clip_timestampsis enabled?
- Are there any known bottlenecks or configuration parameters in MLX-Whisper that can be adjusted to boost processing speed when
-
Model Comparisons:
- The V3 Large Turbo/Turbo models are slower (e.g., 40 seconds for a 5‑minute file) compared to the small model. Should I compare these models to the regular Whisper Large model instead of the small model?
- Is Whisper Turbo expected to be a faster alternative to the small model?
Any insights or suggestions for optimizing transcription speed, especially with clip_timestamps enabled, would be greatly appreciated.
Thank you!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the shown whisper.transcribe call and reproduce the comparison using mlx_whisper/assets/ls_test.flac, a 40-second file, and the listed model configurations. Compare runs with clip_timestamps enabled and disabled, then trace the relevant timing behavior; done means establishing whether the slowdown is expected and documenting or addressing the confirmed cause.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- audio-video-rtc, machine-learning, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100