MiMo-V2-Flash Documentation

repository·main·Indexed 23 days ago

https://github.com/xiaomimimo/mimo-v2-flash

A high-performance Mixture-of-Experts (MoE) language model by Xiaomi designed for efficient long-context reasoning and agentic workflows. Featuring 309B total parameters (15B active) and a 256k context length, it utilizes a hybrid attention architecture and Multi-Token Prediction (MTP) to maximize inference speed. The documentation covers model versions, performance benchmarks, SGLang installation and deployment, and API usage for chat completions and tool calls.

Tokens
2.4K
Snippets
4
Records
12
Agent score
30%

What's inside MiMo-V2-Flash

  1. What is MiMo-V2-Flash?

    main

    MiMo-V2-Flash is a Mixture-of-Experts (MoE) language model optimized for high-speed reasoning and agentic workflows. It balances long-context modeling with inference efficiency through several architectural innovations:

    • Hybrid Attention Architecture: Uses a 5:1 ratio of Sliding Window Attention (SWA) to Global Attention (GA) with a 128-token window, reducing KV-cache storage by ~6x.
    • Multi-Token Prediction (MTP): A lightweight module (0.33B params/block) that triples output speed during inference.
    • Large Context: Supports up to 256k sequence length.
    • Agentic Performance: Optimized via Multi-Teacher On-Policy Distillation (MOPD) and agentic RL for tasks like SWE-Bench.
  2. Handle multi-turn tool calls in thinking mode

    main

    When using thinking mode with multi-turn tool calls, the model generates a reasoning_content field alongside its tool_calls.

    Critical Requirement: To maintain conversation continuity, you must persist and include all previous reasoning_content values in the messages array of every subsequent request in the turn sequence.

  3. Understand Lightweight Multi-Token Prediction (MTP)

    main

    The MTP module is natively integrated into the MiMo-V2-Flash architecture for both training and inference, enabling self-speculative decoding.

    Technical Specifications:

    • Structure: To maintain a low parameter count (0.33B per block), the module uses a dense FFN (Feed-Forward Network) instead of MoE (Mixture of Experts) and SWA instead of GA.
    • Benefits:
      • Triples generation speed via self-speculative decoding.
      • Mitigates GPU idleness during small-batch RL training.
  4. Understand Hybrid Sliding Window Attention architecture

    main

    MiMo-V2-Flash manages long-context quadratic complexity by interleaving Local Sliding Window Attention (SWA) and Global Attention (GA).

    Architecture Details:

    • Block Configuration: The model uses stacks of $M=8$ hybrid blocks. Each block consists of $N=5$ SWA layers followed by 1 GA layer.
    • SWA Efficiency: SWA layers utilize a window size of 128 tokens to significantly reduce KV cache requirements.
    • Sink Bias: A learnable attention sink bias is implemented to maintain model performance despite the aggressive windowing strategy.
  5. Install and launch MiMo-V2-Flash with SGLang

    main

    MiMo-V2-Flash supports FP8 mixed precision inference and is optimized for use with SGLang. To ensure compatibility, you must install a specific development version of SGLang.

    Follow these steps to install the required package and launch the inference server with recommended configurations for the MiMo-V2-Flash model.

    # Install the compatible SGLang version
    pip install sglang==0.5.6.post2.dev8005+pr.15207.g39d5bd57a \
      --index-url https://sgl-project.github.io/whl/pr/ \
      --extra-index-url https://pypi.org/simple
    
    # Launch the server
    SGLANG_ENABLE_SPEC_V2=1 python3 -m sglang.launch_server \
            --model-path XiaomiMiMo/MiMo-V2-Flash \
            --served-model-name mimo-v2-flash \
            --pp-size 1 \
            --dp-size 2 \
            --enable-dp-attention \
            --tp-size 8 \
            --moe-a2a-backend deepep \
            --page-size 1 \
            --host 0.0.0.0 \
            --port 9001 \
            --trust-remote-code \
            --mem-fraction-static 0.75 \
            --max-running-requests 128 \
            --chunked-prefill-size 16384 \
            --reasoning-parser qwen3 \
            --tool-call-parser mimo \
            --context-length 262144 \
            --attention-backend fa3 \
            --speculative-algorithm EAGLE \
            --speculative-num-steps 3 \
            --speculative-eagle-topk 1 \
            --speculative-num-draft-tokens 4 \
            --enable-mtp
  6. Use MiMo-V2-Flash via API or Studio

    main

    For developers who want to interact with the model without local hosting, Xiaomi provides two platforms:

    • Xiaomi MiMo Studio: A playground environment for testing model capabilities.
    • Xiaomi MiMo API Platform: A programmatic interface for integrating MiMo-V2-Flash into applications.
  7. Configure recommended system prompts for MiMo

    main

    To ensure optimal performance and persona alignment, it is highly recommended to use one of the following system prompts. You should provide the current date and week in the placeholders.

    ### English
    ```plaintext
    You are MiMo, an AI assistant developed by Xiaomi.
    
    Today's date: {date} {week}. Your knowledge cutoff date is December 2024.

    Chinese

    你是MiMo(中文名称也是MiMo),是小米公司研发的AI智能助手。
    
    今天的日期:{date} {week},你的知识截止日期是2024年12月。
  8. Access MiMo-V2-Flash models

    main

    MiMo-V2-Flash models are available for download via HuggingFace. There are two primary versions available: the Base model and the full MiMo-V2-Flash model. Both versions feature 309B total parameters, 15B active parameters, and support a context length of up to 256k.

    | Model | Total Params | Active Params | Context Length | Download |
    | :--------------------- | :----------: | :-----------: | :------------: | :-------------------------------------------------------------------: |
    | **MiMo-V2-Flash-Base** | 309B | 15B | 256k | [🤗 HuggingFace](https://huggingface.co/XiaomiMiMo/MiMo-V2-Flash-Base) |
    | **MiMo-V2-Flash** | 309B | 15B | 256k | [🤗 HuggingFace](https://huggingface.co/XiaomiMiMo/MiMo-V2-Flash) |
  9. Configure sampling parameters for MiMo-V2-Flash

    main

    Adjust the top_p and temperature parameters based on your specific use case to get the best results:

    • General/Math/Writing/Web-Dev: Use top_p=0.95 and temperature=0.8.
    • Agentic Tasks (e.g., vibe-coding, tool-use): Use top_p=0.95 and temperature=0.3.
  10. Send chat completion requests to MiMo-V2-Flash

    main

    Once the SGLang server is running, you can interact with the model using the OpenAI-compatible /v1/chat/completions endpoint. To enable the model's reasoning capabilities, include "enable_thinking": true within the chat_template_kwargs object in your JSON payload.

    curl -i http://localhost:9001/v1/chat/completions \
        -H 'Content-Type:application/json' \
        -d  '{ 
                "messages" : [{ 
                    "role": "user", 
                    "content": "Nice to meet you MiMo" 
                }], 
                "model": "mimo-v2-flash", 
                "max_tokens": 4096, 
                "temperature": 0.8, 
                "top_p": 0.95, 
                "stream": true, 
                "chat_template_kwargs": { 
                    "enable_thinking": true 
                } 
            }'
  11. Compare MiMo-V2-Flash Post-training performance

    main

    The post-trained MiMo-V2-Flash model, optimized via MOPD and Agentic RL, is compared against state-of-the-art (SOTA) models like Gemini-3.0 Pro, Claude Sonnet 4.5, and GPT-5 High.

    Key evaluation categories include:

    • Reasoning: High scores in AIME 2025 (94.1) and MMLU-Pro (84.9).
    • Code Agent: Strong performance in SWE-Bench Verified (73.4) and SWE-Bench Multilingual (71.7).
    • General Agent: Competitive in $\tau^2$-Bench (80.3) and BrowseComp (45.4).
    • Long Context: High performance in LongBench V2 (60.6).
  12. Compare MiMo-V2-Flash Base model performance

    main

    The MiMo-V2-Flash-Base model is evaluated against several large-scale models (Kimi-K2, DeepSeek-V3.1, DeepSeek-V3.2 Exp) across various benchmarks. It features 15B activated parameters out of 309B total parameters. Key performance areas include:

    • General Knowledge: High scores in MMLU-Pro (73.2) and GPQA-Diamond (55.1).
    • Math: Strong performance in GSM8K (92.3) and MATH (71.0).
    • Code: Competitive in HumanEval+ (70.7) and BigCodeBench (70.1).
    • Long Context: High accuracy in NIAH-Multi up to 256K tokens (96.7) and robust performance in GSM-Infinite Hard tasks.
    • Chinese/Multilingual: Strong results in C-Eval (87.9) and GlobalMMLU (76.6).