Views
No views yet
mlx_lm.dwq), no forks.mlx-lm 0.31.3 (mlx 0.32.0)| Variant | Size | Status |
|---|---|---|
| Qwen2.5-1.5B-Instruct-MLX-8bit | 1.5 GB | teacher |
| Qwen2.5-1.5B-Instruct-MLX-4bit | 0.93 GB | plain affine 4-bit (gs32) |
| Qwen2.5-1.5B-Instruct-MLX-4bit-DWQ | 0.93 GB | this repo — DWQ |
| Pack | Perplexity ↓ |
|---|---|
| 8-bit teacher (reference) | 8.34 |
| plain affine 4-bit gs32 | 9.86 |
| this pack (DWQ 4-bit gs32) | 9.45 |
exp(nll); full script in the library's docs/dwq-recipe.md
"Gate: exact invocation"):1import mlx.core as mx; from mlx_lm import load
2m, t = load("majentik/Qwen2.5-1.5B-Instruct-MLX-4bit-DWQ")
3ids = mx.array(t.encode(TEXT))[None] # TEXT = fixed passage from docs/dwq-recipe.md
4lg = m(ids[:, :-1]).astype(mx.float32)
5lp = lg - mx.logsumexp(lg, axis=-1, keepdims=True)
6nll = -mx.take_along_axis(lp, ids[:, 1:][..., None], axis=-1).mean()
7print(float(mx.exp(nll))) # -> 9.451# dwq_stable.py — forces the stable reference KL path (see repo docs/dwq-recipe.md)
2import mlx_lm.tuner.losses as _losses
3_losses.can_run_metal = lambda: False
4from mlx_lm.quant.dwq import main
5if __name__ == "__main__":
6 main()1python dwq_stable.py \
2 --model Qwen2.5-1.5B-Instruct-MLX-8bit \
3 --quantized-model Qwen2.5-1.5B-Instruct-MLX-4bit \
4 --mlx-path Qwen2.5-1.5B-Instruct-MLX-4bit-DWQ \
5 --group-size 32 --bits 4 \
6 --num-samples 1024 --max-seq-length 512 --batch-size 1 \
7 --learning-rate 1e-6 --data-path allenai/tulu-3-sft-mixturedocs/dwq-recipe.md, per
docs/quantization-policy.md rule 2 (DWQ for 2–4-bit packs; group-size 32).1pip install mlx-lm
2python -m mlx_lm generate --model majentik/Qwen2.5-1.5B-Instruct-MLX-4bit-DWQ \
3 --prompt "Explain what a hash table is in two sentences."