A pure Rust implementation of Mistral's Voxtral Mini 4B Realtime model enables streaming speech recognition both natively and in the browser through WASM + WebGPU, with a Q4 quantized version running entirely client-side in just 2.5 GB.
The GitHub repository TrevorS/voxtral-mini-realtime-rs presents a technically interesting implementation of Mistral's Voxtral Mini 4B Realtime model for streaming speech recognition. Written entirely in Rust using the Burn ML framework, this project demonstrates how a 4-billion parameter model can be deployed for real-time speech recognition across different environments, including directly in a browser tab.
What's claimed
The project aims to provide a complete implementation of Mistral's Voxtral Mini model with two key deployment paths: native execution and browser-based execution via WebAssembly and WebGPU. The browser implementation uses a Q4 quantized version of the model that requires approximately 2.5 GB of storage and runs entirely client-side without server dependencies.
What's actually new
Several technical innovations make this implementation noteworthy:
First, the project successfully addresses the significant constraints of running a large model in a browser environment. Browser applications typically face strict limitations on memory allocation (2 GB), address space (4 GB), and GPU capabilities. The implementation solves these through:
- A sharded weight loading system that distributes model weights across multiple buffers
- A two-phase loading process that parses weights first, then drops the reader before finalizing
- A hybrid approach for the large embedding table (1.5 GiB), storing Q4 embeddings on the GPU with CPU-side row lookups
- Asynchronous tensor operations to avoid GPU readback synchronization
- A custom patch to the cubecl-wgpu library to work around WebGPU's 256 workgroup invocation limit
Second, the implementation includes a clever workaround for a quantization-specific issue. The upstream mistral-common library pads audio with 32 silence tokens, but after the mel spectrogram/convolution/reshape pipeline, only 16 of the 38 decoder prefix positions are covered by silence. This causes problems with the Q4_0 quantized model when audio starts immediately with speech. The solution increases left padding to 76 tokens, covering the full streaming prefix.
Architecture and implementation details
The audio processing pipeline follows this sequence:
- Audio input (16kHz mono) → Mel spectrogram [B, 128, T]
- Causal encoder (32 layers, 1280 dim, sliding window 750)
- Convolution 4x downsample
- Reshape to [B, T/16, 5120]
- Adapter layer to [B, T/16, 3072]
- Autoregressive decoder (26 layers, 3072 dim, GQA 32Q/8KV)
- Token IDs → Text output
The project offers two inference paths:
- F32 (native): Uses SafeTensors format (~9 GB)
- Q4 GGUF (native + browser): Uses quantized format (~2.5 GB)
For the Q4 path, the implementation uses custom WGSL shaders that fuse dequantization and matrix multiplication operations, optimizing performance for the quantized model.
Browser deployment specifics
Running a 4B model in a browser tab required solving several technical constraints. The implementation uses WASM for portability and WebGPU for GPU acceleration. The Q4 quantized version significantly reduces the memory footprint compared to the F32 version, making browser deployment feasible.
The project includes a complete browser demo with:
- WASM build process
- Self-signed certificate generation (required for WebGPU's secure context)
- Development server setup
- Microphone recording and WAV file upload capabilities
Limitations
Despite these innovations, the implementation has several limitations:
- The Q4 quantized version has reduced accuracy compared to the F32 model
- Browser deployment requires HTTPS due to WebGPU security requirements
- The model weights must be split into 512 MB shards to stay within browser ArrayBuffer limits
- No accuracy (WER) and inference speed benchmarks are currently available
- GPU-dependent tests are skipped in CI due to lack of GPU support in GitHub Actions
Practical significance
This implementation demonstrates several important technical achievements:
- It shows that large language models can be effectively deployed in the browser with careful optimization
- It provides a complete, production-ready implementation of a state-of-the-art speech recognition model
- It showcases Rust's capabilities for high-performance ML implementations
- It offers a practical solution for privacy-conscious applications that process speech locally
The project includes comprehensive documentation, examples for both native and browser deployment, and a complete testing framework. The Apache-2.0 license makes it suitable for both commercial and open-source applications.
This implementation represents a significant step toward making advanced speech recognition models more accessible and privacy-preserving by enabling client-side execution in web browsers. While challenges remain, particularly around model quantization and browser limitations, the technical solutions implemented here provide valuable insights for deploying large models in resource-constrained environments.

Comments
Please log in or register to join the discussion