libmtmd library. This enables vision-language models (VLMs) and speech-language models for diverse AI applications.
Overview
Multimodal support allows models to:- Vision: Analyze images, answer questions about visual content, generate image descriptions
- Audio: Process speech, transcribe audio, understand audio content
- Mixed: Handle multiple modalities simultaneously (e.g., Qwen2.5-Omni)
- Images: Vision models like Gemma 3, SmolVLM, Qwen2-VL, Pixtral
- Audio: Speech models like Ultravox, Voxtral (experimental, may have reduced quality)
Quick Start
1
Download a multimodal model
Use the
-hf flag to automatically download a model with its projector:2
Send a multimodal request
Use the chat completions endpoint with image content:
Loading Multimodal Models
Automatic Loading (Recommended)
Using-hf automatically downloads both the model and multimodal projector:
Manual Loading
Specify the model and projector separately:Disable Multimodal
GPU Offloading
By default, the multimodal projector is offloaded to GPU. To disable:Vision Models
Vision models can analyze images and answer questions about visual content.Available Vision Models
Some models may require a larger context window. Use
-c 8192 or higher if you encounter issues.Using Vision Models
With CLI
With Server (OpenAI API)
Python Example
Image Input Formats
Supported image formats:- Base64 encoded:
data:image/jpeg;base64,/9j/4AAQ... - Local files (CLI):
--image path/to/image.jpg - URLs:
https://example.com/image.jpg
Dynamic Resolution
Some vision models support dynamic resolution for better image understanding:integer
default:"model default"
Minimum tokens each image can use (for dynamic resolution models)
integer
default:"model default"
Maximum tokens each image can use (for dynamic resolution models)
Audio Models
Audio models process speech and audio content.Audio support is highly experimental and may have reduced quality compared to vision models.
Available Audio Models
Using Audio Models
With CLI
With Server
Mixed Modality Models
Some models support multiple input modalities simultaneously.Qwen2.5-Omni
Capabilities: Audio input, vision input, text outputUsing Mixed Modality
Finding More Models
Discover GGUF multimodal models on Hugging Face:- Vision models: https://huggingface.co/models?pipeline_tag=image-text-to-text&sort=trending&search=gguf
- ggml-org collection: https://huggingface.co/collections/ggml-org/multimodal-ggufs-68244e01ff1f39e5bebeeedc
Common Use Cases
Image Analysis
OCR (Text Extraction)
Image Comparison
Speech Transcription
Implementation Details
How Multimodal Works
Multimodal models work by:- Encoding: Images/audio are encoded into embeddings using a separate encoder model (the multimodal projector)
- Integration: These embeddings are combined with text token embeddings
- Processing: The main language model processes the combined embeddings
- Generation: The model generates text responses that incorporate understanding of all modalities
Media Markers
In the prompt, multimodal data is represented by marker strings (e.g.,<__media__>) that act as placeholders. The actual media data is passed separately and substituted in order.
Clients must check the
/models or /v1/models endpoint for the multimodal capability before sending multimodal requests.Performance Optimization
GPU Acceleration
Context Window
Batch Processing
For processing multiple images:Troubleshooting
Model fails to load multimodal projector
Issue: Projector not found or not loading Solution:- Ensure you’re using
-hffor automatic download - Or manually specify with
--mmproj projector.gguf - Check that the projector file exists and is compatible
Images not being processed
Issue: Model ignores image input Solution:- Verify the model supports vision (check model card)
- Ensure projector is loaded (
--mmproj) - Check image format (base64, supported file types)
- Verify the image marker is in the prompt
Out of memory errors
Issue: Crashes or OOM errors with large images Solution:- Reduce
--image-max-tokens - Increase context size with
-c - Use smaller images or resize before encoding
- Enable GPU offloading with
-ngl
Audio quality issues
Issue: Poor audio transcription or understanding Solution:- Use higher quality audio files (16kHz+ sample rate)
- Try different audio models
- Ensure audio format is supported (WAV recommended)
- Note that audio support is experimental
See Also
Server
Full server API reference
CLI Tool
Command-line multimodal usage
Embeddings
Multimodal embeddings
Model Hub
Pre-quantized multimodal models

