Run and fine-tune huge mixture-of-experts LLMs on limited GPUs by splitting work between CPU and GPU
open sourceApache-2.0free
KTransformers is a research project from kvcache.ai (with Tsinghua's MADSys lab) for efficient inference and fine-tuning of large language models through CPU-GPU heterogeneous computing. Its kt-kernel provides CPU kernels optimized with Intel AMX and AVX-512/AVX2 for INT4 and INT8 quantized mixture-of-experts inference, with NUMA-aware memory and hot experts on the GPU and cold ones on the CPU, served through SGLang or a Python API. With LlamaFactory it fine-tunes ultra-large MoE models (DeepSeek, Kimi K2, GLM, MiniMax) with LoRA or full training on limited GPU memory. It supports Ascend NPUs and Intel Arc GPUs too.
Problems it solves
- run DeepSeek-sized MoE models on one GPU plus a big CPU server
- fine-tune a huge mixture-of-experts model without enough GPU memory
- offload LLM experts to CPU RAM for local inference
Features
- CPU-GPU hybrid inference for large MoE models
- Intel AMX and AVX-512/AVX2 kernels
- INT4 and INT8 CPU quantization, GPTQ on GPU
- NUMA-aware expert placement
- SGLang integration
- MoE LoRA and full fine-tuning with LlamaFactory
- Ascend NPU and Intel Arc support
Alternatives
The same job
These do what KTransformers does.
- FreeToken Serving engine that runs frontier-scale open-weight MoE models on consumer GPUs
- Colossal-AI PyTorch library for distributed training, fine-tuning and inference of large AI models
- SGLang Fast inference for LLMs and multimodal models
- kimi-k3-in-c An inference engine in portable C99 that runs the 2.78-trillion-parameter Kimi K3 on one CPU with 8 GB of RAM
- vLLM A high-throughput and memory-efficient inference and serving engine for LLMs
- TensorRT-LLM Optimized LLM and visual generation inference on NVIDIA GPUs
