You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: LLAMAFILE backend supports GGUF format directly, but this feature is still in preview.
3. Launch SGLang Server
Start the SGLang server with your normal SGLang parameters, and add the following KT-Kernel specific parameters to enable CPU-GPU heterogeneous inference:
KT-Kernel Parameters to Add:
--kt-method: Backend method (AMXINT4, AMXINT8, or LLAMAFILE)
--kt-weight-path: Path to the converted CPU weights
--kt-cpuinfer: Number of CPU inference threads (set to physical cores)
--kt-threadpool-count: Number of thread pools (set to NUMA node count)
--kt-num-gpu-experts: Number of experts to keep on GPU
--kt-max-deferred-experts-per-token: Deferred experts for pipelined execution
In principle, we can support any model that SGLang supports. If a model cannot run, then SGLang running purely on GPU likely won't be able to either. So if you test additional models that work, feel free to share them.
Known Issues & Tips / 已知问题与提示
"KT fallback" log messages are normal / "KT fallback" 日志是正常的
If you see logs like KT fallback: layer X prepare weight = XXms, compute = XXms, this is expected behavior indicating that Layer-wise Prefill is working correctly. The "fallback" naming is misleading and will be updated in a future release.
GPTQ-Int4 quantized MoE models may fail with IndexError: start out of range when using tensor-parallel-size > 1 with GPU experts. This is an SGLang-side weight loader issue. Workarounds:
Note
Please avoid creating issues regarding the following questions, as they might be closed without a response.
请避免创建与下述问题有关的 issues,这些 issues 可能不会被回复。
Tip
Documentation: https://kvcache-ai.github.io/ktransformers/
中文文档:https://github.com/kvcache-ai/ktransformers/tree/main/doc/zh
Most of problems / 大多数问题
How to install kt-kernel/ 怎么安装 kt-kernel
Please update repository and install again following the link below:
请参考文档进行安装,以及常见问题指导:
https://github.com/kvcache-ai/ktransformers/blob/main/kt-kernel/README.md
Inference with kt-kernel+Sglang/ 在 kt-kernel + Sglang 上推理
1. Install SGLang
2. Prepare Weights
You need both GPU weights and CPU weights for heterogeneous inference:
GPU Weights: Use the original / quantized model weights.
CPU Weights: Quantize to AMX-optimized format using the conversion script:
Supported input formats: FP8, FP16, BF16 → INT4/INT8.
For more details, see:
Note: LLAMAFILE backend supports GGUF format directly, but this feature is still in preview.
3. Launch SGLang Server
Start the SGLang server with your normal SGLang parameters, and add the following KT-Kernel specific parameters to enable CPU-GPU heterogeneous inference:
KT-Kernel Parameters to Add:
--kt-method: Backend method (AMXINT4, AMXINT8, or LLAMAFILE)--kt-weight-path: Path to the converted CPU weights--kt-cpuinfer: Number of CPU inference threads (set to physical cores)--kt-threadpool-count: Number of thread pools (set to NUMA node count)--kt-num-gpu-experts: Number of experts to keep on GPU--kt-max-deferred-experts-per-token: Deferred experts for pipelined executionExample:
Support models/ 支持的模型列表
Note
In principle, we can support any model that SGLang supports. If a model cannot run, then SGLang running purely on GPU likely won't be able to either. So if you test additional models that work, feel free to share them.
Known Issues & Tips / 已知问题与提示
"KT fallback" log messages are normal / "KT fallback" 日志是正常的
If you see logs like
KT fallback: layer X prepare weight = XXms, compute = XXms, this is expected behavior indicating that Layer-wise Prefill is working correctly. The "fallback" naming is misleading and will be updated in a future release.如果看到类似
KT fallback: layer X prepare weight = XXms的日志,这是预期行为,说明 Layer-wise Prefill 已正常启动。"fallback" 这个名称有误导性,后续版本会优化。Low GPU utilization during prefill / Prefill 阶段 GPU 利用率低
If your GPU utilization is low during prefill, enable Layer-wise Prefill by adding:
This allows the GPU to participate in prefill computation, significantly improving prefill throughput.
如果 prefill 阶段 GPU 利用率很低,请添加
--kt-gpu-prefill-token-threshold 2048参数开启 Layer-wise Prefill。GPTQ_INT4 + tensor-parallel-size > 1 / GPTQ_INT4 与多卡 TP 不兼容
GPTQ-Int4 quantized MoE models may fail with
IndexError: start out of rangewhen usingtensor-parallel-size > 1with GPU experts. This is an SGLang-side weight loader issue. Workarounds:--tensor-parallel-size 1GPTQ-Int4 量化的 MoE 模型在
tensor-parallel-size > 1且使用 GPU experts 时可能报错。这是 SGLang 侧的问题。建议降低 TP 或使用 FP8 权重。Tip
If the problems still exist with the latest code, please create an issue.
若使用最新的代码仍然无法解决问题,请创建一个 issue。