Skip to content

Add a guide for training on AWS Trainium - #7729

Merged
qgallouedec merged 11 commits into
mainfrom
docs-aws-trainium
Oct 14, 2026
Merged

qgallouedec merged 11 commits into
mainfrom
docs-aws-trainium

Conversation

@qgallouedec

@qgallouedec qgallouedec commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Resolves #7661.

Adds a "Training on AWS Trainium" how-to guide: installation, SFT (with the pad_to_multiple_of="auto" default from #7724), torch_compile with the static dynamo shapes workaround (#7660), GRPO/RLOO with the static cache (#7664), data parallel over NeuronCores, and memory. Every number comes from runs on a trn2 instance, and the SFT, compile and GRPO examples were run there (capped to a few steps).

Merge after #7724, since the page describes its default.

cc @michaelbenayoun


Note

Low Risk
Documentation and marketing copy only; no library or training runtime code changes in this diff.

Overview
Adds a Training on AWS Trainium how-to (aws_trainium.md) and wires it into the docs nav and What's New on the README and docs index (replacing the prior fused LM head highlight).

The guide documents running TRL trainers on Neuron via torch-neuronx with no code changes, and focuses on static shapes to limit slow recompiles: default pad_to_multiple_of behavior on Neuron, disabling Dynamo automatic dynamic shapes when using torch_compile=True, and cache_implementation="static" plus bf16 for GRPO/RLOO without vLLM. It also covers Accelerate data parallel across logical NeuronCores and NEURON_RT_VISIBLE_CORES, with benchmark numbers from trn2 runs.

Reviewed by Cursor Bugbot for commit 928802b. Bugbot is set up for automated code reviews on this repo. Configure here.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
πŸ“ Code Review βœ… Completed 2026-10-14T17:15:49.473359Z 376bd88 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with πŸ‘€ while any review is running, comments if it has suggestions, and reacts with πŸ‘ once all reviews finish with no findings.

@github-actions github-actions Bot added the πŸ“š documentation Improvements or additions to documentation label Oct 14, 2026
@bot-ci-comment

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ’‘ Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 376bd88151

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with πŸ‘.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/source/aws_trainium.md Resolved
Comment thread docs/source/aws_trainium.md Outdated
Comment on lines +76 to +84
## Data parallelism

A Trainium2 device exposes 4 logical NeuronCores. Train on all of them with [Accelerate](https://huggingface.co/docs/accelerate):

```bash
accelerate launch --num_processes 4 train.py
```

SFT scales to 3.6x on 4 NeuronCores. To pin a run to some NeuronCores with `NEURON_RT_VISIBLE_CORES`, use the pairs `0,1` or `2,3`, or all four: the Neuron runtime fails to set up the collectives on `1,2`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it the only form of parallelism supported in TRL for now?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the only one I tested on Trainium. TP/FSDP through the transformers distributed API (DistributedConfig) should work since TRL takes the model as is, but I haven't tried it yet.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright!

Comment thread docs/source/aws_trainium.md Resolved

@michaelbenayoun michaelbenayoun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks a lot for this!

@qgallouedec
qgallouedec merged commit 8f39f8f into main Oct 14, 2026
5 checks passed
@qgallouedec
qgallouedec deleted the docs-aws-trainium branch October 14, 2026 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

πŸ“š documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docs: a Trainium (Neuron) page

2 participants