← Back to Leaderboard
MARahim3

ARahim3/mlx-dspark

MLX speculative decoding for faster local LLM inference on Apple Silicon

Engineering Health (Methodology)
A+ · 90/100
Maintenance Activity
● Updated 7d ago
Latest Release
v0.21.4
Commercial License Check
MIT · Commercial Friendly

Automated SPDX check for reference only — not legal advice. Disclaimer

Maintenance35/35
Fork Adoption15/25
Release Cadence20/20
License Clarity20/20
Local AISelf-HostedCLIGPUAPI
Total Stars
★ 811
24h Growth
+2
7d Growth
+6
Forks
69

GitHub Star History

Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.

ARahim3/mlx-dspark Star History (2026-06-30 - 2026-12-04) ALL-TIME STAR HISTORY (2026-06 – 2026-12) +810 in 157d · avg +5/day 856 428 0 2026-06-30: ★ 12026-07-11: ★ 1452026-07-25: ★ 1842026-08-08: ★ 2052026-08-22: ★ 5362026-09-05: ★ 6272026-09-19: ★ 6672026-10-03: ★ 6882026-10-17: ★ 7132026-10-31: ★ 7262026-11-10: ★ 7302026-11-20: ★ 7382026-12-04: ★ 811 ★ 811 06-30 09-16 12-04

Evidence-Backed Technical Brief

AI Deep Review

Architecture & Core Mechanics

mlx-dspark is a Python inference engine that uses MLX to run speculative decoding on Apple Silicon GPUs. It keeps the target model in charge of the output and shares a verification loop across several drafting methods. DSpark uses target hidden states to propose seven tokens and applies a previous-token correction through a Markov head. DFlash denoises a 16-token block in parallel and reuses the target's embeddings and output head. DFlash 2 builds a chain from top candidates; DSpine conditions each position on its predecessor.

The target verifies proposed tokens in blocks, allowing one pass to advance multiple positions when the draft matches. Greedy output matches plain target decoding apart from floating-point tie-breaking; speculative sampling preserves the target distribution under the selected sampling settings, rather than promising the same sampled transcript. Matched drafters load from Hugging Face checkpoints and default to 4-bit quantization. For a loadable target without a matched drafter, n-gram lookup can instead propose a continuation seen earlier in the context.

Key Capabilities & Differentiators

The engine is available through a CLI, Python, and a local HTTP server. The server exposes /v1/chat/completions, /v1/messages, and /v1/responses on one port, with controls for sampling and reasoning as well as tool calling. The CLI can compare plain decoding with speculation, and the separate native Mac app adds model-fit estimates, per-round acceptance telemetry, and a side-by-side output check.

Matched checkpoints cover families including Gemma-4, Qwen3, LFM2.5, and Muse-Glimmer. On a warm M4 Pro at short context, Qwen3.8-27B 4-bit with DFlash 2 decoded at roughly 42–65 tokens/s, with a 2.72× chat speedup and a 4.23× math speedup. The gap matters: measure with your own prompts, and report decode throughput separately from time to first token and end-to-end agent runtime.

Trade-offs & Limitations

Against plain MLX decoding, the key question is whether accepted tokens repay the cost of drafting and verification. The engine profiles the Mac on the first run of a model pair and caches the result to choose a draft cap, but calibration cannot fix a poor target–drafter match. Lookup also cannot guarantee a speedup on prompts without useful repetition. Benchmark the same checkpoint and quantization with and without speculation, then repeat at the 16k–32k context lengths relevant to coding agents rather than extrapolating short-context results.

Compared with the hosted OpenAI API, this is a way to keep inference local and choose your own checkpoints, not a guarantee of hosted model quality, feature parity, or managed concurrency. Unified memory is a practical constraint: Qwen3-8B-8bit is listed at about 11 GB peak RAM, while Qwen3.8-27B 4-bit is about 18 GB and is not a sensible default for a 16 GB Mac. The MIT license covers the engine; check target and drafter weight terms separately.

Hardware & Deployment Guide

Install the engine with pip install mlx-dspark on an Apple Silicon Mac with Python 3.10 or later. v0.21.4 requires MLX 0.32.5 or later, whose few-row quantized matmul and attention kernels reduce verification cost; the release reports up to 16% faster speculative decoding. Weights are not bundled: populate the Hugging Face cache on first use or supply compatible local files for offline operation. The separately distributed Mac app is not included in the Python wheel.

Start with mlx-dspark serve --model mlx-community/Qwen3-8B-8bit; the default listener is 127.0.0.1:8080. Use --no-model and then /admin/load to defer loading or swap checkpoints. The server is designed for local, single-user use. If exposing it beyond loopback, set --api-key; with a key configured, only GET /health remains unauthenticated. Custom checkpoint Python is refused by default, and --trust-remote-code changes that policy for the entire process, not just one model load.

Verification: One MLX target-verification loop serves DSpark, DFlash, DFlash 2, and DSpine.
Model selection: Known target families resolve matched drafters across quantizations; --mode auto can fall back to drafter-free n-gram lookup.
Calibration: First-run measurements are cached per pair, and --max-draft auto can adapt the cap each round.
Benchmarking: On a warm M4 Pro, Qwen3.8-27B 4-bit with DFlash 2 measured 2.72× on chat and 4.23× on math at short context.
Serving: A Python standard-library HTTP server exposes OpenAI Chat Completions, OpenAI Responses, and Anthropic Messages on one port.
Operations: --no-model and /admin/load support deferred loading and model swaps; custom checkpoint Python is blocked by default.
Best For

Apple Silicon users serving a local chat or coding workflow who can choose a matched target–drafter pair and measure gains at their actual context length.

Skip If

You need DeepSeek-V4 inference, a non-Apple GPU runtime, or a managed multi-tenant API with predictable concurrency.

Reviewed on 2026-12-04 · Grounded in GitHub README, root file tree & releasesMethodology

Quick Start & Installation

Local AISelf-HostedCLIGPU
brew tap ARahim3/mlx-dspark https://github.com/ARahim3/mlx-dspark
brew trust arahim3/mlx-dspark          # Homebrew 6+: third-party taps need explicit trust
brew install --cask mlx-dspark
xattr -dr com.apple.quarantine /Applications/mlx-dspark.app   # not notarized yet: clear
                                       # quarantine once, or use System Settings › Privacy &
                                       # Security › "Open Anyway" after the first launch

Comparison vs. Top LLMs & Inference Alternatives

Full comparison →
RepositoryStars7d TrendStackLicenseCore Positioning
mlx-dspark ★811+6PythonMITMLX speculative decoding for faster local LLM inference on Apple Silicon
OmniRoute92.1k+1.5kTypeScriptMITSelf-hosted OpenAI-compatible gateway for multi-provider routing and fallback
ollama189k+703GoMITGo-based LLM serving layer for local model management and inference
nano-vllm16.7k+95PythonMITA compact vLLM-style Python engine for offline GPU batch inference

AI Context Briefing (for Claude / Cursor / Windsurf)

Standardized architecture summary & quickstart commands ready to paste into coding agents.

Raw .md ↗
curl -sL https://repoforai.com/repo/ARahim3/mlx-dspark.md

Embed Star History Chart & Badges in README.md

Full-history Star History SVGs and velocity cards on GitHub Camo: drop-in replacement for OSSInsight and Star History widgets.

ARahim3/mlx-dspark Star History on RepoForAI

Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).

Frequently Asked Questions about mlx-dspark

How do I connect an existing API client or Claude Code?

Point the client at the local server and select the model it serves. OpenAI Chat Completions, OpenAI Responses, and Anthropic Messages share one port. The mlx-dspark claude launcher redirects only the Claude Code process it starts, without rewriting persistent settings. Test streaming, tool calls, and multi-turn tool history with your chosen model before switching an existing workflow.

Which models are practical on a 16 GB Apple Silicon Mac?

For a 16 GB Mac, Qwen3-4B-8bit (~8 GB peak RAM) or Qwen3-8B-8bit (~11 GB) leaves more headroom than Gemma-4 12B 8-bit (~15 GB). Qwen3.8-27B 4-bit is listed at ~18 GB. These are peak RAM figures, not dedicated VRAM requirements; validate memory pressure with your actual context length and other applications running.

Can I use mlx-dspark commercially and self-host it?

The engine is MIT-licensed and can be used commercially subject to the license terms, including retaining the required notices when redistributing it. Review the target and drafter checkpoint licenses separately. For self-hosting, keep the single-user server on loopback where possible, use --api-key if exposing it beyond loopback, and leave custom checkpoint code disabled unless you trust its source.

When should I choose it over plain MLX decoding or the OpenAI API?

Use plain MLX decoding as the control when evaluating a specific target and quantization. A well-matched drafter can reduce decode time without changing greedy output apart from numerical ties, but a weak drafter can add work. Compared with the hosted OpenAI API, mlx-dspark keeps inference on your Mac and gives you control over the checkpoint; it also makes you responsible for memory, model availability, and feature compatibility.

Upstream README & Documentation

This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.

Maintaining ARahim3/mlx-dspark? Pin to Homepage + competitor /alternatives pages with a custom Cloud/Demo CTA.Feature ARahim3/mlx-dspark on Homepage & Alternatives ($19)
WEEKLY BREAKOUT DIGEST

Top 10 Breakout Open-Source AI Repos, Every Thursday

Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.

Zero spam · 1-click unsubscribe · Privacy Policy

Saved in your browser · Export Markdown RFC tables or jump into /vs compare