dfly-mlx
Native DFly speculative decoding for Apple Silicon. One MLX target, one official drafter, one reproducible benchmark.
DFly runs a five-layer block-parallel draft backbone, fuses five intermediate target representations differently at every draft layer, then samples the seven proposals left-to-right through its lightweight hidden-correction head. The Qwen3-8B target verifies every proposal before it is committed.
Early implementation: conversion and generation pass on a 16 GB Apple M5, but no performance number is published yet. The 4-bit target can choose a different greedy token at near-tied logits when run as a verification block instead of one token at a time, so the strict parity benchmark currently fails closed on affected prompts.
Requirements
- Apple Silicon Mac
- Python 3.10–3.13 and MLX/MLX-LM 0.31 or newer
- About 7 GB for the 4-bit target plus converted drafter weights; keep roughly 10 GB free during conversion and leave unified-memory headroom for KV caches
Install
python3.11 -m venv .venv
source .venv/bin/activate
pip install -e '.[convert,test]'
Convert the official checkpoint
The upstream Hugging Face repository currently has a bad latest config.json:
it describes an 80-layer target instead of Qwen3-8B. The converter therefore
pins the last correct upstream revision, 5712926, validates its architecture,
and writes MLX safetensors.
dfly-mlx convert --output ./models/qwen3-8b-dfly-mlx
An already-downloaded checkpoint directory can be supplied with --draft;
the same metadata and tensor-shape gates still apply.
The output remains an Apache-2.0 AngelSlim model derivative and includes its model license.
Or download the ready-to-use MLX conversion:
hf download will702/Qwen3-8B-DFly-MLX \
--local-dir ./models/qwen3-8b-dfly-mlx
Generate
dfly-mlx generate \
--draft ./models/qwen3-8b-dfly-mlx \
--prompt 'Write a quicksort in Python.' \
--max-tokens 256
The target defaults to mlx-community/Qwen3-8B-4bit. Prompts use Qwen3's
no-thinking chat template because the released DFly drafter was trained in
no-thinking mode.
Reproduce the benchmark
dfly-mlx bench \
--draft ./models/qwen3-8b-dfly-mlx \
--trials 3 \
--output benchmark.json
The benchmark warms both paths, records exact software and hardware metadata, and refuses to publish a row unless target-only and DFly token IDs match. Results are medians across trials, not best runs. This is deliberately stricter than the usual speculative-decoding guarantee, where every emitted proposal is accepted by the batched target verifier.
v0.1 boundaries
Qwen3-8B, no-thinking, greedy decoding, and one request at a time. There is no server or training stack yet. Add those only after the native path demonstrates a repeatable speedup.
Attribution
DFly was introduced by Tencent's AngelSpec team. The MLX target execution and
draft/verify machinery come from dflash-mlx. See NOTICE for precise
attribution and licenses.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dfly_mlx-0.1.0.tar.gz.
File metadata
- Download URL: dfly_mlx-0.1.0.tar.gz
- Upload date:
- Size: 19.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
756bd2b2691b76bbe90e1bff6a512d47c1645fbd45e2c817f6c03ffd60d9e68d
|
|
| MD5 |
a259cdc2ff8f02338a008b974f264edc
|
|
| BLAKE2b-256 |
194e4ae06f60d3236c0bdeb94bd8768a5a368cd991589b549bab3e74b14a46b9
|
File details
Details for the file dfly_mlx-0.1.0-py3-none-any.whl.
File metadata
- Download URL: dfly_mlx-0.1.0-py3-none-any.whl
- Upload date:
- Size: 19.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d958ed4aa996b6af887b1e028a56962d2db3474d3065c5276a1464e757db1d05
|
|
| MD5 |
a7138cf679e4333b3e86f010e5e24ef5
|
|
| BLAKE2b-256 |
1eae5d4f4249d7866b9e8ca7be1038b97cd21d97bf36ef9574c913804aac51be
|