Home icon

Train Qwen3 on AWS Trainium with torchtitan

Machine Learning Blog



This article demonstrates three methods to train Qwen3 on AWS Trainium using torchtitan, leveraging TorchNeuron's native PyTorch device registration.

  • Train using Hugging Face Transformers v5 backend with AutoModelForCausalLM and direct safetensors checkpoint loading/saving
  • Switch to torchtitan's native Qwen3 implementation by modifying config.model_spec
  • Add Neuron Kernel Interface (NKI) mixture-of-experts kernels from torchtitan-neuron recipes
  • Register custom NKI kernels using the override registry to replace PyTorch operations
  • All configurations use identical torchrun launch patterns across 64 logical NeuronCores on trn2.48xlarge
  • Validate custom kernels numerically before training to ensure correctness

AWS Trainium integrates seamlessly with torchtitan across all training approaches, enabling flexible model development with standard PyTorch interfaces and optional kernel optimization.



Go to article

The AWS News Feed is currently looking for gold sponsors. If you want to support the AWS community and reach a large audience of AWS professionals, consider sponsoring the AWS News Feed.

Related articles

Oct 20
2026
AWS announces TorchNeuron: Native PyTorch Support for AWS Trainium (Public Beta)
Oct 26
2026
AWS Weekly Roundup: Amazon Polly Generative engine, TorchNeuron for Trainium, and more (October 26, 2026)
Sep 25
2026
Deploying real-time personalized speech with Qwen3-TTS on Amazon SageMaker AI
Oct 22
2026
Write your own training loop — without managing GPUs — with Amazon SageMaker training session APIs

The AWS News Feed is currently looking for silver sponsors. If you want to support the AWS community and reach a large audience of AWS professionals, consider sponsoring the AWS News Feed.