跳到正文
月之暗面 Kimi 模型发布·· 2026-04-23精选AI 评分82

月之暗面发布 Kimi K2 Instruct 模型

moonshotai/Kimi-K2-Instruct

AI 导读

月之暗面发布 Kimi K2,这是一个总参数 1T、激活参数 32B 的 MoE 语言模型,在 15.5T token 上预训练,采用 Muon 优化器,并针对工具调用与自主问题求解做了优化。

推荐理由

原文给出 1T 总参数、32B 激活的 MoE 架构与完整评测对照,可据此判断开源模型在编码和工具调用上的位置。

正文 · AI 翻译

Kimi K2: Open Agentic Intellignece


📰  技术博客     |     📄  论文

0. 更新日志

2025.8.11

  • 现已支持包含 name 字段的消息。我们还将聊天模板移至独立文件,以便更轻松地查看。

2025.7.18

  • 我们进一步修改了聊天模板以提升其稳健性。默认系统提示词也已更新。

2025.7.15

  • 我们更新了分词器实现。现在,像 [EOS] 这样的特殊 token 可以被编码为其对应的 token id。
  • 我们修复了聊天模板中一个会破坏多轮工具调用的 bug。

1. 模型简介

Kimi K2 是一款最先进的混合专家(MoE)语言模型,激活参数为 320 亿,总参数为 1 万亿。Kimi K2 使用 Muon 优化器训练,在前沿知识、推理和编码任务中均取得卓越表现,同时针对智能体能力进行了精心优化。

关键特性

  • 大规模训练:在 15.5T token 上预训练了一个 1T 参数的 MoE 模型,训练过程零不稳定。
  • MuonClip 优化器:我们将 Muon 优化器应用于前所未有的规模,并开发了新颖的优化技术,在扩大规模的同时解决不稳定性问题。
  • 智能体智能:专为工具使用、推理和自主问题解决而设计。

模型变体

  • Kimi-K2-Base:基础模型,为希望完全控制微调和定制解决方案的研究人员和开发者提供了强有力的起点。
  • Kimi-K2-Instruct:经过后训练的模型,最适合即插即用的通用聊天和智能体体验。它是一个无需长思考的反射级模型。

Evaluation Results

2. 模型摘要

架构 混合专家(MoE)
总参数 1T
激活参数 32B
层数(包含稠密层) 61
稠密层数 1
注意力隐藏维度 7168
MoE 隐藏维度(每个专家) 2048
注意力头数 64
专家数量 384
每个 token 选择的专家数 8
共享专家数量 1
词表大小 160K
上下文长度 128K
注意力机制 MLA
激活函数 SwiGLU

3. 评估结果

指令模型评估结果

基准测试 指标 Kimi K2 Instruct DeepSeek-V3-0324 Qwen3-235B-A22B
(非思考)
Claude Sonnet 4
(无扩展思考)
Claude Opus 4
(无扩展思考)
GPT-4.1 Gemini 2.5 Flash
Preview (05-20)
编码任务
LiveCodeBench v6
(24 年 8 月 - 25 年 5 月)
Pass@1 53.7 46.9 37.0 48.5 47.4 44.7 44.7
OJBench Pass@1 27.1 24.0 11.3 15.3 19.6 19.5 19.5
MultiPL-E Pass@1 85.7 83.1 78.2 88.6 89.6 86.7 85.6
SWE-bench Verified
(无智能体编码)
无测试单补丁(准确率) 51.8 36.6 39.4 50.2 53.0 40.8 32.6
SWE-bench Verified
(智能体编码)
单次尝试(准确率) 65.8 38.8 34.4 72.7* 72.5* 54.6 —
多次尝试(准确率) 71.6 — — 80.2 79.4* — —
SWE-bench Multilingual
(智能体编码)
单次尝试(准确率) 47.3 25.8 20.9 51.0 — 31.5 —
TerminalBench 内部框架(准确率) 30.0 — — 35.5 43.2 8.3 —
Terminus(准确率) 25.0 16.3 6.6 — — 30.3 16.8
Aider-Polyglot 准确率 60.0 55.1 61.8 56.4 70.7 52.4 44.0
工具使用任务
Tau2 retail Avg@4 70.6 69.1 57.0 75.0 81.8 74.8 64.3
Tau2 airline Avg@4 56.5 39.0 26.5 55.5 60.0 54.5 42.5
Tau2 telecom Avg@4 65.8 32.5 22.1 45.2 57.0 38.6 16.9
AceBench 准确率 76.5 72.7 70.5 76.2 75.6 80.1 74.5
数学与 STEM 任务
AIME 2024 Avg@64 69.6 59.4* 40.1* 43.4 48.2 46.5 61.3
AIME 2025 Avg@64 49.5 46.7 24.7* 33.1* 33.9* 37.0 46.6
MATH-500 准确率 97.4 94.0* 91.2* 94.0 94.4 92.4 95.4
HMMT 2025 Avg@32 38.8 27.5 11.9 15.9 15.9 19.4 34.7
CNMO 2024 Avg@16 74.3 74.7 48.6 60.4 57.6 56.6 75.0
PolyMath-en Avg@4 65.1 59.5 51.9 52.8 49.8 54.0 49.9
ZebraLogic 准确率 89.0 84.0 37.7* 73.7 59.3 58.5 57.9
AutoLogi 准确率 89.5 88.9 83.3 89.8 86.1 88.2 84.1
GPQA-Diamond Avg@8 75.1 68.4* 62.9* 70.0* 74.9* 66.3 68.2
SuperGPQA 准确率 57.2 53.7 50.2 55.7 56.5 50.8 49.6
Humanity's Last Exam
(仅文本)
- 4.7 5.2 5.7 5.8 7.1 3.7 5.6
通用任务
MMLU EM 89.5 89.4 87.0 91.5 92.9 90.4 90.1
MMLU-Redux EM 92.7 90.5 89.2 93.6 94.2 92.4 90.6
MMLU-Pro EM 81.1 81.2* 77.3 83.7 86.6 81.8 79.4
IFEval Prompt Strict 89.8 81.1 83.2* 87.6 87.4 88.0 84.3
Multi-Challenge Acc 54.1 31.4 34.0 46.8 49.0 36.4 39.5
SimpleQA Correct 31.0 27.7 13.2 15.9 22.8 42.3 23.3
Livebench Pass@1 76.4 72.4 67.6 74.8 74.6 69.8 67.8

• 粗体表示全球 SOTA,下划线表示开源 SOTA。
• 标有 * 的数据点直接取自模型的技术报告或博客。
• 除 SWE-bench Verified (Agentless) 外,所有指标均以 8k 输出 token 长度进行评估。SWE-bench Verified (Agentless) 限制为 16k 输出 token 长度。
• Kimi K2 在使用 bash/editor 工具的 SWE-bench Verified 测试中达到 65.8% 的 pass@1(单次尝试补丁,无测试时计算)。在相同条件下,它还在 SWE-bench Multilingual 测试中达到 47.3% 的 pass@1。此外,我们报告了 SWE-bench Verified 测试(71.6%)的结果,该结果通过采样多个序列并利用内部评分模型选择单个最佳序列来利用并行测试时计算。
• 为确保评估的稳定性,我们在 AIME、HMMT、CNMO、PolyMath-en、GPQA-Diamond、EvalPlus、Tau2 上采用了 avg@k。
• 由于评估成本过高,部分数据点已被省略。


基础模型评估结果

Benchmark Metric Shot Kimi K2 Base Deepseek-V3-Base Qwen2.5-72B Llama 4 Maverick
通用任务
MMLU EM 5-shot 87.8 87.1 86.1 84.9
MMLU-pro EM 5-shot 69.2 60.6 62.8 63.5
MMLU-redux-2.0 EM 5-shot 90.2 89.5 87.8 88.2
SimpleQA Correct 5-shot 35.3 26.5 10.3 23.7
TriviaQA EM 5-shot 85.1 84.1 76.0 79.3
GPQA-Diamond Avg@8 5-shot 48.1 50.5 40.8 49.4
SuperGPQA EM 5-shot 44.7 39.2 34.2 38.8
编码任务
LiveCodeBench v6 Pass@1 1-shot 26.3 22.9 21.1 25.1
EvalPlus Pass@1 - 80.3 65.6 66.0 65.5
数学任务
MATH EM 4-shot 70.2 60.1 61.0 63.0
GSM8k EM 8-shot 92.1 91.7 90.4 86.3
中文任务
C-Eval EM 5-shot 92.5 90.0 90.9 80.9
CSimpleQA Correct 5-shot 77.6 72.1 50.5 53.5

• 本工作中我们仅评估开源预训练模型。我们报告 Qwen2.5-72B 的结果,因为在我们研究时 Qwen3-235B-A22B 的基础检查点尚未开源。
• 所有模型均使用相同的评估协议进行评估。

4. 部署

你可以在 https://platform.moonshot.ai 上访问 Kimi K2 的 API,我们为你提供兼容 OpenAI/Anthropic 的 API。

兼容 Anthropic 的 API 通过 real_temperature = request_temperature * 0.6 映射温度,以便更好地兼容现有应用。

我们的模型检查点以 block-fp8 格式存储,你可以在 Huggingface 上找到它。

目前,建议在以下推理引擎上运行 Kimi-K2:

  • vLLM
  • SGLang
  • KTransformers
  • TensorRT-LLM

vLLM 和 SGLang 的部署示例可在 模型部署指南 中找到。


5. 模型使用

聊天补全

本地推理服务启动后,你可以通过聊天端点与其交互:

def simple_chat(client: OpenAI, model_name: str):
    messages = [
        {"role": "system", "content": "You are Kimi, an AI assistant created by Moonshot AI."},
        {"role": "user", "content": [{"type": "text", "text": "Please give a brief self-introduction."}]},
    ]
    response = client.chat.completions.create(
        model=model_name,
        messages=messages,
        stream=False,
        temperature=0.6,
        max_tokens=256
    )
    print(response.choices[0].message.content)

Kimi-K2-Instruct 的推荐温度为 temperature = 0.6。 如果不需要特殊说明,上述系统提示是一个不错的默认值。


工具调用

Kimi-K2-Instruct 具有强大的工具调用能力。 要启用它们,你需要在每个请求中传入可用工具列表,然后模型将自主决定何时以及如何调用它们。

以下示例演示了端到端调用天气工具:

# Your tool implementation
def get_weather(city: str) -> dict:
    return {"weather": "Sunny"}

# Tool schema definition
tools = [{
    "type": "function",
    "function": {
        "name": "get_weather",
        "description": "Retrieve current weather information. Call this when the user asks about the weather.",
        "parameters": {
            "type": "object",
            "required": ["city"],
            "properties": {
                "city": {
                    "type": "string",
                    "description": "Name of the city"
                }
            }
        }
    }
}]

# Map tool names to their implementations
tool_map = {
    "get_weather": get_weather
}

def tool_call_with_client(client: OpenAI, model_name: str):
    messages = [
        {"role": "system", "content": "You are Kimi, an AI assistant created by Moonshot AI."},
        {"role": "user", "content": "What's the weather like in Beijing today? Use the tool to check."}
    ]
    finish_reason = None
    while finish_reason is None or finish_reason == "tool_calls":
        completion = client.chat.completions.create(
            model=model_name,
            messages=messages,
            temperature=0.6,
            tools=tools,          # tool list defined above
            tool_choice="auto"
        )
        choice = completion.choices[0]
        finish_reason = choice.finish_reason
        if finish_reason == "tool_calls":
            messages.append(choice.message)
            for tool_call in choice.message.tool_calls:
                tool_call_name = tool_call.function.name
                tool_call_arguments = json.loads(tool_call.function.arguments)
                tool_function = tool_map[tool_call_name]
                tool_result = tool_function(**tool_call_arguments)
                print("tool_result:", tool_result)

                messages.append({
                    "role": "tool",
                    "tool_call_id": tool_call.id,
                    "name": tool_call_name,
                    "content": json.dumps(tool_result)
                })
    print("-" * 100)
    print(choice.message.content)

tool_call_with_client 函数实现了从用户查询到工具执行的流水线。 该流水线要求推理引擎支持 Kimi-K2 的原生工具解析逻辑。 有关流式输出和手动工具解析,请参阅 工具调用指南。


6. 许可证

代码仓库和模型权重均在 Modified MIT License 下发布。


7. 第三方声明

参见 THIRD PARTY NOTICES


7. 联系我们

如有任何问题,请通过 [email protected] 联系我们。

来源:月之暗面 Kimi 模型发布 · hf-mirror.com