Downloads · 30 days
23
19% of all-time downloads
cnrai/DeepSeek-V4-Flash-0731-MXFP8-MLX
DeepSeek-V4-Flash-0731-MXFP8-MLX is a text generation model from cnrai. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as mit.
MXFP8-quantized DeepSeek-V4-Flash for Apple Silicon, optimized for PAVE Core, OpenPAVE and vllm-mlx
Downloads · 30 days
23
19% of all-time downloads
All-time downloads
121
Public
Repo size
294 GB
Likes
1
Public
Click a slice to open those files.
.safetensors294 GB · 100%
From the Hugging Face model README
MXFP8-quantized DeepSeek-V4-Flash for Apple Silicon, optimized for PAVE Core, OpenPAVE and vllm-mlx
| Feature | Details |
|---|---|
| Base model | deepseek-ai/DeepSeek-V4-Flash-0731 |
| Quantization | MXFP8 (8-bit floating point with block-wise scaling) |
| Original format | FP8 (E4M3 weights, E8M0 block scales) |
| Architecture | Hybrid attention + pooling (DeepSeek V4 MoE, 43 layers) |
| Parameters | ~274 GB on disk |
| Designed for | Mac Studio M3 Ultra 512GB + PAVE Core |
The original DeepSeek-V4-Flash-0731 checkpoint uses FP8 (E4M3) weights with E8M0 block scales. MLX's Metal kernel backend doesn't natively read HuggingFace F8_E4M3/E8M0 dtypes from safetensors. This checkpoint converts them to MXFP8 format, which MLX loads natively via mx.quantized_matmul(mode='mxfp8').
The conversion is performed directly from the original deepseek-ai/DeepSeek-V4-Flash-0731 checkpoint — not from a re-quantized derivative. This is critical: any intermediate re-quantization (e.g. MXFP4 to MXFP8 via a third party) compounds quantization noise and degrades quality. By starting from the source, we guarantee no double-quantization.
The original checkpoint stores two different quantization formats, despite being labeled "FP8":
| Layer type | Source format | Bits per weight | Layout |
|---|---|---|---|
| Attention (q/k/v/o projections) | FP8 E4M3 | 8-bit | Weight tensor + E8M0 block-scale tensor |
| Shared MLP (gate/up/down) | FP8 E4M3 | 8-bit | Weight tensor + E8M0 block-scale tensor |
| MoE experts (switch_mlp, 256 experts) | MXFP4 E2M1 | 4-bit | 2 nibbles packed per byte + E8M0 block-scale |
┌─────────────────────────────────────────────────────────┐
│ STEP 1: Load original weights via PyTorch │
│ (reads HF F8_E4M3/E8M0 and MXFP4-packed I8 dtypes) │
├─────────────────────────────────────────────────────────┤
│ STEP 2: Dequantize to bf16 │
│ │
│ FP8 E4M3 path: │
│ bf16 = E4M3_value × 2^(block_scale_byte - 127) │
│ (lossless: bf16 mantissa=7 bits > E4M3 mantissa=3) │
│ │
│ MXFP4 E2M1 path: │
│ bf16 = mx.dequantize(mxfp4_packed, block_scales) │
│ (lossless: bf16 mantissa=7 bits > E2M1 mantissa=1) │
├─────────────────────────────────────────────────────────┤
│ STEP 3: Re-quantize bf16 → MLX MXFP8 │
│ mx.quantize(bf16_weights, bits=8, mode='mxfp8') │
│ (MLX computes optimal E4M3 + E8M0 block scales) │
└─────────────────────────────────────────────────────────┘
No double quantization. We convert from the original source checkpoint, not from an intermediate MXFP4 derivative. The rejected path (MXFP4 → bf16 → MXFP8) would compound two rounding errors; our path (source → bf16 → MXFP8) introduces only one.
bf16 intermediate is lossless. Both FP8 E4M3 (3 mantissa bits) and MXFP4 E2M1 (1 mantissa bit) fit exactly into bf16's 7 mantissa bits. The dequantization to bf16 introduces zero additional rounding error.
Expert weights gain precision. MoE experts go from 4-bit (MXFP4 E2M1, 1 mantissa bit) to 8-bit (MXFP8 E4M3, 3 mantissa bits). This is a strict precision upgrade — 3× more mantissa bits reduces quantization error by ~8× per weight. Since V4-Flash has 256 small experts (2048 intermediate each), the extra precision directly improves MoE routing and output quality.
Block scales are recomputed optimally. The original E8M0 block scales are designed for the source format's dynamic range. MLX's mx.quantize recomputes block scales that are optimal for MXFP8's E4M3 mantissa range, rather than reusing scales designed for a different format.
Output: 45 safetensors shards, ~274 GB total. Expert weights doubled from 4-bit to 8-bit as intended.
Mac Studio M3 Ultra (512GB unified memory):
| Metric | Value |
|---|---|
| Decode throughput | up to 26 tok/s (without MTP speculative decoding) |
| Prefill throughput | ~106 tok/s |
| Model load size | ~274 GB |
| Quantization overhead | ~14% slower vs MXFP4 (31 tok/s) due to 2x bandwidth |
--max-num-seqs 1--cache-memory-mb 8192 prefix cache--ssd-cache-dir for SSD-tier KV cacheChat completion: N tokens in Xs log linesThis model is designed to work perfectly with PAVE Core — a highly customized fork of vllm-mlx optimized for DeepSeek-V4-Flash and GLM-5.2 on Apple Silicon.
reasoning_effort support and server-side reasoning preservationBuilt specifically for OpenPAVE — the AI coding agent.