AIToday
Large Language ModelsAI Coding AssistantsOpen-Source AIAmazon AI BlogPublished: Oct 22, 2026, 06:00 JST

AWS shows three ways to train Qwen3 on one trn2.48xlarge

Send on LINE
AWS shows three ways to train Qwen3 on one trn2.48xlarge

3 Key Points

  1. What happened

    AWS walked through training Qwen3 three ways on one trn2.48xlarge — via Hugging Face Transformers v5, torchtitan's native Qwen3, and NKI mixture-of-experts kernels — all using the same torchrun launcher.

  2. Why it matters

    Hedge: this is a documented example rather than a claim of performance gains.

Not sure about something? Ask the AI

Questions and answers are published on this page.

Summaries like this, in your inbox every morning.

Context & Analysis

The post is structured around three configurations that differ in how the model is built, not in how the job is launched. In the first, Transformers v5 supplies the Qwen3 implementation through AutoModelForCausalLM, and the config simply sets the Hub ID. The second swaps in torchtitan's native Qwen3Model by changing config.model_spec, starting from qwen3_32b() and replacing the model spec with the 4B variant because the tested build lacks a generic 4B builder. The third goes further, replacing the mixture-of-experts block with NKI grouped-experts kernels through qwen3_nki_moe_config(), reduced to 4 layers and 64 experts so it fits on one trn2.48xlarge.

The custom-kernel section is the most procedural. A kernel from nkilib is wrapped with wrap_nki and registered as a PyTorch operator, and a second operator handles the backward pass with saved routing metadata. A numerical check compared rope_hf against torchtitan's PyTorch rotary embedding with float32 inputs; the run reported a maximum absolute difference of 0.0 for query and key. The authors describe this part as demonstrating registration and autograd integration, not performance improvement.

What ties the three paths together is the launcher and the override mechanism. Data parallel sharding is set with data_parallel_shard_degree = -1 across 64 ranks, and tensor parallelism can be layered on the same multidimensional DeviceMesh. Overrides are scoped with fully qualified names so that, for example, fqns=["layers.1[0-9].attention.rope"] targets rotary embeddings in layers 10 through 19. torchtitan halts when two overrides claim the same node. This points to a workflow where switching between Hub-defined and native implementations, or attaching custom kernels, is a configuration change rather than a different training stack.

FAQ
What hardware does this walkthrough require?
A single trn2.48xlarge instance, which has 16 Trainium2 accelerators and 128 physical NeuronCores, run under 64 logical NeuronCores at LNC=2.
Can I fine-tune published Qwen3 weights rather than start from scratch?
Yes. Enabling checkpoint loading and pointing initial_load_path at the local Qwen3 assets lets the run load published weights, and the final checkpoint saves as Hugging Face safetensors.
How do I check that the published weights loaded correctly?
The first training-step loss is the quick check: the verified run produced a step 1 loss of 6.54 from published weights versus 12.43 from random initialization.
Amazon AI BlogRead Original Article
Send on LINE

AI news that matters for your work, delivered every morning.

Pick your industry and the AI tools you use, and get news related to your work every day.

Free · 30 seconds with Google · unsubscribe anytimeWhat is AIToday? →

Ask AI

Ask AI anything about this article. The AI reads this article, earlier AIToday articles, and Wikipedia, and cites its sources. Q&As are published on this page for other readers too.

Questions and answers are published on this page.

Related Articles

Next articleOpenAI issues blueprint to arm cyber defenders in "defender's window"