AWS Trainium 支持 frontier 模型:SGLang-Neuron 正式发布
SGLang-Neuron is now publicly available through an AWS Deep Learning Container. With SGLang-Neuron, you can serve models and generate reinforcement learning rollouts with SGLang on

# AWS Trainium 支持 frontier 模型:SGLang-Neuron 正式发布
SGLang-Neuron 是 AWS Deep Learning Container 中公开可用的镜像,可让您直接在 AWS Trainium 硬件上运行前沿模型,并生成强化学习(RL)回放。 它继承了 SGLang 熟悉的服务器接口和生成 API,无需修改代码即可切换到 Trainium 平台。 适合追求规模化部署、追求硬件成本效益的开发者和研究团队。 决策时优先考虑:是否已有 Trainium 实例可用、模型是否通过 TorchNeuron 原生支持、以及是否需要 RL 回放场景。
AWS Trainium 系列芯片提供训练与推理的高性能和成本优势。SGLang-Neuron 通过 out-of-tree 插件方式,将 SGLang 核心(调度、请求生命周期、RadixAttention、前缀缓存)无缝连接到 Trainium 后端。底层采用原生 PyTorch,结合 Neuron Kernel Interface(NKI)内核和 torch.compile,实现高效图编译与执行。
SGLang-Neuron 在 AWS Trainium 上的运行机制
SGLang-Neuron 插件注册 Neuron 平台,环境变量 SGLANG_PLATFORM=neuron 自动启用。 Trainium 通过 TorchNeuron 成为原生 PyTorch 设备。SGLang-Neuron 仅实现 Trainium 专属的模型层、注意力机制、MoE 分组和图运行器。 核心服务仍由 SGLang 负责,迭代速度独立于硬件后端。
PD disaggregation(Prefill-Decode 分离)也在支持范围内:
- Prefill 服务器计算 KV 缓存。
- 通过 NIXL 在 Elastic Fabric Adapter(EFA)上传输给 Decode 服务器。
- Decode 服务器继续使用 SGLang 调度器生成剩余 tokens。
如何在 AWS Trainium 上使用 SGLang-Neuron
- 使用
pytorch-inference-sglang-neuron容器启动 Trainium3 EC2 实例。 - 在容器内设置
SGLANG_PLATFORM=neuron并启动服务器:
``bash SGLANG_PLATFORM=neuron \ python -m sglang.launch_server \ --model-path openai/gpt-oss-120b \ --tp-size 8 \ --ep-size 8 \ --kv-cache-dtype fp8_e4m3 \ --context-length 10240 \ --chunked-prefill-size 8192 \ --max-running-requests 64 \ --max-total-tokens 655360 \ --mem-fraction-static 0.8 \ --host 127.0.0.1 \ --port 30000 ``
- 向本地端点发送请求:
``bash curl \ -H 'Content-Type: application/json' \ -d '{ "model": "openai/gpt-oss-120b", "messages": [{"role": "user", "content": "Explain why the sky appears blue."}], "temperature": 0, "max_tokens": 128 }' ``
完整快速上手指南和已验证配置请参考官方仓库文档。更多前沿模型支持与 RL 回放示例,参见 AWS 官方博客。
| 组件 | 描述 | 典型设置示例 |
|---|---|---|
| 硬件 | AWS Trainium3 EC2 | p3dn.48xlarge |
| 容器 | pytorch-inference-sglang-neuron | v0.1.0-neuron-py314-sdk-2.33.0 |
| 并行度(TP) | 张量并行 | 8 |
| 环境变量 | SGLANG_PLATFORM=neuron | 自动启用 |
| KV 缓存格式 | fp8_e4m3 | 混合精度推理 |
| 请求并发上限 | max-running-requests | 64 |
延伸阅读
- API 中转:对接 SGLang-Neuron 端点时的流量代理与限流策略
- API 中转探测:验证 Trainium 端点可用性与延迟
- 模型天梯:训练与推理场景下硬件加速的性能对比
- 开源部署实验室:本地与云端混合部署最佳实践
- 本地部署指南:在 Trainium 兼容容器上运行 SGLang 完整流程
- 官方 API 接入:通过 AWS Deep Learning Container 快速切换到 Trainium
风险与边界
AWS Trainium 硬件需匹配对应 EC2 实例类型,初期部署门槛较高。模型需通过 TorchNeuron 原生支持,未经验证的 frontier 模型可能出现兼容性问题。使用前请确认官方镜像版本与硬件规格。 以上内容基于 AWS 官方 2026-11-12 发布信息整理,仅供参考。非法律意见,实际操作请以 AWS 控制台最新数据为准。
English summary
SGLang-Neuron is now publicly available through an AWS Deep Learning Container, allowing frontier AI models to be served and RL rollouts generated directly on AWS Trainium hardware. It reuses the familiar SGLang interface and generation APIs you already know, with no code changes required. Trainium’s native PyTorch support via TorchNeuron and out-of-tree plugins provide strong economics for large-scale inference and training workloads. Quick-start steps include launching the pytorch-inference-sglang-neuron container, setting SGLANG_PLATFORM=neuron, and running the server with standard launch flags. PD disaggregation and NKI kernels further optimize performance. Ideal for teams already using SGLang who want lower-cost, high-performance inference on AWS Trainium. Test with supported models like gpt-oss-120b and monitor via the official getting-started guide.
(正文字数约 2 450 字,去除空白符)
适用于 GrokCode 倍率榜。信息仅供参考,不构成购买、投资或法律意见。