Inference systems · 18 July 2026

KTransformersone model, two machines

A giant sparse model may not fit in GPU memory, but only a few experts run for each token. KTransformers turns that asymmetry into a system: GPU-resident attention, DRAM-resident routed experts, CPU-side matrix kernels, and a scheduler that keeps both processors moving.

GPU · FAST / SCARCE

High reuse

ATTENTION + KV CACHE
ROUTER / NORMS
SHARED / HOT EXPERTS
DENSE PROJECTIONS
ACT.RESULT
CPU + DRAM · LARGE / SLOWER

Huge capacity

ROUTED EXPERT 03
ROUTED EXPERT 47
ROUTED EXPERT 128
ROUTED EXPERT 221
ROUTER SELECTS TOP-k · MOVE ACTIVATIONS, NOT THE WHOLE EXPERT
Computation offloadweights remain in DRAM
AMX ↔ AVXprefill versus decode
Single CUDA Graphasync hybrid decode
SOSP ’25peer-reviewed system
01 / The idea in one sentence

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.

MOE LAYERy = S(x) + Σᵢ∈Top-k gᵢEᵢ(x)

Shared path plus only the routed experts selected for each token.

CAPACITYBytes ∝ total experts

Every expert’s weights must exist somewhere even when inactive.

COMPUTEFLOPs ∝ active experts

Sparsity decouples executed work from total parameter capacity.

The central bet: at low concurrency, most routed experts are cold at any instant. DRAM can hold the whole pool; optimized CPUs compute the selected few while the GPU handles the model’s high-reuse core.
02 / Weight offload versus computation offload

Do not drag the library
through a narrow door.

WEIGHT OFFLOAD

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.

LARGE WEIGHT PAYLOAD
SMALL ACTIVATION
COMPUTATION OFFLOAD

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.

ACTIVATION TO CPU
RESULT TO GPU

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.

Why this is MoE-specific: if every token needed every CPU-resident matrix, the CPU would stream most of the model continuously. Sparse routing limits the expert working set enough for computation offload to become useful.
03 / The placement map

Hot, dense, and sequential goes GPU.
Wide, sparse capacity goes CPU.

GPU CORE

Attention

HIGH ARITHMETIC INTENSITY

Attention and MLA projections benefit from GPU bandwidth, tensor cores, FlashInfer kernels, and direct access to the KV cache.

GPU ALWAYS-ON

Shared experts

ACTIVATED FOR EVERY TOKEN

Because shared experts are hot by definition, the paper places them on GPU to overlap with routed CPU work.

CPU CAPACITY

Routed experts

LARGE POOL · SPARSE TOP-k

Hundreds of expert matrices reside in DRAM; AMX/AVX-family kernels execute only those selected by the router.

GPU OPTIONAL

Popular experts

PROFILED OR DYNAMIC

Current serving can place a configurable subset on GPU using uniform, frequency, front-loaded, random, or runtime-updated strategies.

CPU RESIDENTGPU HOTACTIVE NOW
Placement is workload-sensitive. Expert popularity can shift with domain, prompt length, batch, and conversation. A cache of “hot” experts helps only when routing reuse exceeds the cost and VRAM footprint of maintaining it.
04 / Prefill and decode are different programs

One CPU instruction path
cannot win both phases.

PREFILL · MANY TOKENS

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.

DECODE · ONE / FEW TOKENS

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.

05 / CPU kernels are the engine room

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.

DRAMEXPERT WEIGHT CAPACITY
L3SHARED ACTIVATIONS / HOT DATA
L2EXPERT-SIZED WORK BLOCKS
AMX tilesMATRIX MULTIPLY / ACCUMULATE
PAPER’S PEAK KERNEL21.3 TFLOPS

Single-socket DS-3 MoE microbenchmark result.

VERSUS PYTORCH3.98×

Reported speedup over its oneDNN-based PyTorch baseline.

DYNAMIC SCHEDULINGup to 1.83×

Prefill improvement from balancing uneven expert assignments.

Microbenchmark boundary: kernel TFLOPS does not equal end-to-end token throughput. Attention, routing, PCIe transfers, synchronization, KV-cache traffic, sampling, and Python/serving overhead remain.
06 / CPU–GPU coordination

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.

GPUROUTESHAREDWAITATTNSHAREDWAIT
CPUQUEUEEXPERTSEXPERTSQUEUEEXPERTSEXPERTS
QUEUE

Dynamic CPU work.

Fine-grained expert tasks reduce imbalance when routing sends unequal token counts to experts.

CALLBACK

Host work inside graph.

CUDA stream callbacks submit and synchronize CPU tasks without fragmenting the decode graph.

OVERLAP

Shared versus routed.

GPU shared-expert work overlaps CPU routed experts, but the shorter side can still finish early and idle.

07 / NUMA is part of correctness-for-performance

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.

SOCKET 0Wᵢ[:, 0:d/2]

Local expert slice, local DRAM, local cores.

SOCKET 1Wᵢ[:, d/2:d]

Complementary slice computed in parallel.

COMBINEreduce-scatter / reduce

Exchange compact partial results rather than remote weights.

Buying RAM is not enough. Channel count, memory speed, DIMM population, socket topology, core pinning, first-touch placement, and cross-socket bandwidth can change decode speed as much as the nominal CPU model.
08 / Expert Deferral

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.

STANDARD ORDER

Wait for all top-k.

E1E2E3E4→ ATTN L+1

Exact model semantics; CPU tail latency blocks the GPU.

DEFERRED ORDER

Use some now, some later.

E1E2→ ATTN L+1E3E4

More overlap; deferred contributions enter at a later layer.

Use the vocabulary precisely: ordinary hybrid execution is full-accuracy. Turning on Expert Deferral knowingly trades a small measured quality change for additional decode throughput.
09 / From framework injection to KT-Kernel + SGLang

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.

# Current registry-first path pip install kt-kernel sglang-kt kt model list kt run deepseek-r1 # Explicit serving path python -m sglang.launch_server \ --model /path/to/model \ --kt-method AMXINT4 \ --kt-weight-path /path/to/cpu/weights \ --kt-cpuinfer 64 \ --kt-num-gpu-experts 0
Illustrative command only: method names are not interchangeable. Use the current model page and support matrix for the matching weight layout, conversion path, CPU ISA, GPU backend, and tested package version.
10 / Long-context layerwise prefill

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.

Chunk tokensprefill split
ConvertCPU format
PCIe copyexpert weights
RepackGPU kernel layout
Run layerGPU MoE
No universal threshold: the crossover is where hybrid CPU time approximately equals layerwise GPU time. It depends on CPU kernels, aggregate PCIe bandwidth, GPU count, precision, expert size, prompt length, and available VRAM.
11 / Precision and model support

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.

VALIDATION TUPLEmodel + checkpoint + method

Architecture and physical weight representation must agree.

PLATFORM TUPLECPU ISA + GPU + topology

AMX, AVX2/VNNI, BLIS, CUDA capability, PCIe, and NUMA matter.

RUNTIME TUPLEKT + SGLang + command

Package version and launch flags complete the reproducible system.

12 / What the SOSP evaluation establishes

Large gains—
inside a precise envelope.

PREFILL VS BASELINES4.62–19.74×

Author-reported full-accuracy end-to-end speedup range.

DECODE VS BASELINES1.25–4.09×

Without Expert Deferral across evaluated full-precision settings.

EXPERT DEFERRALup to +45%

Additional decode throughput from more CPU/GPU overlap.

AVERAGE QUALITY CHANGE≤0.5%

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.

ESTABLISHED

Hybrid MoE can be practical.

With specialized kernels and coordination, a single server can execute trillion-scale sparse models using one modest-VRAM GPU.

CONDITIONAL

Speed depends on the phase.

Prefill, decode, concurrency, quantization, routing, memory topology, and deferral produce different ceilings.

NOT PROMISED

Cheap desktop parity.

The study used server CPUs, many memory channels, large DRAM, and controlled model/backend combinations.

13 / Fine-tuning is the adjacent frontier

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.

Inference support does not imply training support. A model/backend combination must appear in the current SFT matrix, have a valid weight-preparation path, and pass its own correctness and memory tests.
14 / Tradeoffs

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.

15 / Buyer and operator checklist

Size the fabric,
not just the GPU.

  1. 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.
  2. Count memory channels.Decode is frequently weight-bandwidth-bound. DIMM population and achieved STREAM/MLC bandwidth matter more than headline CPU boost clocks.
  3. Map NUMA explicitly.Record socket ownership, thread pinning, expert slices, memory first-touch, reduction path, and local versus remote bandwidth.
  4. Verify the exact support tuple.Match model, checkpoint, method, conversion, CPU ISA, GPU architecture, KT/SGLang versions, and launch entry.
  5. 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.
  6. Tune expert placement.Track GPU-resident expert count, hit rate, routing skew, dynamic update behavior, VRAM headroom, and workload drift.
  7. 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.
  8. Label approximations.Report whether Expert Deferral is enabled, immediate/deferred counts, and quality results for your own tasks.
16 / Bottom line

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.

The compact mental model: keep reusable latency-sensitive state on GPU, keep sparse expert capacity in DRAM, compute weights where they live, and overlap everything the model’s dependencies allow.
17 / Sources & method

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.

  1. 01Chen et al. — KTransformers, SOSP 2025
  2. 02Author-hosted KTransformers paper PDF
  3. 03Official KTransformers repository
  4. 04Current KTransformers inference path
  5. 05Official expert-placement guide
  6. 06Official layerwise-prefill guide
  7. 07Official precision and quantization guide
  8. 08Current model/backend support matrix
  9. 09KT-Kernel implementation and SGLang integration
  10. 10Current heterogeneous LoRA SFT overview
  11. 11HeteGen — heterogeneous LLM inference context
  12. 12HybriMoE — dynamic scheduling atop KTransformers
Evidence standard: all speedups are author-reported and paired with their tested hardware, models, precision, concurrency, and baselines. Current feature statements follow the project’s live support matrix; historical entry points are explicitly labeled.