Mistral Medium 3.5
Mistral Medium 3.5
Mistral Medium 3.5는 Mistral AI의 첫 플래그십 **병합 모델(merged model)**이에요. 단일 dense 128B 체크포인트 하나로 지시 수행(instruction following), 추론(reasoning), 코딩을 모두 처리해요. 이 페이지에서는 SGLang에서 Mistral Medium 3.5를 설치·배포·호출하는 방법과 EAGLE 추측 디코딩, 벤치마크 결과를 상세히 안내해요.
출처: 문서
본문
1. Model Introduction (모델 소개)
Mistral Medium 3.5는 Mistral AI의 첫 플래그십 **병합 모델(merged model)**이에요. 지시 수행, 추론, 코딩을 한 세트의 가중치에서 처리하는 단일 dense 128B 체크포인트를 제공해요. Le Chat에서 Mistral Medium 3.1과 Magistral을 대체하고, Vibe 코딩 에이전트에서 Devstral 2를 대체했어요. 추론 강도(reasoning effort)는 요청마다 설정할 수 있어서, 같은 모델로 빠른 채팅 응답을 하거나 깊은 에이전트 작업을 수행할 수 있어요. 비전 인코더는 다양한 이미지 크기와 종횡비를 처리하도록 처음부터 다시 훈련되었어요.
주요 특징:
- Dense 128B 파라미터 — MoE 없음, MLA 없음, 평범한 GQA (96 heads, 8 KV heads, head_dim=128)
- 256K 컨텍스트 윈도우 — 원래 4K 베이스 위에 YARN RoPE 스케일링 적용
- 하이브리드 추론:
reasoning_effort("none"또는"high")로 요청마다 즉시 응답과 깊은 추론을 전환 - 비전: 텍스트 + 이미지 입력 지원. 다양한 이미지 크기/종횡비를 처리하는 처음부터 훈련된 인코더
- 함수 호출: 네이티브 툴 호출과 JSON 출력
- FP8 네이티브: FP8 e4m3 정적 텐서 양자화가 내장된 형태로 배포
- 다국어: 영어, 프랑스어, 독일어, 스페인어, 포르투갈어, 이탈리아어, 일본어, 한국어, 러시아어, 중국어, 아랍어, 페르시아어, 인도네시아어, 말레이어, 네팔어, 폴란드어, 루마니아어, 세르비아어, 스웨덴어, 터키어, 우크라이나어, 베트남어, 힌디어, 벵골어 등 24개 언어 지원
- 라이선스: 수정 MIT (대규모 매출 기업 제외 상업·비상업적 사용 가능)
아키텍처:
- 256K 컨텍스트를 위한 YARN RoPE를 갖춘 Mistral 3 백본
- Dense (MoE 아님), 128B 파라미터
- 표준 GQA 어텐션 (MLA 아님)
- 처음부터 훈련된 Pixtral 스타일 비전 인코더 (48 layers, patch_size=14, spatial_merge=2, image_size=1540)
- 멀티모달 입력: 텍스트 + 이미지
모델:
HuggingFace 리포에는 mistral 네이티브 레이아웃(params.json + consolidated-*.safetensors)과 HF 레이아웃(config.json + model-*.safetensors)이 모두 포함되어 있어요. SGLang이 형식을 자동 감지하며, 둘 다 있을 때는 HF 레이아웃을 선호해요.
2. SGLang Installation (SGLang 설치)
공식 SGLang 설치 가이드를 참고해요.
Docker 이미지: lmsysorg/sglang:latest가 이 쿡북의 모든 GPU(H100 / H200 / B200 / B300)를 지원해요.
3. Model Deployment (모델 배포)
3.1 Basic Configuration
인터랙티브 명령 생성기: 아래 설정 선택기를 사용해 Mistral Medium 3.5용 실행 명령을 생성해요.
3.2 Configuration Tips
- Tensor Parallelism: Mistral Medium 3.5 FP8(약 130 GB)는 Hopper(H100/H200)에서
--tp 4, Blackwell(B200/B300)에서--tp 2가 필요해요. - 추론 강도:
reasoning_effort("none","high")로 요청마다 추론 깊이를 설정할 수 있어요. 재시작 없이 호출마다 전환 가능해요. - 권장 temperature:
reasoning_effort="high"일 때0.7.reasoning_effort="none"일 때는 작업에 따라0.0~0.7— 간결한 답이 필요하면 낮게, 창의적 출력이 필요하면 높게. - 컨텍스트 길이와 메모리: 모델은 256K 컨텍스트 윈도우를 가져요. 메모리가 부족하면
--context-length(예:32768)를 낮춰 시작하고 안정되면 늘려요. - 툴 호출:
--tool-call-parser mistral을 활성화해 네이티브 함수 호출을 지원해요. - 추론 파서:
--reasoning-parser mistral을 활성화하면reasoning_content를 메인 응답 콘텐츠와 분리해요. - 시스템 프롬프트: 모델은
chat_template.jinja와SYSTEM_PROMPT.txt에 권장 시스템 프롬프트를 포함해요. 시스템 메시지를 직접 넘기지 않으면 chat template이 Mistral 기본값(모델 정체성, 현재 날짜, 툴 사용 가이드)을 주입해요. Mistral 참조 설정과 완전히 일치시키려면 HF 리포에서SYSTEM_PROMPT.txt를 로드해{name},{today},{yesterday}를 치환해요(Section 4.6 참고).
3.3 Speculative Decoding (EAGLE)
Mistral은 mistralai/Mistral-Medium-3.5-128B-EAGLE EAGLE 드래프트 헤드를 제공해요. dense 128B 타깃 위에서 추측 디코딩(speculative decoding)을 실행할 수 있어요. 드래프트는 타깃의 vocab/head를 공유하는 2-layer GQA 본체로, 타깃처럼 FP8 양자화(약 4 GB)되며 저동시성 지연-중심 서빙을 위해 설계되었어요.
python -m sglang.launch_server \
--model-path mistralai/Mistral-Medium-3.5-128B \
--tp 4 \
--dtype bfloat16 \
--tool-call-parser mistral \
--reasoning-parser mistral \
--speculative-algorithm EAGLE \
--speculative-draft-model-path mistralai/Mistral-Medium-3.5-128B-EAGLE \
--speculative-num-steps 3 \
--speculative-eagle-topk 1 \
--speculative-num-draft-tokens 4 \
--port 30000
--dtype bfloat16은 필수예요. 드래프트params.json에는dtype필드가 없어서--dtype auto가 fp32로 폴백했다가 fp16으로 다운캐스트돼요. embed/head가 공유될 때 bf16 타깃과 충돌하게 돼요. bf16을 명시하면 양쪽이 정렬돼요(타깃에는 no-op — 이미 bf16으로 로드됨).- 드래프트는 타깃과 같은 vocab과 lm_head를 사용해요. 베이스 모델 위의 메모리 오버헤드는 TP 샤드당 약 4 GB예요.
(num-steps, eagle-topk, num-draft-tokens) = (3, 1, 4)가 권장 시작점이에요. 작업에 맞게 튜닝해요 — 더 넓은 트리(높은eagle-topk/num-draft-tokens)는 높은 수용률(템플릿화된) 출력에 좋고, 좁은 트리는 다양한 텍스트에서 지연 시간을 낮게 유지해요.- EAGLE는 저동시성에서 빛나요. 고동시성에서는 throughput이 타깃의 배치 forward pass에 지배되므로 드래프트의 기여가 작아져요. 배치 서빙 워크로드에서는 EAGLE 없이 실행하는 걸 고려해요.
4. Model Invocation (모델 호출)
4.1 Thinking Mode
Mistral Medium 3.5는 하이브리드 추론 모델이에요. 기본적으로 추론 트레이스를 생성하지 않으며, reasoning_effort="high"를 넘기면 깊은 추론 경로가 켜져요. Mistral은 추론 모드에서 temperature=0.7을 권장해요.
from openai import OpenAI
client = OpenAI(
base_url="http://localhost:30000/v1",
api_key="EMPTY",
)
response = client.chat.completions.create(
model="mistralai/Mistral-Medium-3.5-128B",
messages=[
{"role": "user", "content": "Solve step by step: what is 17 × 23 + 144 / 12?"},
],
temperature=0.7,
extra_body={"reasoning_effort": "high"},
)
print("Reasoning:", response.choices[0].message.reasoning_content)
print("Answer:", response.choices[0].message.content)
출력:
Reasoning: I need to follow the order of operations (PEMDAS/BODMAS): multiplication and
division before addition, evaluated left to right.
17 × 23: I'll break it as 17 × (20 + 3) = 340 + 51 = 391.
144 / 12 = 12.
Finally, 391 + 12 = 403.
Answer: **17 × 23 + 144 / 12 = 403**
Step by step:
1. 17 × 23 = 391
2. 144 / 12 = 12
3. 391 + 12 = 403
4.2 Instruct Mode (Reasoning Off)
추론 트레이스를 건너뛰고 빠른 직접 응답을 받으려면 reasoning_effort="none"으로 설정해요. 인스트럭트 모드에서 Mistral은 작업의 창의성에 따라 0.0~0.7 범위의 temperature를 권장해요.
from openai import OpenAI
client = OpenAI(
base_url="http://localhost:30000/v1",
api_key="EMPTY",
)
response = client.chat.completions.create(
model="mistralai/Mistral-Medium-3.5-128B",
messages=[
{"role": "user", "content": "What is the capital of France?"},
],
temperature=0.1,
extra_body={"reasoning_effort": "none"},
)
print(response.choices[0].message.content)
출력:
The capital of France is **Paris**. It is one of the most famous and visited cities in
the world, known for its rich history, art, culture, and landmarks like the Eiffel Tower,
Louvre Museum, and Notre-Dame Cathedral.
4.3 Streaming with Reasoning
from openai import OpenAI
client = OpenAI(
base_url="http://localhost:30000/v1",
api_key="EMPTY",
)
stream = client.chat.completions.create(
model="mistralai/Mistral-Medium-3.5-128B",
messages=[
{"role": "user", "content": "Explain the difference between async and threading in Python."},
],
temperature=0.7,
extra_body={"reasoning_effort": "high"},
stream=True,
)
print("=== Reasoning ===")
for chunk in stream:
delta = chunk.choices[0].delta
if hasattr(delta, "reasoning_content") and delta.reasoning_content:
print(delta.reasoning_content, end="", flush=True)
elif delta.content:
print("\n=== Response ===")
print(delta.content, end="", flush=True)
print()
4.4 Tool Calling
Mistral Medium 3.5는 네이티브 함수 호출을 지원해요. --tool-call-parser mistral로 활성화해요.
from openai import OpenAI
client = OpenAI(
base_url="http://localhost:30000/v1",
api_key="EMPTY",
)
tools = [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the current weather for a city",
"parameters": {
"type": "object",
"properties": {
"location": {"type": "string", "description": "City name"},
"unit": {"type": "string", "enum": ["celsius", "fahrenheit"]},
},
"required": ["location"],
},
},
}
]
response = client.chat.completions.create(
model="mistralai/Mistral-Medium-3.5-128B",
messages=[{"role": "user", "content": "What's the weather in Paris?"}],
tools=tools,
tool_choice="auto",
)
tool_calls = response.choices[0].message.tool_calls
for tc in tool_calls:
print(f"Tool: {tc.function.name}")
print(f"Args: {tc.function.arguments}")
출력:
Tool: get_weather
Args: {"location": "Paris"}
4.5 Vision (Image Input)
Mistral Medium 3.5는 텍스트와 함께 이미지 입력을 받아요. 비전 인코더는 다양한 이미지 크기와 종횡비를 처리하도록 처음부터 재훈련되었어요.
from openai import OpenAI
client = OpenAI(
base_url="http://localhost:30000/v1",
api_key="EMPTY",
)
response = client.chat.completions.create(
model="mistralai/Mistral-Medium-3.5-128B",
messages=[
{
"role": "user",
"content": [
{"type": "text", "text": "Describe what you see in this image."},
{
"type": "image_url",
"image_url": {"url": "https://raw.githubusercontent.com/sgl-project/sglang/main/assets/logo.png"},
},
],
}
],
temperature=0.7,
extra_body={"reasoning_effort": "none"},
)
print(response.choices[0].message.content)
출력:
The image features a stylized representation of the acronym "SGL." The letters
are large, bold, and orange with a brown outline, giving them a three-dimensional
effect. To the left of the letters, there is a graphic that resembles a neuron
or a node with connections, also in a similar orange and brown color scheme. The
node has a code symbol (</>) inside a square, suggesting a connection to
programming or technology.
4.6 Loading the Reference System Prompt
Mistral은 가중치와 함께 SYSTEM_PROMPT.txt를 배포해요. 참조 설정은 HF 리포에서 이를 로드해 런타임에 {name}, {today}, {yesterday}를 치환해서 모델이 자신의 정체성과 현재 날짜를 알게 해요. 시스템 프롬프트를 생략하면 SGLang의 chat template이 기본 시스템 프롬프트를 주입하지만, Mistral 참조와 완전히 동일하게 하려면 명시적으로 로드해요.
from datetime import datetime, timedelta
from huggingface_hub import hf_hub_download
from openai import OpenAI
MODEL = "mistralai/Mistral-Medium-3.5-128B"
def load_system_prompt(repo_id: str, filename: str = "SYSTEM_PROMPT.txt") -> str:
path = hf_hub_download(repo_id=repo_id, filename=filename)
today = datetime.today().strftime("%Y-%m-%d")
yesterday = (datetime.today() - timedelta(days=1)).strftime("%Y-%m-%d")
name = repo_id.split("/")[-1]
with open(path) as f:
return f.read().format(name=name, today=today, yesterday=yesterday)
client = OpenAI(base_url="http://localhost:30000/v1", api_key="EMPTY")
response = client.chat.completions.create(
model=MODEL,
messages=[
{"role": "system", "content": load_system_prompt(MODEL)},
{"role": "user", "content": "Write me a sentence where every word starts with the next letter in the alphabet — start with 'a' and end with 'z'."},
],
temperature=0.1,
extra_body={"reasoning_effort": "none"},
)
print(response.choices[0].message.content)
5. Benchmarks (벤치마크)
검증은 4× H200에서 --tp 4로 /v1/chat/completions 엔드포인트를 통해 실행되었어요.
5.1 Accuracy Benchmarks
GSM8K
python3 benchmark/gsm8k/bench_sglang.py --port 30000
결과:
Accuracy: 0.945
Invalid: 0.000
Latency: 13.594 s
Output throughput: 1560.660 token/s
MMMU
python3 benchmark/mmmu/bench_sglang.py --port 30000
결과:
Overall accuracy: 0.586
5.2 Speed Benchmarks
Latency (Low Concurrency)
python3 -m sglang.bench_serving \
--backend sglang \
--dataset-name random \
--num-prompts 10 \
--max-concurrency 1 \
--random-input-len 1024 \
--random-output-len 512 \
--port 30000
결과:
============ Serving Benchmark Result ============
Backend: sglang
Successful requests: 10
Benchmark duration (s): 38.86
Total input tokens: 6101
Total generated tokens: 2684
Output token throughput (tok/s): 69.07
Mean E2E Latency (ms): 3883.80
Median TTFT (ms): 95.90
Median TPOT (ms): 14.19
==================================================
Throughput (High Concurrency)
python3 -m sglang.bench_serving \
--backend sglang \
--dataset-name random \
--num-prompts 1000 \
--max-concurrency 100 \
--random-input-len 1024 \
--random-output-len 512 \
--port 30000
결과:
============ Serving Benchmark Result ============
Backend: sglang
Successful requests: 1000
Benchmark duration (s): 117.28
Total input tokens: 512842
Total generated tokens: 262023
Output token throughput (tok/s): 2234.18
Total token throughput (tok/s): 6607.01
Mean E2E Latency (ms): 11303.79
Median TTFT (ms): 152.95
Median TPOT (ms): 42.53
==================================================
5.3 EAGLE Speculative Decoding (Latency)
동일한 4× H200 설정, Section 3.3의 EAGLE 구성. 단일 스트림 지연 벤치마크(--max-concurrency 1).
python3 -m sglang.bench_serving \
--backend sglang \
--dataset-name random \
--num-prompts 10 \
--max-concurrency 1 \
--random-input-len 1024 \
--random-output-len 512 \
--port 30000
결과:
============ Serving Benchmark Result ============
Backend: sglang
Successful requests: 10
Benchmark duration (s): 27.64
Total input tokens: 6101
Total generated tokens: 2684
Output token throughput (tok/s): 97.10
Mean E2E Latency (ms): 2762.99
Median TTFT (ms): 90.69
Median TPOT (ms): 9.73
Accept length: 1.72
==================================================
EAGLE는 Section 5.2의 베이스라인 대비 동일 워크로드에서 약 1.41× 출력 throughput과 약 29% 낮은 E2E 지연을 제공해요. 수용 길이 1.72는 각 드래프트 사이클이 평균 약 1.7개의 토큰을 수용한다는 뜻이에요.
더 알아보기 (Learn more)
- 공식 SGLang 설치 가이드 — SGLang 설치 방법
- EAGLE 추측 디코딩 (Hugging Face) — 드래프트 모델
- Mistral Medium 3.5 (Hugging Face) — FP8 체크포인트