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.
Metadata
Release files for dfly-mlx 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dfly_mlx-0.1.0.tar.gz | 19.2 kB | Without provenance | Details for dfly_mlx-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dfly_mlx-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for dfly_mlx-0.1.0-py3-none-any.whl |
Total release size: 38.4 kB
Release files / dfly_mlx-0.1.0.tar.gz
| Download URL | dfly_mlx-0.1.0.tar.gz |
|---|---|
| Size | 19.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
756bd2b2691b76bbe90e1bff6a512d47c1645fbd45e2c817f6c03ffd60d9e68d
|
|
BLAKE2b-256 checksum How to use checksums |
194e4ae06f60d3236c0bdeb94bd8768a5a368cd991589b549bab3e74b14a46b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.13
|
Release files / dfly_mlx-0.1.0-py3-none-any.whl
| Download URL | dfly_mlx-0.1.0-py3-none-any.whl |
|---|---|
| Size | 19.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d958ed4aa996b6af887b1e028a56962d2db3474d3065c5276a1464e757db1d05
|
|
BLAKE2b-256 checksum How to use checksums |
1eae5d4f4249d7866b9e8ca7be1038b97cd21d97bf36ef9574c913804aac51be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.13
|
Security for dfly-mlx 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.