MiniMax-M2

MiniMax-M2

MiniMax-M2은 컴팩트하고 빠르며 비용 효율적인 MoE 모델이에요(총 2,300억 파라미터, 활성 100억 파라미터). 코딩과 agentic 작업에서 엘리트 성능을 위해 만들어졌으며 강력한 일반 지능도 유지해요. Artificial Analysis에서 종합 점수가 오픈소스 모델 중 전 세계 1위를 기록했어요.

출처: 문서

본문

1. Model Introduction

MiniMax-M2은 컴팩트하고 빠르며 비용 효율적인 MoE 모델(총 2,300억 파라미터, 활성 1,000억 파라미터)로, 코딩과 agentic 작업에서 엘리트 성능을 위해 만들어졌으며 강력한 일반 지능도 유지해요.

이 세대는 전반에 걸친 종합적 업그레이드를 제공해요:

  • 뛰어난 지능: MiniMax-M2는 Artificial Analysis에서 수학·과학·지시 따르기·코딩·agentic tool use 전반에 걸쳐 매우 경쟁력 있는 일반 지능을 보여줘요. 종합 점수가 오픈소스 모델 중 전 세계 1위를 기록했어요.
  • 고급 코딩: 종단간 개발자 워크플로우를 위해 설계된 MiniMax-M2는 다중 파일 편집, 코딩-실행-수정 루프, 테스트 검증 수리에서 탁월해요. Terminal-Bench와 (Multi-)SWE-Bench 스타일 작업에서의 강력한 성능은 터미널·IDE·CI 전반의 언어에서 실용적 효율을 보여줘요.
  • Agent 성능: MiniMax-M2는 셸·브라우저·검색·코드 러너 전반에서 복잡한 장기 도구 체인을 계획하고 실행해요. BrowseComp 스타일 평가에서 표면화하기 어려운 소스를 지속적으로 찾아내고, 증거 추적을 유지하며, 흔들리는 단계에서 우아하게 복구해요.
  • 효율적 설계: 100억 활성 파라미터(총 2,300억)로 MiniMax-M2는 대화형 에이전트와 배치 샘플링에 더 낮은 지연 시간·더 낮은 비용·더 높은 처리량을 제공하며, 배포 가능성이 높으면서도 코딩·agentic 작업에서 빛나는 모델로의 전환과 완벽히 일치해요.

자세한 내용은 공식 Minimax GitHub 저장소를 참조하세요.

2. SGLang Installation

SGLang은 여러 설치 방법을 제공해요. 하드웨어 플랫폼과 요구사항에 따라 가장 적합한 설치 방법을 선택할 수 있어요.

설치 지침은 공식 SGLang 설치 가이드를 참조하세요. AMD 환경은 현재 Docker 이미지 설치로 SGLang에서 사용할 수 있어요.

2.1 AMD Docker

2.1.1 Launch docker

docker pull lmsysorg/sglang:v0.5.9-rocm720-mi30x
docker run -d -it --ipc=host --network=host --privileged \
  --cap-add=CAP_SYS_ADMIN \
  --device=/dev/kfd --device=/dev/dri --device=/dev/mem \
  --group-add video --cap-add=SYS_PTRACE \
  --security-opt seccomp=unconfined \
  -v /:/work \
  -e SHELL=/bin/bash \
  --name Minimax \
 lmsysorg/sglang:v0.5.9-rocm720-mi30x \
  /bin/bash

2.1.2 Make modifications inside the docker

mv /sgl-workspace/sglang/python/sglang/srt/models/transformers.py \
   /sgl-workspace/sglang/python/sglang/srt/models/hf_transformers_model.py

2.1.3 Fix torch compile

/sgl-workspace/sglang/python/sglang/srt/models/minimax_m2.py에서 다음 줄을 주석 처리하세요: @torch.compile(dynamic=True, backend=get_compiler_backend())

#@torch.compile(dynamic=True, backend=get_compiler_backend())

3. Model Deployment

이 섹션은 빠른 배포에서 성능 최적화까지 단계별 가이드를 제공하며, 다양한 수준의 사용자에게 적합해요.

3.1 Basic Configuration

상단의 Command Generator를 사용해 하드웨어 플랫폼·모델 변형·배포 전략·thinking 능력에 맞는 배포 명령을 자동 생성하세요. 예시 기본 명령(AMD MI300X, MiniMax-M2.1, 4-GPU):

sglang serve \
  --model-path MiniMaxAI/MiniMax-M2 \
  --tp 4 \
  --trust-remote-code

Tool calling: --tool-call-parser minimax-m2. Reasoning: --reasoning-parser minimax-append-think.

3.1.1 NVIDIA GPU Deployment

위 대화형 명령 생성기는 AMD 배포를 다뤄요. NVIDIA GPU(H100/H200/B200)에서는 이 명시적 명령을 사용하세요:

4-GPU 배포 (최대 400K 컨텍스트):

python -m sglang.launch_server \
    --model-path MiniMaxAI/MiniMax-M2 \
    --tp-size 4 \
    --tool-call-parser minimax-m2 \
    --reasoning-parser minimax-append-think \
    --host 0.0.0.0 \
    --trust-remote-code \
    --port 30000 \
    --mem-fraction-static 0.85

8-GPU 배포 (최대 3M 컨텍스트):

python -m sglang.launch_server \
    --model-path MiniMaxAI/MiniMax-M2 \
    --tp-size 8 \
    --ep-size 8 \
    --tool-call-parser minimax-m2 \
    --reasoning-parser minimax-append-think \
    --host 0.0.0.0 \
    --trust-remote-code \
    --port 30000 \
    --mem-fraction-static 0.85

3.2 System Requirements

권장 구성 — 실제 요구사항은 워크로드에 따라 달라요:

GPUs Context Length Support
4× 96 GB GPUs Up to 400K tokens
8× 144 GB GPUs Up to 3M tokens

3.3 Testing Deployment

서버가 시작된 후 다음으로 검증하세요:

curl http://localhost:30000/v1/chat/completions \
    -H "Content-Type: application/json" \
    -d '{
        "model": "MiniMaxAI/MiniMax-M2",
        "messages": [
            {"role": "system", "content": [{"type": "text", "text": "You are a helpful assistant."}]},
            {"role": "user", "content": [{"type": "text", "text": "Who won the world series in 2020?"}]}
        ]
    }'

4. Model Invocation

4.1 Basic Usage

기본 API 사용과 요청 예시는 다음을 참조하세요:

4.2 Advanced Usage

4.2.1 Reasoning Parser

서버 명령:

    sglang serve \
    --model-path MiniMaxAI/MiniMax-M2 \
    --tp-size 4 \
    --reasoning-parser minimax-append-think \
    --trust-remote-code \
    --mem-fraction-static 0.85

테스트 코드:

from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:30000/v1",
    api_key="EMPTY"
)

# Enable streaming to see the thinking process in real-time
response = client.chat.completions.create(
    model="MiniMaxAI/MiniMax-M2",
    messages=[
        {"role": "user", "content": "Solve this problem step by step: What is 15% of 240?"}
    ],
    temperature=0.6,
    max_tokens=2048,
    stream=True
)

# Process the stream
has_thinking = False
has_answer = False
thinking_started = False

for chunk in response:
    if chunk.choices and len(chunk.choices) > 0:
        delta = chunk.choices[0].delta

        # Print thinking process
        if hasattr(delta, 'reasoning_content') and delta.reasoning_content:
            if not thinking_started:
                print("=============== Thinking =================", flush=True)
                thinking_started = True
            has_thinking = True
            print(delta.reasoning_content, end="", flush=True)

        # Print answer content
        if delta.content:
            # Close thinking section and add content header
            if has_thinking and not has_answer:
                print("\n=============== Content =================", flush=True)
                has_answer = True
            print(delta.content, end="", flush=True)

print()

출력 예시:

 thinkingFirst, the user asks: "What is 15% of 240?" This is a straightforward percentage calculation. I need to solve it step by step as per the instruction.

The problem is: What is 15% of 240?

To find a percentage of a number, I multiply the number by the percentage divided by 100. So, 15% is 15/100, which simplifies to 0.15.

Therefore, 15% of 240 is 240 times 0.15.

Let me calculate that: 240 × 0.15.

I can break it down: 240 × 0.15 = 240 × (15/100) = (240 × 15) / 100.

Now, 240 × 15. 200 × 15 = 3000, and 40 × 15 = 600, so total 3000 + 600 = 3600.

Then, divide by 100: 3600 / 100 = 36.

So, 15% of 240 is 36.

I should confirm this with another method. For example, 10% of 240 is 24, and 5% is half of that, which is 12. Then 15% is 10% + 5% = 24 + 12 = 36. Same answer.

Or, using fractions: 15% = 3/20, so 240 × 3/20 = (240 / 20) × 3 = 12 × 3 = 36.

All methods confirm it's 36.

The user said "solve this problem step by step," so I should present the steps clearly.

Step 1: Understand that "15% of 240" means 15 per hundred of 240.

Step 2: Convert percentage to decimal: 15% = 15/100 = 0.15.

Step 3: Multiply the number by the decimal: 240 × 0.15.

Step 4: Calculate the multiplication: 240 × 0.15 = 36.

Step 5: Therefore, 15% of 240 is 36.

I should also mention that percentage means per hundred, so it's straightforward.

Finally, I need to box the answer as per the instruction.

So, the final answer is 36.
 response

To find 15% of 240, follow these steps:

1. **Understand the percentage**: "15%" means 15 per hundred, or 15/100.
2. **Convert to a decimal**: 15/100 = 0.15.
3. **Multiply by the number**: 240 × 0.15.
4. **Calculate the result**:
   - 240 × 0.15 = 36.

Alternatively, you can break it down:
- 10% of 240 is 24 (since 240 ÷ 10 = 24).
- 5% of 240 is half of 10%, which is 12.
- Therefore, 15% is 10% + 5% = 24 + 12 = 36.

Both methods confirm the result.

**Answer**: 36

4.2.2 Tool Calling

서버 명령:

sglang serve \
    --model-path MiniMaxAI/MiniMax-M2 \
    --tp-size 4 \
    --tool-call-parser minimax-m2 \
    --trust-remote-code \
    --mem-fraction-static 0.85

테스트 코드:

from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:30000/v1",
    api_key="EMPTY"
)

# Define available tools
tools = [
    {
        "type": "function",
        "function": {
            "name": "get_weather",
            "description": "Get the current weather for a location",
            "parameters": {
                "type": "object",
                "properties": {
                    "location": {
                        "type": "string",
                        "description": "The city name"
                    },
                    "unit": {
                        "type": "string",
                        "enum": ["celsius", "fahrenheit"],
                        "description": "Temperature unit"
                    }
                },
                "required": ["location"]
            }
        }
    }
]

# Make request with streaming to see thinking process
response = client.chat.completions.create(
    model="MiniMaxAI/MiniMax-M2",
    messages=[
        {"role": "user", "content": "What's the weather in Beijing?"}
    ],
    tools=tools,
    temperature=0.7,
    stream=True
)

# Process streaming response
thinking_started = False
has_thinking = False
tool_calls_accumulator = {}

for chunk in response:
    if chunk.choices and len(chunk.choices) > 0:
        delta = chunk.choices[0].delta

        # Print thinking process
        if hasattr(delta, 'reasoning_content') and delta.reasoning_content:
            if not thinking_started:
                print("=============== Thinking =================", flush=True)
                thinking_started = True
            has_thinking = True
            print(delta.reasoning_content, end="", flush=True)

        # Accumulate tool calls
        if hasattr(delta, 'tool_calls') and delta.tool_calls:
            # Close thinking section if needed
            if has_thinking and thinking_started:
                print("\n=============== Content =================\n", flush=True)
                thinking_started = False

            for tool_call in delta.tool_calls:
                index = tool_call.index
                if index not in tool_calls_accumulator:
                    tool_calls_accumulator[index] = {
                        'name': None,
                        'arguments': ''
                    }

                if tool_call.function:
                    if tool_call.function.name:
                        tool_calls_accumulator[index]['name'] = tool_call.function.name
                    if tool_call.function.arguments:
                        tool_calls_accumulator[index]['arguments'] += tool_call.function.arguments

        # Print content
        if delta.content:
            print(delta.content, end="", flush=True)

# Print accumulated tool calls
for index, tool_call in sorted(tool_calls_accumulator.items()):
    print(f"🔧 Tool Call: {tool_call['name']}")
    print(f"   Arguments: {tool_call['arguments']}")

print()

출력 예시:

Alright, the user is asking about the weather in Beijing. This is a straightforward request that I can help with using the get_weather tool that's available to me.

Let me think about what I need to do here. The user wants to know the current weather conditions in Beijing, which is the capital city of China. To provide this information, I need to use the get_weather tool that's been provided to me.

Looking at the tool's parameters, I can see it requires:
1. location - which is required and should be a string representing the city name
2. unit - which is optional and can be either "celsius" or "fahrenheit"

For the location parameter, I'll use "Beijing" since that's what the user asked about.

For the unit parameter, the user didn't specify their preference between celsius and fahrenheit. Since Beijing is in China, which primarily uses celsius, and celsius is the more standard unit internationally, I'll default to celsius. If the user wants the temperature in fahrenheit instead, they can ask in a follow-up message and I can provide that information.

So I need to make a tool call to get_weather with the following parameters:
- location: "Beijing"
- unit: "celsius"

This should return the current weather information for Beijing, which I can then share with the user. I'll format my response using the required XML tags for tool calls as specified in my instructions.
 response

🔧 Tool Call: get_weather
   Arguments: {"location": "Beijing", "unit": "celsius"}

5. Benchmark

5.1 Speed Benchmark

테스트 환경:

  • 하드웨어: AMD MI300X GPU(4x)

  • 모델: MiniMax-M2

  • 텐서 병렬화: 4

  • sglang 버전: 0.5.7

모델 배포:

sglang serve \
    --model-path MiniMaxAI/MiniMax-M2 \
    --tp-size 4 \
    --trust-remote-code \
    --mem-fraction-static 0.85

5.1.1 Low Concurrency (Latency-Optimized)

  • 벤치마크 명령:
python3 -m sglang.bench_serving \
  --backend sglang \
  --model MiniMaxAI/MiniMax-M2 \
  --dataset-name random \
  --random-input-len 1000 \
  --random-output-len 1000 \
  --num-prompts 10 \
  --max-concurrency 1 \
  --request-rate inf

  • 테스트 결과:
============ Serving Benchmark Result ============
Backend:                                 sglang
Traffic request rate:                    inf
Max request concurrency:                 1
Successful requests:                     10
Benchmark duration (s):                  138.91
Total input tokens:                      6101
Total input text tokens:                 6101
Total input vision tokens:               0
Total generated tokens:                  4220
Total generated tokens (retokenized):    4220
Request throughput (req/s):              0.07
Input token throughput (tok/s):          43.92
Output token throughput (tok/s):         30.38
Peak output token throughput (tok/s):    46.00
Peak concurrent requests:                2
Total token throughput (tok/s):          74.30
Concurrency:                             1.00
----------------End-to-End Latency----------------
Mean E2E Latency (ms):                   13887.62
Median E2E Latency (ms):                 10377.26
---------------Time to First Token----------------
Mean TTFT (ms):                          4528.94
Median TTFT (ms):                        385.23
P99 TTFT (ms):                           38338.51
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                          22.21
Median TPOT (ms):                        22.24
P99 TPOT (ms):                           22.25
---------------Inter-Token Latency----------------
Mean ITL (ms):                           22.23
Median ITL (ms):                         22.24
P95 ITL (ms):                            22.35
P99 ITL (ms):                            22.41
Max ITL (ms):                            23.64
==================================================

5.1.2 Medium Concurrency (Balanced)

  • 벤치마크 명령:
python3 -m sglang.bench_serving \
  --backend sglang \
  --model MiniMaxAI/MiniMax-M2 \
  --dataset-name random \
  --random-input-len 1000 \
  --random-output-len 1000 \
  --num-prompts 80 \
  --max-concurrency 16 \
  --request-rate inf

  • 테스트 결과:
============ Serving Benchmark Result ============
Backend:                                 sglang
Traffic request rate:                    inf
Max request concurrency:                 16
Successful requests:                     80
Benchmark duration (s):                  81.07
Total input tokens:                      39668
Total input text tokens:                 39668
Total input vision tokens:               0
Total generated tokens:                  40805
Total generated tokens (retokenized):    40803
Request throughput (req/s):              0.99
Input token throughput (tok/s):          489.29
Output token throughput (tok/s):         503.32
Peak output token throughput (tok/s):    704.00
Peak concurrent requests:                19
Total token throughput (tok/s):          992.61
Concurrency:                             13.74
----------------End-to-End Latency----------------
Mean E2E Latency (ms):                   13925.95
Median E2E Latency (ms):                 14348.75
---------------Time to First Token----------------
Mean TTFT (ms):                          532.32
Median TTFT (ms):                        147.69
P99 TTFT (ms):                           1978.48
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                          27.49
Median TPOT (ms):                        26.56
P99 TPOT (ms):                           46.52
---------------Inter-Token Latency----------------
Mean ITL (ms):                           26.31
Median ITL (ms):                         23.47
P95 ITL (ms):                            24.37
P99 ITL (ms):                            125.10
Max ITL (ms):                            1192.51
==================================================

5.1.3 High Concurrency (Throughput-Optimized)

  • 벤치마크 명령:
python3 -m sglang.bench_serving \
  --backend sglang \
  --model MiniMaxAI/MiniMax-M2 \
  --dataset-name random \
  --random-input-len 1000 \
  --random-output-len 1000 \
  --num-prompts 500 \
  --max-concurrency 100 \
  --request-rate inf
  • 테스트 결과:
============ Serving Benchmark Result ============
Backend:                                 sglang
Traffic request rate:                    inf
Max request concurrency:                 100
Successful requests:                     500
Benchmark duration (s):                  153.71
Total input tokens:                      249831
Total input text tokens:                 249831
Total input vision tokens:               0
Total generated tokens:                  252662
Total generated tokens (retokenized):    250982
Request throughput (req/s):              3.25
Input token throughput (tok/s):          1625.33
Output token throughput (tok/s):         1643.75
Peak output token throughput (tok/s):    2597.00
Peak concurrent requests:                107
Total token throughput (tok/s):          3269.09
Concurrency:                             91.14
----------------End-to-End Latency----------------
Mean E2E Latency (ms):                   28017.24
Median E2E Latency (ms):                 26865.28
---------------Time to First Token----------------
Mean TTFT (ms):                          387.41
Median TTFT (ms):                        183.90
P99 TTFT (ms):                           1192.44
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                          55.23
Median TPOT (ms):                        57.84
P99 TPOT (ms):                           70.23
---------------Inter-Token Latency----------------
Mean ITL (ms):                           54.79
Median ITL (ms):                         39.01
P95 ITL (ms):                            143.10
P99 ITL (ms):                            150.46
Max ITL (ms):                            986.14
==================================================

5.2 Accuracy Benchmark

5.2.1 GSM8K Benchmark

  • 서버 명령:
sglang serve \
    --model-path MiniMaxAI/MiniMax-M2 \
    --tp-size 4 \
    --trust-remote-code \
    --mem-fraction-static 0.85
  • 벤치마크 명령:
  python3 -m sglang.test.few_shot_gsm8k --num-questions 200
  • 결과:
    • MiniMax-M2
 Accuracy: 0.950
 Invalid: 0.000
 Latency: 15.120 s
 Output throughput: 1306.711 token/s