# Repository Briefing: antirez/voxtral.c
> Source: https://repoforai.com/repo/antirez/voxtral.c (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/antirez/voxtral.c
- **Category**: Voice, Vision & Video (语音 / 视觉 / 视频生成)
- **Primary Language**: C
- **License**: MIT
- **Engineering Health**: C (47/100 · Maintenance 6/35 · Adoption 15/25 · Releases 6/20 · License 20/20)
- **Review Snapshot**: 2026-12-02
- **Deployment / Stack Signals**: Local AI, CLI, GPU, API
- **Momentum**: 1,754 ★ total (+0 24h / +0 7d) · 129 forks
- **When to Use**: Best for: Local captions, privacy-sensitive transcription prototypes, and native applications that need incremental text on Apple Silicon. Skip if: You need an out-of-the-box hosted endpoint, dependable real-time throughput on a CPU-only Linux deployment, or unattended long-running capture without first validating drop and reset behavior.

## Overview
```text
### Architecture & Core Mechanics
voxtral.c is a native inference engine for Mistral Voxtral Realtime 4B, not a general model runner. Audio is normalized to 16 kHz and passed through mel feature extraction, a convolutional stem, and a 32-layer causal transformer encoder with a 750-position attention window. After 4× downsampling, a 5120→3072→3072 adapter with GELU feeds a 26-layer Ministral-3-based decoder. The decoder uses grouped-query attention with 32 query heads and 8 KV heads; the Tekken vocabulary has 131,072 entries.

The source separates audio processing, encoder, decoder, kernels, safetensors loading, and tokenization into dedicated C modules. Apple acceleration lives in `voxtral_metal.m` and `voxtral_shaders.metal`; the BLAS build uses Accelerate on macOS or OpenBLAS on Linux. BF16 weights are memory-mapped from safetensors. `main.c` provides the CLI, while `voxtral.h` exposes an in-process streaming API that feeds audio, queues decoded text, and finalizes pending input. There is no packaged network service.

### Key Capabilities & Differentiators
The CLI accepts 16-bit PCM WAV and resamples it to 16 kHz. `--stdin` distinguishes RIFF WAV from raw signed 16-bit little-endian, 16 kHz mono PCM, so ffmpeg can act as a format bridge without becoming an inference dependency. On macOS, `--from-mic` captures from the default input via AudioQueue Services and strips detected silence. The model covers 13 languages, including English, Mandarin Chinese, Japanese, Hindi, and Arabic. Output arrives incrementally, with transcript text on stdout and diagnostics on stderr.

Overlapping encoder chunks bound audio-encoding state, while a rolling decoder KV cache caps history at 8,192 positions. This allows streams to continue beyond the context window without retaining all preceding context. `--monitor` exposes encoder passes, invalid or control-only token streaks, watchdog timeouts, and resets, which help distinguish a stalled decode from an encoder that is simply waiting for more audio.

### Trade-offs & Limitations
Compared with a hosted Whisper API, voxtral.c keeps audio and inference local and offers direct access to incremental text. In exchange, you provision the hardware, stage the model, and build any service layer yourself. The M3 Max measurements show how much backend choice matters: for 3.6 seconds of audio, the encoder took 284 ms on Metal versus roughly 8 seconds on BLAS; short-sequence decode was 23.5 ms per step versus 335 ms. Metal reuses cached FP16 weights, while BLAS repeatedly converts BF16 weights to FP32. These are hardware-specific measurements, not a head-to-head benchmark against Whisper.

For live input, the default 2-second encoder interval is a throughput compromise: reducing `-I` can make text arrive sooner, but each encoder call adds roughly 50 ms of fixed overhead in the measured setup. Offline file transcription does not use this interval. Testing has covered only a few samples, and microphone input may skip audio when processing falls behind. Before adopting it for continuous capture, test cache rollover, transcript continuity across resets, and whether target hardware keeps up without dropping input.

### Hardware & Deployment Guide
Stage the model with `./download_model.sh`, which populates `voxtral-model/` with `consolidated.safetensors` (about 8.9 GB), `tekken.json`, and `params.json`. On Apple Silicon, build with `make mps`; use `make blas` with Accelerate on Intel macOS or OpenBLAS on Linux. A file smoke test is `./voxtral -d voxtral-model -i samples/test_speech.wav`. Once the assets are staged, native inference runs offline without Python, CUDA, or vLLM. The separate Python reference uses PyTorch, safetensors, soundfile, and soxr.

Size Apple Silicon deployments for the roughly 8.4 GB FP16 Metal weight cache, up to roughly 1.8 GB of decoder KV cache, and about 200 MB of working buffers, plus headroom for mapped BF16 pages and the rest of the system. Memory mapping makes weights available without reading them all up front; it does not remove their runtime memory cost. No tagged release is listed. Pin a tested commit and validate the build, sustained memory use, and long-stream behavior on the hardware you intend to deploy.
```

## Key Capabilities
```text
- Model pipeline: 32-layer causal audio encoder, 4× downsampling, and a 26-layer Ministral-3-based decoder with 32 query heads and 8 KV heads.
- Bounded streaming state: Overlapping encoder chunks and an 8,192-position rolling decoder KV cache cap inference state without retaining unlimited context.
- Metal execution: BF16 weights are staged as FP16 on the GPU, and each decoder token runs in a single Metal command buffer.
- Native integration: `vox_stream_t` accepts incremental audio and queues text for retrieval; the CLI keeps transcript output on stdout and diagnostics on stderr.
- Audio input: 16-bit PCM WAV is resampled to 16 kHz; stdin also accepts raw 16 kHz mono `s16le`; live microphone capture is macOS-only.
- Streaming control: `-I` trades responsiveness for encoder batching, while `--monitor` exposes decode stalls, watchdog timeouts, and resets.
```

## Quick Start / Clone
```bash
pip install torch safetensors soundfile soxr
python python_simple_implementation.py voxtral-model audio.wav
```
