Back to directory

dflash-mlx

An implementation of DFlash block-diffusion speculative decoding for the MLX framework on Apple Silicon, generating multiple tokens per pass while guaranteeing output identical to standard autoregressive decoding.

dflash-mlx

dflash-mlx implements DFlash, a speculative-decoding technique, for MLX on Apple Silicon. A small draft model generates sixteen tokens at once using block diffusion, and the target model verifies all sixteen in a single forward pass; only tokens that match the target model's own greedy output are kept, so the result is lossless even though generation is faster.

It is built on stock MLX with a small number of custom Metal kernels for cases that need tighter numerical control, including a tape-replay approach to rolling back rejected tokens without snapshotting the full model state, routing for long-context attention on Qwen and Gemma model families, and quantized matrix multiplication kernels tuned for the verification step. A prefix cache keeps target and recurrent state in memory, with optional overflow to disk, so revisited prompts skip recomputation.

It is written in Python under the Apache-2.0 license.

More in Inference

See all 770
  • OpenDecision

    deepanwadhwa.github.io

    An open-source Python package that answers typed questions about application state or documents using a local natural-language-inference model, returning structured choice, score, yes/no or evidence-relation values instead of free text.

  • Lifeboat

    iterate.ai

    A local inference server that puts an OpenAI- and Anthropic-compatible API in front of open-weight language models running on hardware you control, from a laptop to a GPU cluster.

  • Claude S40

    github.com

    An unofficial Claude chat client for 2007-era Nokia Series 40 phones, built as a Java ME app plus a small Go relay server, with web search, reading mode and saved chats.