⭐ Star us on GitHub — it motivates us a lot!
Mjölnir — faster, bigger-context LLM serving on edge GPUs: a dedicated decode kernel per platform, a tuned vLLM image that carries every kernel, and a CLI that serves, benchmarks and documents it.
Features •
Quickstart •
Benchmarks •
Interactive charts •
Platforms •
Case study •
Contributing
What is
Mjolnir?
Mjölnir is Old Norse for “Thor’s hammer” — pronounced “MYOL-nir”.
Mjolnir makes LLM serving on edge GPUs faster and roomier. It is four things:
- a decode-attention kernel per platform — a CuTe DSL kernel on the Thor’s
tcgen05 tensor cores, an mma.sync kernel on the Orin — each written for its exact chip;
- a 6-bit
e2m3 KV cache for vLLM — 25% fewer bytes than fp8 at near-fp8 accuracy;
- a patched vLLM image that carries all of it; and
- a CLI that serves models from YAML configs and benchmarks every claim.
mjolnir serve up # or: vllm serve <model> --attention-backend MJOLNIR
Why any of this helps: every generated token re-reads the whole KV cache — on an edge GPU, decode speed is a memory problem. Stock vLLM reads bf16 (twice the bytes) or, at best, fp8; Mjolnir reads less, tuned per chip. The per-board story: Supported Hardware.
Key Features
How the % and × here are calculated
- Throughput (decode, prefill — tokens/s, higher is better): change = (Mjolnir − official) ÷ official × 100.
+57% = 1.57× the tokens per second. On the infographic a change of +100% or more is written as the multiple Mjolnir ÷ official (+200% = 3×).
- Latency (TTFT, ITL — milliseconds, lower is better): change = (Mjolnir − official) ÷ official × 100, so a negative value is a latency reduction:
−27% = 27% fewer milliseconds. It is not the reciprocal speedup official ÷ Mjolnir − 1, which reads larger for the same pair.
- Worked example (Jetson AGX Thor, 4K context, 1 request): TTFT 2,253 → 1,983 ms: (1,983 − 2,253) ÷ 2,253 × 100 = −12.0% (a latency reduction of 12.0%). The reciprocal speedup would be 2,253 ÷ 1,983 = 1.14× (+13.6%) — the same measurement, a different convention.
- Values: the mean over the measured runs per cell (6 measured after 2 warm-ups, llama-benchy): decode = generated tokens ÷ generation time per request (summed over requests at higher concurrency), prefill = prompt tokens ÷ prompt-processing time, TTFT = time to the first content token, ITL = 1000 ÷ the per-request decode rate.
- Colors: green = better by at least 3%, grey = within ±3% (
E2E_NOISE_PCT), red = worse by at least that. With speculative decoding a single decode cell moves more between runs (acceptance depends on the prompt), so repeat (--repeat) before reading a few-% difference.
+54% tokens/s vs the official vLLM image. MTP with 5 draft tokens: an fp8 lm_head and a 64K draft vocabulary.
|
+153% prefill throughput, −12% time to first token.
|
The 6-bit e2m3 KV cache holds 25% fewer bytes per token, so more tokens in the same memory.
|
Tool calling within ±3.6 points of the stock FlashInfer fp8 baseline.
|
One command surface for the whole repo: serve · bench · verify · calibrate · plot.
|
Each model is a YAML file of serve flags. mjolnir serve up does the rest.
|
KV-cache scales and the draft vocabulary come from mjolnir calibrate and ship next to the config.
|
Kernel, serving and accuracy benches in one CLI, raw JSON for every table, chart and number on this page.
|
An agent loop proposes, tests and logs kernel experiments; every try leaves data behind.
|
Quickstart
# the CLI (the package is mjolnir-cli; the command is `mjolnir`)
uv tool install mjolnir-cli
# one-time: Jetson host setup for stable numbers (clocks, power mode, fans, swap)
mjolnir hw setup
# serve: the active model's default config on the Mjolnir image, --attention-backend MJOLNIR, port 6001
mjolnir serve up
curl -s http://localhost:6001/v1/chat/completions \
-H 'content-type: application/json' \
-d '{"model": "Qwen/Qwen3.8-27B", "messages": [{"role": "user", "content": "hi"}], "max_tokens": 64}'
Use the image directly (any model, any vLLM flags):
docker run --rm -it --gpus all --ipc host -p 8000:8000 \
narandill/mjolnir-vllm <model> --kv-cache-dtype fp8 --attention-backend MJOLNIR
Supported Hardware
Mjolnir is detection-first: the CLI resolves the host platform (never a silent
guess), every platform gets its own page and — once
kernel results exist for its headline model — its own kernel case study.
Measured Models
✅ serves natively · ❌ every config targeting it is unavailable · — no config targets it · t/s = decode tokens/s at 1 request / 0 context, the fastest config’s latest run (hover a cell for it) · from benchmarks/history.jsonl
Model Configs
A served model is a file, not a command line. Each config is the vllm serve flags as YAML — model, quantization, KV-cache dtype, attention backend, speculative decoding, context length — one directory per config under configs/<vendor>/<model>/, with everything the variant needs beside it: a .env sidecar for what YAML cannot carry (the fp8 lm_head, the draft vocabulary) and the model’s calibration files. A whole model directory:
configs/Qwen/Qwen3.8-27B/
├── NVFP4_MJOLNIR_E2M3_LMH8_VT64K/ # attention-backend: MJOLNIR · kv-cache-dtype: fp6_e2m3 · MTP, 5 drafts
│ ├── config.yaml
│ └── .env # MJOLNIR_LM_HEAD=fp8 · MJOLNIR_DRAFT_VOCAB={configs}/draft_vocab.json
├── NVFP4/
│ └── config.yaml # the stock FlashInfer baseline, same model and limits
├── kv_scales/e2m3.json # per-channel KV scales (mjolnir calibrate)
└── draft_vocab.json # the drafter's vocabulary (mjolnir calibrate --draft-vocab)
mjolnir model use # pick the model and config (interactive)
mjolnir serve up --config NVFP4_MJOLNIR_E2M3 # or serve one explicitly
- One file per variant — an A/B is two configs, not two shell histories:
mjolnir bench ab --backends NVFP4,NVFP4_MJOLNIR_E2M3_LMH8_VT64K.
- The same config everywhere —
serve, bench, verify and calibrate read the same YAML and .env, so a benchmark measures exactly what you serve.
- Yours without forking — drop configs into
~/.local/share/mjolnir/configs/ (same layout); they appear next to the repo’s.
More: adding a model config · the default model and config · serving · which setting wins · fp6 KV and calibration.
The CLI
mjolnir # help + next steps
mjolnir serve [up|down|status|logs] # the vLLM container on the Mjolnir image
mjolnir model | image # pick the active model config / vLLM image
mjolnir calibrate [--draft-vocab] # fp6 KV-cache scales (and the drafter's vocabulary) per model
mjolnir verify <stage> # kernel correctness + ncu benchmarks -> benchmarks/raw/verify
mjolnir verify bench | all # every benchmark stage (all = + correctness)
mjolnir verify show | list # re-print saved results
mjolnir bench e2e | compare # official vLLM image vs Mjolnir: decode, prefill, TTFT, ITL
mjolnir bench perf | ab | accuracy # serving benchmarks, A/B legs, model quality
mjolnir plot --readme [--site DIR] # charts + README + docs (+ the interactive site) from raw data
mjolnir autoresearch [init|run|ledger] # the autonomous kernel-research loop
mjolnir gate | hw | litellm | perses # clean-window gate, Thor host setup, side stacks
Every command, sub-command and option, with defaults: the CLI reference — generated from the commands themselves; mjolnir <command> --help prints the same.
Contributing
Mjolnir is meant to be a community case study: every claim is reproducible with one command, and every experiment — kept or discarded — leaves raw data behind.
- Run the benchmarks on your Thor —
mjolnir verify bench writes JSON you can open a PR with; the README, docs and charts re-render from it.
- Try a kernel idea — change
src/mjolnir/mjolnir/arch/thor/ (the Thor kernel family), prove it with mjolnir verify correctness and an mjolnir verify ab --variants ... run, and send the raw result with the PR.
- Let the agents try —
mjolnir autoresearch run drives an OpenCode research loop (web + arXiv research, implementation, debugging) where every experiment is logged on the ledger.
- Guidelines: CONTRIBUTING.md · docs index.
Repository layout
├── src/
│ ├── mjolnir/ the kernel package (PyPI: mjolnir-kernel, import `mjolnir`)
│ │ └── mjolnir/ arch/{thor,orin}/ (kernel families) · runner.py · backend.py
│ └── mjolnir-cli/ the CLI package (PyPI: mjolnir-cli, command `mjolnir`)
│ └── mjolnir_cli/ verify/ · charts.py · readme.py · autoresearch.py · serve/bench/...
├── docker/vllm-thor/ the image: Dockerfile, patches/, apply/verify gates, PATCHES.md
├── configs/ model configs (NVFP4_MJOLNIR_E2M3_LMH8_VT64K default, NVFP4 = FlashInfer, NVFP4_FA2)
├── benchmarks/raw/verify/ raw verify results (one JSON per stage run) — the charts' only input
├── assets/benchmarks/ generated charts (SVG; the hero banners stay JPEG)
├── docs/platforms/ per-platform pages + the kernel case studies (rendered)
├── research/ the autoresearch program + ledger
└── .opencode/ OpenCode agents (autoresearch, researchers, engineer, debugger)
Security
The served API is unauthenticated; expose it deliberately. See SECURITY.md.
License
Mjolnir is open source under the Apache License 2.0 — the license of vLLM and FlashInfer, which it builds on — with one exception: the kernel, src/mjolnir/mjolnir/arch/thor/decode.py, is derived from an NVIDIA CUTLASS CuTe DSL example and stays under that example’s BSD-3-Clause license, with NVIDIA’s notice kept at the top of the file.
Third-party
Third-party code, the vLLM / FlashInfer / FlashAttention files the image patches, and what the narandill/mjolnir-vllm image redistributes are listed in NOTICE.
Mjölnir — built on and for the edge ❤️.
Generated from README.md.j2 by mjolnir plot --readme.
评论