Skip to main content
Optimizing WhisperKit performance involves balancing speed, accuracy, and resource usage. This guide covers compute units, model selection, decoding options, and platform-specific optimizations.

Compute Units

CoreML models can target different hardware accelerators on Apple devices:

Neural Engine

Specialized ML accelerator (fastest, most efficient)

GPU

Graphics processor (good balance)

CPU

Central processor (most compatible)

ModelComputeOptions

Configure compute units for each model component:

Available Compute Units

MLComputeUnits
CPU only - most compatible, slowest
MLComputeUnits
CPU and GPU - good for macOS < 14
MLComputeUnits
CPU and Neural Engine - recommended for macOS 14+, iOS 17+
MLComputeUnits
All available compute units - lets CoreML decide

CLI Configuration

Set compute units via command-line:

Model Selection

Model size significantly impacts speed and accuracy:
39M parameters
Speed: ~32x real-time | WER: ~10-15% | Size: ~75 MBBest for: Real-time applications, low-end devices, quick prototyping
74M parameters
Speed: ~16x real-time | WER: ~8-12% | Size: ~142 MBBest for: Balanced speed/quality, general transcription
244M parameters
Speed: ~6x real-time | WER: ~5-8% | Size: ~466 MBBest for: Production applications requiring accuracy
769M parameters
Speed: ~2x real-time | WER: ~4-6% | Size: ~1.5 GBBest for: High-accuracy requirements, offline processing
1550M parameters
Speed: ~1x real-time | WER: ~3-5% | Size: ~3 GBBest for: Maximum accuracy, multilingual, post-processing

Distil Models

Distilled models offer 2-3x speedup with minimal accuracy loss:
Benchmarks: WhisperKit Benchmarks

Decoding Options

Temperature and Sampling

Control randomness and diversity:
Float
default:"0.0"
  • 0.0: Deterministic (always pick most likely token)
  • 0.0 - 1.0: Increasing randomness
  • Higher values = more creative but less accurate
Int
default:"5"
Number of top candidates to sample from when temperature > 0

Fallback Strategy

Automatically retry failed segments:

Quality Thresholds

Detect and reject poor transcriptions:
Lower thresholds = more rejections = better quality but longer processingDefault values work well for most use cases.

Timestamp Control

Word timestamps require ~10-15% more processing time.

Parallel Processing

Concurrent Workers

Process multiple audio segments in parallel:
iOS devices show regression with >4 workers. macOS handles 16+ workers efficiently.

Chunking Strategy

Voice Activity Detection (VAD):
  • Automatically splits audio at silence
  • Reduces unnecessary processing
  • Better for long audio with pauses
  • Slightly slower initialization
No Chunking:
  • Process entire audio file
  • Faster for short clips
  • May hit token limits on very long audio

Prefill Optimization

KV Cache Prefill

Accelerate initial decoding with cached key-value pairs:
Prefill reduces first-token latency by 2-3x but requires compatible models with prefill data.

Language and Task Prefill

Automatic prefill when:
  • Language is specified
  • Task is .translate
  • Custom prompt tokens provided

Memory Management

Model Prewarming

Reduce peak memory during model loading:
CoreML models need “specialization” on first load (compiling for your device). This specialized cache is maintained by Apple but evicted after OS updates.With prewarm=true:
  • Models loaded sequentially
  • Each model unloaded after specialization
  • Lower peak memory (1 model at a time)
  • 2x longer load time if cache is hit
With prewarm=false (default):
  • Models loaded in parallel
  • Higher peak memory (all models + compilation)
  • Faster load time when cache is hit
Enable when: Minimizing peak memory is critical (older devices, background apps)Disable when: Load time is critical (real-time apps, foreground processing)
See Memory Management for detailed strategies.

Performance Metrics

Real-Time Factor

Tokens Per Second

Speed Factor

Platform-Specific Tips

macOS

M1/M2/M3 Optimization

iOS/iPadOS

iPhone/iPad Optimization

watchOS

WhisperKit on watchOS requires tiny/base models with CPU-only compute units due to memory constraints.

Benchmarking

Measure performance on your target devices:
View results: See BENCHMARKS.md for details.

Optimization Checklist

1

Choose the right model

Start with small for balance, tiny for speed, large-v3 for accuracy
2

Configure compute units

Use .cpuAndNeuralEngine on macOS 14+ and iOS 17+
3

Enable prefill caching

Set usePrefillCache = true for faster first-token generation
4

Adjust concurrent workers

16 on macOS, 4 on iOS for optimal parallelism
5

Use VAD chunking

Enable chunkingStrategy = .vad for long audio files
6

Tune quality thresholds

Lower thresholds for better quality, higher for speed
7

Monitor metrics

Track real-time factor and tokens per second
8

Test on target devices

Always benchmark on actual hardware

Next Steps

Memory Management

Advanced memory optimization strategies

Custom Models

Fine-tune models for your domain