TL;DR
이 글은 2.4T 파라미터와 토큰당 95B 활성 파라미터를 가진 Qwen3.8-2.4T-A95B를 Amazon SageMaker HyperPod의 ml.p6-b300 인스턴스에 vLLM으로 배포하는 절차를 다룹니다. NVFP4 양자화로 가중치를 약 1.2TB까지 줄이고 8개의 NVIDIA B300 GPU에 적재하며, HyperPod Inference Operator가 모델 다운로드와 GPU 할당, 상태 점검, endpoint 수명주기를 Kubernetes manifest 하나로 관리합니다. Qwen3.8의 Gated DeltaNet과 Gated Attention을 결합한 구조는 긴 컨텍스트에서 메모리 증가를 제한하고, 내장 reasoning, tool calling, Multi-Token Prediction을 통해 agentic workload를 처리합니다. 512개 요청과 동시성 32 조건의 실험에서는 TP와 EP에 MTP를 함께 적용했을 때 TTFT가 59.7% 줄고 요청 지연 시간이 12.2% 감소했으며 출력 처리량이 12.6% 늘었습니다.
섹션별 상세


용어 해설
- Mixture of Experts
- — Mixture of Experts는 하나의 거대한 모델을 여러 Expert로 나누고 입력 토큰마다 일부 Expert만 선택해 계산하는 구조입니다. Qwen3.8은 512개의 routed expert와 1개의 shared expert를 사용하며 토큰마다 10개의 routed expert를 활성화합니다. 전체 파라미터는 2.4T이지만 실제 추론에는 약 95B만 참여해 계산량과 서빙 비용을 줄입니다.
- NVFP4 양자화(NVFP4)
- — NVFP4는 가중치와 활성값을 4비트 수준으로 표현하는 NVIDIA의 양자화 형식입니다. Qwen3.8의 가중치 메모리를 BF16 기준 약 4.8TB에서 약 1.2TB로 줄여 8개의 B300 GPU가 제공하는 총 2.1TB 메모리에 적재할 수 있게 합니다. 낮아진 메모리 사용량은 KV-cache와 활성값을 위한 공간을 남깁니다.
- Multi-Token Prediction
- — Multi-Token Prediction은 모델에 내장된 draft head가 다음 여러 토큰을 먼저 예측하고 본 모델이 한 번의 forward pass에서 이를 검증하는 speculative decoding 방식입니다. Qwen3.8은 별도의 draft model 없이 이 기능을 사용할 수 있습니다. 실험에서는 draft token 1개만으로 TTFT가 TP 기준보다 58.7% 줄었습니다.
- Tensor Parallelism
- — Tensor Parallelism은 하나의 모델 계산을 여러 GPU에 나눠 각 GPU가 텐서의 일부를 처리하는 방식입니다. 이 글의 기본 설정은 TP=8로, 2.4T 파라미터 모델을 p6-b300 인스턴스의 8개 B300 GPU에 분산합니다. Expert Parallelism과 결합하면 MoE Expert 분배 방식을 별도로 조정할 수 있습니다.
- KV-cache
- — KV-cache는 이전 토큰의 Key와 Value를 저장해 긴 대화에서 이미 계산한 어텐션 결과를 재사용하는 메모리 구조입니다. 일반적인 full attention에서는 컨텍스트가 길어질수록 캐시가 커지지만 Qwen3.8의 Gated DeltaNet 층은 고정 크기의 recurrent state를 사용합니다. 전체 92개 층 중 23개 Gated Attention 층만 컨텍스트 길이에 따른 KV-cache 증가를 만듭니다.
코드 예제
vllm serve Inferact/Qwen3.8-2.4T-A95B-NVFP4 \
--tensor-parallel-size 8 \
--quantization nvfp4 \
--load-format fastsafetensors \
--trust-remote-code \
--enable-prefix-caching \
--moe-backend auto \
--reasoning-parser qwen3 \
--enable-auto-tool-choice \
--tool-call-parser qwen3 \
--speculative-config '{"method":"mtp","num_speculative_tokens":1}' \
--served-model-name Qwen3.88개 B300 GPU에 모델을 분산하고 NVFP4, reasoning parser, tool calling, prefix caching, MTP speculative decoding을 활성화하는 vLLM 실행 명령입니다.
apiVersion: inference.sagemaker.aws.amazon.com/v1
kind: InferenceEndpointConfig
metadata:
name: qwen38
spec:
modelName: qwen38
instanceType: ml.p6-b300.48xlarge
invocationEndpoint: v1/chat/completions
replicas: 1
modelSourceConfig:
huggingFaceModel:
modelId: Inferact/Qwen3.8-2.4T-A95B-NVFP4
modelSourceType: huggingface
worker:
image: vllm/vllm-openai:qwen38
modelInvocationPort:
containerPort: 8000
name: http
modelVolumeMount:
mountPath: /opt/ml/model
name: model-weights
resources:
limits:
nvidia.com/gpu: 8
requests:
nvidia.com/gpu: 8SageMaker HyperPod의 InferenceEndpointConfig으로 Hugging Face 모델 소스, vLLM 컨테이너, 8개 GPU 자원, OpenAI 호환 호출 경로를 선언합니다.
from openai import OpenAI
client = OpenAI(
base_url="http://:8000/v1",
api_key="unused", # vLLM does not require auth by default
)
response = client.chat.completions.create(
model="Qwen3.8",
messages=[{"role": "user", "content": "Explain the trade-offs of MoE vs dense models for inference."}],
temperature=0.6,
top_p=0.95,
)
# Reasoning trace (the model's thinking)
print("Thinking:", response.choices[0].message.reasoning_content)
# Final answer
print("Answer:", response.choices[0].message.content)OpenAI Python SDK를 사용해 Qwen3.8의 reasoning_content와 최종 content를 분리해 받는 기본 채팅 요청입니다.
tools = [{ "type": "function", "function": { "name": "get_stock_price", "description": "Get the current stock price for a ticker symbol", "parameters": { "type": "object", "properties": { "ticker": {"type": "string", "description": "Stock ticker, e.g. 'AMZN'"} }, "required": ["ticker"], "additionalProperties": False, }, "strict": True, } }]
response = client.chat.completions.create(
model="Qwen3.8",
messages=[{"role": "user", "content": "What's Amazon's stock price right now?"}],
tools=tools,
tool_choice="auto",
)
# The model reasons internally, then emits a structured tool call
print("Thinking:", response.choices[0].message.reasoning_content)
tool_call = response.choices[0].message.tool_calls[0].function
print(f"Function: {tool_call.name}, Args: {tool_call.arguments}")strict JSON schema를 적용한 함수 도구를 등록하고 reasoning_content와 구조화된 tool call 인자를 각각 읽습니다.
curl http://:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{ "model": "Qwen3.8", "messages": [{"role": "user", "content": "Hello, Qwen3.8!"}], "temperature": 0.6, "max_tokens": 256 }'OpenAI 호환 chat completions endpoint가 준비됐는지 curl로 간단히 확인하는 요청입니다.
기술
- Qwen3.8-2.4T-A95B
- Amazon SageMaker HyperPod
- vLLM
- Amazon EKS
- NVIDIA B300 Blackwell Ultra
- NVFP4
- KEDA
- Amazon CloudWatch
- Amazon Managed Prometheus
- Grafana
- OpenAI Python SDK
- Hugging Face Hub
- Amazon S3
- Amazon FSx
활용 사례
- multi-step coding
- autonomous tool use
- long-horizon planning
- research workflows
- coding agents
- long-document analysis
- agentic reasoning pipelines
- OpenAI-compatible self-hosted inference
언급된 리소스
AI 요약 · 북마크 · 개인 피드 설정 — 무료
출처 · 인용 안내
인용 시 "요약 출처: AI Trends (aitrends.kr)"를 표기하고, 사실 확인은 원문 보기 기준으로 진행해 주세요. 자세한 기준은 운영 정책을 참고해 주세요.