概念
Hosting large models on SageMaker
Large model inference containers, tensor parallelism, quantization and memory sizing.
本课尚未翻译,暂以英文显示。
- 1The application sends a prompt and reads tokens as they stream back.
- 2The container loads the model and splits it across the GPUs.
Tensor parallel degree
- What it does
- Splits each layer across GPUs
- Watch for
- Match the GPU count
Quantization
- What it does
- Stores weights in 8 or 4 bits
- Watch for
- Small quality loss
Instance memory
- What it does
- Holds weights and the attention cache
- Watch for
- 70B at 16-bit is about 140 GB
Volume and timeouts
- What it does
- Disk, download and health check time
- Watch for
- Raise them for models over 30 or 40 GB
Streaming
- What it does
- Returns tokens as they come
- Watch for
- InvokeEndpointWithResponseStream
Inferentia and Trainium
- What it does
- AWS silicon for inference
- Watch for
- Compile with the Neuron SDK
| Setting | What it does | Watch for |
|---|---|---|
| Tensor parallel degree | Splits each layer across GPUs | Match the GPU count |
| Quantization | Stores weights in 8 or 4 bits | Small quality loss |
| Instance memory | Holds weights and the attention cache | 70B at 16-bit is about 140 GB |
| Volume and timeouts | Disk, download and health check time | Raise them for models over 30 or 40 GB |
| Streaming | Returns tokens as they come | InvokeEndpointWithResponseStream |
| Inferentia and Trainium | AWS silicon for inference | Compile with the Neuron SDK |
1 / 2
Tensor parallel degree
- What it does
- Splits each layer across GPUs
- Watch for
- Match the GPU count
Quantization
- What it does
- Stores weights in 8 or 4 bits
- Watch for
- Small quality loss
Instance memory
- What it does
- Holds weights and the attention cache
- Watch for
- 70B at 16-bit is about 140 GB
| Setting | What it does | Watch for |
|---|---|---|
| Tensor parallel degree | Splits each layer across GPUs | Match the GPU count |
| Quantization | Stores weights in 8 or 4 bits | Small quality loss |
| Instance memory | Holds weights and the attention cache | 70B at 16-bit is about 140 GB |
2 / 2
Volume and timeouts
- What it does
- Disk, download and health check time
- Watch for
- Raise them for models over 30 or 40 GB
Streaming
- What it does
- Returns tokens as they come
- Watch for
- InvokeEndpointWithResponseStream
Inferentia and Trainium
- What it does
- AWS silicon for inference
- Watch for
- Compile with the Neuron SDK
| Setting | What it does | Watch for |
|---|---|---|
| Volume and timeouts | Disk, download and health check time | Raise them for models over 30 or 40 GB |
| Streaming | Returns tokens as they come | InvokeEndpointWithResponseStream |
| Inferentia and Trainium | AWS silicon for inference | Compile with the Neuron SDK |
是什么
A large language model does not fit one small GPU. SageMaker AI offers large model inference (LMI) containers that bundle an inference engine such as vLLM or TensorRT-LLM, with a Neuron build for AWS Inferentia and AWS Trainium. You deploy one from JumpStart or from your own model files, and the container serves requests, batches them continuously and can stream tokens back.
是什么
Size memory first. Weights take about 2 bytes per parameter at 16-bit, so a 70-billion-parameter model needs about 140 GB for weights alone, plus room for the attention cache. An ml.g5.12xlarge has four 24 GB GPUs (96 GB), so that model does not fit unless you quantize it. Quantization stores weights in 8 or 4 bits, which cuts memory and cost for a small loss of quality. Tensor parallel degree splits each layer across GPUs in one instance. Set it to the number of GPUs you want to use.
是什么
Large models start slowly. In the production variant, raise the volume size when the model is over 30 GB and the instance has no local disk, the model download timeout when it is over 40 GB, and the container startup health check timeout when the health check times out. Uncompressed files in S3 load faster than one model.tar.gz. For streaming, call InvokeEndpointWithResponseStream. Inferentia and Trainium instances (ml.inf2, ml.trn1) need a model compiled with the Neuron SDK.
要记住
- LMI container: an inference engine, continuous batching and streaming, from JumpStart or your files.
- Memory: about 2 bytes per parameter at 16-bit, plus the attention cache.
- Quantization: 8 or 4 bit weights. Less memory and cost, small quality loss.
- Tensor parallel degree: splits layers across the GPUs of one instance.
要记住
- Large models need more disk, a longer download timeout and a longer health check timeout.
- Inferentia and Trainium: compile for Neuron first.
考试中
- “Model weights are larger than one GPU” points to a bigger instance with tensor parallelism, or quantization.
- “Endpoint creation fails with a health check timeout on a large model” points to a longer container startup health check timeout.
- “Show tokens to the user as they are generated” points to InvokeEndpointWithResponseStream.
- “Lower the cost of serving an LLM on AWS silicon” points to Inferentia2 or Trainium with the Neuron SDK.
本任务内容 · 3.1
- Compute environments and deployment targets
- SageMaker hosting
- Real-time and serverless inference
- Asynchronous and batch inference
- Multi-model and multi-container endpoints, inference components
- Choosing a deployment orchestrator
- Foundation model deployment options
- Hosting large models on SageMaker
- Bringing in models built outside AWS
Agents Classic
AgentCore
- Agent protocols and multi-agent patterns
- Reranking and retrieval strategies