Views
No views yet
mlx-vlm.mlx-vlm installed:1pip install --upgrade mlx-vlm
21from mlx_vlm import generate, load
2from mlx_vlm.prompt_utils import apply_chat_template
3from mlx_vlm.utils import load_config
4
5# Load model and processor
6model_id = "zherebetskyy/Qwen3.8-27B-mxfp8-mlx"
7model, processor = load(model_id)
8config = load_config(model_id)
9
10# Prepare prompt & image input
11image = ["[http://images.cocodataset.org/val2017/000000039769.jpg](http://images.cocodataset.org/val2017/000000039769.jpg)"]
12prompt = "Describe the contents of this image in detail."
13
14formatted_prompt = apply_chat_template(processor, config, prompt, num_images=1)
15
16# Generate response
17output = generate(model, processor, formatted_prompt, image, max_tokens=256)
18print(output)
191python -m mlx_vlm.generate \
2 --model zherebetskyy/Qwen3.8-27B-mxfp8-mlx \
3 --image <PATH_TO_IMAGE> \
4 --prompt "Describe this image." \
5 --max-tokens 200
6Qwen3.8-27B, balancing memory, token generation speed, and reasoning accuracy is key. Below is how MXFP8 compares to alternative quantizations:| Format | Bit-Width | Quantization Strategy | Dynamic Range | Outlier Preservation | Relative Accuracy (% of FP16) |
|---|---|---|---|---|---|
| MXFP8 (This Model) | 8-bit | Microscaling (E4M3 / E8M0 scale) | Very High | Superior | ~99.5% - 99.9% |
| 6-bit MLX | 6-bit | Uniform Linear / Grouped | Moderate | Good | ~97.5% - 98.5% |
| 4-bit MLX | 4-bit | Grouped Integer (INT4) | Limited | Low | ~92.0% - 95.0% |
| NVFP4 MLX | 4-bit | Microscaling (E2M1 / FP4) | Low-Medium | Medium | ~93.5% - 96.0% |
E8M0 Scaling):
Unlike traditional uniform integer quantization (such as standard INT4 or INT8), standard OCP Microscaling (MX) formats divide tensors into fine-grained blocks (typically size 32) and assign a shared 8-bit scale factor (E8M0). This allows sub-block values to adjust scaling dynamic ranges dynamically without truncating high-magnitude features.E4M3 Layout):
Language and vision models suffer accuracy loss in low-bit representations because weight distributions concentrate near zero while containing critical outlier values in active channels. MXFP8's E4M3 dynamic range preserves high-energy activation and weight outliers effortlessly.4-bit, NVFP4) work well for simple chat, they often experience severe performance degradation on multi-step reasoning, mathematical tasks, structural JSON parsing, and dense visual processing. MXFP8 preserves full-precision quality on benchmark reasoning tasks.mlx-vlm >= 0.6.13