Repository navigation
Conversation
didlawowo
force-pushed
the
feat/voxtral-realtime-clean
branch
2 times, most recently
from
March 16, 2026 21:18
e461266 to
b31e2c9
Compare
Author
|
any reviewer ? |
Add model support for Voxtral Mini 4B Realtime (mistralai/Voxtral-Mini-4B-Realtime-2602). GGUF conversion: - VoxtralRealtimeEncoderModel for Mistral-format mmproj conversion - Precompute ada_rms_norm_t_cond adaptive normalization at conversion time Decoder: - Optional ffn_ada_norm_up tensor per layer (zero overhead for other models) Audio encoder (voxtral-realtime-enc.cpp): - Causal transformer with sliding window attention (750), RoPE, SwiGLU - Causal conv1d with left-padding, frame stacking, adapter MLP mtmd integration: - PROJECTOR_TYPE_VOXTRAL_REALTIME with Whisper-compatible mel params - Audio preprocessor with Voxtral-specific normalization Based on work by @Acceldium (PR ggml-org#19698), refactored for Phase 1 scope.
Implement the Voxtral Realtime dual-stream inference protocol where audio and text embeddings are summed at each position (not prepended). mtmd-helper: - mtmd_helper_eval_voxtral_realtime() handles full pipeline - Token embedding table loader from GGUF - Prefill: combined[i] = audio_embd[i] + tok_embd[prompt[i]] - Autoregressive: continue dual-stream while within audio range mtmd-cli: - Detect mtmd_support_voxtral_realtime() in single-turn mode - Route to dual-stream path, print transcription Tested with LibriSpeech: perfect transcription, 169ms encode, 145 tok/s.
Add OpenAI-compatible audio transcription endpoint for speech-to-text.
New task type SERVER_TASK_TYPE_AUDIO_TRANSCRIPTION follows the EMBEDDING
pattern: process at DONE_PROMPT, run dual-stream transcription, release slot.
Endpoint accepts JSON with base64-encoded audio:
POST /v1/audio/transcriptions
{"file": "<base64>", "format": "wav", "language": "en"}
Response format:
{"task": "transcribe", "language": "en", "text": "..."}
Resolves feature request ggml-org#15291 (audio transcription endpoint).
Support the standard OpenAI Whisper API format: curl -F file=@audio.wav -F language=en /v1/audio/transcriptions Also keeps JSON+base64 as fallback. Multipart fields (file, language, model, etc.) are extracted from httplib's form parser and passed through server_http_req.
- Use llama_vocab_is_eog() instead of single eos_token check in helper - Skip control tokens and streaming markers during detokenization - Fixes trailing "ished." artifact in transcription output
- Error handling tests using tinygemma3 (vision-only, no audio) - Verify endpoint exists (not 404) - Verify multipart and JSON formats are accepted - Verify graceful error when model doesn't support audio - Integration test with real model (skipped by default, set LLAMA_TEST_AUDIO_MODEL=1)
didlawowo
force-pushed
the
feat/voxtral-realtime-clean
branch
from
March 20, 2026 08:53
b31e2c9 to
97907d0
Compare
Collaborator
|
This PR contains many model-specific code paths, which are considered as anti-pattern in libmtmd design. Please refer to #20914 for a formal discussion before proceeding. For now, I'm closing the current PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Full support for Voxtral Mini 4B Realtime (February 2026), Mistral's streaming speech-to-text model, including a new OpenAI-compatible
/v1/audio/transcriptionsendpoint.Pre-quantized GGUFs: https://huggingface.co/chris0173/Voxtral-Mini-4B-Realtime-2602-GGUF
What's included
1. Audio encoder + GGUF conversion (
convert_hf_to_gguf.py,mtmd/)VoxtralRealtimeEncoderModelfor Mistral-format mmproj conversionada_rms_norm_t_condat conversion time (zero runtime overhead)PROJECTOR_TYPE_VOXTRAL_REALTIMEwith Whisper-compatible mel params2. Dual-stream transcription (
mtmd-helper.cpp,mtmd-cli.cpp)mtmd_helper_eval_voxtral_realtime()implements the dual-stream protocolllama-mtmd-cli --image audio.wav -p "Transcribe"3. Server endpoint (
tools/server/)POST /v1/audio/transcriptions— OpenAI Whisper-compatible APImultipart/form-data(standard) and JSON with base64 (fallback)SERVER_TASK_TYPE_AUDIO_TRANSCRIPTIONUsage
Response format:
{"task":"transcribe","language":"en","duration":0.0,"text":"Let him come in then, said the king..."}Resource requirements
Testing
Tested on RTX 3090 with LibriSpeech (7127-75946-0002.flac):
Deployed and verified on a Kubernetes cluster with ArgoCD GitOps.
Dual-stream protocol (architecture note)
Unlike standard multimodal models that prepend media embeddings, Voxtral Realtime sums audio and text embeddings at each position:
This enables streaming with <500ms latency. The prefix consists of
[BOS] + [PAD×32] + [DELAY×6]= 39 tokens.Related
What this does NOT include