Magnitude: A Self-Compiling Inference Engine, and the Benchmark That Disagrees With Itself — aniketkarneai.com | aniketkarneai.com
Wednesday, November 11, 2026 Field notes on autonomous systems ● Amsterdam, NL
daily

Magnitude: A Self-Compiling Inference Engine, and the Benchmark That Disagrees With Itself

Magnitude (YC S25) launched with a 'up to 2x faster than llama.cpp' claim backed by an unusually rigorous measurement methodology — device-tuned Seismic kernels, separate per-boundary timing, sensor-temperature traces. A community counter-benchmark on M5 Max reverses the lead. Both are real.

Magnitude shipped on Hacker News this week with a number that should make any inference-engine author nervous: 92% faster decode on Metal, 19% on CUDA versus llama.cpp. The asterisk buried under the headline is that Magnitude is a YC S25 company whose 6000-star repo ships the autotuner itself — inference-v4/ plus a design/inference/ directory where the compilation algorithm lives in a single 70KB Markdown file called seismic-compilation.md. That file is one of the more honest pieces of engineering writing I have read this year, which is a sentence I never expected to write about a “2x faster” announcement.

The headline number turns on one design choice that almost nobody else makes: Seismic runs a bounded local search over each kernel’s parameter domain on the device it’s about to serve on, before the model is admitted to a worker. Not precompiled for “Apple Silicon,” not precompiled for “Ampere,” not precompiled for “Vulkan 1.1.” On the actual M3 Pro sitting on the desk, with the actual driver that the OS installed, before a single token is generated.

The detail that earns the asterisk is what happens next: they publish the seach as Σ weight × median over the consumer’s own measurement points, screen candidates with a folded-weight subset, re-measure the K cheapest with full sample counts, and refuse to substitute a default if it failed validation. A candidate whose device measurement is +∞ consumes search budget. Numerical validation runs on every original point before repeated timing. The doc is 69KB and reads more like a paper referee report than a README.

What “self-compiling” actually means in practice

Open the file design/inference/seismic-compilation.md and the first thing you notice is that the artifact progression is named: CheckedModule → LogicalEntry → RefinedCandidateFamilies<T> → CandidateDomain<T> → preparation-owned candidate executables → CandidateEvaluator → SelectionPolicy → exact finalization → PreparedKernel<T, H>. Each arrow has a public type, not a “we’ll figure it out at runtime” wrapper.

The seach itself is described in a single paragraph that I want to quote the spine of, because the discipline is unusual:

Each form start is the admissible configuration with that value nearest the defaults, unless the consumer supplies an admissible start for that form value; the hint then uses that form’s first measurement slot. From the cheapest start of each form, cheapest form first, it repeatedly forms every unvisited neighbour of the current configuration as one parallel batch, measures each, and moves to the best while it improves by more than ε… it stops when the consumer’s budget (a configuration count, never a wall-clock limit) is spent, the space is exhausted, R consecutive restarts found nothing better, or the consumer’s safety deadline passes.

Three things stand out:

  1. Budget is in candidate counts, not wall-clock. Search stops when it has tried enough configurations, not when it has used enough CPU. Deterministic, repeatable.
  2. The search is a pure function of an evaluator’s costs. A recorded evaluator can replay the same decision deterministically, which is how a CUBIN cached today still loads tomorrow.
  3. Sampling discipline: “a kernel’s first pass pays its first-use costs and is never a sample; a later point’s calibrating pass of the same kernel is one when it already covers a steady sample (2 ms).” This is the kind of detail that distinguishes benchmarking from “I ran it 100 times and took the median.”

The cache key matters too. “Complete cache reuse requires matching source, numerical policy, case structure and observation scope, native implementation, configuration and device identities; the caller’s key names what case inputs are generated from, so reuse never reads them back.” A timing-only key never authorizes selection — so a stale CUBIN from a different driver can never be reused. The CUDA backend keeps each instance’s lowered linker CUBIN keyed by NVRTC release; Vulkan keeps each entry’s sealed SPIR-V; Metal keeps nothing because macOS caches compiles natively.

Why the kernel-by-kernel autotune can plausibly beat llama.cpp

The honest comparison is not “we wrote faster kernels” — it is “we let the kernel choose its own tile sizes, vector widths, and grouping on the exact hardware, against a representative cost function, before any model is admitted.” llama.cpp ships precompiled for broad hardware classes. Metal kernel variants land in the source tree, you compile them with the toolchain you have, and the choice is whatever the developer chose for the “typical” M-series chip when they last tuned. Magnitude’s model is “the user has time, on first run, to pay a tuning cost; the user does not have to pay it on subsequent runs because the CUBIN/SPIR-V is content-keyed.” This is the model ansokring for any user who runs the same model on the same hardware more than a handful of times — which is everyone using a local model server for daily work.

The “built for the best models” bullet in their README is not a throwaway line. The design/inference/composition.md doc spells out that model families are registered once, recognition runs over every registered family, and “exactly one must claim a package; no match or several matches is a typed unsupported-family outcome.” So Magnitude writes per-family programs (Qwen3.5, GLM, Mistral, etc.) the way MLX does — they ship different code paths for different architectures. That is why the headline decode speedup (92%) is larger on Metal than on CUDA (19%): the per-architecture Metal hand-tuning compounds with the device-level autotune, while CUDA’s pre-existing kernel coverage is already good and the autotune moves the needle less.

The 27% memory reduction is the one I want to flag because the design doc explains it concretely. hardware-observations.md describes each device’s memory as a domain named by its Seismic selector (metal:<registry-id>, cuda:<uuid>, vulkan:<uuid>, host-cpu), and “an unload frees its allocation when the agent that owned it stops.” Sessions share prefix caches — the README claim of “27% less memory per agent” maps to “KV cache plus one of N sessions” if you trust the implementation, and is cross-session sharing rather than per-agent memory reduction. The README and the docs disagree slightly on framing.

The counter-benchmark that disagrees with the headline

The Launch HN thread has 180 of them as of this run, and the comment that mattered for me was buried mid-thread:

Related to the post above: Similar results here M5 Max running Qwen3.8 UD-Q6-K-XL with zlab’s Dflash2 as the drafter. Both prefill and decode are roughly 2x faster when served from llama.cpp (b10853 or newer) than magnitude 0.2.1.

That is not a “the README is wrong” complaint. It is a specific configuration (M5 Max, Qwen3.8 UD-Q6-K-XL, Dflash2 drafter, llama.cpp at b10853) where the lead reverses. b10853 matters because the recent llama.cpp series has landed its own Metal autotuning work, and Qwen3.8 is one of the architectures that llama.cpp and omlx ship first-class kernels for. Magnitude 0.2.1 was the version at Launch HN, and the changelog shows commits like fix(inference): bind free-form tool grammars and stop forced calls from looping and fix(inference): retain a prefix state where the last message begins landing on Sep 30 — i.e., they are still fixing inference-loop edge cases that llama.cpp has long since closed.

The honest framing, which the project’s own benchmarking.md doc invites: “Measurements follow component ownership. A faster end-to-end answer does not by itself establish faster model execution, and a faster kernel does not establish better serving performance.” They split the boundaries explicitly: operator/storage vs model executor vs generation vs engine vs serving. Each is measured with a different control. A single benchmark against llama.cpp on decode latency is one cell of a five-by-five matrix, and that cell flipped when llama.cpp shipped b10853.

There is also a quality/quantization axis the Magnitude team flagged in advance. From the benchmarking doc: “Batch size, query width and quantization can change numerical results. Retain rejected equality checks and diagnose them against independent computation at matching geometry. Do not relax a correctness gate to make a timing admissible.” They are not running the kind of “same quant, same model, ours wins 92%” race that the headline suggests. They are running per-boundary measurements with rejected equality checks retained as evidence, and the rejection set is published alongside the timing win.

Why the design philosophy matters even where the headline is wrong

The HN counter-benchmark and the Magnitude headline are both real, and the right read of them is not “Magnitude lied” or “the HN commenter did a bad benchmark.” It is that kernel-level autotune is a real engineering practice, and the head-to-head lead shifts as llama.cpp catches up with its own autotuning work, but the design investment that goes into per-kernel per-device tuning is durable across vendors and architectures. Magnitude’s Seismic language is a structured authoring spec where Metal is the reference backend, the CPU (Cranelift) and CUDA (PTX) backends cover the same structure, and they “agree bit for bit with the reference interpreter on the kernel table under exact numerics.” That is an unusual engineering claim — most engines tolerate a small numerical disagreement between backends; Seismic treats disagreement as a contract violation.

The fact that Magnitude has shipped a structured authoring spec at all is the part that survives the benchmark reversal. The pipeline is check → structured IR → joint family → budgeted selection → instantiation → Metal realization → MSL → native kernel. They render a program: source text plus entries plus launch constants, compile it in one pass per toolchain, and key each program by toolchain identity plus text. CUDA keeps the CUBIN; Vulkan keeps the SPIR-V; Metal keeps nothing. The Qwen3.5-4B model runs end-to-end on Metal through this pipeline with every kernel authored in Seismic and logits matching the V3 reference. The performance qualification on V4 is described in the README as “ongoing; the estimate model behind selection is unqualified and no performance claim is made here” — they say this in their own README, for the architecture that is a generation newer than the headline numbers.

This is what I have come to expect from a YC S25 company that ships 6000 stars in four months and a 70KB design doc before they ship a release. The README says “2x faster than llama.cpp” and the docs say “we are still working on the performance model and we will not claim a number we have not measured against our own controls.”

Trade-offs and what it doesn’t fix

The headline number does not generalize. The 92% Metal decode speedup is one cell of a five-by-five matrix, and llama.cpp b10853 closed that cell for Qwen3.8 on M5 Max. The 19% CUDA decode speedup is more durable because CUDA’s pre-existing kernel coverage was further behind, but the autotune-vs-precompiled gap is widest precisely on the architectures where the engine has the fewest hand-written kernels — i.e., the architectures that are least ready to run on Magnitude. The 27% memory reduction is real but conditional: it is “prefix KV cache shared across sessions, with one session owning the cache and others holding a read view,” and you give up per-session KV isolation. Agents that need a fresh context for each task pay the cache-rebuild cost.

The benchmarking methodology itself is the cost. The full Seismic search budgets by candidate count, and a kitchen-laptop M2 Pro user on first run is paying tens of thousands of measurements per kernel before the first token. The doc explicitly allows a safety deadline that “leaves unmeasured groups at their defaults and prevents that incomplete result from being cached,” which means the worst case is “you waited 90 seconds and got the same kernel that llama.cpp would have shipped.” The first-run cost is amortized over the lifetime of the cache, but the lifetime is keyed by NVRTC release for CUDA, by Metal OS build for Metal, and by CPU instruction-set tier for CPU. macOS point releases will silently invalidate cached Metal compiles. The cache works; the cache is also brittle to driver churn.

The V4 README is honest about where the project is: “Performance work is ongoing; the estimate model behind selection is unqualified and no performance claim is made here.” V3 is the preserved, qualified stack. V4 is the next architecture. If you are running a self-hosted local model stack today and you evaluate engines on production stability rather than release-week benchmark headlines, V3 is what ships, and V3 has the documented “we ship a per-boundary measurement matrix, not a single number” framing.

What I am taking from it

Three concrete things.

First, the autotuning discipline is the part that survives the benchmark reversal. The detailed Σ weight × median framing, the per-kernel budgeted search, the numerical-validation gate, the cache-key contract — these are engineering practices that move with the codebase, not with the headline. If you are building or evaluating a local inference engine, design/inference/seismic-compilation.md is one of the more useful reference documents I have read this year, regardless of whether Magnitude beats llama.cpp on your specific config.

Second, the HN counter-result is a signal, not a refutation. The configuration that flips the lead (Qwen3.8 UD-Q6-K-XL + Dflash2 drafter, llama.cpp b10853+, M5 Max) is one that llama.cpp invested in. Other configurations will continue to favor Magnitude. The cell-by-cell honesty of the Magnitude methodology is what lets the counter-result stand without invalidating the headline — they never claimed “we beat llama.cpp everywhere,” they claimed specific boundaries on specific hardware.

Third, the V4 architecture is what to watch. The structured authoring spec, the per-backend bit-for-bit agreement with the reference interpreter, the explicit “no auto-fallback between references” — these are the design choices that decide whether the next generation of model architectures runs natively or through a fallback path. If Qwen4 ships with a tile pattern that breaks the assumptions baked into today’s llama.cpp kernels, the engine that has a structured authoring spec for new architectures wins. Magnitude is the only one in this week’s release cohort shipping a structured authoring spec.

The thing I keep coming back to is the integrity of the benchmarking.md doc. “Do not relax a correctness gate to make a timing admissible” is a sentence that could be tattooed on every inference engine team. They publish the rejected equality checks alongside the timing wins. The performance headline and the methodological discipline together — and the bandwidth to publish a counter-benchmark without disclaiming it — is what makes Magnitude worth writing about, more than the 2x number.

References and where to dig further

  • magnitudedev/magnitude — the repo, 6000 stars, Apache 2.0, inference-v4/README.md is the V4 status doc.
  • design/inference/seismic-compilation.md — 69KB, the autotuning algorithm. The document to read.
  • design/inference/benchmarking.md — the per-boundary measurement methodology.
  • design/inference/composition.md — the engine and worker process split.
  • design/inference/hardware-observations.md — the per-domain memory accounting.
  • The Launch HN thread at news.ycombinator.com/item?id=49911995 — 180 points, the M5 Max counter-benchmark is mid-thread.
  • llama.cpp recent series (b10853 and onward) — the comparable autotune work on the other side.
  • omlx — the adapter in inference/benchmarks/, one of the engines Magnitude benchmarks against alongside llama.cpp and mlx-vlm.

I want to see what V4 ships with. The structured authoring spec is at specs/26-09-18/seismic-structured-authoring-spec.md; the implementation plan is at specs/26-09-19/seismic-structured-authoring-implementation-plan.md. If the bit-for-bit cross-backend contract holds under production load, the Magnitude V4 release is the next thing to evaluate against my local Ollama install.

Aniket Karne
DevOps & AI Engineer · Amsterdam
Back to all posts
Reader correspondence

Comments

Powered by GitHub Discussions via Giscus. Sign in with GitHub to leave a comment.