GPTQ W4A16 quantization of microsoft/Phi-4-multimodal-instruct —
a 5.6 B parameter multimodal model by Microsoft supporting text, vision (images), and audio inputs.
The GGUF files in Swicked86/phi4-mm-gguf are smaller but lack audio.
This model is the sweet spot: all three modalities at roughly ⅓ the size of bf16.
Available Files
File
Size
Notes
model-00001-of-00002.safetensors
~3 GB
Quantized weight shard 1
model-00002-of-00002.safetensors
~2 GB
Quantized weight shard 2
config.json
—
Includes quantization_config — vLLM auto-detects
tokenizer.model / tokenizer.json
—
Tokenizer
preprocessor_config.json
—
Vision + audio processor config (bf16 encoders)
The SigLIP-400M vision encoder and conformer-based speech encoder are stored at full bfloat16 precision —
only the Phi3 text transformer weights (32 decoder layers) are quantized to int4.
VRAM Requirements
Model weights occupy 6.11 GiB (measured). The remaining VRAM is used by the KV cache — vLLM pre-allocates the full KV cache pool at startup based on --gpu-memory-utilization and --max-model-len. Total VRAM allocated = weights + pre-allocated KV cache, regardless of how many requests are active.
By GPU tier
GPU
VRAM
Recommended --max-model-len
--gpu-memory-utilization
Notes
RTX 3070 / 2080 Super
8 GB
—
—
⚠️ Not recommended. Weights alone are 6.1 GB; insufficient headroom for KV cache.
RTX 3080 10 GB / 2080 Ti
10 GB
16,384
0.85
Minimum viable. Tight — use lowest context only.
RTX 3080 12 GB / 4070
12 GB
16,384–32,768
0.85
Comfortable at 16K; 32K fits with care.
RTX 3080 Ti / 4070 Ti / 4080
16 GB
32,768–65,520
0.85–0.90
Good balance of context and headroom.
RTX 3090 / 4090 / 4080 Super
24 GB
65,520
0.85–0.90
Recommended. Full tested context, comfortable.
RTX 5090 / A6000 / A100 40 GB
32+ GB
65,520–131,072
0.45–0.90
Plenty of headroom; lower utilization keeps VRAM free for other tasks.
By context length
--max-model-len
Weights
KV cache (est.)
Total (est.)
Min GPU VRAM
16,384
~6.1 GB
~1.5 GB
~8 GB
10 GB
32,768
~6.1 GB
~3.0 GB
~10 GB
12 GB
65,520
~6.1 GB
~6.0 GB
~13 GB
16 GB
131,072 (max, untested)
~6.1 GB
~12.0 GB
~19 GB
24 GB
KV cache estimates use Phi-4-Mini architecture (32 layers, 8 KV heads, head_dim 96, bf16 activations ≈ 96 KB/token).
Add ~1–2 GB for framework overhead. Weights measured on RTX 5090 with vLLM.
Why does vLLM show higher usage than "total est." above?
vLLM pre-allocates the entire KV cache pool at startup. On a large GPU (e.g. 32 GB at
--gpu-memory-utilization 0.45), it reserves 0.45 × 32 GB = ~14 GB for KV cache even
if no requests are active. The table above shows the minimum needed, not what vLLM
will allocate when given more headroom.
Usage
Step 1 — Install vLLM
Requirements: Python 3.10+, CUDA GPU with ≥ 8 GB VRAM, vLLM 0.9.0+
pip install vllm
Do not install auto-gptq or pass --quantization gptq. This model uses
compressed-tensors format, which vLLM handles automatically from config.json.
1from openai import OpenAI
23client = OpenAI(base_url="http://localhost:8080/v1", api_key="local")45response = client.chat.completions.create(6 model="phi4-mm",7 messages=[{"role":"user","content":"What is the capital of France?"}],8 max_tokens=256,9)10print(response.choices[0].message.content)
phi4-mm uses a custom conformer-based audio encoder (24 conformer blocks) with a rank-320 speech LoRA
applied to the language decoder — no separate ASR model needed.
Supported formats: wav, mp3, ogg, flac.
1import base64
2from openai import OpenAI
34client = OpenAI(base_url="http://localhost:8080/v1", api_key="local")56withopen("photo.jpg","rb")as f:7 image_b64 = base64.b64encode(f.read()).decode()8withopen("question.wav","rb")as f:9 audio_b64 = base64.b64encode(f.read()).decode()1011response = client.chat.completions.create(12 model="phi4-mm",13 messages=[{14"role":"user",15"content":[16{"type":"image_url","image_url":{"url":f"data:image/jpeg;base64,{image_b64}"}},17{"type":"input_audio","input_audio":{"data": audio_b64,"format":"wav"}},18{"type":"text","text":"Answer the spoken question about the image."},19],20}],21 max_tokens=512,22)23print(response.choices[0].message.content)
Tool calling
phi4-mm emits tool calls as functools[{"name":"...","arguments":{...}}].
The --tool-call-parser phi4_mini_json flag (vLLM 0.7+) handles this automatically.
For a complete chat template that injects tools into phi4-mm's native <|tool|>...<|/tool|> block,
see deploy/wsl-vllm/phi4-mm-tool-template.jinja
in the companion repo.
Requires pip install llmcompressor (or pip install compressed-tensors) to load
the quantization_config from the checkpoint.
Quality
Inference Tests
All tests run via vLLM on RTX 5090, --gpu-memory-utilization 0.45.
Text — factual recall (< 0.5s):
Prompt: "What is the capital of France?"
Response: "The capital of France is Paris." ✅
Text — math reasoning (0.748s):
Prompt: "Solve step by step: If a train travels 120 miles in 2 hours, what is its speed in km/h?"
Response: step-by-step solution → 96.54 km/h ✅
Text — code generation (1.068s):
Prompt: "Write a Python function that checks if a string is a palindrome."
Response: correct is_palindrome() with docstring + example calls ✅
Vision — real image (3000×4000 JPEG):
Prompt: "Describe what you see in this image in detail."
Response: correctly identified anime figure on a TV screen, described the room, entertainment setup, and animation style ✅
Audio — real voice message (Discord OGG Opus, converted to 16kHz WAV):
Input: Discord voice message (~11s) discussing software development
Response: "The speaker is describing the process of transforming the rag function into a function that uses a local database rather than writing to and from files." ✅
Audio note: Discord voice messages are OGG Opus at 48 kHz. Convert to 16 kHz mono WAV before
sending for best results. Pass "format": "wav" in the request.
vLLM LoRA note: vLLM currently only applies LoRA to the language model layers.
Vision encoder LoRA layers (SigLIP) are silently skipped — this is a vLLM limitation.
The speech LoRA (language decoder, rank-320) loaded and applied correctly.