moonshotai/Kimi-K2.7-Code
Coding-focused agentic MoE built on Kimi-K2.6, tuned for long-horizon software-engineering tasks with thinking-only reasoning, tool calling, and vision-language input
1T MoE coding agent with ~30% fewer thinking tokens than Kimi-K2.6
vllm serve moonshotai/Kimi-K2.7-Code \
--trust-remote-code \
--tensor-parallel-size 8 \
--tool-call-parser kimi_k2 \
--enable-auto-tool-choice \
--reasoning-parser kimi_k2 \
--speculative-config '{"model":"lightseekorg/kimi-k2.7-coder-eagle3.1-mla","method":"eagle3","num_speculative_tokens":3}' \
--mm-encoder-tp-mode dataThe interactive builder loads with JavaScript. Append .md to this page's URL, query string included, for any configuration's command as Markdown — e.g. /moonshotai/Kimi-K2.7-Code.md.
Overview
Kimi-K2.7-Code is a coding-focused agentic model built on top of Kimi-K2.6. It substantially improves real-world long-horizon coding performance — strengthening end-to-end task completion across complex software-engineering workflows while improving token efficiency, reducing thinking-token usage by ~30% versus Kimi-K2.6.
It shares the same architecture as Kimi-K2.5 / Kimi-K2.6 (1T-parameter MoE, 32B activated,
DeepSeek-V3 backbone with MLA attention and a MoonViT vision encoder), so the K2.6
deployment method can be reused directly. Kimi-K2.7-Code runs in thinking mode only
with preserve_thinking forced on; keep the reasoning parser enabled.
Prerequisites
- vLLM version: >= 0.19.1 (manually verified). The model is also available in the vLLM nightly wheel, but nightly builds are experimental.
- Hardware (INT4): 8x H200 GPUs (verified), or equivalent aggregate VRAM (~640 GB)
uv venv
source .venv/bin/activate
uv pip install -U vllm --torch-backend=auto
Launch command
Serve on a single H200 node with TP8 (vision encoder in data-parallel mode):
vllm serve moonshotai/Kimi-K2.7-Code \
--tensor-parallel-size 8 \
--mm-encoder-tp-mode data \
--trust-remote-code \
--tool-call-parser kimi_k2 \
--enable-auto-tool-choice \
--reasoning-parser kimi_k2
Key notes
--tool-call-parser kimi_k2— required for enabling tool calling.--reasoning-parser kimi_k2— Kimi-K2.7-Code supports thinking mode only; pass this for correct reasoning processing.--mm-encoder-tp-mode data— runs the small MoonViT encoder data-parallel to avoid TP communication overhead.
AMD MI300X/MI325X
On 8x MI300X or MI325X (gfx942), use the standard W4A16 MoE path with AITER
and INT4 QuickReduce.
export VLLM_ROCM_USE_AITER=1
export VLLM_ROCM_QUICK_REDUCE_QUANTIZATION=INT4
vllm serve moonshotai/Kimi-K2.7-Code \
--host 0.0.0.0 \
--port 8000 \
--trust-remote-code \
--tensor-parallel-size 8 \
--tool-call-parser kimi_k2 \
--enable-auto-tool-choice \
--reasoning-parser kimi_k2 \
--mm-encoder-tp-mode data
AMD MI350X/MI355X
On 8x MI350X or MI355X (gfx950), add --moe-backend flydsl to use the
optimized FlyDSL W4A16 MoE kernel. Keep LoRA disabled for this path.
export VLLM_ROCM_USE_AITER=1
export VLLM_ROCM_QUICK_REDUCE_QUANTIZATION=INT4
vllm serve moonshotai/Kimi-K2.7-Code \
--tensor-parallel-size 8 \
--trust-remote-code \
--mm-encoder-tp-mode data \
--moe-backend flydsl \
--tool-call-parser kimi_k2 \
--enable-auto-tool-choice \
--reasoning-parser kimi_k2 \
--compilation-config '{"pass_config": {"fuse_allreduce_rms": false}}'
Notes:
- The FlyDSL INT4 MoE path does not support expert parallelism; do not add
--enable-expert-parallel. - Keep
--compilation-config '{"pass_config": {"fuse_allreduce_rms": false}}'; it is required for this FlyDSL path on MI350X / MI355X. - vLLM has tuned MI350X/MI355X FlyDSL configs for this Kimi shape at TP=8 and TP=4.
- Keep vLLM's default block size unless you are tuning long-context
throughput;
--block-size 64is safe to try.
Client Usage
Once the vLLM server is running, consume it via the OpenAI-compatible API. The recommended
sampling for thinking mode is temperature=1.0 and top_p=0.95.
import time
from openai import OpenAI
client = OpenAI(
api_key="EMPTY",
base_url="http://localhost:8000/v1",
timeout=3600,
)
messages = [
{
"role": "user",
"content": [
{
"type": "image_url",
"image_url": {
"url": "https://huggingface.co/moonshotai/Kimi-K2.7-Code/resolve/main/figures/kimi-logo.png"
},
},
{"type": "text", "text": "Describe this image in detail."},
],
}
]
start = time.time()
response = client.chat.completions.create(
model="moonshotai/Kimi-K2.7-Code",
messages=messages,
max_tokens=4096,
temperature=1.0,
top_p=0.95,
)
print(f"Response costs: {time.time() - start:.2f}s")
print(f"Reasoning: {response.choices[0].message.reasoning}")
print(f"Response: {response.choices[0].message.content}")
Troubleshooting
- OOM errors: Lower
--max-num-seqsor--max-model-len, or adjust TP/EP to match your GPU count. - Vision encoder performance: Use
--mm-encoder-tp-mode datato run the vision encoder in data-parallel mode. The encoder is small, so TP adds communication overhead with little gain. - Unique multimodal inputs: Pass
--mm-processor-cache-gb 0to avoid caching overhead. For repeated inputs,--mm-processor-cache-type shmuses host shared memory for better performance at high TP settings. - Text-only workloads: Pass
--language-model-onlyto skip loading MoonViT and free VRAM for KV cache.
References
- Kimi-K2.7-Code on Hugging Face
- Kimi-K2.7-Code deployment guide
- Kimi-K2.6 recipe
- vLLM multimodal inputs guide
Ascend overview
Kimi-K2.7-Code is a 1T-parameter MoE coding model with a MoonViT encoder. The Ascend W4A8 checkpoint runs on Atlas 800I A2 (910B4) as a four-node prefill/decode cluster: two prefill nodes with DP2 x TP8 and two decode nodes with DP4 x TP4, connected through Mooncake KV transfer and fronted by the Ascend proxy.
Ascend prerequisites
- Hardware and node topology: 4 x Atlas 800I A2, 8 x 910B4 (64 GB) each
- vLLM / vLLM Ascend runtime: vLLM-Ascend v0.32.0rc1
- Image:
quay.io/ascend/vllm-ascend:v0.32.0rc1 - Checkpoint:
Eco-Tech/Kimi-K2.7-Code-w4a8revisiona671b826a7329495a89d6ff70b9c4ea96588c035 - Draft:
z-lab/Kimi-K2.5-DFlash - Host:
/etc/hccn.confpresent, shared model storage mounted, onemooncake_masterreachable by every engine - Both model ids resolve from ModelScope (
VLLM_USE_MODELSCOPE=true)
Client usage
from openai import OpenAI
client = OpenAI(
base_url="http://<router-host>:<router-port>/v1",
api_key="EMPTY",
)
response = client.chat.completions.create(
model="kimi27",
messages=[{"role": "user", "content": "Hello"}],
max_tokens=1024,
)
print(response.choices[0].message.content)
Ascend references
Configurations qualified on specific hardware, layered on the baseline command. Unless marked Opt-in, a preset applies automatically on its hardware and strategy; pick Baseline in the builder to drop it.
Two prefill nodes (DP2 x TP8) and two decode nodes (DP4 x TP4), with Mooncake KV transfer and the Ascend proxy in front.
image quay.io/ascend/vllm-ascend:v0.32.0rc1 · model rev a671b826a7329495a89d6ff70b9c4ea96588c035
RunbookTopology · Placeholders to fill · Mooncake
Topology
Four Atlas 800I A2 nodes (8 x 910B4, 64 GB each):
- Prefill: two dedicated nodes, DEP with TP8 on 8 devices. Each node runs one DP rank (global DP2, local DP1) on an external endpoint.
- Decode: two dedicated nodes, DEP with TP4 on 8 devices. Each node runs two local DP ranks (global DP4, local DP2); HTTP ports are base port plus the local rank, so 7100 and 7101 per node.
- The Ascend proxy enumerates all four decode endpoints and both prefill endpoints. Do not send normal generation requests directly to a decode endpoint; decode is a KV consumer and can wedge when it receives a plain request.
The renderer emits external-DP worker commands for these two-node pools.
The validated cluster used the equivalent per-rank vllm serve processes
from launch_online_dp.py, with the same DP/TP sizes, rank offsets,
7100/7101 ports and KV connector settings.
Placeholders to fill
Export or replace the usual renderer variables before launch:
$PREFILL_NODE_1, $PREFILL_NODE_2, $DECODE_NODE_1, $DECODE_NODE_2,
$PREFILL_DP_RPC_PORT, $DECODE_DP_RPC_PORT, $IFACE_NAME,
$ROUTER_HOST, $ROUTER_PORT, and $MOONCAKE_CONFIG_PATH.
Mooncake
Every prefill and decode node needs the same shared config, an exported
MOONCAKE_CONFIG_PATH, and a reachable mooncake_master. The validated
config used 15 GB per TP rank (32 clients, 480 GB total); a 1 GB value
only yields 32 GB and triggers eviction under two concurrent 64k requests.
The master ran on the first prefill node:
{
"metadata_server": "P2PHANDSHAKE",
"protocol": "ascend",
"device_name": "",
"master_server_address": "$PREFILL_NODE_1:50088",
"global_segment_size": "15GB",
"preferred_segment": false,
"prefer_alloc_in_same_node": true
}
Start mooncake_master --rpc_port=50088 on the first prefill node before
the engines. When using the rendered Docker command, add
-v /etc/hccn.conf:/etc/hccn.conf:ro so the Ascend Mooncake backend can
read the host RoCE configuration; the renderer's default Ascend mount set
omits it.