{
  "id": 15947926,
  "title": "Train Qwen3 on AWS Trainium with torchtitan",
  "url": "https://urgent.news/2026/10/21/train-qwen3-on-aws-trainium-with-torchtitan",
  "topic": "ai",
  "section": "AI",
  "published": "2026-10-21T20:00:22.000Z",
  "source": {
    "name": "AWS Machine Learning",
    "slug": "aws-machine-learning",
    "url": "https://aws.amazon.com/blogs/machine-learning/train-qwen3-on-aws-trainium-with-torchtitan/"
  },
  "original_language": "en",
  "account": "To train the Qwen3 model using torchtitan on AWS Trainium with torchtitan, follow these steps. The configurations are presented in the order of three training methods.\n\n1. First, use Transformers v5 as the modeling backend with torchtitan. Set up the environment with the AWS Deep Learning AMI for Neuron or a Neuron PyTorch training container. Ensure that the required versions of torch, torch_neuronx, transformers, and torchtitan-neuron are installed. Clone the torchtitan-neuron repository and obtain the Qwen3 model artifacts from Hugging Face Hub. Store the model in a local directory and create a Python config function, transformers_modeling_backend_full(). Set the Hugging Face model ID, assets path, dataset, training steps, local batch size, and data parallel shard degree in the config. Launch the training with torchrun, specifying the number of processes, RDZV backend, endpoint, local rank filter, role, and tee. The command will utilize all 64 logical NeuronCores for training.\n\n2. Second, switch to torchtitan's native Qwen3 by changing config.model_spec. This method customizes the model implementation and kernels for the specific workload. Create another Python config function, transformers_modeling_backend_native_qwen3(). Set the config.model_spec to Qwen3 and update the training configuration accordingly. The data parallel setting remains the same as in the first configuration.\n\n3. Lastly, add Neuron Kernel Interface (NKI) mixture-of-experts (MoE) kernels from the torchtitan-neuron recipes. Customize the model implementation further by attaching your own kernel using torchtitan's override registry. Create a third Python config function, torchtitan_neuron_qwen3(). Set the config.model_spec to Qwen3 with NKI MoE kernels and update the training configuration as needed. Once again, maintain the same data parallel setting as in the previous configurations.\n\nIn all three configurations, use the same torchrun launch pattern and config structure. After training, fine-tune from published weights by enabling checkpoint loading and specifying the initial load path, folder, and save settings. Load the exported checkpoint with AutoModelForCausalLM and verify the results, ensuring that the checkpoint remains a standard Hugging Face checkpoint.",
  "summary": "Train Qwen3 on AWS Trainium with torchtitan three ways on a single trn2.48xlarge: the Hugging Face Transformers v5 modeling backend, torchtitan's native Qwen3, and NKI mixture-of-experts kernels. The same torchrun launcher and config structure work unchanged across all three paths, including loading and saving published Hugging Face safetensors.",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}