# dflash-mlx-speculative-decoding

Speeds up MLX inference on Apple Silicon by 1.7x to 4.1x using lossless DFlash speculative decoding with block diffusion drafts.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 443 installs · ★ 88
- Author: reason-machines
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/reason-machines/trending-skills/tree/HEAD/skills/dflash-mlx-speculative-decoding/SKILL.md
- Updated: 2026-10-09
- HTML: https://affpapa.org/en/nevibecode/skills/dflash-mlx-speculative-decoding

## What it does

This skill guides the coding agent through configuring DFlash speculative decoding inside Apple Silicon MLX setups. Generation relies on a compact draft model near 1B parameters that produces 16 candidate tokens simultaneously. The primary model evaluates this entire block during one forward pass. Because only verified tokens make it into output, the generated text matches greedy decoding.

The package provides paired setups for Qwen3.5 models at 4B, 9B, 27B, and 35B. Draft checkpoints resolve automatically through an internal registry. You also get a CLI runner `dflash`, an OpenAI-compatible runtime `dflash-serve` on port 8000, and a benchmarking tool `dflash-benchmark`.

An Apple Silicon Mac, Python 3.10+, and MLX 0.31.1+ are mandatory. Unlisted model checkpoints fail at startup unless you supply an explicit draft model using `--draft`.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add reason-machines/trending-skills --skill dflash-mlx-speculative-decoding -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/dflash-mlx-speculative-decoding/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/dflash-mlx-speculative-decoding/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add reason-machines/trending-skills --skill dflash-mlx-speculative-decoding -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/dflash-mlx-speculative-decoding/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add reason-machines/trending-skills --skill dflash-mlx-speculative-decoding -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/dflash-mlx-speculative-decoding/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install reason-machines/trending-skills dflash-mlx-speculative-decoding
```

2. **Manually: put the files in place**
- File: `.github/skills/dflash-mlx-speculative-decoding/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add reason-machines/trending-skills --skill dflash-mlx-speculative-decoding -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/reason-machines/trending-skills --path skills/dflash-mlx-speculative-decoding
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/dflash-mlx-speculative-decoding/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add reason-machines/trending-skills --skill dflash-mlx-speculative-decoding -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/reason-machines/trending-skills/tree/HEAD/skills/dflash-mlx-speculative-decoding/SKILL.md

## When to use it
- speed up token generation under MLX
- run a local OpenAI-compatible inference server on port 8000
- benchmark inference speed gains against baseline mlx_lm
- configure speculative decoding pairs for Qwen3.5

## Example prompts
- Start a local dflash-serve instance with model Qwen/Qwen3.5-9B on port 8000
- Benchmark Qwen/Qwen3.5-9B against baseline MLX with a 1024 token limit
- Write a Python script using DFlashRuntime for streaming token output

## Similar
- [jetson-speculative-decoding](https://affpapa.org/en/nevibecode/skills/jetson-speculative-decoding.md) — skill · 1100 installs
- [emerging-techniques-speculative-decoding](https://affpapa.org/en/nevibecode/skills/emerging-techniques-speculative-decoding.md) — skill · 59 installs
- [speak-tts](https://affpapa.org/en/nevibecode/skills/speak-tts.md) — skill · 735 installs
- [mac-mini-llm-lab](https://affpapa.org/en/nevibecode/skills/mac-mini-llm-lab.md) — skill · 309 installs
- [qianwen-model-selector](https://affpapa.org/en/nevibecode/skills/qianwen-model-selector.md) — skill · 5500 installs
- [qwencloud-text](https://affpapa.org/en/nevibecode/skills/qwencloud-text.md) — skill · 1600 installs

From the same set: [reason-machines/trending-skills](https://affpapa.org/en/nevibecode/by/reason-machines/trending-skills.md) — 186 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
