GitHub Repos advanced 4 min read Jul 20, 2026 · Updated Jul 23, 2026
Public Preview Sign in free for the full digest →

KTransformers: Run 671B MoE Models on a Single GPU

“The paper's own baseline ran 671B DeepSeek-V3 at 4.68 tokens/s with the GPU sitting below 30% utilization — KTransformers fixed that by refusing to move the experts to the GPU at all.”

KTransformers: Run 671B MoE Models on a Single GPU
1 Views
0 Likes
0 Bookmarks
Source · github.com

“"currently the best option especially combined with AMD Epyc NPS0" — but also "requires at least 16GB VRAM CUDA GPU" — ubergarm, comparing inference engines at https://github.com/ubergarm/r1-ktransformers-guide/issues/11”

You know that feeling when the model you want to run is 671 billion parameters and your GPU has 24GB? The usual answer is to shrink the model until it fits, and watch quality go with it, or to stream expert weights over PCIe and watch a 32 GB/s link become the bottleneck. The research notes the older approach's real cost: Fiddler-style offloading fired over 7,000 CUDA kernel launches per decoded token, burning 73% of GPU execution time on launch overhead alone, while PyTorch's oneDNN AMX path hit only 7% of the CPU's theoretical peak. So you end up with idle silicon on both sides of the PCIe bus and 4.68 tokens/s to show for it.

llminferencemixture-of-expertscpucudaopen-sourcepython

Think of a mixture-of-experts model as a hospital: every patient sees reception, but then gets routed to two or three specialists out of a couple hundred on staff. Reception is small and busy, so KTransformers puts it on the GPU — attention plus the shared experts. The specialists are numerous but each one is rarely called, so they stay in CPU DRAM and do their work there, with kernels hand-written for Intel AMX during prefill and AVX-512 during decode. The clever part is Expert Deferral: instead of making the GPU wait for every specialist to finish, a subset of experts is deferred one layer forward and computed while the GPU handles the next layer's attention, then merged back in. The paper reports this pushes CPU and GPU utilization from 74%/28% to 100%/37% on DeepSeek-V3, a 33% decode throughput gain, at an average accuracy cost of 0.5% versus 13.3% if you had simply skipped those experts.

01
Expert Deferral scheduler — you get 33% more decode throughput on DeepSeek-V3 by overlapping CPU expert work with the next layer's GPU attention, instead of paying for idle silicon on both sides.
02
In-place CPU expert computation — expert weights stay in DRAM and never cross PCIe, so your ceiling becomes CPU memory bandwidth (about 440 GB/s on dual-socket DDR5) instead of a 32 GB/s PCIe 4.0 link.
03
Per-phase kernel selection — AMX handles prefill and AVX-512 handles decode, because the paper measured AVX-512 losing to baseline in prefill while beating the AMX kernel by up to 2.22× in decode.
04
YAML module injection — you swap HuggingFace torch.nn modules for hardware-specific ones with regex match/replace rules, so adapting a new model architecture is a config edit rather than a fork.
05
Whole-decode CUDA Graph capture — one graph instead of per-layer instances drops GPU kernel-launch overhead from over 20% to near zero, worth up to 1.23× on its own.
06
Four CPU backends with an auto-detecting installer — install.sh probes for AMX, AVX512_VNNI and AVX512_BF16, so an AVX2-only Haswell box still runs the LLAMAFILE path with GGUF weights and no conversion step.
07
kt-sft LoRA fine-tuning — the v0.6.1 notes claim 6–12× training throughput versus a ZeRO-Offload baseline on MoE workloads using about half the CPU memory of the previous KT SFT implementation.
Who it’s for

If you run large MoE models on your own hardware — a lab, a regulated industry where data cannot leave the building, or a team pricing an on-prem box against an H100 cluster — this is the technique to understand. It pays off best if you have an AMX-capable Xeon or an EPYC 9000, hundreds of GB of DDR5, and at least a 16GB CUDA GPU. Skip it if you are serving high concurrency: the paper explicitly evaluates batch size 1 and scopes itself to 'low concurrency (e.g., single or few requests per batch)', and it will not help you on Apple Silicon, ARM, or a laptop.

Worth exploring

Yes, if you are sizing on-prem inference hardware — the technique is peer-reviewed at SOSP '25, ships monthly releases, and is running commercially inside Approaching.AI's token platform, which is about as strong a production signal as an academic kernel library gets. But treat the marketing framing skeptically: the project site says 'Deploy 100B+ parameter models locally with just a single RTX 5090', while engineers who ran it describe a floor of 16GB VRAM, 600GB–1TB of DDR5, and specific Intel or AMD generations. Also note that the original integrated framework has been moved to archive/ and serving is now delegated to SGLang, so integrate against kt-kernel and SGLang, not the pre-v0.4.2 ...

Developer playbook
Tech stack, code snippet, sentiment, alternatives.
PM playbook
Adoption angles, user fit, positioning.
CEO playbook
Traction signals, ROI, build vs buy.
Deep-dive insight
Full long-form analysis, no fluff.
Easy mode
Core idea, fast — when you need the gist.
Pro mode
Technical nuance, edge cases, tradeoffs.
Read the full digest
Go beyond the preview

Deep-dive insight, Easy and Pro modes, plus action playbooks — the full breakdown is one tap away.

Underrated tools. Unfiltered takes.

Read the full digest in the Snaplyze app for deep-dive insight, Easy and Pro modes, and the playbooks you can actually use.

Install Snaplyze →