Vision-Language Models in MLX
mlx-vlm is the MLX-native package for vision-language models — models that take an image (or video frames) and a text prompt, and produce text. The current best-of-class for the Apple-Silicon-friendly tier are Qwen-VL family models, LLaVA derivatives, and the smaller multimodal Llamas.
The shape is parallel to mlx-lm's — load returns model + processor; generate takes prompt + image and returns text. The only real new piece is the image preprocessing, which is the part most VLM tutorials get wrong on the first try.
Install + minimum loop
pip install mlx-vlm in your mlx env. The CLI is python -m mlx_vlm.generate; the Python API mirrors mlx_lm's shape with a processor object that handles images.
The image preprocessing detail everyone gets wrong
VLMs are trained on a specific image resolution and a specific normalization (mean/std). If you pass an image at the wrong resolution or skip the normalization, the model still produces output — usually plausibly worded, completely hallucinated. The processor object that mlx-vlm returns from load() handles all of this for you when you use its API; the bug appears when people pre-process images themselves and bypass the processor.
Always feed images through the processor. Don't try to be clever with PIL or torchvision transforms — the processor knows the model's expectations.
What VLMs are good at (today)
- OCR-like tasks — reading text in images, including handwriting and tables.
- Chart and diagram interpretation — "what's the trend in this graph?" works surprisingly well.
- Visual question answering — "how many people are in this photo?" "what's the broken part?" — the bread-and-butter.
- UI screenshot reasoning — "what does this app do?" "is this button enabled?" — increasingly strong as agentic UI workflows develop.
What they're still weak at
- Spatial precision — "how far apart are these two objects in pixels?" or anything requiring exact geometry. VLMs are describing images, not measuring them.
- Counting many objects — works well up to ~5 instances, degrades quickly past that.
- Small text in large images — resolution matters; if text is below ~10 pixels per character at the model's input resolution, OCR fails.