Introducing Amazon SageMaker HyperPod Inference Gateway
https://aws.amazon.com/blogs/machine-learning/introducing-amazon-sagemaker-hyperpod-inference-gateway/📌 首token延遲最多降82%,SageMaker新增GPU感知推論閘道
TL;DR:HyperPod Inference Gateway用GPU即時訊號路由推論請求,零改動應用程式碼即可裝上。
一個聊天機器人使用者原本要等4.4秒才看到第一個字,換上新的路由層後縮短到800毫秒以內。造成這種差距的元兇,往往不是模型本身,而是Kubernetes預設的round-robin或least-connections負載平衡演算法——它們對GPU內部發生的事完全沒有可見性。
🤔 問題不在模型,在路由演算法看不見GPU裡發生什麼
當叢集裡有些pod的KV cache已經飽和、有些正在跑到一半的長文本生成、還有些已經把你需要的LoRA adapter載入記憶體時,傳統round-robin依然會盲目地把請求平均分配。結果就是請求堆積在忙碌的pod後面,閒置容量卻沒被用到;流量突發時首token延遲飆到4秒以上;GPU利用率高低不均、難以預測;團隊只能靠過度佈署GPU來補償——這等於花錢養著沒在做有用工作的GPU。
🧩 兩層架構:叢集內智慧路由 + 跨叢集全域協調
Amazon SageMaker HyperPod Inference Gateway是一個Kubernetes原生的GPU感知路由系統,以單一EKS managed addon(amazon-sagemaker-hyperpod-inference)的形式部署在既有HyperPod基礎架構上。
第一層(Tier 1)建構在開源的Gateway API Inference Extension之上,包含三個核心元件:一個高效能L7 proxy負責終止進入的HTTPS流量,並為每個叢集對外暴露單一私有端點;它會檢查每個OpenAI相容請求的body,抽出model欄位,路由到正確的模型池,天生支援一個閘道服務多個模型;而真正的智慧層則是EPP(Endpoint Picker),它持續消費每個模型伺服pod回報的即時Prometheus指標,用一套加權評分演算法選出最適合的後端——每個評分項都可設定權重,因此你可以依工作負載特性(延遲敏感的對話 vs. 吞吐量優先的批次任務)調整路由行為,其中包括會識別哪些pod已經把特定LoRA adapter載入記憶體的LoRA Affinity Scorer,以及找出共享prompt前綴命中率的Prefix Cache Hit Rate Scorer。第二層(Tier 2)則疊加在Tier 1之上,提供跨叢集、跨區域的協調能力:跨叢集容錯移轉、全域流量限速,以及成本感知的流量調度。
部署方式很單純:安裝addon、建立一個宣告式的InferenceGatewayConfig自訂資源定義模型與路由行為,再幫既有的模型伺服deployment加上標籤讓閘道能發現它們。閘道對外暴露的是標準OpenAI相容端點,現有的client程式碼完全不用改。若同一叢集上跑多個模型,Body-Based Router會依請求body中的model欄位自動路由到對應模型池,不需要在應用程式裡寫任何路由邏輯;若是共享base model、掛載多個LoRA adapter,閘道會優先把請求導向已經載入該adapter的pod,避免昂貴的adapter swap延遲,若沒有pod已載入,則導向可用容量最多、能最快載入完成的pod。
📊 三種真實場景下的benchmark:8B到235B模型
團隊在p5.48xlarge(H100)與g5(A10G)機型上,針對8B到235B參數的四款模型做測試,流量都經過內部Application Load Balancer,貼近真實生產路徑,測試客戶端與模型伺服端各自運行在獨立node group以避免資源互相干擾,且全程使用閘道的預設路由設定,不做任何額外調校。三個場景分別呈現差異:混合GPU世代時,較小記憶體的機型會在round-robin下率先飽和,而其他機型明明還能負荷,閘道能即時偵測這種不均並調整;突發流量下,單一副本會在忙碌與閒置間反覆震盪,round-robin無法平滑這種延遲尖峰,閘道則能把請求導向有餘裕的pod;多輪對話、文件問答等共享prompt前綴的場景中,Prefix Cache Hit Rate評分器會把請求導向已經快取該前綴的pod,避免重複計算。
⚠️ 均勻叢集、穩定流量下,增益有限
三個場景呈現一致的規律:叢集偏離「均勻」的程度越大,閘道帶來的增益就越明顯。反過來說,在完全均勻的GPU叢集、流量穩定的情況下,各副本的利用率本就接近一致,此時閘道的表現與round-robin相當——也就是說,這不是萬能的效能加速器,而是針對生產環境中真實常見的「異質硬體、突發流量、共享前綴」三種痛點設計的解法。目前Tier 1(單叢集路由)已在支援inference add-on的區域上線,Tier 2的跨叢集協調則是進一步擴充。
🎯 實務啟示
如果你的LLM推論叢集混雜著不同代的GPU、承受著突發流量,或工作負載中有大量共享prompt前綴(如多輪對話、RAG檢索),這個addon值得一試——因為它不需要sidecar、不需要service mesh、也不需要改動應用程式碼,裝上去幾分鐘內就能觀察到首token延遲的變化,比起重新設計整套路由架構,風險與成本都低得多。
🔗 來源
- 標題:Introducing Amazon SageMaker HyperPod Inference Gateway
- 作者/機構:Vinay Arora
- 連結:https://aws.amazon.com/blogs/machine-learning/introducing-amazon-sagemaker-hyperpod-inference-gateway/
#AWS #SageMaker #Kubernetes #LLMInference #GPU #LoadBalancing #MLOps #EKS #InferenceOptimization #CloudComputing
原始資料 AWS ML · 收集於 2026-09-18
摘要原文
Eliminate GPU waste. Reduce first-token latency by up to 82%. Install one Kubernetes-native addon with zero application changes. Running large language models (LLMs) at scale on GPU clusters is expensive. The default Kubernetes load balancers are making it worse. Round-robin and least-connections algorithms have no visibility into what’s happening inside your GPUs: which pods have saturated KV caches, which are mid-way through long-context generations, or which already have the LoRA adapter your request needs loaded in memory. The result? Round-robin routing causes requests to pile up behind busy pods while idle capacity remains unused. First-token latency spikes to 4+ seconds during traffic bursts. GPU utilization becomes uneven and unpredictable. You over-provision to compensate. This burns money on GPUs that aren’t doing useful work. Today, we’re excited to announce Amazon SageMaker HyperPod Inference Gateway. It is a Kubernetes-native, GPU-aware routing system that deploys as a single EKS managed addon on your existing HyperPod infrastructure. It uses real-time GPU signals to place every inference request on the best-suited pod, delivering lower latency with no changes to your model servers or client applications. “A chatbot user waiting 4.4 seconds for the first token now sees it in under 800 ms.” The Inference Gateway uses a two-tier design built entirely on Kubernetes-native primitives. Figure 1: Two-tier architecture of the Inference Gateway The first tier installs directly on each HyperPod/EKS cluster as the amazon-sagemaker-hyperpod-inference addon. It consists of three core components, all built on the open-source Gateway API Inference Extension: High-performance L7 proxy that terminates incoming HTTPS traffic and exposes a single private endpoint per cluster. Inspects each incoming OpenAI-compatible request body, extracts the model field, and routes to the correct model pool. Supports multi-model routing: one gateway, many models. The intelligence layer. EPP consumes real-time Prometheus metrics from every model-serving pod and uses a weighted scoring algorithm to select the best-suited backend: Each scorer carries a configurable weight, so you can tune routing behavior for your specific workload (latency-sensitive chat compared to throughput-optimized batch). The second tier adds fleet-wide coordination across multiple clusters and regions, with cross-cluster failover, global rate limiting, and cost-aware traffic shaping. Tier 2 builds on top of Tier 1. Each cluster’s per-cluster gateway continues to handle local intelligent routing. The Inference Gateway deploys with a single addon install and a declarative InferenceGatewayConfig custom resource. No sidecars, no service mesh, no application code changes. Add a label to your existing model server deployments so the gateway can discover them: Create a single InferenceGatewayConfig resource that defines your models and routing behavior: The gateway exposes a standard OpenAI-compatible endpoint. Your existing client code works unchanged: That’s it. No SDK changes. No SigV4 signing for inference traffic. Standard HTTP with an OpenAI-compatible schema. Running multiple models on the same cluster? The Body-Based Router handles it natively. Define multiple schedulers in your config, and the gateway automatically routes each request to the correct model pool based on the model field in the request body. One gateway. Multiple models. Zero routing logic in your application. Serving fine-tuned LoRA adapters on a shared base model? The Inference Gateway routes adapter requests to pods that already have the adapter loaded in GPU memory. This eliminates costly adapter swap latency. The EPP’s LoRA Affinity Scorer identifies which pods have the requested adapter resident and routes accordingly. If no pod has it loaded, the request goes to the pod with the most available capacity to load it quickly. The gateway degrades gracefully at every level: The gateway emits metrics at every layer, all surfaced through your existing monitoring stack: How much performance are you leaving on the table with default Kubernetes routing? To find out, we benchmarked four models ranging from 8B to 235B parameters, deployed on p5.48xlarge (H100) and g5 (A10G) instances. All traffic was routed through internal Application Load Balancers, matching the exact path a production request travels. A dedicated client node group generated controlled load while model servers ran in isolation on a separate server node group, ensuring zero resource contention under high concurrency. Every result that follows uses the gateway’s default routing configuration, with no tuning required. GPU-aware routing delivers the biggest gains exactly where round-robin struggles most. We tested three real-world scenarios across four models (8B to 235B parameters). In production, GPU fleets are rarely uniform. When a smaller-memory instance saturates under traffic that its larger peers handle comfortably, round-robin keeps sending requests to overloaded pods. The Inference Gateway detects this imbalance in real time. Figure 2: Mixed GPU generations, round-robin baseline compared to the Inference Gateway Bursty demand is the norm for most LLM workloads. A single replica cycles between overloaded and idle, creating latency spikes that round-robin cannot smooth out. The gateway absorbs these bursts by steering requests toward pods with available capacity. Figure 3: Bursty traffic, round-robin baseline compared to the Inference Gateway Workloads like multi-turn conversations and document Q&A share a common prompt prefix across requests. The gateway’s Prefix Cache Hit Rate scorer routes these requests to pods that already have the prefix cached, avoiding redundant computation. Figure 4: Shared prompt prefixes, round-robin baseline compared to the Inference Gateway The pattern across all three scenarios is consistent: the more your fleet diverges from uniform, the more you gain. On a fully uniform fleet under steady traffic, replicas hold near-identical utilization, and the gateway performs on par with round-robin. This makes intelligent routing most valuable for the conditions production traffic actually creates: mixed hardware, bursty demand, and shared prompt prefixes. You can turn it on without hand-tuning anything first. All figures are measured against a Kubernetes round-robin baseline on the same model replicas, using the gateway’s default routing configuration. “Comparable” means the difference fell within run-to-run variance. The Inference Gateway is not a separate platform you deploy alongside Kubernetes. It is Kubernetes: SageMaker HyperPod Inference Gateway (Tier 1, per-cluster routing) is available today in regions where inference add-on is available. Ready to stop wasting GPU capacity on naive routing? Install the Inference Gateway addon and start seeing first-token latency improvements in minutes rather than weeks.
由 claude-code/sonnet 自動生成