Add Kimi-K2.7-Code Eagle3-MLA draft (full vocab) + README with per-benchmark accept_length
Browse files- README.md +88 -0
- config.json +47 -0
- model.safetensors +3 -0
README.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
base_model: moonshotai/Kimi-K2.7-Code
|
| 4 |
+
tags:
|
| 5 |
+
- text-generation
|
| 6 |
+
- speculative-decoding
|
| 7 |
+
- eagle3
|
| 8 |
+
- eagle3-mla
|
| 9 |
+
- draft-model
|
| 10 |
+
- vllm
|
| 11 |
+
language:
|
| 12 |
+
- en
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# kimi-k2.7-code-eagle3-mla
|
| 16 |
+
|
| 17 |
+
## Model Overview
|
| 18 |
+
|
| 19 |
+
kimi-k2.7-code-eagle3-mla is an Eagle3 MTP draft model with MLA (Multi-Latent Attention) for
|
| 20 |
+
accelerating inference of **Kimi-K2.7-Code** under vLLM speculative decoding. The draft proposes
|
| 21 |
+
`num_speculative_tokens` candidate tokens per step; the Kimi-K2.7-Code verifier accepts them in
|
| 22 |
+
parallel, so the output distribution is identical to plain autoregressive decoding while decode
|
| 23 |
+
throughput improves.
|
| 24 |
+
|
| 25 |
+
### Why an MLA (Multi-Latent Attention) Draft Model
|
| 26 |
+
|
| 27 |
+
Compared with an MHA draft model, the MLA variant is a better fit for Kimi-K2.7-Code deployment:
|
| 28 |
+
|
| 29 |
+
- Uses less KV cache, which reduces serving memory pressure.
|
| 30 |
+
- Matches Kimi-K2.7-Code's MLA architecture, so it fits more naturally into the inference engine's
|
| 31 |
+
KV-cache handling under different serving scenarios such as PD-Disaggregation.
|
| 32 |
+
|
| 33 |
+
### Architecture
|
| 34 |
+
|
| 35 |
+
- **Algorithm**: EAGLE-3 with MLA, single draft decoder layer.
|
| 36 |
+
- **Verifier**: Kimi-K2.7-Code. The draft reuses the verifier's frozen embedding / lm_head / norm
|
| 37 |
+
and trains one MLA decoder layer plus an auxiliary-hidden-state fusion layer.
|
| 38 |
+
- **Draft vocabulary**: full 163,840-token vocabulary (no truncation).
|
| 39 |
+
|
| 40 |
+
### Training Setup
|
| 41 |
+
|
| 42 |
+
- **Framework**: **Camelot**, an online speculative-decoding training framework — FSDP training
|
| 43 |
+
and vLLM inference run concurrently, with the verifier continuously generating fresh training
|
| 44 |
+
data.
|
| 45 |
+
- **Training data**: Kimi-K2.7-Code native data (agentic / coding / tool trajectories and
|
| 46 |
+
re-answered prompts).
|
| 47 |
+
- **Schedule**: cosine LR 2e-5, sequence length 8192, `ttt_steps=4`.
|
| 48 |
+
|
| 49 |
+
## Performance
|
| 50 |
+
|
| 51 |
+
The primary metric is **accept_length** — the average number of tokens accepted per speculation
|
| 52 |
+
step with `num_speculative_tokens=3`. Higher is better.
|
| 53 |
+
|
| 54 |
+
Benchmarks were run on vLLM 0.20.0 (TP=8, greedy decoding, concurrency=1) against the
|
| 55 |
+
Kimi-K2.7-Code verifier.
|
| 56 |
+
|
| 57 |
+
| Category | Benchmark | N | Accept Length |
|
| 58 |
+
| --- | --- | --- | --- |
|
| 59 |
+
| Dialogue | [MTBench](https://github.com/lm-sys/FastChat/tree/main/fastchat/llm_judge) | 80 | 2.427 |
|
| 60 |
+
| Chinese | [CEval](https://huggingface.co/datasets/ceval/ceval-exam) | 212 | 2.348 |
|
| 61 |
+
| Math | [GSM8K](https://github.com/openai/grade-school-math) | 500 | 3.201 |
|
| 62 |
+
| Code | [HumanEval](https://huggingface.co/datasets/openai/openai_humaneval) | 164 | 2.738 |
|
| 63 |
+
| Math | [MATH500](https://huggingface.co/datasets/HuggingFaceH4/MATH-500) | 500 | 2.918 |
|
| 64 |
+
| Math | [AIME](https://huggingface.co/datasets/Maxwell-Jia/AIME_2024) | 30 | 2.542 |
|
| 65 |
+
| Code | [LiveCodeBench](https://huggingface.co/datasets/livecodebench/code_generation) | 200 | 2.362 |
|
| 66 |
+
| Code | [SPEED-Bench (coding)](https://huggingface.co/datasets/nvidia/SPEED-Bench) | 80 | 2.515 |
|
| 67 |
+
|
| 68 |
+
---
|
| 69 |
+
|
| 70 |
+
## Quick Start
|
| 71 |
+
|
| 72 |
+
### Requirements
|
| 73 |
+
|
| 74 |
+
- NVIDIA GPU with CUDA 12.0+
|
| 75 |
+
- [vLLM](https://github.com/vllm-project/vllm) >= 0.20.0
|
| 76 |
+
|
| 77 |
+
### Launch Server (vLLM)
|
| 78 |
+
|
| 79 |
+
```bash
|
| 80 |
+
vllm serve moonshotai/Kimi-K2.7-Code \
|
| 81 |
+
--tensor-parallel-size 8 \
|
| 82 |
+
--speculative-config '{"model": "novita/kimi-k2.7-code-eagle3-mla", "method": "eagle3", "num_speculative_tokens": 3}' \
|
| 83 |
+
--trust-remote-code
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
### Launch Server (SGLang)
|
| 87 |
+
|
| 88 |
+
MLA Eagle3 draft model is not yet supported in SGLang. Will update once support is available.
|
config.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"Eagle3DeepseekV2ForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"model_type": "kimi_k2",
|
| 6 |
+
"hidden_size": 7168,
|
| 7 |
+
"intermediate_size": 18432,
|
| 8 |
+
"num_hidden_layers": 1,
|
| 9 |
+
"num_attention_heads": 64,
|
| 10 |
+
"num_key_value_heads": 64,
|
| 11 |
+
"q_lora_rank": 1536,
|
| 12 |
+
"kv_lora_rank": 512,
|
| 13 |
+
"qk_nope_head_dim": 128,
|
| 14 |
+
"qk_rope_head_dim": 64,
|
| 15 |
+
"v_head_dim": 128,
|
| 16 |
+
"hidden_act": "silu",
|
| 17 |
+
"rms_norm_eps": 1e-05,
|
| 18 |
+
"vocab_size": 163840,
|
| 19 |
+
"draft_vocab_size": 163840,
|
| 20 |
+
"torch_dtype": "bfloat16",
|
| 21 |
+
"rope_theta": 50000.0,
|
| 22 |
+
"rope_scaling": {
|
| 23 |
+
"beta_fast": 1.0,
|
| 24 |
+
"beta_slow": 1.0,
|
| 25 |
+
"factor": 64.0,
|
| 26 |
+
"mscale": 1.0,
|
| 27 |
+
"mscale_all_dim": 1.0,
|
| 28 |
+
"original_max_position_embeddings": 4096,
|
| 29 |
+
"type": "yarn"
|
| 30 |
+
},
|
| 31 |
+
"eagle_config": {
|
| 32 |
+
"eagle_aux_hidden_state_layer_ids": [
|
| 33 |
+
2,
|
| 34 |
+
30,
|
| 35 |
+
58
|
| 36 |
+
],
|
| 37 |
+
"use_aux_hidden_state": true,
|
| 38 |
+
"use_input_layernorm_in_first_layer": true,
|
| 39 |
+
"use_last_layernorm": true,
|
| 40 |
+
"use_mtp_layernorm": false
|
| 41 |
+
},
|
| 42 |
+
"bos_token_id": 163584,
|
| 43 |
+
"eos_token_id": 163585,
|
| 44 |
+
"pad_token_id": 0,
|
| 45 |
+
"_torchspec_version": "0.1.0",
|
| 46 |
+
"max_position_embeddings": 262144
|
| 47 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:dd5a71a1027bda3116df4d1abaecc5ad6c2e1d25009508ce08924e0f15b85d2b
|
| 3 |
+
size 6031210296
|