GLM-4.7

GLM-4.7

GLM-4.7은 Zhipu AI가 개발한 강력한 언어 모델로, 추론·함수 호출·에이전트 워크플로에서 뛰어난 능력을 갖추고 있어요. 확장된 컨텍스트 윈도우, 개선된 chain-of-thought 처리, 크게 향상된 코드 생성·이해 능력, 더 견고한 함수 호출·에이전트 기능을 제공해요. NVIDIA Blackwell(B200, GB200)과 AMD MI300X/MI325X/MI355X GPU에 맞춰 튜닝되었고, BF16·FP8·NVFP4 양자화 변형을 지원해요.

이 문서는 SGLang으로 GLM-4.7을 배포하는 방법과 추론 파서, 함수 호출, thinking budget 같은 고급 기능 사용법을 설명해요.

원문 페이지에는 하드웨어 플랫폼, 양자화 방법, 텐서 병렬 크기, 배포 전략 등을 골라 실행할 배포 명령어를 자동으로 만들어 주는 대화형 선택기가 포함되어 있어요. 위키에서는 렌더링되지 않으니, 아래 섹션의 명령어를 직접 참고하면 돼요.

출처: 문서

본문

1. 모델 소개

GLM-4.7은 Zhipu AI가 개발한 강력한 언어 모델로, 추론·함수 호출·에이전트 워크플로에서 뛰어난 능력을 갖추고 있어요.

GLM-4.7은 주요 전 분야에서 개선을 가져왔어요:

  • 확장된 컨텍스트 윈도우: 더 긴 문서와 복잡한 다중 턴 대화를 지원하도록 확장된 컨텍스트 윈도우
  • 강화된 추론: 더 나은 chain-of-thought 처리를 갖춘 개선된 추론 능력
  • 뛰어난 코딩: 크게 개선된 코드 생성·이해 능력과 더 나은 실제 애플리케이션 성능
  • 고급 도구 사용: 복잡한 워크플로를 위한 더 견고한 함수 호출·에이전트 능력
  • 최적화된 성능: 모든 하드웨어 플랫폼에서 더 나은 처리량·지연 시간 특성

자세한 내용은 공식 GLM-4.7 문서를 참고하세요.

주요 특징:

  • 최고 수준의 추론: 가장 복잡한 문제 해결 작업을 위한 강화된 추론 능력
  • 여러 양자화 형식: 서로 다른 성능/메모리 트레이드오프를 위한 BF16, FP8, NVFP4 변형 제공
  • 하드웨어 최적화: NVIDIA Blackwell (B200, GB200) 및 AMD MI300X/MI325X/MI355X GPU에 튜닝됨
  • 고성능: 처리량과 지연 시간 시나리오 모두에 최적화

제공 모델:

라이선스:

라이선스 세부사항은 공식 GLM-4.7 모델 카드를 참고하세요.

2. SGLang 설치

SGLang은 여러 설치 방법을 제공해요. 하드웨어 플랫폼과 요구사항에 맞는 설치 방법을 선택하면 돼요.

설치 안내는 공식 SGLang 설치 가이드를 참고하세요.

하드웨어 플랫폼별 Docker 이미지:

하드웨어 플랫폼 Docker 이미지
NVIDIA H100 / H200 / B200 lmsysorg/sglang:v0.5.12
NVIDIA GB200 / B300 / GB300 (aarch64) lmsysorg/sglang:v0.5.12-cu130
AMD MI300X / MI325X lmsysorg/sglang:v0.5.12-rocm720-mi30x
AMD MI355X lmsysorg/sglang:v0.5.12-rocm720-mi35x

3. 모델 배포

이 섹션에서는 하드웨어 플랫폼과 사용 사례에 맞게 최적화된 배포 구성을 제공해요.

3.1 기본 구성

대화형 명령 생성기: 아래 구성 선택기를 사용하면 하드웨어 플랫폼·양자화 방법·배포 전략·추론(Thinking) 기능에 맞는 배포 명령을 자동으로 생성할 수 있어요.

3.2 구성 팁

하드웨어에 맞는 가중치 형식을 선택하세요: NVIDIA Blackwell(B200, GB200)에서는 NVFP4, H100/H200/AMD에서는 FP8, 풀 프리시전 폴백으로는 BF16. 플랫폼별 권장 텐서 병렬 크기:

하드웨어 NVFP4 FP8 BF16
B200 (8×, 단일 노드) tp=2 / 4 / 8 tp=4 / 8 tp=8
GB200 (NVL72, 트레이당 4×) tp=2 / 4 tp=4
H200 (8×) tp=8 tp=8
AMD MI300X / MI325X / MI355X tp=2 / 4 / 8 tp=4 / 8
  • EAGLE 추측 디코딩: GLM-4.7을 지원해요. --speculative-algorithm EAGLE --speculative-num-steps 3 --speculative-eagle-topk 1 --speculative-num-draft-tokens 4 플래그를 추가하세요. spec-v2 중첩 스케줄러는 기본적으로 활성화되어 있으며, 비활성화하려면 --disable-overlap-schedule을 전달하세요.
  • Thinking Budget: --enable-custom-logit-processor 플래그를 사용하고 요청에서 Glm4MoeThinkingBudgetLogitProcessor를 전달해 모델의 thinking 토큰 수를 제한할 수 있어요 (4.2.3절 참고).

일반적인 GLM-4.x 계열 시작 안내(AMD ROCm 주의사항 등)는 Launch GLM-4.5 / GLM-4.6 / GLM-4.7 with SGLang을 참고하세요. 하드웨어별 벤치마크 명령과 플래그는 아래 §5.1에 인라인으로 정리되어 있어요.

4. 모델 호출

4.1 기본 사용법

기본 API 사용법과 요청 예시는 아래를 참고하세요:

4.2 고급 사용법

4.2.1 추론(Reasoning) 파서

GLM-4.7은 기본적으로 Thinking 모드를 지원해요. 배포 시 추론 파서를 활성화하면 thinking 영역과 content 영역을 분리할 수 있어요:

python -m sglang.launch_server \
  --model zai-org/GLM-4.7 \
  --reasoning-parser glm45 \
  --tp 8 \
  --host 0.0.0.0 \
  --port 8000

Thinking 과정과 함께 스트리밍하기:

from openai import OpenAI

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

# Enable streaming to see the thinking process in real-time
response = client.chat.completions.create(
    model="zai-org/GLM-4.7",
    messages=[
        {"role": "user", "content": "Solve this problem step by step: What is 15% of 240?"}
    ],
    temperature=0.7,
    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()

출력 예시:

=============== Thinking =================
To solve this problem, I need to calculate 15% of 240.
Step 1: Convert 15% to decimal: 15% = 0.15
Step 2: Multiply 240 by 0.15
Step 3: 240 × 0.15 = 36
=============== Content =================

The answer is 36. To find 15% of 240, we multiply 240 by 0.15, which equals 36.

참고: 추론 파서는 모델의 단계별 사고 과정을 캡처해서, 모델이 결론에 도달하는 방식을 볼 수 있게 해줘요.

4.2.2 함수 호출(Tool Calling)

**모델별 파서 이름:** GLM-4.5와 GLM-4.6은 `--tool-call-parser glm45`을 사용해요. GLM-4.7과 GLM-4.7-Flash는 `--tool-call-parser glm47`을 사용해요. 모든 GLM 모델은 세대와 무관하게 `--reasoning-parser glm45`를 사용해요.

GLM-4.7은 함수 호출 기능을 지원해요. 함수 호출 파서를 활성화하세요:

python -m sglang.launch_server \
  --model zai-org/GLM-4.7 \
  --reasoning-parser glm45 \
  --tool-call-parser glm47 \
  --tp 8 \
  --host 0.0.0.0 \
  --port 8000

Python 예시 (Thinking 과정 포함):

from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:8000/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="zai-org/GLM-4.7",
    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

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 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 =================", flush=True)
                thinking_started = False

            for tool_call in delta.tool_calls:
                if tool_call.function:
                    print(f"Tool Call: {tool_call.function.name}")
                    print(f"   Arguments: {tool_call.function.arguments}")

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

print()

출력 예시:

=============== Thinking =================
The user is asking about the weather in Beijing. I need to use the get_weather function to retrieve this information.
I should call the function with location="Beijing".
=============== Content =================

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

참고:

  • 추론 파서는 모델이 어떻게 도구를 사용할지 결정하는지를 보여줘요
  • 함수 호출은 함수 이름과 인자로 명확하게 표시돼요
  • 이후 함수를 실행하고 결과를 다시 보내 대화를 이어갈 수 있어요

함수 호출 결과 처리하기:

# After getting the tool call, execute the function
def get_weather(location, unit="celsius"):
    # Your actual weather API call here
    return f"The weather in {location} is 22°{unit[0].upper()} and sunny."

# Send tool result back to the model
messages = [
    {"role": "user", "content": "What's the weather in Beijing?"},
    {
        "role": "assistant",
        "content": None,
        "tool_calls": [{
            "id": "call_123",
            "type": "function",
            "function": {
                "name": "get_weather",
                "arguments": '{"location": "Beijing", "unit": "celsius"}'
            }
        }]
    },
    {
        "role": "tool",
        "tool_call_id": "call_123",
        "content": get_weather("Beijing", "celsius")
    }
]

final_response = client.chat.completions.create(
    model="zai-org/GLM-4.7",
    messages=messages,
    temperature=0.7
)

print(final_response.choices[0].message.content)
# Output: "The weather in Beijing is currently 22°C and sunny."

4.2.3 Thinking Budget

CustomLogitProcessor를 사용해 thinking 토큰 수를 제한할 수 있어요. --enable-custom-logit-processor로 시작하세요:

import openai
from sglang.srt.sampling.custom_logit_processor import Glm4MoeThinkingBudgetLogitProcessor

client = openai.Client(base_url="http://127.0.0.1:30000/v1", api_key="*")
response = client.chat.completions.create(
    model="zai-org/GLM-4.7",
    messages=[{"role": "user", "content": "Is Paris the Capital of France?"}],
    max_tokens=1024,
    extra_body={
        "custom_logit_processor": Glm4MoeThinkingBudgetLogitProcessor().to_str(),
        "custom_params": {"thinking_budget": 512},
    },
)
print(response)

5. 벤치마크

이 섹션은 비교 가능한 벤치마크 결과를 위해 업계 표준 구성을 사용해요.

5.1 속도 벤치마크

테스트 환경:

  • 하드웨어: NVIDIA B200, NVIDIA GB200, AMD MI300X/MI325X/MI355X (8x)
  • 모델: NVIDIA Blackwell에서는 GLM-4.7-NVFP4, AMD에서는 GLM-4.7-FP8 또는 GLM-4.7 (BF16)
  • SGLang 버전: 0.5.12 (NVIDIA Blackwell), 0.5.6.post1 (AMD)
  • B200에서 GPU당 최고 처리량 구성: TP=2 NVFP4 bf16-KV (NVFP4 가중치, EP 없음). 아래 수치는 이 구성에서 나온 값이에요.

벤치마크 방법론:

프레임워크와 하드웨어 플랫폼 간 결과를 비교할 수 있도록 업계 표준 벤치마크 구성을 사용해요.

5.1.1 표준 테스트 시나리오

네 가지 핵심 시나리오는 실제 사용 패턴을 반영해요:

시나리오 입력 길이 출력 길이 사용 사례
Chat 1K 1K 가장 흔한 대화형 AI 워크로드
Reasoning 1K 8K 장문 생성, 복잡한 추론 작업
Summarization 8K 1K 문서 요약, RAG 검색
Throughput 4K 1K 혼합 RAG / 에이전트 / 다중 턴 대화 (아래 인라인 B200 / GB200 결과에 사용)

5.1.2 동시성 수준

처리량과 지연 시간의 트레이드오프(Pareto frontier)를 파악하기 위해 각 시나리오를 세 가지 동시성 수준에서 테스트해요:

  • 낮은 동시성: --max-concurrency 1 (지연 시간 최적화)
  • 중간 동시성: --max-concurrency 16 (균형)
  • 높은 동시성: --max-concurrency 100 (처리량 최적화) — Throughput (4K/1K) 시나리오는 아래 인라인 B200/GB200 결과와 맞추기 위해 --max-concurrency 128을 사용해요.

5.1.3 프롬프트 수

각 동시성 수준에서 num_prompts를 설정해 실제 사용자 부하를 시뮬레이션해요:

  • 빠른 테스트: num_prompts = concurrency × 1 (최소 테스트)
  • 권장: num_prompts = concurrency × 5 (표준 벤치마크)
  • 안정적 측정: num_prompts = concurrency × 10 (프로덕션급)

5.1.4 벤치마크 명령

시나리오 1: Chat (1K/1K) - 가장 중요

  • 모델 배포
python -m sglang.launch_server \
  --model zai-org/GLM-4.7 \
  --tp 8
  • 낮은 동시성 (지연 시간 최적화)
python -m sglang.bench_serving \
  --backend sglang \
  --model zai-org/GLM-4.7 \
  --dataset-name random \
  --random-input-len 1000 \
  --random-output-len 1000 \
  --num-prompts 10 \
  --max-concurrency 1 \
  --request-rate inf
  • 중간 동시성 (균형)
python -m sglang.bench_serving \
  --backend sglang \
  --model zai-org/GLM-4.7 \
  --dataset-name random \
  --random-input-len 1000 \
  --random-output-len 1000 \
  --num-prompts 80 \
  --max-concurrency 16 \
  --request-rate inf
  • 높은 동시성 (처리량 최적화)
python -m sglang.bench_serving \
  --backend sglang \
  --model zai-org/GLM-4.7 \
  --dataset-name random \
  --random-input-len 1000 \
  --random-output-len 1000 \
  --num-prompts 500 \
  --max-concurrency 100 \
  --request-rate inf

시나리오 2: Reasoning (1K/8K)

  • 낮은 동시성
python -m sglang.bench_serving \
  --backend sglang \
  --model zai-org/GLM-4.7 \
  --dataset-name random \
  --random-input-len 1000 \
  --random-output-len 8000 \
  --num-prompts 10 \
  --max-concurrency 1 \
  --request-rate inf
  • 중간 동시성
python -m sglang.bench_serving \
  --backend sglang \
  --model zai-org/GLM-4.7 \
  --dataset-name random \
  --random-input-len 1000 \
  --random-output-len 8000 \
  --num-prompts 80 \
  --max-concurrency 16 \
  --request-rate inf
  • 높은 동시성
python -m sglang.bench_serving \
  --backend sglang \
  --model zai-org/GLM-4.7 \
  --dataset-name random \
  --random-input-len 1000 \
  --random-output-len 8000 \
  --num-prompts 320 \
  --max-concurrency 64 \
  --request-rate inf

시나리오 3: Summarization (8K/1K)

  • 낮은 동시성
python -m sglang.bench_serving \
  --backend sglang \
  --model zai-org/GLM-4.7 \
  --dataset-name random \
  --random-input-len 8000 \
  --random-output-len 1000 \
  --num-prompts 10 \
  --max-concurrency 1 \
  --request-rate inf
  • 중간 동시성
python -m sglang.bench_serving \
  --backend sglang \
  --model zai-org/GLM-4.7 \
  --dataset-name random \
  --random-input-len 8000 \
  --random-output-len 1000 \
  --num-prompts 80 \
  --max-concurrency 16 \
  --request-rate inf
  • 높은 동시성
python -m sglang.bench_serving \
  --backend sglang \
  --model zai-org/GLM-4.7 \
  --dataset-name random \
  --random-input-len 8000 \
  --random-output-len 1000 \
  --num-prompts 320 \
  --max-concurrency 64 \
  --request-rate inf

시나리오 4: Throughput (4K/1K) — NVIDIA Blackwell with NVFP4

아래 하위 섹션(§5.1.4.1 NVIDIA B200, §5.1.4.2 NVIDIA GB200)은 nvidia/GLM-4.7-NVFP4 가중치로 이 시나리오를 측정하고 bench_serving의 전체 출력을 그대로 보고해요. 다른 NVIDIA 하드웨어에는 §3.1의 배포 라인을 바꿔 넣으면 같은 명령을 적용할 수 있어요.

참고: 이 실행들은 EOS 활성화 생성(--disable-ignore-eos 없음)을 사용하므로, 생성 토큰 수치가 엄격한 고정 OSL 핀보다는 자연스러운 모델 동작을 반영해요. 같은 워크로드에서 EOS 활성화 실행과 비교해야 하며, 고정 출력 길이 벤치마크와는 비교하지 마세요.

5.1.4.1 NVIDIA B200

모델 배포 (NVIDIA B200, TP=2 NVFP4 — GPU당 최대 tok/s 구성):

python -m sglang.launch_server \
  --model nvidia/GLM-4.7-NVFP4 \
  --tp-size 2 \
  --mem-fraction-static 0.85 \
  --reasoning-parser glm45 \
  --tool-call-parser glm47
  • 낮은 동시성 (지연 시간 최적화)
python -m sglang.bench_serving \
  --backend sglang \
  --model nvidia/GLM-4.7-NVFP4 \
  --dataset-name random \
  --random-input-len 4096 \
  --random-output-len 1024 \
  --num-prompts 5 \
  --max-concurrency 1 \
  --request-rate inf
============ Serving Benchmark Result ============
Backend:                                 sglang
Max request concurrency:                 1
Successful requests:                     5
Benchmark duration (s):                  25.07
Total input tokens:                      8105
Total generated tokens:                  2674
Request throughput (req/s):              0.20
Input token throughput (tok/s):          323.25
Output token throughput (tok/s):         106.65
Total token throughput (tok/s):          429.90
Concurrency:                             1.00
----------------End-to-End Latency----------------
Mean E2E Latency (ms):                   5011.93
Median E2E Latency (ms):                 6441.44
---------------Time to First Token----------------
Mean TTFT (ms):                          179.61
Median TTFT (ms):                        169.05
P99 TTFT (ms):                           238.01
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                          9.05
Median TPOT (ms):                        9.03
P99 TPOT (ms):                           9.16
---------------Inter-Token Latency----------------
Mean ITL (ms):                           9.05
Median ITL (ms):                         9.05
==================================================
  • 중간 동시성 (균형)
python -m sglang.bench_serving \
  --backend sglang \
  --model nvidia/GLM-4.7-NVFP4 \
  --dataset-name random \
  --random-input-len 4096 \
  --random-output-len 1024 \
  --num-prompts 80 \
  --max-concurrency 16 \
  --request-rate inf
============ Serving Benchmark Result ============
Backend:                                 sglang
Max request concurrency:                 16
Successful requests:                     80
Benchmark duration (s):                  60.60
Total input tokens:                      179772
Total generated tokens:                  39657
Request throughput (req/s):              1.32
Input token throughput (tok/s):          2966.39
Output token throughput (tok/s):         654.37
Total token throughput (tok/s):          3620.76
Concurrency:                             14.01
----------------End-to-End Latency----------------
Mean E2E Latency (ms):                   10615.87
Median E2E Latency (ms):                 9985.45
---------------Time to First Token----------------
Mean TTFT (ms):                          267.39
Median TTFT (ms):                        177.26
P99 TTFT (ms):                           584.29
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                          20.98
Median TPOT (ms):                        21.06
P99 TPOT (ms):                           24.88
---------------Inter-Token Latency----------------
Mean ITL (ms):                           20.92
Median ITL (ms):                         17.93
==================================================
  • 높은 동시성 (처리량 최적화)
python -m sglang.bench_serving \
  --backend sglang \
  --model nvidia/GLM-4.7-NVFP4 \
  --dataset-name random \
  --random-input-len 4096 \
  --random-output-len 1024 \
  --num-prompts 640 \
  --max-concurrency 128 \
  --request-rate inf
============ Serving Benchmark Result ============
Backend:                                 sglang
Max request concurrency:                 128
Successful requests:                     640
Benchmark duration (s):                  172.95
Total input tokens:                      1453591
Total generated tokens:                  308740
Request throughput (req/s):              3.70
Input token throughput (tok/s):          8404.67
Output token throughput (tok/s):         1785.14
Total token throughput (tok/s):          10189.80
Concurrency:                             117.85
----------------End-to-End Latency----------------
Mean E2E Latency (ms):                   31848.20
Median E2E Latency (ms):                 28554.42
---------------Time to First Token----------------
Mean TTFT (ms):                          1598.40
Median TTFT (ms):                        298.88
P99 TTFT (ms):                           11015.96
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                          65.94
Median TPOT (ms):                        65.81
P99 TPOT (ms):                           137.73
---------------Inter-Token Latency----------------
Mean ITL (ms):                           62.99
Median ITL (ms):                         35.44
==================================================

5.1.4.2 NVIDIA GB200

모델 배포 (NVIDIA GB200, TP=2 NVFP4 — GPU당 최대 tok/s 구성):

python -m sglang.launch_server \
  --model nvidia/GLM-4.7-NVFP4 \
  --tp-size 2 \
  --mem-fraction-static 0.85 \
  --reasoning-parser glm45 \
  --tool-call-parser glm47
  • 낮은 동시성 (지연 시간 최적화)
python -m sglang.bench_serving \
  --backend sglang \
  --model nvidia/GLM-4.7-NVFP4 \
  --dataset-name random \
  --random-input-len 4096 \
  --random-output-len 1024 \
  --num-prompts 5 \
  --max-concurrency 1 \
  --request-rate inf
============ Serving Benchmark Result ============
Backend:                                 sglang
Max request concurrency:                 1
Successful requests:                     5
Benchmark duration (s):                  24.74
Total input tokens:                      8105
Total generated tokens:                  2674
Request throughput (req/s):              0.20
Input token throughput (tok/s):          327.65
Output token throughput (tok/s):         108.10
Total token throughput (tok/s):          435.75
Concurrency:                             1.00
----------------End-to-End Latency----------------
Mean E2E Latency (ms):                   4944.47
Median E2E Latency (ms):                 6347.31
---------------Time to First Token----------------
Mean TTFT (ms):                          211.41
Median TTFT (ms):                        207.25
P99 TTFT (ms):                           226.46
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                          8.86
Median TPOT (ms):                        8.84
P99 TPOT (ms):                           8.96
---------------Inter-Token Latency----------------
Mean ITL (ms):                           8.87
Median ITL (ms):                         8.85
==================================================
  • 중간 동시성 (균형)
python -m sglang.bench_serving \
  --backend sglang \
  --model nvidia/GLM-4.7-NVFP4 \
  --dataset-name random \
  --random-input-len 4096 \
  --random-output-len 1024 \
  --num-prompts 80 \
  --max-concurrency 16 \
  --request-rate inf
============ Serving Benchmark Result ============
Backend:                                 sglang
Max request concurrency:                 16
Successful requests:                     80
Benchmark duration (s):                  60.40
Total input tokens:                      179772
Total generated tokens:                  39657
Request throughput (req/s):              1.32
Input token throughput (tok/s):          2976.52
Output token throughput (tok/s):         656.61
Total token throughput (tok/s):          3633.13
Concurrency:                             13.97
----------------End-to-End Latency----------------
Mean E2E Latency (ms):                   10611.51
Median E2E Latency (ms):                 9956.84
---------------Time to First Token----------------
Mean TTFT (ms):                          338.14
Median TTFT (ms):                        215.25
P99 TTFT (ms):                           915.40
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                          20.87
Median TPOT (ms):                        21.36
P99 TPOT (ms):                           27.05
---------------Inter-Token Latency----------------
Mean ITL (ms):                           20.77
Median ITL (ms):                         16.53
==================================================
  • 높은 동시성 (처리량 최적화)
python -m sglang.bench_serving \
  --backend sglang \
  --model nvidia/GLM-4.7-NVFP4 \
  --dataset-name random \
  --random-input-len 4096 \
  --random-output-len 1024 \
  --num-prompts 640 \
  --max-concurrency 128 \
  --request-rate inf
============ Serving Benchmark Result ============
Backend:                                 sglang
Max request concurrency:                 128
Successful requests:                     640
Benchmark duration (s):                  181.89
Total input tokens:                      1453591
Total generated tokens:                  309221
Request throughput (req/s):              3.52
Input token throughput (tok/s):          7991.59
Output token throughput (tok/s):         1700.04
Total token throughput (tok/s):          9691.63
Concurrency:                             118.86
----------------End-to-End Latency----------------
Mean E2E Latency (ms):                   33690.47
Median E2E Latency (ms):                 30421.55
---------------Time to First Token----------------
Mean TTFT (ms):                          1353.16
Median TTFT (ms):                        383.52
P99 TTFT (ms):                           8940.53
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                          69.88
Median TPOT (ms):                        71.77
P99 TPOT (ms):                           131.75
---------------Inter-Token Latency----------------
Mean ITL (ms):                           67.23
Median ITL (ms):                         33.46
==================================================

5.1.5 결과 이해하기

핵심 지표:

  • 요청 처리량 (req/s): 초당 처리하는 요청 수
  • 출력 토큰 처리량 (tok/s): 초당 생성하는 총 토큰 수
  • 평균 TTFT (ms): 첫 토큰까지의 시간 (Time to First Token) - 응답성을 측정해요
  • 평균 TPOT (ms): 출력 토큰당 시간 (Time Per Output Token) - 생성 속도를 측정해요
  • 평균 ITL (ms): 토큰 간 지연 시간 (Inter-Token Latency) - 스트리밍 일관성을 측정해요

이 구성이 중요한 이유:

  • 1K/1K (Chat): 가장 흔한 대화형 AI 워크로드를 나타내요. 대부분의 배포에서 최우선 시나리오예요.
  • 1K/8K (Reasoning): 복잡한 추론·코드 생성·상세한 설명에 중요한 장문 생성 능력을 테스트해요.
  • 8K/1K (Summarization): 대용량 컨텍스트 입력에서의 성능을 평가하며, RAG 시스템·문서 Q&A·요약 작업에 필수적이에요.
  • 4K/1K (Throughput): 프로덕션 배포에서 전형적인 현실적인 혼합 워크로드(RAG 컨텍스트 + 중간 길이 응답)를 나타내요. prefill이 중요할 만큼 입력이 길면서 decode 정상 상태가 지배할 만큼 출력도 길어요. 위의 인라인 B200 / GB200 결과에 사용됐어요.
  • 가변 동시성: 다양한 부하 수준에서 처리량과 지연 시간의 최적 트레이드오프인 Pareto frontier를 포착해요. 낮은 동시성은 최상의 지연 시간을, 높은 동시성은 최대 처리량을 보여줘요.

결과 해석하기:

  • 자신의 하드웨어 기준선 수치와 결과를 비교해 보세요
  • 동일 지연 시간에서 더 높은 처리량 = 더 나은 성능
  • 더 낮은 TTFT = 더 반응성 좋은 사용자 경험
  • 더 낮은 TPOT = 더 빠른 생성 속도

5.2 정확도 벤치마크

표준 벤치마크에서 모델 정확도를 기록해요:

5.2.1 GSM8K 벤치마크

  • 벤치마크 명령
python -m sglang.test.few_shot_gsm8k \
  --num-shots 5 \
  --num-questions 1319 \
  --port 30000
  • 테스트 결과 (NVIDIA B200, TP=2 NVFP4)
Accuracy: 0.946
Latency: 178.284 s
Output throughput: 769.204 token/s
  • 테스트 결과 (NVIDIA GB200, TP=2 NVFP4)
Accuracy: 0.951
Latency: 175.190 s
Invalid: 0.000

더 알아보기 (Learn more)