Place each operator where
its economics make sense.
KTransformers is not ordinary “CPU offload.” It is a heterogeneous execution engine built around the unusual arithmetic of sparse Mixture-of-Experts models.
A dense model uses nearly every parameter for every token. An MoE model may own hundreds of expert feed-forward networks but route each token through only a small top-k subset. Total weight capacity is enormous; active computation is much smaller. That gap creates an opportunity unavailable to a similarly sized dense model.
KTransformers keeps latency-sensitive, repeatedly reused operators—attention, routing, normalization, dense/shared paths, and often the KV cache—on GPU. The much larger routed-expert pool lives in CPU DRAM and is computed by CPU kernels. The system transfers compact activations and partial results across the device boundary rather than loading an expert’s weights into VRAM every time it is selected.
The result is not GPU-class speed from cheap RAM. It is a deliberate trade: accept slower expert computation and sophisticated synchronization so a workstation can execute a model whose total weights would otherwise require a multi-GPU server.
Shared path plus only the routed experts selected for each token.
Every expert’s weights must exist somewhere even when inactive.
Sparsity decouples executed work from total parameter capacity.
Do not drag the library
through a narrow door.
Fetch expert → compute on GPU
Expert weights stay in DRAM or storage until selected, then cross PCIe into VRAM. GPU arithmetic is fast, but each miss can move megabytes or gigabytes before useful work begins.
Compute expert where weights live
Routed weights remain persistent in DRAM. The CPU receives token activations, performs the expert MLP locally, and returns its weighted output. PCIe carries vectors rather than entire matrices.
PCIe bandwidth makes the distinction decisive.
The SOSP paper uses PCIe 4.0’s theoretical 32 GB/s link as the reference bottleneck and reports 440 GB/s aggregate measured DRAM bandwidth on its dual-socket platform. Those numbers are not interchangeable—CPU kernels must still read weights and perform math—but they explain why repeatedly transferring expert weights is unattractive.
Compute offload changes the bottleneck from PCIe weight movement to CPU memory bandwidth, CPU matrix throughput, routing imbalance, and device coordination. KTransformers exists because the naïve version of this design was still slow: the paper’s Fiddler-style DeepSeek-V3 baseline achieved 70.02 tokens/s prefill, 4.68 tokens/s decode, and under 30% GPU utilization on its A100 plus dual-Xeon setup.
Hot, dense, and sequential goes GPU.
Wide, sparse capacity goes CPU.
Attention
HIGH ARITHMETIC INTENSITYAttention and MLA projections benefit from GPU bandwidth, tensor cores, FlashInfer kernels, and direct access to the KV cache.
Shared experts
ACTIVATED FOR EVERY TOKENBecause shared experts are hot by definition, the paper places them on GPU to overlap with routed CPU work.
Routed experts
LARGE POOL · SPARSE TOP-kHundreds of expert matrices reside in DRAM; AMX/AVX-family kernels execute only those selected by the router.
Popular experts
PROFILED OR DYNAMICCurrent serving can place a configurable subset on GPU using uniform, frequency, front-loaded, random, or runtime-updated strategies.
One CPU instruction path
cannot win both phases.
High arithmetic intensity
A long prompt sends many tokens to each expert. Weight tiles are reused across a batch of activations, so matrix-matrix throughput matters and AMX can amortize setup.
Low arithmetic intensity
Each step routes very few tokens. Expert computation becomes vector-like and weight-bandwidth-bound; lightweight AVX-512 was faster than processing full AMX tiles in the paper.
KTransformers chooses based on tokens assigned per expert.
In the SOSP implementation, AMX handles high-ARI expert work while a compatible AVX-512 kernel takes over when four or fewer tokens reach an expert. The same preprocessed weight layout supports both, avoiding a format conversion at the phase boundary.
This is a systems lesson larger than one instruction set. “CPU inference speed” is not one number: prefill resembles batched matrix multiplication; decode resembles repeated memory streaming. Current KTransformers has expanded into AVX2, AVX-VNNI, AMD BLIS, native BF16/FP8/INT4, and narrow model-specific paths, but exact support depends on model, checkpoint, CPU ISA, package version, and method.
AMX throughput begins
with memory layout.
Matrix instructions do not rescue a poor data path. KTransformers preprocesses expert weights around tiles, cache lines, quantization groups, and the CPU cache hierarchy.
An AMX-enabled core exposes tile registers holding 16 rows by 64 bytes. KTransformers rearranges expert weights at load time into compatible submatrices, aligns tiles to 64-byte cache lines, and stores group-wise INT8/INT4 scales separately. INT4 values are packed into byte-sized blocks and unpacked with SIMD intrinsics.
During execution, weights are divided into thread tasks, then into blocks sized for L2, then into AMX tiles. Activations tend to remain in shared L3; weight blocks stream from DRAM into L2; partial results use tile registers and L1. Tasks targeting the same expert are co-scheduled to improve reuse.
The fused MoE operator further combines the many Gate, Up, and Down projections across experts into larger batches, reducing thread barriers. Dynamic task scheduling breaks imbalanced expert workloads into smaller queue entries so idle cores can steal work.
Single-socket DS-3 MoE microbenchmark result.
Reported speedup over its oneDNN-based PyTorch baseline.
Prefill improvement from balancing uneven expert assignments.
Parallel hardware only helps
when dependencies permit overlap.
The router runs on GPU, CPU workers execute routed experts, and GPU streams execute shared experts. Two synchronization barriers per layer can erase the benefit.
After routing, a control thread pushes CPU expert tasks into a lock-free queue and launches the GPU’s shared-expert work. Background CPU workers consume the queue. When GPU work completes, the control path waits for routed results, merges both contributions, and advances.
A naïve submit barrier and completion barrier interrupt CUDA Graph capture and force thousands of tiny launches during token-by-token decode. KTransformers wraps submit and sync callbacks with cudaLaunchHostFunc, keeping the full one-token decode path inside one CUDA Graph. The paper reports up to 1.23× decode speedup from this optimization.
The graph removes launch overhead; it does not remove the semantic dependency. The next attention layer still waits for the current routed-expert sum unless execution is deliberately reordered—which is where Expert Deferral enters.
Dynamic CPU work.
Fine-grained expert tasks reduce imbalance when routing sends unequal token counts to experts.
Host work inside graph.
CUDA stream callbacks submit and synchronize CPU tasks without fragmenting the decode graph.
Shared versus routed.
GPU shared-expert work overlaps CPU routed experts, but the shorter side can still finish early and idle.
Two sockets are not
one uniform pool of RAM.
A CPU core reading the other socket’s expert weights pays lower bandwidth, higher latency, and interconnect contention.
The paper’s machine measured 220 GB/s within a socket and 125 GB/s across sockets. A NUMA-oblivious DeepSeek-V3 layer took 6.9 ms on one socket and only improved to 5.8 ms on both—a weak 16% gain because remote access consumed the theoretical parallelism.
KTransformers uses NUMA-aware tensor parallelism: every expert matrix is sliced across sockets rather than assigning whole experts to nodes. Each socket stores and computes its local slice; a lightweight reduction combines partial outputs. This balances work even when the router selects an uneven set of experts and avoids almost all remote weight traffic.
The reported breakdown attributes up to 1.63× decode improvement and up to 1.22× prefill improvement to NUMA-aware tensor parallelism. Decode benefits more because it is particularly memory-bandwidth-bound.
Local expert slice, local DRAM, local cores.
Complementary slice computed in parallel.
Exchange compact partial results rather than remote weights.
Break the dependency—
and slightly change the model.
Expert Deferral lets the GPU begin the next attention layer before every routed expert from the current layer has finished.
Selected routed experts are divided into immediate and deferred groups. Immediate outputs join the residual stream before the next attention layer as usual. Deferred outputs arrive one layer later, feeding a subsequent layer and overlapping CPU expert compute with GPU attention.
The paper’s heuristic defers the minimum needed to saturate CPU utilization while keeping at least two immediate experts for behavioral stability. On its DeepSeek-V3 showcase, the mechanism raised CPU utilization from 74% to 100%, GPU utilization from 28% to 37%, and decode throughput by 33%; across evaluated scenarios it added up to 45%.
This is an approximate architectural transformation, not a lossless scheduling trick. Timing changes the residual representation seen by the next layer. The paper reports an average accuracy drop of no more than 0.5% across its benchmark suite for the chosen settings, with individual scores sometimes rising or falling.
Wait for all top-k.
Exact model semantics; CPU tail latency blocks the GPU.
Use some now, some later.
More overlap; deferred contributions enter at a later layer.
The architecture evolved.
Old tutorials are not the current product.
The SOSP system extended Hugging Face with YAML-driven operator injection. The current public serving path uses KT-Kernel for CPU experts and SGLang-KT as the serving runtime.
The research framework walked a Hugging Face module tree and replaced matching PyTorch classes or names with optimized implementations: FusedMoE on CPU, FlashInfer MLA on GPU, and Marlin quantized linear layers. A YAML rule selected class, device, precision, and options such as deferred-expert count, leaving the public Hugging Face interface unchanged.
That design matters intellectually because it separated model definition from hardware policy. But the repository has since archived the original integrated framework. Current documentation directs users to kt run <model> for registry defaults or python -m sglang.launch_server … --kt-* for explicit serving configuration.
Commands using local_chat.py, the old ktransformers/server/main.py, balance_serve, or legacy optimization-rule paths should be treated as historical unless the current docs explicitly revive them. The fast-moving support matrix is scoped to an exact model, checkpoint, method, backend, hardware class, and package version.
For long prompts, move a layer—
not every active expert decision.
Current KTransformers can switch from hybrid prefill to a layerwise GPU path once token count is large enough to amortize weight movement.
Short prefill stays heterogeneous: CPU experts and GPU operators cooperate. Beyond a configurable token threshold, layerwise prefill chunks the prompt, stages one MoE layer’s full working expert set into GPU memory, runs that layer for the chunk, then proceeds layer by layer.
The pipeline overlaps weight-format conversion into pinned memory, PCIe transfer, and GPU repacking at expert granularity. Double buffering and DDIO-aware adjacency aim to keep converted expert chunks hot in last-level cache so PCIe reads do not force a full DRAM round trip.
This deliberately reverses the normal computation-offload choice because a long token batch gives the GPU enough reuse to justify moving weights. The bottleneck moves from CPU expert compute toward PCIe bandwidth and GPU math. Extra VRAM includes roughly one full MoE layer working set plus temporary buffers that grow with chunk size.
A “4-bit model” is not
a complete deployment description.
KTransformers method names encode weight format, CPU backend, conversion assumptions, and often a narrow model family.
Current documented inference methods include native BF16, FP8, per-channel FP8, RAWINT4, GPTQ INT4, converted AMX INT8/INT4, LLAMAFILE/GGUF, and a model-specific MXFP4 path. A checkpoint labeled INT4 may still be incompatible if its packing, scale granularity, expert layout, or CPU kernel expectation differs.
Native-format paths can let CPU and GPU share one semantic weight representation; converted AMX paths preprocess expert weights for the tile-oriented CPU backend. Quantization reduces DRAM capacity and bandwidth pressure but introduces format conversion, accuracy, and kernel-support questions.
The support matrix itself uses statuses such as Current, Needs smoke, Legacy, Historical, or narrow. That is healthy documentation: rapid model support is not the same as broad production validation. Reproduce the exact tuple before trusting a throughput number.
Architecture and physical weight representation must agree.
AMX, AVX2/VNNI, BLIS, CUDA capability, PCIe, and NUMA matter.
Package version and launch flags complete the reproducible system.
Large gains—
inside a precise envelope.
Author-reported full-accuracy end-to-end speedup range.
Without Expert Deferral across evaluated full-precision settings.
Additional decode throughput from more CPU/GPU overlap.
Reported average accuracy drop for Expert Deferral benchmarks.
The paper tests low-concurrency local inference, the regime sparse computation offload favors most.
Hardware was a dual-socket Xeon Platinum 8452Y system with 72 physical cores and 2 TB DDR5 total, paired separately with a 40 GB A100 or 16 GB RTX 4080 over PCIe 4.0. Models were DeepSeek-V3-0324 (671B), DeepSeek-V2.5 (236B), and Qwen2-57B-A14B. Batch size was one; prefill prompts ranged from 32 to 8,192 tokens; decode used a 32-token prompt and up to 512 generated tokens.
For DeepSeek-V3, the placement table assigns 17B parameters to GPU and 654B to CPU. In raw BF16 those CPU parameters imply roughly 1.31 TB of weight payload; INT4’s theoretical data floor is about 327 GB before scales, metadata, alignment, buffers, runtime state, and OS headroom. This explains both the huge DRAM requirement and the attraction of quantization.
The performance range spans models, precisions, phases, prompt sizes, GPUs, and two very different baselines. It should not be collapsed into “KTransformers is 19.74× faster.” Modern releases, newer models, consumer CPUs, slower RAM, different PCIe generations, concurrency, or long-context workloads require fresh measurement.
Hybrid MoE can be practical.
With specialized kernels and coordination, a single server can execute trillion-scale sparse models using one modest-VRAM GPU.
Speed depends on the phase.
Prefill, decode, concurrency, quantization, routing, memory topology, and deferral produce different ceilings.
Cheap desktop parity.
The study used server CPUs, many memory channels, large DRAM, and controlled model/backend combinations.
The same placement logic
can carry LoRA training.
Current KTransformers treats MoE LoRA SFT as a first-class workflow through LLaMA-Factory, while keeping giant base experts on CPU.
The GPU handles attention, shared paths, and trainable adapter capacity; CPU AMX backends execute the frozen or mostly frozen expert base using BF16, INT8, or INT4 prepared weights. This reduces the VRAM cliff enough to make workstation-scale adapter training conceivable.
Training is not simply inference with gradients. Activations, adapter gradients, optimizer state, checkpointing, data pipeline, and backward communication add memory and bandwidth. KTransformers v0.6.1 reports 6–12× performance over a ZeRO-Offload baseline and roughly half the CPU memory of the previous KT SFT path in its benchmark settings, but those results are tied to exact models, context, LoRA configuration, hardware, and baseline.
The current docs explicitly mark old Kimi SFT and DPO pages as historical or unconfirmed. The supported public path is LLaMA-Factory YAML plus use_kt: true, an Accelerate KT configuration, and the ktransformers[sft] package.
What KTransformers buys—
and what it cannot repeal.
Capacity over latency
DRAM makes giant expert pools affordable, but decode must stream selected weights through a far slower hierarchy than HBM.
Sparse models over dense models
The architecture benefits when total parameters greatly exceed active parameters. Dense models offer much less cold capacity to park.
Low concurrency over saturation
At high batch/concurrency, more experts become active and GPUs achieve better reuse; cloud-style all-GPU serving becomes more attractive.
Complexity over simplicity
CPU ISA, memory channels, NUMA pinning, converted weights, SGLang compatibility, CUDA graphs, and expert placement all become tuning surfaces.
Quantization over exact weights
Lower bits reduce capacity and bandwidth but add format-specific kernels, conversion risk, and potential quality changes.
Deferral over exact semantics
Optional Expert Deferral improves overlap by changing when contributions enter the residual stream; it must be evaluated as an approximation.
Size the fabric,
not just the GPU.
- Start with weight bytes.Calculate expert storage from the actual checkpoint format, then add scales, metadata, conversion copies, buffers, mmap/page cache, KV cache, and OS headroom.
- Count memory channels.Decode is frequently weight-bandwidth-bound. DIMM population and achieved STREAM/MLC bandwidth matter more than headline CPU boost clocks.
- Map NUMA explicitly.Record socket ownership, thread pinning, expert slices, memory first-touch, reduction path, and local versus remote bandwidth.
- Verify the exact support tuple.Match model, checkpoint, method, conversion, CPU ISA, GPU architecture, KT/SGLang versions, and launch entry.
- Separate prefill and decode.Measure TTFT, prefill tokens/s, inter-token latency, decode tokens/s, and end-to-end latency across real prompt/output lengths.
- Tune expert placement.Track GPU-resident expert count, hit rate, routing skew, dynamic update behavior, VRAM headroom, and workload drift.
- Treat layerwise prefill as a crossover.Co-tune token threshold and chunk size against CPU speed, PCIe generation, aggregate links, GPU memory, and KV-cache allocation.
- Label approximations.Report whether Expert Deferral is enabled, immediate/deferred counts, and quality results for your own tasks.
KTransformers does not hide the hierarchy.
It programs around it.
The framework’s real achievement is turning an awkward collection of mismatched resources into a phase-aware MoE execution pipeline.
DRAM supplies capacity for routed expert weights. CPU matrix extensions and cache-aware layouts turn selected experts into useful throughput. GPU HBM and tensor cores retain the attention path, KV cache, shared experts, and dense operators. NUMA-aware slicing keeps each socket local. CUDA Graph callbacks reduce control overhead. Optional Expert Deferral changes dependency timing to expose still more parallelism.
The design works because sparse MoE models separate capacity from active computation. It is most compelling for low-concurrency local or private inference where owning the entire model matters more than matching an all-GPU cluster’s latency.
It is also a reminder that “can run” and “runs well” are different claims. A few hundred gigabytes of RAM may satisfy capacity while insufficient memory channels, weak CPU ISA support, poor NUMA placement, or a slow PCIe path makes the experience impractical. KTransformers raises the ceiling; the whole workstation determines where you land.
Paper, code, then current docs.
The architecture and benchmark results use the SOSP 2025 paper. Current commands, support boundaries, expert placement, precision, layerwise prefill, and SFT status use the maintained project documentation and repository. Accessed 18 July 2026.
- 01Chen et al. — KTransformers, SOSP 2025↗
- 02Author-hosted KTransformers paper PDF↗
- 03Official KTransformers repository↗
- 04Current KTransformers inference path↗
- 05Official expert-placement guide↗
- 06Official layerwise-prefill guide↗
- 07Official precision and quantization guide↗
- 08Current model/backend support matrix↗
- 09KT-Kernel implementation and SGLang integration↗
- 10Current heterogeneous LoRA SFT overview↗
- 11HeteGen — heterogeneous LLM inference context↗
- 12HybriMoE — dynamic scheduling atop KTransformers↗