[来源关键摘录] Kimi K2 指令微调版 Hugging Face 官方模型页与改良版 MIT 许可说明。
[正文前段节选] Hugging Face
Search models, datasets, users... ⌘K
Kimi-K2-Instruct
Moonshot AI 21.3k
Text Generation
Transformers
doi:10.57967/hf/5976
conversational
Eval Results
License: modified-mit
Model card Files Files and versions
Copy to bucket
Use this model
A newer version of this model is available: moonshotai/Kimi-K2-Instruct-0905
📰 Tech Blog | 📄 Paper
0. Changelog
Messages with name field are now supported. We’ve also moved the chat template to a standalone file for easier viewing.
We further modified our chat template to improve its robustness. The default system prompt has also been updated.
We have updated our tokenizer implementation. Now special tokens like [EOS] can be encoded to their token ids.
We fixed a bug in the chat template that was breaking multi-turn tool calls.
1. Model Introduction
Kimi K2 is a state-of-the-art mixture-of-experts (MoE) language model with 32 billion activated parameters and 1 trillion total parameters. Trained with the Muon optimizer, Kimi K2 achieves exceptional performance across frontier knowledge, reasoning, and coding tasks while being meticulously optimized for agentic capabilities.
Key Features
Large-Scale Training: Pre-trained a 1T parameter MoE model on 15.5T tokens with zero training instability.
MuonClip Optimizer: We apply the Muon optimizer to an unprecedented scale, and develop novel optimization techniques to resolve instabilities while scaling up.
Agentic Intelligence: Specifically designed for tool use, reasoning, and autonomous problem-solving.
Model Variants
Kimi-K2-Base: The foundation model, a strong start for researchers and builders who want full control for fine-tuning and custom solutions.
Kimi-K2-Instruct: The post-trained model best for drop-in, general-purpose chat and agentic experiences. It is a reflex-grade model without long thinking.
2. Model Summary
Architecture
Mixture-of-Experts (MoE)
Total Parameters
Activated Parameters
Number of Layers (Dense layer included)
Number of Dense Layers
Attention Hidden Dimension
MoE Hidden Dimension (per Expert)
Number of Attention Heads
Number of Experts
Selected Experts per Token
Number of Shared Experts
Vocabulary Size
Context Length
Attention Mechanism
Activation Function
3. Evaluation Results
Instruction model evaluation results
Kimi K2 Instruct
DeepSeek-V3-0324
Qwen3-235B-A22B (non-thinking)
Claude Sonnet 4 (w/o extended thinking)
Claude Opus 4 (w/o extended thinking)
Gemini 2.5 Flash Preview (05-20)
Coding Tasks
LiveCodeBench v6(Aug 24 - May 25)
SWE-bench Verified (Agentless Coding)
Single Patch w/o Test (Acc)
SWE-bench Verified (Agentic Coding)
Single Attempt (Acc)
Multiple Attempts (Acc)
SWE-bench Multilingual (Agentic Coding)
TerminalBench
Inhouse Framework (Acc)
Terminus (Acc)
Aider-Polyglot
Tool Use Tasks
Tau2 airline
Tau2 telecom
Math & STEM Tasks
GPQA-Diamond
Humanity's Last Exam(Text Only)
General Tasks
Prompt Strict
Multi-Challenge
• Bold denotes global SOTA, and underlined denotes open-source SOTA.
• Data points marked with * are taken directly from the model's tech report or blog.
• All metrics, except for SWE-bench Verified (Agentless), are evaluated with an 8k output token length. SWE-bench Verified (Agentless) is limited to a 16k output token length.
• Kimi K2 achieves 65.8% pass@1 on the SWE-bench Verified tests with bash/editor tools (single-attempt patches, no test-time compute). It also achieves a 47.3% pass@1 on the SWE-bench Multilingual tests under the same conditions. Additionally, we report results on SWE-bench Verified tests (71.6%) that leverage parallel test-time compute by sampling multiple sequences and selecting the single best via an internal scoring model.
• To ensure the stability of the evaluation, we employed avg@k on the AIME, HMMT, CNMO, PolyMath-en, GPQA-Diamond, EvalPlus, Tau2.
• Some data points have been omitted due to prohibitively expensive evaluation costs.
Base model evaluation results
Kimi K2 Base
Deepseek-V3-Base
Llama 4 Maverick
MMLU-redux-2.0
LiveCodeBench v6
Mathematics Tasks
Chinese Tasks
• We only evaluate open-source pretrained models in this work. We report results for Qwen2.5-72B because the base checkpoint for Qwen3-235B-A22B was not open-sourced at the time of our study.
• All models are evaluated using the same evaluation protocol.
4. Deployment
You can access Kimi K2's API on https://platform.moonshot.ai , we provide OpenAI/Anthropic-compatible API for you.
The Anthropic-compatible API maps temperature by real_temperature = request_temperature * 0.6 for better compatible with existing applications.
Our model checkpoints are stored in the block-fp8 format, you can find it on Huggingface.
Currently, Kimi-K2 is recommended to run on the following inference engines:
KTransformers
TensorRT-LLM
Deployment examples for vLLM and SGLang can be found in the Model Deployment Guide.
5. Model Usage
Chat Completion
Once the local inference service is up, you can interact with it through the chat endpoint:
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)
The recommended temperature for Kimi-K2-Instruct is temperature = 0.6.
If no special instructions are required, the system prompt above is a good default.
Tool Calling
Kimi-K2-Instruct has strong tool-calling capabilities.
To enable them, you need to pass the list of available tools in each request, then the model will autonomously decide when and how to invoke them.
The following example demonstrates calling a weather tool end-to-end:
# Your tool implementation
def get_weather(city: str) -> dict:
return {"weather": "Sunny"}
# Tool schema definition
"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": {
"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):
{"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(
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)
The tool_call_with_client function implements the pipeline from user query to tool execution.
This pipeline requires the inference engine to support Kimi-K2’s native tool-parsing logic.
For streaming output and manual tool-parsing, see the Tool Calling Guide.
Both the code repository and the model weights are released under the Modified MIT License.
7. Third Party Notices
See THIRD PARTY NOTICES
7. Contact Us
If you have any questions, please reach out at support@moonshot.cn.
Downloads last month 225,698
Chat template
Model tree for moonshotai/Kimi-K2-Instruct
Quantizations
[...内容已截断,完整版请查看原文或 Wayback 快照]