AWS has published a walkthrough for training Qwen3 models on AWS Trainium with torchtitan, using a single trn2.48xlarge instance. The post describes three approaches that use the same torchrun launch pattern and configuration structure.
The first approach uses Transformers v5 as torchtitan’s modeling backend. It loads Qwen3 through AutoModelForCausalLM and supports reading published Hugging Face safetensors and exporting trained weights in the same format. AWS says a tested Qwen3-4B fine-tuning run started with a loss of 6.54 from published weights, compared with 12.43 from random initialization.
The second approach uses torchtitan’s native Qwen3 implementation, selected through its model registry. The example uses scaled dot product attention and data-parallel sharding across 64 logical NeuronCores.
The third approach uses Neuron Kernel Interface, or NKI, mixture-of-experts kernels from torchtitan-neuron recipes. The example configures a reduced four-layer Qwen3-30B-A3B model with 64 experts and routes each token to four experts. AWS says this configuration is designed to fit on one trn2.48xlarge and does not use expert parallelism.
The walkthrough requires a Neuron Deep Learning AMI or PyTorch training container, along with specified versions of torch, torch_neuronx, Transformers, and torchtitan-neuron. It covers both eager execution and torch.compile, as well as registering custom NKI operators and their backward passes.