AI Cloud Architect

Accelerating decode-heavy LLM inference with speculative decoding on AWS Trainium and vLLM

AWSHow-to by Yahav Biran and Truong PhamAWS Artificial Intelligence Blog

In this post, you will learn how speculative decoding works and why it helps reduce cost per generated token on AWS Trainium2.

Read the original (opens the source's page in a new tab)

AI: Summary

What it is

Speculative decoding on Trainium2 with vLLM cuts end-to-end latency for structured, repetitive prompts (AWS says up to 3x), while open-ended prompts see no consistent gain.

Who it is for

Teams serving Qwen3 models on Trainium2 through vLLM on EKS who want to cut decode cost for predictable outputs like code or templated reports.

Key points

  • Benchmark pairs Qwen3-32B target with Qwen3-1.7B draft and num_speculative_tokens=7 on trn2.48xlarge.
  • Structured prompts drop inter-token latency to about 15 ms per token versus about 45 ms for open-ended prompts.
  • TTFT is unchanged because speculative decoding does not affect the prefill stage.
  • Draft and target models must share a tokenizer; the 0.6B draft had about 60% lower acceptance and lost its speed advantage.

The same at other vendors

Timeline

Posts about AWS Trainium, oldest first.

  1. Customer storySplash Music transforms music generation using AWS Trainium and Amazon SageMaker HyperPod · AWS · Customer story
  2. This postAccelerating decode-heavy LLM inference with speculative decoding on AWS Trainium and vLLM
  3. Update to an existing featureAWS Neuron SDK 2.29.0 now available with NKI and Neuron Explorer out of Beta, a new CPU Simulator, and an expanded NKI Library · AWS · Release note
  4. New featureAWS Neuron SDK now available with Neuron Agentic Development for NKI kernel development on Trainium · AWS · Announcement
  5. How-toStop hand-tuning kernels: How Neuron Agentic Development accelerates AWS Trainium optimizations · AWS · How-to
  6. How-toHow Deepgram optimized voice AI at scale with AWS Trainium · AWS · How-to
  7. PreviewAWS announces TorchNeuron: Native PyTorch Support for AWS Trainium (Public Beta) · AWS · Announcement
  8. How-toBeyond the KV cache: Training and serving i14’s Laplace 3B linear attention model on AWS Trainium2 with native PyTorch · AWS · How-to
  9. How-toTrain Qwen3 on AWS Trainium with torchtitan · AWS · How-to
Show all 10 posts
  1. Customer storySplash Music transforms music generation using AWS Trainium and Amazon SageMaker HyperPod · AWS · Customer story
  2. This postAccelerating decode-heavy LLM inference with speculative decoding on AWS Trainium and vLLM
  3. Update to an existing featureAWS Neuron SDK 2.29.0 now available with NKI and Neuron Explorer out of Beta, a new CPU Simulator, and an expanded NKI Library · AWS · Release note
  4. New featureAWS Neuron SDK now available with Neuron Agentic Development for NKI kernel development on Trainium · AWS · Announcement
  5. How-toStop hand-tuning kernels: How Neuron Agentic Development accelerates AWS Trainium optimizations · AWS · How-to
  6. How-toHow Deepgram optimized voice AI at scale with AWS Trainium · AWS · How-to
  7. PreviewAWS announces TorchNeuron: Native PyTorch Support for AWS Trainium (Public Beta) · AWS · Announcement
  8. How-toBeyond the KV cache: Training and serving i14’s Laplace 3B linear attention model on AWS Trainium2 with native PyTorch · AWS · How-to
  9. How-toTrain Qwen3 on AWS Trainium with torchtitan · AWS · How-to
  10. How-toDeploy frontier AI models on AWS Trainium with SGLang-Neuron · AWS · How-to