Skip to content

[Observability 1/7] Toy trainers for observability development - #2601

Closed
felipemello1 wants to merge 1 commit into
gh/felipemello1/17/basefrom
gh/felipemello1/17/head
Closed

felipemello1 wants to merge 1 commit into
gh/felipemello1/17/basefrom
gh/felipemello1/17/head

Conversation

@felipemello1

@felipemello1 felipemello1 commented Mar 16, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

How to review

Focus on the read.me. It should give you a mental model moving forward.
For the toy examples, just glance over it. No need to nitpick or understand it deeply. It is a base for PR development and can be deleted later.

Summary

Two toy training scripts that serve as development sandboxes for the observability APIs. They're minimal but exercise the same patterns as a real workflow.

toy_spmd.py — 4-GPU SPMD trainer with 2D parallelism (DP=2, TP=2). Runs with torch.distributed.run.

toy_rl.py — Multi-actor RL loop using Monarch. A controller orchestrates a rollouter, reward scorer, and trainer.

Test plan

Overfitting to the same batch to show training.

Console output toy_spmd

step: 1  loss: 3.65555  grad_norm: 0.49419
step: 5  loss: 3.05283  grad_norm: 0.40876
step: 10  loss: 2.53639  grad_norm: 0.31771
  val loss: 2.4611
step: 20  loss: 2.02626  grad_norm: 0.22093
  val loss: 1.9949
Done. Output: outputs/toy_spmd

Console output toy_rl

step: 1  loss: 3.65156  grad_norm: 0.49804
step: 1  reward_mean: 1.00000
step: 2  loss: 3.48354  grad_norm: 0.47334
step: 2  reward_mean: 1.00000
step: 3  loss: 3.32657  grad_norm: 0.44708
step: 3  reward_mean: 1.00000
step: 6  loss: 2.93530  grad_norm: 0.36988
step: 6  reward_mean: 1.00000
Done in 14.4s. Output: outputs/toy_rl

Each step logs both training loss and RL reward.

Run toy_spmd:
python -m torch.distributed.run --nproc_per_node=4 -m torchtitan.experiments.observability.toy_spmd
Run toy_rl:
python -m torchtitan.experiments.observability.toy_rl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/8gpu CLA Signed This label is managed by the Meta Open Source bot.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants