stoke: Faster MLX models, checked against the original.

On your Mac, stoke rewrites parts of your model as custom Metal GPU kernels and leaves the rest exactly as it was. It speeds up reading short and medium prompts, and generating images.

Real models, faster on a base M4.

24 GB of memory, MLX 0.32.2, timed September–October 2026. Results are per machine: we haven’t established that kernels carry across chips.

Qwen3-30B-A3B (3-bit MoE)

Time to first token on a 128-token prompt, through MLX-LM’s own generation call.

First-token log-probabilities matched the original bit for bit.

Profile: 128 tokens 1.24× · 300 1.17× · 512 1.13× · 1,041 1.08× · 2,048 1.02×

gpt-oss-20b (OpenAI, MXFP4 experts)

Reading a 32-token prompt, timed over 10 forward passes against compiled MLX.

Profile: 32 tokens 1.32× · 128 1.18× · 512 1.08× · 2,048 ≈1.00×

LFM2.5-24B-A2B (Liquid, 4-bit MoE)

Reading a short prompt, against MLX-LM’s uncompiled path, the one LM Studio runs.

Profile: short prompt 1.13× · 512 tokens 1.07× · 1,532 1.04× · 5,305 1.01×

FLUX.2 Klein 4B (image model, in mflux)

10 denoising steps at 768 × 768, on the published weights, against mflux’s own compiled step.

1.07× when a single step is timed on its own.

Faster on an open benchmark of GPU workloads.

MetalBench, an open suite by Lazarus-931 ↗, defines 35 small MLX workloads for Apple GPUs, each a fused pair of operations; stoke uses only its problem definitions and times each whole workload on an Apple M4.

geometric mean across all 35, against compiled MLX. A workload without a win counts as 1.00×.

Small workloads gain more than whole models, which measured 1.11× to 1.32×.

The AI drafts. The harness decides.

  1. Bring your model.

    A Python file whose build() returns an MLX model (mlx-lm, mflux or your own code) and a short manifest: which inputs to speed up, and how many attempts to allow.

  2. An AI writes kernels.

    A coding agent (Claude Code, Codex or Gemini CLI) writes custom Metal GPU kernels for parts of the model.

  3. The harness keeps only what holds.

    A kernel stays only if the model’s outputs still match the original (bit for bit, or within a set allowance where the math is reordered) and the whole model gets faster by more than the timing noise. Fast in isolation doesn’t count. The AI never grades its own work.

  4. Apply it in one line.

    model = apply(model)

    Input sizes the run didn’t check fall back to the original code: correct, just not faster.

Your weights and data stay on your Mac. The coding agent receives a text briefing, not weights: the code, shapes and timings of the operations to rewrite.

A run takes hours. If nothing beats the original, nothing ships.

Bring us a model.

Today we run stoke with you, on your model, on the chip you serve on. You get a verified speedup you apply in one line, or a clear answer that nothing beat your baseline.

Campground is built by Shivam Garg.