DeepSeek V3.2
DeepSeek V3.2
이 문서는 각각 다른 사용 사례에 최적화된 세 가지 변형 모델을 포함하는 DeepSeek-V3.2 시리즈를 SGLang으로 배포하고 호출하는 방법을 설명해요. DeepSeek V3.2 시리즈는 DSA(DeepSeek Sparse Attention) 메커니즘을 도입해 장문 맥락 시나리오에서 효율을 크게 개선했어요. 원문 페이지에는 하드웨어 플랫폼과 배포 전략을 골라 명령을 자동 생성해 주는 대화형 선택기가 포함되어 있어요.
출처: 문서
본문
1. 모델 소개
DeepSeek-V3.2 시리즈는 각각 다른 사용 사례에 최적화된 세 가지 모델 변형을 포함해요:
**DeepSeek-V3.2-Exp**는 DeepSeek-V3.1-Terminus의 업그레이드 버전으로, 지속 훈련을 통해 DeepSeek Sparse Attention(DSA) 메커니즘을 도입했어요. DSA는 lightning indexer가 구동하는 세분화된 희소 어텐션 메커니즘으로, DeepSeek-V3.2-Exp가 장문 맥락 시나리오에서 상당한 효율 개선을 달성할 수 있게 해요. 일반 대화, 장문 맥락 처리, 효율적 추론에 권장돼요.
**DeepSeek-V3.2**는 일반 작업과 대화 시나리오에 적합한 표준 버전이에요. 로컬 배포의 경우 temperature = 1.0, top_p = 0.95 샘플링 파라미터를 설정하는 것을 권장해요. 표준 대화와 일반 작업에 권장돼요.
**DeepSeek-V3.2-Speciale**는 심층 추론 작업 전용으로 설계된 특수 변형이에요. 이 모델은 복잡한 논리 추론과 심층 사고가 필요한 시나리오에 특별히 최적화되어 있어요. 다만 이 모델은 도구 호출을 지원하지 않아요(아래 참고). 로컬 배포의 경우 temperature = 1.0, top_p = 0.95 샘플링 파라미터를 설정하는 것을 권장해요. 심층 추론 작업, 복잡한 논리 문제, 수학적 추론에 권장돼요.
**DeepSeek-V3.2-NVFP4**는 Blackwell 기기용으로 NVIDIA가 최적화한 DeepSeek-V3.2의 NVFP4 양자화 변형이에요. ModelOpt FP4 양자화와 MoE 러너 백엔드 선택(flashinfer_trtllm (권장), flashinfer_cutlass, 또는 flashinfer_cutedsl)을 사용하며, 더 낮은 텐서 병렬화(TP=4)로 효율적인 배포를 가능하게 해요. DeepSeek-V3.2와 동일한 도구 호출, 추론, 추측 디코딩(MTP) 기능을 지원해요.
**DeepSeek-V3.2-MXFP4**는 AMD MI300X/MI355X 기기용 DeepSeek-V3.2의 OCP-MXFP4 최적화 변형이에요. OCP MXFP4 양자화와 triton mxfp4 백엔드(gptoss-120B와 동일한 백엔드)를 사용하며, 단일 노드에서 더 낮은 텐서 병렬화(TP=8)로 효율적인 배포를 가능하게 해요. DeepSeek-V3.2와 동일한 도구 호출, 추론, fp8-kv, CP, TP 및 추측 디코딩 MTP 기능을 포함해요.
2. SGLang 설치
SGLang은 여러 설치 방법을 제공해요. 하드웨어 플랫폼과 요구 사항에 가장 적합한 설치 방법을 선택할 수 있어요.
설치 지침은 공식 SGLang 설치 가이드를 참고하세요.
2.1 Docker 이미지
서로 다른 하드웨어 플랫폼용 사전 빌드 Docker 이미지를 사용할 수 있어요:
# NVIDIA H200 / B200
docker pull lmsysorg/sglang:latest
# AMD MI350 / MI355X
docker pull lmsysorg/sglang:v0.5.8-rocm700-mi35x
# AMD MI300X
# Note: v0.5.8-rocm700-mi30x does not include PR #17504.
# Prefer the newest MI30x ROCm image tag from Docker Hub when available, or build from source.
docker pull lmsysorg/sglang:v0.5.8-rocm700-mi30x
# Ascend NPU (A2/A3 Series)
docker pull lmsysorg/sglang:dsv32-a2
docker pull lmsysorg/sglang:dsv32-a3
3. 모델 배포
이 섹션은 빠른 배포에서 성능 최적화까지 이어지는 점진적인 가이드를 제공하며, 다양한 수준의 사용자에게 적합해요.
3.1 기본 설정
대화형 명령 생성기 (Interactive Command Generator): 아래 설정 선택기를 사용해 하드웨어 플랫폼, 모델 변형, 배포 전략, 사고 능력에 맞는 배포 명령을 자동으로 생성할 수 있어요. SGLang은 NVIDIA H200, B200과 AMD MI300X/MI355X GPU에서 DeepSeek V3.2 서빙을 지원해요. (대화형 위젯은 원문 페이지에서 동작하므로, 기본 설정 기준 명령은 다음과 같아요.)
sglang serve \
--model-path deepseek-ai/DeepSeek-V3.2-Exp \
--tp 8
경고 여기 있는 모든 레시피는 기본
--dsa-topk-backend sgl-kernel로 DSA indexer top-k를 실행해요. 다른 top-k 백엔드 선택은 DeepSeek-V3.2에서 완전히 검증되지 않았어요.
3.2 설정 팁
- 짧은 시퀀스 MHA prefill (적응형): 2048 토큰(기본 임계값)보다 짧은 prefill 시퀀스의 경우 DSA 백엔드가 자동으로 표준 MHA로 전환해요(SM90에서 FlashAttention variable-length, SM100에서 TRT-LLM ragged MHA 사용). 더 긴 시퀀스로 확장하려면 환경 변수
SGLANG_DSA_PREFILL_DENSE_ATTN_KV_LEN_THRESHOLD를 더 큰 값으로 설정하세요(약간의 정확도 트레이드오프 가능). - DSA prefill/decode 어텐션 커널 (
--dsa-prefill-backend,--dsa-decode-backend): DeepSeek-V3.2에는dsa백엔드가 자동으로 선택돼요. 사용 가능한 커널:flashmla_sparse,flashmla_sparse_q8(네이티브 FP8 e4m3 희소 prefill — fp8→bf16 역양자화 왕복 없음; Hopper SM90 +--kv-cache-dtype fp8_e4m3전용, prefill 전용),flashmla_kv,flashmla_auto,fa3(Hopper 전용),tilelang(GPU/HPU/NPU),aiter(AMD, decode 전용),trtllm(Blackwell 전용). 기본값: Hopper BF16 KV →flashmla_sparseprefill /fa3decode; Hopper FP8 KV →flashmla_kv양쪽; Blackwell BF16 →flashmla_sparse/trtllm; Blackwell FP8 →trtllm양쪽. - 인덱스 캐시 (Index Cache): 무시할 만한 정확도 비용으로 계층 간 indexer 결과를 재사용해 효율을 높여요. 특히 GLM-5의 경우 더 나은 속도/정확도 트레이드오프를 위해
--json-model-override-args '{"index_topk_pattern": "FFSFSSSFSSFFFSSSFFFSFSSSSSSFFSFFSFFSSFFFFFFSFFFFFSFFSSSSSSFSFFFSFSSSFSFFSFFSSS"}'를 추가하세요. - HiSparse (실험적): KV 데이터를 CPU 고정 메모리로 오프로드해 장문 맥락 decode 중 요청별 GPU 메모리를 줄여요. PD disaggregation 모드(decode 인스턴스 전용)가 필요해요. HiSparse Guide를 참고하세요.
- Blackwell의 NVFP4:
--quantization modelopt_fp4과--moe-runner-backend flashinfer_trtllm(권장) /flashinfer_cutlass/flashinfer_cutedsl를 지정하세요. 전체 예시:python -m sglang.launch_server --model nvidia/DeepSeek-V3.2-NVFP4 --tp 4 \ --quantization modelopt_fp4 --moe-runner-backend flashinfer_trtllm \ --tool-call-parser deepseekv32 --reasoning-parser deepseek-v3 - NCCL 타임아웃: 모델 로딩이 느리면 →
--dist-timeout 3600추가.
4. 모델 호출
4.1 기본 사용법
기본 API 사용법과 요청 예시는 다음을 참고하세요:
4.2 고급 사용법
4.2.1 추론 파서 (Reasoning Parser)
DeepSeek-V3.2는 추론 모드를 지원해요. 배포 중 reasoning parser를 활성화해 thinking 섹션과 content 섹션을 분리하세요:
sglang serve \
--model-path deepseek-ai/DeepSeek-V3.2-Exp \
--reasoning-parser deepseek-v3 \
--tp 8 \
--host 0.0.0.0 \
--port 30000
사고 과정이 포함된 스트리밍:
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="deepseek-ai/DeepSeek-V3.2-Exp",
messages=[
{"role": "user", "content": "Solve this problem step by step: What is 15% of 240?"}
],
temperature=0.7,
max_tokens=2048,
extra_body = {"chat_template_kwargs": {"thinking": True}},
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.
참고: reasoning parser는 모델의 단계별 사고 과정을 캡처해 모델이 결론에 도달하는 방식을 볼 수 있게 해줘요.
4.2.2 도구 호출 (Tool Calling)
DeepSeek-V3.2와 DeepSeek-V3.2-Exp는 도구 호출 기능을 지원해요. 다만 서로 다른 파라미터를 사용해요. tool call parser를 활성화하세요:
참고: DeepSeek-V3.2-Speciale은 도구 호출을 지원하지 않아요. reasoning parser만으로 실행하세요:
python3 -m sglang.launch_server \
--model-path deepseek-ai/DeepSeek-V3.2-Speciale \
--trust-remote-code \
--tp-size 8 --dp-size 8 --enable-dp-attention \
--reasoning-parser deepseek-v3
배포 명령:
DeepSeek-V3.2-Exp 용:
sglang serve \
--model-path deepseek-ai/DeepSeek-V3.2-Exp \
--tool-call-parser deepseekv31 \
--reasoning-parser deepseek-v3 \
--chat-template ./examples/chat_template/tool_chat_template_deepseekv32.jinja \
--tp 8 \
--host 0.0.0.0 \
--port 30000
DeepSeek-V3.2의 경우 --tool-call-parser deepseekv32을 사용하고 --chat-template을 제거하세요.
Python 예시 (사고 과정 포함):
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="deepseek-ai/DeepSeek-V3.2-Exp",
messages=[
{"role": "user", "content": "What's the weather in Beijing?"}
],
tools=tools,
extra_body = {"chat_template_kwargs": {"thinking": True}},
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()
출력 예시:
=============== 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"}
참고:
- reasoning parser는 모델이 도구를 어떻게 사용하기로 결정하는지 보여줘요
- 도구 호출은 함수 이름과 인자로 명확하게 표시돼요
- 그런 다음 함수를 실행하고 결과를 다시 보내 대화를 이어갈 수 있어요
도구 호출 결과 처리:
# 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="deepseek-ai/DeepSeek-V3.2-Exp",
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 다중 토큰 예측 (Multi-Token Prediction, EAGLE 추측 디코딩)
SGLang은 EAGLE speculative decoding을 기반으로 DeepSeek V3.2의 Multi-Token Prediction(MTP)을 구현해요. 이 최적화는 작은 배치 크기에서 디코딩 속도를 크게 개선해요.
DP Attention 사용:
python -m sglang.launch_server --model deepseek-ai/DeepSeek-V3.2-Exp --tp 8 --dp 8 \
--enable-dp-attention \
--speculative-algorithm EAGLE \
--speculative-num-steps 3 --speculative-eagle-topk 1 --speculative-num-draft-tokens 4
순수 TP 사용:
python -m sglang.launch_server --model deepseek-ai/DeepSeek-V3.2-Exp --tp 8 \
--speculative-algorithm EAGLE \
--speculative-num-steps 3 --speculative-eagle-topk 1 --speculative-num-draft-tokens 4
bench_speculative.py로 워크로드에 최적 값을 찾으세요. 최소 실행 가능 설정은 --speculative-num-steps 1 --speculative-eagle-topk 1 --speculative-num-draft-tokens 2이에요.
--max-running-requests는 MTP에서 기본값 48이에요. 더 큰 배치 크기에서는 늘리세요.
spec-v2 overlap 스케줄러는 기본적으로 활성화돼요. 비활성화하려면
--disable-overlap-schedule을 전달하세요.
4.2.4 PD Disaggregation
Prefill-Decode(PD) disaggregation은 prefill과 decode 단계를 서로 다른 인스턴스로 분리해 혼합 워크로드에서 GPU 사용률을 개선해요.
Prefill 명령:
python -m sglang.launch_server \
--model-path deepseek-ai/DeepSeek-V3.2-Exp \
--disaggregation-mode prefill \
--host $LOCAL_IP \
--port $PORT \
--tp 8 \
--dp 8 \
--enable-dp-attention \
--dist-init-addr ${HOST}:${DIST_PORT} \
--trust-remote-code \
--disaggregation-bootstrap-port 8998 \
--mem-fraction-static 0.9
Decode 명령:
python -m sglang.launch_server \
--model-path deepseek-ai/DeepSeek-V3.2-Exp \
--disaggregation-mode decode \
--host $LOCAL_IP \
--port $PORT \
--tp 8 \
--dp 8 \
--enable-dp-attention \
--dist-init-addr ${HOST}:${DIST_PORT} \
--trust-remote-code \
--mem-fraction-static 0.9
Router 명령:
python -m sglang_router.launch_router --pd-disaggregation \
--prefill $PREFILL_ADDR 8998 \
--decode $DECODE_ADDR \
--host 127.0.0.1 \
--port 30000
프로덕션 배포(RBG / LWS 기반, DeepEP EP 병렬화)의 경우 multi_node_deployment docs를 참고하세요.
4.2.5 DSA 장문 시퀀스 컨텍스트 병렬 및 PP/CP
장문 시퀀스 워크로드의 경우 CUDA에서 --enable-prefill-cp --cp-strategy interleave로 prefill 컨텍스트 병렬화(CP)를 활성화하세요.
경고 Zigzag prefill CP(
--cp-strategy zigzag)는 DeepSeek V3.2, GLM-5, GLM-5.1, GLM-5.2, GLM-5.3에서 일시적으로 사용할 수 없어요. 이 모델에는interleave를 사용하고--dp 1을 유지하세요; interleave DSA CP는--dp가 1보다 큰 것을 지원하지 않아요.
Interleave (--cp-strategy interleave): 토큰을 token_idx % cp_size로 분배해요. fused MoE, FP8 KV cache, 다중 배치 prefill을 지원해요.
# Interleave — FusedMoE + CP8
python -m sglang.launch_server --model deepseek-ai/DeepSeek-V3.2-Exp \
--tp 8 --enable-prefill-cp --attn-cp-size 8 \
--cp-strategy interleave --max-running-requests 32
PP + CP (다중 노드): 크로스 노드 확장을 위해 Pipeline Parallelism과 Context Parallelism을 결합해요. 아래 프로덕션 최적화 설정은 Hopper에서 검증되었어요:
Hopper 플랫폼에서 DeepSeek V3.2의 에이전트 워크플로우 로컬 배포에는 DP2 + MTP를 제안해요:
export SGLANG_DEEPEP_LL_COMBINE_SEND_NUM_SMS=32
export SGLANG_SET_CPU_AFFINITY=1
# Test workload ISL/OSL=1k/1k, raw tap : 4948.16 toks/sec, MAX ITL 5970
# dp 2 : 5019.54 toks/sec, MAX ITL 7233
# dp 4 : 4942.82 toks/sec, MAX ITL 35654
# dp 2 + mtp : 6842.51 toks/sec, MAX ITL 3081
sglang_args=$(echo serve \
--model-path $MAPPED_MODEL_PATH \
--nccl-init $MASTER_ADDR:$MASTER_PORT --nnodes 2 --node-rank $RANK --tp 16 \
--dp 2 --enable-dp-attention --page-size 64 \
--trust-remote-code --host "0.0.0.0" --port 30000 \
--log-requests \
--context-length 65536 --max-running-requests 128 \
--speculative-algorithm EAGLE \
--speculative-num-steps 2 --speculative-eagle-topk 1 --speculative-num-draft-tokens 3 \
--allow-auto-truncate --enable-metrics \
--tool-call-parser deepseekv32 --reasoning-parser deepseek-v3 \
--served-model-name DeepSeek-V3.2-Opt-dp2-mtp
)
sglang_args=($sglang_args)
sglang "${sglang_args[@]}" 2>&1 | tee $LOG_DIR/$RANK.log
CP + PP + EP + DP
CP는 현재 Hopper 플랫폼에서 PP=2와 함께 활성화되며, 독립 실행 배포에서 TP=16을 TP=8로 줄일 수 있어요:
# verified on Hopper platform
sglang_args=$(echo serve \
--model-path $MAPPED_MODEL_PATH \
--nccl-init $MASTER_ADDR:$MASTER_PORT --nnodes 2 --node-rank $RANK --tp 8 --pp-size 2 --dp 1 --enable-dp-attention \
--moe-a2a-backend deepep --ep-size 16 \
--page-size 128 \
--chunked-prefill-size 16384 \
--attention-backend dsa \
--dsa-prefill-backend flashmla_sparse \
--dsa-decode-backend flashmla_sparse \
--enable-prefill-cp \
--cp-strategy interleave \
--cuda-graph-max-bs-decode 128 \
--max-running-requests 128 \
--trust-remote-code --host "0.0.0.0" --port 30000 \
--log-requests \
--context-length 65536 \
--allow-auto-truncate --enable-metrics \
--tool-call-parser deepseekv32 --reasoning-parser deepseek-v3 \
--served-model-name DeepSeek-V3.2-dsa-pp-cp-ep-dp
)
sglang_args=($sglang_args)
sglang "${sglang_args[@]}" 2>&1 | tee $LOG_DIR/$RANK.log
fp8 KV + CP + PP
FP8 KV는 메모리 사용량을 줄여요. DeepSeek V3.2의 경우 interleave CP와 PP와 결합하고 --dp 1을 유지하세요:
# verified in Hopper platform
dp_config=" \
--dp 1 --enable-dp-attention \
"
cp_config=" \
--enable-prefill-cp \
--cp-strategy interleave \
"
# see discussion : https://github.com/sgl-project/sglang/pull/12065
sglang_args=$(echo serve \
--model-path $MAPPED_MODEL_PATH \
--nccl-init $MASTER_ADDR:$MASTER_PORT --nnodes 2 --node-rank $RANK --tp 8 --pp-size 2 --pp-async-batch-depth 1 \
$dp_config \
--trust-remote-code --host "0.0.0.0" --port 30000 \
--log-requests \
--context-length 65536 --max-running-requests 128 \
$cp_config \
--kv-cache-dtype fp8_e4m3 \
--allow-auto-truncate --enable-metrics \
--tool-call-parser deepseekv32 --reasoning-parser deepseek-v3 \
--served-model-name DeepSeek-V3.2-Opt-fp8kv-pp2-cp4
)
sglang_args=($sglang_args)
sglang "${sglang_args[@]}" 2>&1 | tee $LOG_DIR/$RANK.log
5. 벤치마크
5.1 Blackwell에서의 속도 벤치마크
테스트 환경:
- 하드웨어: NVIDIA B200 GPU (8x)
- 모델: DeepSeek-V3.2-Exp
- 텐서 병렬화(Tensor Parallelism): 8
- sglang 버전: 0.5.6
ShareGPT_Vicuna_unfiltered 데이터셋에 대해 SGLang 내장 벤치마킹 도구로 성능 평가를 수행했어요. 이 데이터셋은 실제 대화 데이터를 포함해 실제 사용 시나리오의 성능을 더 잘 반영해요. 실제 사용 패턴을 시뮬레이션하기 위해 각 요청을 1024개의 입력 토큰과 1024개의 출력 토큰으로 구성했어요.
5.1.1 지연 시간 민감 벤치마크
- 모델 배포 명령:
sglang serve \
--model-path deepseek-ai/DeepSeek-V3.2-Exp \
--tp 8 \
--speculative-algorithm EAGLE \
--speculative-num-steps 3 \
--speculative-eagle-topk 1 \
--speculative-num-draft-tokens 4 \
--host 0.0.0.0 \
--port 30000
- 벤치마크 명령:
python3 -m sglang.bench_serving \
--backend sglang \
--host 127.0.0.1 \
--port 30000 \
--model deepseek-ai/DeepSeek-V3.2-Exp \
--random-input-len 1024 \
--random-output-len 1024 \
--num-prompts 10 \
--max-concurrency 1
- 테스트 결과:
============ Serving Benchmark Result ============
Backend: sglang
Traffic request rate: inf
Max request concurrency: 1
Successful requests: 10
Benchmark duration (s): 29.11
Total input tokens: 1972
Total input text tokens: 1972
Total input vision tokens: 0
Total generated tokens: 2784
Total generated tokens (retokenized): 2777
Request throughput (req/s): 0.34
Input token throughput (tok/s): 67.73
Output token throughput (tok/s): 95.62
Peak output token throughput (tok/s): 157.00
Peak concurrent requests: 3
Total token throughput (tok/s): 163.36
Concurrency: 1.00
Accept length: 2.46
----------------End-to-End Latency----------------
Mean E2E Latency (ms): 2909.74
Median E2E Latency (ms): 3088.27
P90 E2E Latency (ms): 4200.62
P99 E2E Latency (ms): 5588.52
---------------Time to First Token----------------
Mean TTFT (ms): 317.58
Median TTFT (ms): 191.31
P99 TTFT (ms): 740.79
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms): 9.09
Median TPOT (ms): 9.25
P99 TPOT (ms): 11.73
---------------Inter-Token Latency----------------
Mean ITL (ms): 9.35
Median ITL (ms): 7.64
P95 ITL (ms): 22.81
P99 ITL (ms): 23.33
Max ITL (ms): 31.45
==================================================
5.1.2 처리량 민감 벤치마크
- 모델 배포 명령:
sglang serve \
--model-path deepseek-ai/DeepSeek-V3.2-Exp \
--tp 8 \
--ep 8 \
--dp 8 \
--enable-dp-attention \
--host 0.0.0.0 \
--port 30000
- 벤치마크 명령:
python3 -m sglang.bench_serving \
--backend sglang \
--host 127.0.0.1 \
--port 30000 \
--model deepseek-ai/DeepSeek-V3.2-Exp \
--random-input-len 1024 \
--random-output-len 1024 \
--num-prompts 1000 \
--max-concurrency 100
- 테스트 결과:
============ Serving Benchmark Result ============
Backend: sglang
Traffic request rate: inf
Max request concurrency: 100
Successful requests: 1000
Benchmark duration (s): 219.09
Total input tokens: 301701
Total input text tokens: 301701
Total input vision tokens: 0
Total generated tokens: 188375
Total generated tokens (retokenized): 187443
Request throughput (req/s): 4.56
Input token throughput (tok/s): 1377.06
Output token throughput (tok/s): 859.80
Peak output token throughput (tok/s): 2465.00
Peak concurrent requests: 109
Total token throughput (tok/s): 2236.86
Concurrency: 88.05
----------------End-to-End Latency----------------
Mean E2E Latency (ms): 19291.23
Median E2E Latency (ms): 11927.39
---------------Time to First Token----------------
Mean TTFT (ms): 530.36
Median TTFT (ms): 444.00
P99 TTFT (ms): 1504.78
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms): 106.16
Median TPOT (ms): 106.69
P99 TPOT (ms): 221.12
---------------Inter-Token Latency----------------
Mean ITL (ms): 100.46
Median ITL (ms): 41.73
P95 ITL (ms): 225.67
P99 ITL (ms): 392.37
Max ITL (ms): 975.03
==================================================
5.2 정확도 벤치마크
5.2.1 GSM8K 벤치마크
- 벤치마크 명령:
python3 -m sglang.test.few_shot_gsm8k --num-questions 200 --port 30000
-
테스트 결과:
- DeepSeek-V3.2-Exp
Accuracy: 0.980 Invalid: 0.000 Latency: 19.128 s Output throughput: 965.919 token/s
- DeepSeek-V3.2-Exp
-
전체 GSM8K (1319 questions) — 더 엄격한 정확도 확인을 위해 전체 세트 8-shot을 실행하세요:
python3 benchmark/gsm8k/bench_sglang.py --num-shots 8 --num-questions 1319 --parallel 1319
- 8-shot:
Accuracy: 0.956 Invalid: 0.000 Latency: 25.109 s Output throughput: 5226.235 token/s - 20-shot (장문 맥락; 8-shot 결과에 가깝게 유지):
Accuracy: 0.956 Invalid: 0.000 Latency: 29.545 s Output throughput: 4418.617 token/s
5.2.2 MMLU 벤치마크
- 벤치마크 명령:
cd sglang
bash benchmark/mmlu/download_data.sh
python3 benchmark/mmlu/bench_sglang.py --nsub 10 --port 30000
- 테스트 결과:
- DeepSeek-V3.2-Exp
subject: abstract_algebra, #q:100, acc: 0.780 subject: anatomy, #q:135, acc: 0.874 subject: astronomy, #q:152, acc: 0.961 subject: business_ethics, #q:100, acc: 0.860 subject: clinical_knowledge, #q:265, acc: 0.925 subject: college_biology, #q:144, acc: 0.972 subject: college_chemistry, #q:100, acc: 0.660 subject: college_computer_science, #q:100, acc: 0.880 subject: college_mathematics, #q:100, acc: 0.840 subject: college_medicine, #q:173, acc: 0.879 Total latency: 7.961 Average accuracy: 0.879
- DeepSeek-V3.2-Exp
5.2.3 GPQA-Diamond 벤치마크
- 벤치마크 명령:
python3 -m sglang.test.run_eval --port 30000 --eval-name gpqa --num-examples 198 --max-tokens 128000 --repeat 8 --thinking-mode deepseek-v3
- 테스트 결과 (model:
deepseek-ai/DeepSeek-V3.2-Exp, 8×B200):- 기본값 (
temperature=0): 8회 실행 평균 0.797 — 모델 카드에 보고된 DeepSeek-V3.2-Exp 공식 GPQA-Diamond 점수 79.9와 거의 일치해요 temperature=1.0, top_p=0.95사용 시(DeepSeek 권장):
- 기본값 (
python3 -m sglang.test.run_eval --port 30000 --eval-name gpqa --num-examples 198 --max-tokens 128000 --repeat 8 --top-p 0.95 --temperature 1.0 --thinking-mode deepseek-v3
Repeat: 8, mean: 0.840
Scores: ['0.848', '0.808', '0.848', '0.838', '0.879', '0.813', '0.838', '0.848']
5.2.4 AIME 2025 벤치마크
sgl-eval로 평가한 AIME 2025 결과(8×B200):
| 모델 | pass@1 avg-of-4 | majority@4 | pass@4 |
|---|---|---|---|
| DeepSeek-V3.2-Exp | 87.50% ± 1.67% | 90.00% | 90.00% |
| DeepSeek-V3.2 | 92.50% ± 1.67% | 94.71% | 96.67% |
| DeepSeek-V3.2-Speciale | 95.00% ± 1.92% | 95.83% | 100.00% |
재현. sgl-eval을 설치하고, tool-call과 reasoning parser로 서버를 시작한 다음 sgl-eval run을 실행하세요. AIME 2025 데이터셋은 sgl-eval과 함께 제공되며, thinking이 기본적으로 켜져 있어요:
pip install sgl-eval
sgl-eval run aime25 \
--base-url http://localhost:30000/v1 \
--model deepseek-ai/DeepSeek-V3.2-Exp \
--n-repeats 4 \
--temperature 1.0 \
--top-p 0.95 \
--max-tokens 64000
# Use --max-tokens 120000 for the DeepSeek-V3.2-Speciale model
5.3 Hopper에서의 속도 벤치마크
테스트 환경:
- 하드웨어: NVIDIA H800 GPU (16x)
- 모델: DeepSeek-V3.2
- 텐서 병렬화(Tensor Parallelism): 16
- sglang 버전: 0.5.9
5.3.1 지연 시간 민감 벤치마크
- 모델 배포 명령:
export SGLANG_DEEPEP_LL_COMBINE_SEND_NUM_SMS=32
export SGLANG_SET_CPU_AFFINITY=1
# Test workload ISL/OSL=1k/1k, raw tap : 4948.16 toks/sec, MAX ITL 5970
# dp 2 : 5019.54 toks/sec, MAX ITL 7233
# dp 4 : 4942.82 toks/sec, MAX ITL 35654
# dp 2 + mtp : 6842.51 toks/sec, MAX ITL 3081
sglang_args=$(echo serve \
--model-path $MAPPED_MODEL_PATH \
--nccl-init $MASTER_ADDR:$MASTER_PORT --nnodes 2 --node-rank $RANK --tp 16 \
--dp 2 --enable-dp-attention --page-size 64 \
--trust-remote-code --host "0.0.0.0" --port 30000 \
--log-requests \
--context-length 65536 --max-running-requests 128 \
--speculative-algorithm EAGLE \
--speculative-num-steps 2 --speculative-eagle-topk 1 --speculative-num-draft-tokens 3 \
--allow-auto-truncate --enable-metrics \
--tool-call-parser deepseekv32 --reasoning-parser deepseek-v3 \
--served-model-name DeepSeek-V3.2-Opt-dp2-mtp
)
sglang_args=($sglang_args)
sglang "${sglang_args[@]}" 2>&1 | tee $LOG_DIR/$RANK.log
- 벤치마크 명령:
python3 -m sglang.bench_serving \
--backend sglang \
--host $MASTER_ADDR \
--port 30000 \
--model deepseek-ai/DeepSeek-V3.2 \
--random-input-len 1024 \
--random-output-len 1024 \
--num-prompts 10 \
--max-concurrency 1
- 테스트 결과:
============ Serving Benchmark Result ============
Backend: sglang
Traffic request rate: 64.0
Max request concurrency: 1
Successful requests: 10
Benchmark duration (s): 48.96
Total input tokens: 6101
Total input text tokens: 6101
Total generated tokens: 4220
Total generated tokens (retokenized): 4217
Request throughput (req/s): 0.20
Input token throughput (tok/s): 124.62
Output token throughput (tok/s): 86.20
Peak output token throughput (tok/s): 113.00
Peak concurrent requests: 2
Total token throughput (tok/s): 210.81
Concurrency: 1.00
Accept length: 3.27
----------------End-to-End Latency----------------
Mean E2E Latency (ms): 4893.12
Median E2E Latency (ms): 3742.47
P90 E2E Latency (ms): 8877.37
P99 E2E Latency (ms): 10769.85
---------------Time to First Token----------------
Mean TTFT (ms): 199.88
Median TTFT (ms): 176.15
P99 TTFT (ms): 272.49
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms): 10.99
Median TPOT (ms): 10.88
P99 TPOT (ms): 13.93
---------------Inter-Token Latency----------------
Mean ITL (ms): 11.15
Median ITL (ms): 8.86
P95 ITL (ms): 17.29
P99 ITL (ms): 33.71
Max ITL (ms): 36.84
==================================================
5.3.2 처리량 민감 벤치마크
동일한 배포 방법을 사용하고 동시성을 최대화하여 처리량을 변화시켜요:
python3 -m sglang.bench_serving \
--backend sglang \
--host $MASTER_ADDR \
--port 30000 \
--model deepseek-ai/DeepSeek-V3.2 \
--random-input-len 1024 \
--random-output-len 1024 \
--num-prompts 2048 \
--max-concurrency 1024 # see picture below why we use 1024 for concurrency, hence num prompts 2048
DeepSeek 3.2는 최대 1024까지의 동시성을 안정적으로 지원하며, 동시성이 128보다 커지면 TTFT가 급격히 증가해요:
성능 기록:
============ Serving Benchmark Result ============
Backend: sglang
Traffic request rate: 64.0
Max request concurrency: 1024
Successful requests: 2048
Benchmark duration (s): 408.09
Total input tokens: 1048992
Total input text tokens: 1048992
Total generated tokens: 1032734
Total generated tokens (retokenized): 1031817
Request throughput (req/s): 5.02
Input token throughput (tok/s): 2570.50
Output token throughput (tok/s): 2530.66
Peak output token throughput (tok/s): 5092.00
Peak concurrent requests: 1035
Total token throughput (tok/s): 5101.16
Concurrency: 763.41
Accept length: 3.26
----------------End-to-End Latency----------------
Mean E2E Latency (ms): 152117.70
Median E2E Latency (ms): 181704.84
P90 E2E Latency (ms): 215924.77
P99 E2E Latency (ms): 231679.59
---------------Time to First Token----------------
Mean TTFT (ms): 127729.28
Median TTFT (ms): 170098.94
P99 TTFT (ms): 185705.73
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms): 49.18
Median TPOT (ms): 48.48
P99 TPOT (ms): 77.24
---------------Inter-Token Latency----------------
Mean ITL (ms): 48.46
Median ITL (ms): 52.11
P95 ITL (ms): 110.26
P99 ITL (ms): 200.63
Max ITL (ms): 2666.37
==================================================
--random-range-ratio 1을 추가하면 훨씬 더 높은 통계 수치를 얻을 수 있어요:
============ Serving Benchmark Result ============
Backend: sglang
Traffic request rate: 64.0
Max request concurrency: 1024
Successful requests: 2048
Benchmark duration (s): 612.87
Total input tokens: 2097152
Total input text tokens: 2097152
Total generated tokens: 2097152
Total generated tokens (retokenized): 2096201
Request throughput (req/s): 3.34
Input token throughput (tok/s): 3421.84
Output token throughput (tok/s): 3421.84
Peak output token throughput (tok/s): 9077.00
Peak concurrent requests: 1039
Total token throughput (tok/s): 6843.68
Concurrency: 772.66
Accept length: 3.26
----------------End-to-End Latency----------------
Mean E2E Latency (ms): 231222.27
Median E2E Latency (ms): 289846.24
P90 E2E Latency (ms): 314480.41
P99 E2E Latency (ms): 320392.27
---------------Time to First Token----------------
Mean TTFT (ms): 194081.02
Median TTFT (ms): 252945.22
P99 TTFT (ms): 279637.50
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms): 36.31
Median TPOT (ms): 36.73
P99 TPOT (ms): 46.33
---------------Inter-Token Latency----------------
Mean ITL (ms): 36.31
Median ITL (ms): 23.18
P95 ITL (ms): 96.79
P99 ITL (ms): 135.81
Max ITL (ms): 3121.00
==================================================