Skip to main content

Configuration

WhisperKit provides extensive configuration options through WhisperKitConfig and ModelComputeOptions to customize model loading, computation, and transcription behavior.

WhisperKitConfig

The main configuration class for initializing WhisperKit:
See WhisperKitConfig

Basic Configuration

Simple Initialization

Convenience Initializer

See WhisperKit.init

Model Configuration

Model Selection

String?
default:"nil"
Model variant name (e.g., “tiny”, “base”, “small”, “medium”, “large-v3”). If nil, uses the recommended model for the device.

Model Repository

String?
default:"argmaxinc/whisperkit-coreml"
Hugging Face repository containing the models.
String?
default:"nil"
Authentication token for private repositories.
String?
default:"https://huggingface.co"
Custom Hugging Face Hub endpoint URL.

Local Models

String?
default:"nil"
Path to a local model folder. If set, download is typically set to false.
URL?
default:"nil"
Path to tokenizer files. If nil, searches model folder and downloads if needed.

Download Configuration

URL?
default:"nil"
Base directory for downloading models. If nil, uses default cache location.
Bool
default:"true"
Whether to download models if not available locally.
Bool
default:"false"
Use background URL session for downloads (survives app suspension).

ModelComputeOptions

Control which compute units (CPU, GPU, Neural Engine) are used for each model component:
See ModelComputeOptions

Compute Unit Options

  • .cpuOnly - CPU only
  • .cpuAndGPU - CPU and GPU
  • .cpuAndNeuralEngine - CPU and Neural Engine
  • .all - All available units

Default Compute Configuration

Optimizing for Different Devices

Loading Behavior

Prewarm

Bool?
default:"nil"
Load and unload models sequentially to trigger Core ML specialization with lower peak memory usage.
See WhisperKitConfig.prewarm
When to use prewarm:
  • Loading large models (medium, large)
  • Memory-constrained devices
  • First launch after OS update (triggers Core ML compilation)
Trade-offs:
  • Doubles model load time (usually less than 1s overhead when cached)
  • Significantly reduces peak memory usage

Load

Bool?
default:"nil"
Whether to load models immediately. If nil, loads if modelFolder is provided.

Logging

Verbosity

Bool
default:"true"
Enable detailed logging output.
Logging.LogLevel
default:".info"
Maximum log level to display: .debug, .info, .error, .none.
See WhisperKit.loggingCallback

Custom Components

Replace default components with custom implementations:

Audio Processor

AudioProcessing?
default:"AudioProcessor()"
Custom audio processing implementation.

Feature Extractor

FeatureExtracting?
default:"FeatureExtractor()"
Custom mel spectrogram feature extraction.

Audio Encoder

AudioEncoding?
default:"AudioEncoder()"
Custom audio encoding implementation.

Text Decoder

TextDecoding?
default:"TextDecoder()"
Custom text decoding implementation.

Logits Filters

[LogitsFiltering]?
default:"nil"
Custom filters to modify logits before sampling.

Segment Seeker

SegmentSeeking?
default:"SegmentSeeker()"
Custom segment seeking logic for timestamp alignment.

Voice Activity Detector

VoiceActivityDetector?
default:"nil"
VAD implementation for audio chunking.

Audio Input Configuration

AudioInputConfig?
default:"AudioInputConfig()"
Configuration for audio input processing.
See WhisperKitConfig.audioInputConfig

State Callbacks

Monitor model state changes and transcription progress:

Model State Callback

See WhisperKit.modelStateCallback

Transcription State Callback

See WhisperKit.transcriptionStateCallback

Segment Discovery Callback

See WhisperKit.segmentDiscoveryCallback

Complete Configuration Example

Best Practices

Memory Management

Use prewarm: true for large models on memory-constrained devices. Call unloadModels() when not in use.

Compute Units

Use Neural Engine for iOS 17+ devices. Fall back to GPU for older devices.

Logging

Enable verbose logging during development. Disable in production for performance.

Background Downloads

Use background sessions for large models (medium, large) to prevent interruption.

Performance Tuning

For Real-time Streaming

For Maximum Accuracy

For Minimal Memory

Next Steps

Transcription

Start transcribing audio

Streaming

Real-time audio transcription