Skip to main content
ModelComputeOptions configures which compute units (CPU, GPU, Neural Engine) are used for each component of the WhisperKit transcription pipeline.

Overview

WhisperKit models consist of multiple components that can run on different compute units. ModelComputeOptions allows fine-grained control over where each component executes for optimal performance.

Properties

MLComputeUnits
default:".cpuAndGPU"
Compute units for mel spectrogram generation.
MLComputeUnits
Compute units for audio encoding. Defaults to Neural Engine on newer OS versions for better performance.
MLComputeUnits
default:".cpuAndNeuralEngine"
Compute units for text decoding.
MLComputeUnits
default:".cpuOnly"
Compute units for KV cache prefill operations.

Initialization

Parameters

MLComputeUnits
default:".cpuAndGPU"
Compute units for mel spectrogram extraction.
MLComputeUnits
default:"nil"
Compute units for audio encoding. When nil, automatically selects .cpuAndNeuralEngine on iOS 17+/macOS 14+ and .cpuAndGPU on older versions.
MLComputeUnits
default:".cpuAndNeuralEngine"
Compute units for text decoding.
MLComputeUnits
default:".cpuOnly"
Compute units for prefill operations.

MLComputeUnits Values

Apple’s MLComputeUnits enum specifies which processors can execute a Core ML model:
  • .cpuOnly - Only the CPU
  • .cpuAndGPU - CPU and GPU
  • .cpuAndNeuralEngine - CPU and Neural Engine (recommended for most models)
  • .all - All available compute units

Usage Examples

Default Configuration

Custom Configuration

Force CPU-Only Execution

Simulator Handling

When running on the iOS Simulator, all compute options are automatically overridden to .cpuOnly since the simulator doesn’t support GPU or Neural Engine execution.

Performance Considerations

Neural Engine

The Neural Engine provides the best performance for most Whisper models on Apple Silicon devices:
  • Recommended for audioEncoderCompute and textDecoderCompute
  • Requires iOS 17+/macOS 14+ for optimal audio encoder performance
  • Most efficient for battery-powered devices

GPU

The GPU can be beneficial for certain operations:
  • Recommended for melCompute on most devices
  • May provide better throughput on some Mac models
  • Consider for batch processing scenarios

CPU Only

CPU-only execution:
  • Required for prefillCompute operations
  • Use when Neural Engine/GPU are unavailable
  • May be necessary for debugging or compatibility