Every app that listens β€” the meeting transcriber, the voice assistant, the subtitle generator on your phone β€” needs speech-to-text that runs without a datacenter, and for most of the industry the answer is this repository. whisper.cpp took OpenAI’s Whisper model, the encoder-decoder transformer trained on hundreds of thousands of hours of audio, and reimplemented it in plain C/C++ on top of ggml, the same tensor library that powers llama.cpp. The results define a genre: quantized models that transcribe on a laptop CPU in real time, on a phone, in a browser through WebAssembly, with zero runtime memory allocations and a dependency-free build. Sibling projects in this series β€” faster-whisper, the whisper module in transformers β€” trade off speed and portability differently, but this one wins on the edge: if your code needs to hear, and it runs somewhere without a GPU rack, you are likely linking against this codebase. As always in this series, what follows is an educational tour of published source code.

The architecture is a clean two-story building. The ground floor is ggml β€” tensor algebra, computation graphs, quantized block formats, and a backend registry that dispatches the same graph onto CPU SIMD kernels, CUDA, Metal, Vulkan, SYCL, and a dozen further accelerators including remote RPC. The upper floor is the transcription engine in src/whisper.cpp: log-mel spectrogram computation, the encoder that turns audio into hidden states, the decoder that emits text tokens autoregressively with greedy or beam-search strategies, timestamp tokens for segment alignment, automatic language detection, grammar-constrained decoding, and Silero voice-activity detection to skip silence. Between the floors sits a deliberately stable C API in include/whisper.h β€” context init, whisper_full with its parameter struct, and result accessors β€” which is why the ecosystem of bindings exists at all. The upper floor recently gained a second tenant: NVIDIA’s Parakeet architecture now runs through the same engine. MIT-licensed, it is the most portable ASR implementation in active development.

whisper.cpp overview architecture diagram

whisper.cpp at a glance: the engine implements the C API, builds graphs from the Whisper and Parakeet architectures, computes through ggml with its quantization and backend registry, GPUs register into the dispatch layer, and the CLI, server, streaming app and language bindings all consume the same header.

Reading the overview from left to right:

  • The C API is the entire public contract in one readable header.
  • The engine is seventy-five hundred lines implementing every stage of transcription.
  • The Whisper arch names tensors and wires encoder-decoder graphs.
  • The Parakeet arch adds a second, faster ASR model family.
  • The ggml core executes the computation graphs on any device.
  • Quantization defines the block formats that shrink models five-fold.
  • The backend registry schedules work across CPU and GPU devices.
  • The CLI is the reference app every tutorial starts with.

Why You Need This

The first reason is the transcription engine, because it is a complete masterclass in running a transformer encoder-decoder for a real product. whisper.cpp opens with log-mel spectrogram extraction β€” the Hann window, the FFT, the seventy-nine filterbank features Whisper was trained on β€” then builds the encoder graph from the architecture definitions and runs it once per utterance. Decoding is where the engineering concentrates: greedy or beam-search sampling selected through the parameter struct, timestamp token handling that splits output into segments, a language auto-detect pass on the first thirty seconds, suppression rules for repeated and hallucinated tokens, temperature fallback when confidence collapses, and grammar constraints that force output into JSON or a custom syntax. The VAD integration runs Silero before inference so silence costs nothing β€” with a dedicated example showing segmentation alone. Encoder offload paths to OpenVINO and Core ML plug in where the platform pays.

The second reason is ggml, because this repository is one of the two flagships that made the library a de facto standard. The core builds computation graphs as lists of tensor operations, schedules them across thread pools, and executes with zero runtime allocations β€” the property that makes deterministic memory behavior possible at all. The quantization module implements the block formats β€” Q4_0 through Q8_0 and their dot products β€” that cut model size roughly in half per step with small accuracy cost, and the quantize tool rewrites a downloaded model into any of them. The backend layer enumerates devices and schedules graph sections onto each, with the CPU reference in ggml-cpu and accelerators registering themselves: CUDA, Metal, Vulkan, SYCL, and more exotic targets from RPC to WebGPU. GGUF handles the model container format shared across the whole ggml family.

The third reason is the application surface, which explains the project’s reach. The CLI β€” eleven hundred lines β€” is a complete product: input from file or microphone, every output format from plain text to SRT, VTT and karaoke, VAD and grammar flags, word-level timestamps. The HTTP server exposes an OpenAI-compatible inference endpoint, so existing client code works unchanged. The streaming example shows the sliding-window pattern for live captioning, talk-llama chains this engine with llama.cpp into a voice assistant, and the Node addon plus WebAssembly builds cover server-side JavaScript and the browser. Bindings for Go, Java, Ruby, Python and the mobile ports in the examples directory all compile against the same header β€” the proof that a stable C API is the best interface design a library can ship.

whisper.cpp detail architecture diagram

The detail view: the API surface with grammar and VAD; the engine group covering Whisper, Parakeet and the encoder offloads; the ggml group from core to GGUF; five accelerator backends; the app family from CLI to WebAssembly; and the model tooling that converts and downloads everything.

The detail view shows the full machine room. The model tooling is unusually complete: the PyTorch converter turns OpenAI checkpoints into ggml files, the HuggingFace-to-CoreML converter and its OpenVINO sibling prepare encoder offloads, and the Silero converter brings the VAD model into the same format β€” with download scripts wrapping all of it. The Parakeet engine demonstrates how the architecture abstraction in src pays off: a completely different model family β€” a token-and-duration transducer rather than a decoder β€” enters through the same graph-building conventions. The benchmark tool isolates encoder and decoder timing so backend comparisons are honest, and the shared helpers handle audio decoding across formats so each example stays focused on its own lesson.

From Install to a Transcript

The quickstart is two commands and a model download. Build with cmake or make, run ./models/download-ggml-model.sh base.en, then ./build/bin/whisper-cli -f samples/jfk.wav -m models/ggml-base.en.bin β€” a transcript prints with timestamps. From there, -np and -otxt or -osrt shape output, --vad silences the gaps, --grammar forces structure, and -ng disables GPU for pure-CPU runs. The server follows: whisper-server serves the same models over HTTP in OpenAI request format, and the stream example moves to live audio with a two-command run. Quantizing is one command with the quantize tool β€” the Q5 models are the sweet spot most examples ship with. One caution: the converter scripts need a Python environment with the original PyTorch package, and running on Apple Silicon is noticeably faster than most x86 laptops because Metal is a first-class backend β€” benchmark before choosing a device.

Honest limits: Whisper itself hallucinates on silence and music β€” the suppression heuristics and VAD help but do not eliminate it, and long recordings need chunking that the CLI handles but the raw API leaves to you. Speaker diarization is out of scope; the repo transcribes, it does not tell you who spoke. Translation is limited to the X-to-English task Whisper was trained on, no other language pairs. The Parakeet support is newer and its model zoo is smaller than Whisper’s. Windows builds work but the performance story centers on Apple Silicon and CUDA. None of this dents the achievement: a dependency-free C++ engine, a stable C API, and transcription running everywhere from a $30 microcontroller-adjacent board to a browser tab β€” the reference implementation for edge AI audio.

Watch PyShine on YouTube

Contents