Skip to content

[graph_trainer] Add bitwise deterministic guardrail test - #2799

Merged
SherlockNoMad merged 17 commits into
mainfrom
gh/SherlockNoMad/8/head
Apr 7, 2026
Merged

SherlockNoMad merged 17 commits into
mainfrom
gh/SherlockNoMad/8/head

Conversation

@SherlockNoMad

@SherlockNoMad SherlockNoMad commented Apr 2, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

Add test_bitwise_deterministic.py that verifies GraphTrainer (aot_fx_trace)
and Trainer (eager) produce bitwise identical losses, model weights, and
gradients on both Llama3 and DeepSeek-v3 debug models. Uses hash_model and
hash_gradient utilities for efficient whole-model comparison.

This serves as a guardrail — all graph_trainer changes must pass this
test before proceeding with other tests.

Also adds hash_model/hash_gradient to torchtitan/tools/utils.py and
documents the guardrail in graph_trainer's CLAUDE.md.

TODO:

  1. Use distributed setup for multi-GPU testing

Add a dedicated CLAUDE.md for the graph_trainer experiment covering:
- Graph pass signature convention (gm, example_inputs, *, kwargs) -> gm
- Core modification policy (extend via subclassing, not branching)
- Local development commands for Llama3 and DeepSeek-v3 aot_fx_trace
- Unit, numerics, and integration test commands
- Reference to root CLAUDE.md for shared conventions

[ghstack-poisoned]
Add test_bitwise_deterministic.py that verifies GraphTrainer (aot_fx_trace)
and Trainer (eager) produce bitwise identical losses, model weights, and
gradients on both Llama3 and DeepSeek-v3 debug models. Uses hash_model and
hash_gradient utilities for efficient whole-model comparison.

This serves as a guardrail — all graph_trainer changes must pass this
test before proceeding with other tests.

Also adds hash_model/hash_gradient to torchtitan/tools/utils.py and
documents the guardrail in graph_trainer's CLAUDE.md.

TODO:
1. Use distributed setup for multi-GPU testing

[ghstack-poisoned]
Add a dedicated CLAUDE.md for the graph_trainer experiment covering:
- Graph pass signature convention (gm, example_inputs, *, kwargs) -> gm
- Core modification policy (extend via subclassing, not branching)
- Local development commands for Llama3 and DeepSeek-v3 aot_fx_trace
- Unit, numerics, and integration test commands
- Reference to root CLAUDE.md for shared conventions

[ghstack-poisoned]
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Apr 2, 2026
SherlockNoMad added a commit that referenced this pull request Apr 2, 2026
Add test_bitwise_deterministic.py that verifies GraphTrainer (aot_fx_trace)
and Trainer (eager) produce bitwise identical losses, model weights, and
gradients on both Llama3 and DeepSeek-v3 debug models. Uses hash_model and
hash_gradient utilities for efficient whole-model comparison.

This serves as a guardrail — all graph_trainer changes must pass this
test before proceeding with other tests.

Also adds hash_model/hash_gradient to torchtitan/tools/utils.py and
documents the guardrail in graph_trainer's CLAUDE.md.

TODO:
1. Use distributed setup for multi-GPU testing

ghstack-source-id: c9165a8
Pull Request resolved: #2799
Add test_bitwise_deterministic.py that verifies GraphTrainer (aot_fx_trace)
and Trainer (eager) produce bitwise identical losses, model weights, and
gradients on both Llama3 and DeepSeek-v3 debug models. Uses hash_model and
hash_gradient utilities for efficient whole-model comparison.

This serves as a guardrail — all graph_trainer changes must pass this
test before proceeding with other tests.

Also adds hash_model/hash_gradient to torchtitan/tools/utils.py and
documents the guardrail in graph_trainer's CLAUDE.md.

TODO:
1. Use distributed setup for multi-GPU testing

[ghstack-poisoned]
SherlockNoMad added a commit that referenced this pull request Apr 2, 2026
Add test_bitwise_deterministic.py that verifies GraphTrainer (aot_fx_trace)
and Trainer (eager) produce bitwise identical losses, model weights, and
gradients on both Llama3 and DeepSeek-v3 debug models. Uses hash_model and
hash_gradient utilities for efficient whole-model comparison.

This serves as a guardrail — all graph_trainer changes must pass this
test before proceeding with other tests.

Also adds hash_model/hash_gradient to torchtitan/tools/utils.py and
documents the guardrail in graph_trainer's CLAUDE.md.

TODO:
1. Use distributed setup for multi-GPU testing

ghstack-source-id: 58f4079
Pull Request resolved: #2799
Add test_bitwise_deterministic.py that verifies GraphTrainer (aot_fx_trace)
and Trainer (eager) produce bitwise identical losses, model weights, and
gradients on both Llama3 and DeepSeek-v3 debug models. Uses hash_model and
hash_gradient utilities for efficient whole-model comparison.

This serves as a guardrail — all graph_trainer changes must pass this
test before proceeding with other tests.

Also adds hash_model/hash_gradient to torchtitan/tools/utils.py and
documents the guardrail in graph_trainer's CLAUDE.md.

TODO:
1. Use distributed setup for multi-GPU testing

[ghstack-poisoned]
SherlockNoMad added a commit that referenced this pull request Apr 2, 2026
Add test_bitwise_deterministic.py that verifies GraphTrainer (aot_fx_trace)
and Trainer (eager) produce bitwise identical losses, model weights, and
gradients on both Llama3 and DeepSeek-v3 debug models. Uses hash_model and
hash_gradient utilities for efficient whole-model comparison.

This serves as a guardrail — all graph_trainer changes must pass this
test before proceeding with other tests.

Also adds hash_model/hash_gradient to torchtitan/tools/utils.py and
documents the guardrail in graph_trainer's CLAUDE.md.

TODO:
1. Use distributed setup for multi-GPU testing

ghstack-source-id: 604814a
Pull Request resolved: #2799
Comment thread torchtitan/tools/utils.py Outdated
if isinstance(obj, torch.Tensor):
if isinstance(obj, DTensor):
t = obj.to_local().cpu().contiguous()
else:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

just curious, how long does this take for a model like 8B or 70B? (or what size models have you been using it on)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have been using debug configs, which is tiny model, and the test is <20s.
I have previously uses the same hash for internal T2 models, perf doesn't seems to be an issue.

Add test_bitwise_deterministic.py that verifies GraphTrainer (aot_fx_trace)
and Trainer (eager) produce bitwise identical losses, model weights, and
gradients on both Llama3 and DeepSeek-v3 debug models. Uses hash_model and
hash_gradient utilities for efficient whole-model comparison.

This serves as a guardrail — all graph_trainer changes must pass this
test before proceeding with other tests.

Also adds hash_model/hash_gradient to torchtitan/tools/utils.py and
documents the guardrail in graph_trainer's CLAUDE.md.

TODO:
1. Use distributed setup for multi-GPU testing

[ghstack-poisoned]
SherlockNoMad added a commit that referenced this pull request Apr 3, 2026
Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at
bottom):
* #2802
* #2799
* __->__ #2797

Add a dedicated CLAUDE.md for the graph_trainer experiment covering:
- Graph pass signature convention (gm, example_inputs, *, kwargs) -> gm
- Core modification policy (extend via subclassing, not branching)
- Local development commands for Llama3 and DeepSeek-v3 aot_fx_trace
- Unit, numerics, and integration test commands
- Reference to root CLAUDE.md for shared conventions
SherlockNoMad added a commit that referenced this pull request Apr 3, 2026
Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at
bottom):
* #2802
* #2799
* __->__ #2797

Add a dedicated CLAUDE.md for the graph_trainer experiment covering:
- Graph pass signature convention (gm, example_inputs, *, kwargs) -> gm
- Core modification policy (extend via subclassing, not branching)
- Local development commands for Llama3 and DeepSeek-v3 aot_fx_trace
- Unit, numerics, and integration test commands
- Reference to root CLAUDE.md for shared conventions
…guardrail test"

Add test_bitwise_deterministic.py that verifies GraphTrainer (aot_fx_trace)
and Trainer (eager) produce bitwise identical losses, model weights, and
gradients on both Llama3 and DeepSeek-v3 debug models. Uses hash_model and
hash_gradient utilities for efficient whole-model comparison.

This serves as a guardrail — all graph_trainer changes must pass this
test before proceeding with other tests.

Also adds hash_model/hash_gradient to torchtitan/tools/utils.py and
documents the guardrail in graph_trainer's CLAUDE.md.

TODO:
1. Use distributed setup for multi-GPU testing

[ghstack-poisoned]
Add test_bitwise_deterministic.py that verifies GraphTrainer (aot_fx_trace)
and Trainer (eager) produce bitwise identical losses, model weights, and
gradients on both Llama3 and DeepSeek-v3 debug models. Uses hash_model and
hash_gradient utilities for efficient whole-model comparison.

This serves as a guardrail — all graph_trainer changes must pass this
test before proceeding with other tests.

Also adds hash_model/hash_gradient to torchtitan/tools/utils.py and
documents the guardrail in graph_trainer's CLAUDE.md.

TODO:
1. Use distributed setup for multi-GPU testing

[ghstack-poisoned]
SherlockNoMad added a commit that referenced this pull request Apr 3, 2026
Add test_bitwise_deterministic.py that verifies GraphTrainer (aot_fx_trace)
and Trainer (eager) produce bitwise identical losses, model weights, and
gradients on both Llama3 and DeepSeek-v3 debug models. Uses hash_model and
hash_gradient utilities for efficient whole-model comparison.

This serves as a guardrail — all graph_trainer changes must pass this
test before proceeding with other tests.

Also adds hash_model/hash_gradient to torchtitan/tools/utils.py and
documents the guardrail in graph_trainer's CLAUDE.md.

TODO:
1. Use distributed setup for multi-GPU testing

ghstack-source-id: 6ddf67b
Pull Request resolved: #2799
Comment thread .ci/docker/requirements.txt Outdated
Comment on lines +11 to +12
numpy < 2
pytest

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done.

Comment thread torchtitan/tools/utils.py Outdated
t = obj.cpu().contiguous()
if per_tensor:
tensor_hash = hashlib.new(algo)
tensor_hash.update(t.numpy().tobytes())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

just curious -- do we have to depend on numpy to get bytes? Ideally we don't need to introduce numpy dependency if we can workaround it here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

alternative is to use tensor.untyped_storage(), but call is sinificantly slower than the numpy().tobytes() path.

Added a todo to investigate.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

looks like this is a known issue

pytorch/pytorch#108565 (comment)

shows benchmark

Comment thread torchtitan/tools/utils.py Outdated
return 312e12


def _hash_model_impl(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

since these functions are only used in testing, can we put them in [repo_root]/test/utils.py for now?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done.

# pytest torchtitan/experiments/graph_trainer/tests/test_precompile.py -v

# Run bitwise deterministic guardrail test
pytest torchtitan/experiments/graph_trainer/tests/test_bitwise_deterministic.py -v

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

just so I understand correctly, this is running identical test on all 8 ranks.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this is still a single gpu test atm.
We can make it a distribute test to cover deterministic of distributed init/ops.
If we don't have such coverage in titan core, we should add one.

…guardrail test"

Add test_bitwise_deterministic.py that verifies GraphTrainer (aot_fx_trace)
and Trainer (eager) produce bitwise identical losses, model weights, and
gradients on both Llama3 and DeepSeek-v3 debug models. Uses hash_model and
hash_gradient utilities for efficient whole-model comparison.

This serves as a guardrail — all graph_trainer changes must pass this
test before proceeding with other tests.

Also adds hash_model/hash_gradient to torchtitan/tools/utils.py and
documents the guardrail in graph_trainer's CLAUDE.md.

TODO:
1. Use distributed setup for multi-GPU testing

[ghstack-poisoned]
Add test_bitwise_deterministic.py that verifies GraphTrainer (aot_fx_trace)
and Trainer (eager) produce bitwise identical losses, model weights, and
gradients on both Llama3 and DeepSeek-v3 debug models. Uses hash_model and
hash_gradient utilities for efficient whole-model comparison.

This serves as a guardrail — all graph_trainer changes must pass this
test before proceeding with other tests.

Also adds hash_model/hash_gradient to torchtitan/tools/utils.py and
documents the guardrail in graph_trainer's CLAUDE.md.

TODO:
1. Use distributed setup for multi-GPU testing

[ghstack-poisoned]
SherlockNoMad added a commit that referenced this pull request Apr 4, 2026
Add test_bitwise_deterministic.py that verifies GraphTrainer (aot_fx_trace)
and Trainer (eager) produce bitwise identical losses, model weights, and
gradients on both Llama3 and DeepSeek-v3 debug models. Uses hash_model and
hash_gradient utilities for efficient whole-model comparison.

This serves as a guardrail — all graph_trainer changes must pass this
test before proceeding with other tests.

Also adds hash_model/hash_gradient to torchtitan/tools/utils.py and
documents the guardrail in graph_trainer's CLAUDE.md.

TODO:
1. Use distributed setup for multi-GPU testing

ghstack-source-id: 4c052fe
Pull Request resolved: #2799
SherlockNoMad added a commit that referenced this pull request Apr 6, 2026
Add test_bitwise_deterministic.py that verifies GraphTrainer (aot_fx_trace)
and Trainer (eager) produce bitwise identical losses, model weights, and
gradients on both Llama3 and DeepSeek-v3 debug models. Uses hash_model and
hash_gradient utilities for efficient whole-model comparison.

This serves as a guardrail — all graph_trainer changes must pass this
test before proceeding with other tests.

Also adds hash_model/hash_gradient to torchtitan/tools/utils.py and
documents the guardrail in graph_trainer's CLAUDE.md.

TODO:
1. Use distributed setup for multi-GPU testing

ghstack-source-id: 6ddf67b
Pull Request resolved: #2799
…guardrail test"

Add test_bitwise_deterministic.py that verifies GraphTrainer (aot_fx_trace)
and Trainer (eager) produce bitwise identical losses, model weights, and
gradients on both Llama3 and DeepSeek-v3 debug models. Uses hash_model and
hash_gradient utilities for efficient whole-model comparison.

This serves as a guardrail — all graph_trainer changes must pass this
test before proceeding with other tests.

Also adds hash_model/hash_gradient to torchtitan/tools/utils.py and
documents the guardrail in graph_trainer's CLAUDE.md.

TODO:
1. Use distributed setup for multi-GPU testing

[ghstack-poisoned]
Add test_bitwise_deterministic.py that verifies GraphTrainer (aot_fx_trace)
and Trainer (eager) produce bitwise identical losses, model weights, and
gradients on both Llama3 and DeepSeek-v3 debug models. Uses hash_model and
hash_gradient utilities for efficient whole-model comparison.

This serves as a guardrail — all graph_trainer changes must pass this
test before proceeding with other tests.

Also adds hash_model/hash_gradient to torchtitan/tools/utils.py and
documents the guardrail in graph_trainer's CLAUDE.md.

TODO:
1. Use distributed setup for multi-GPU testing

[ghstack-poisoned]
@SherlockNoMad
SherlockNoMad requested a review from aditvenk as a code owner April 6, 2026 20:16
SherlockNoMad added a commit that referenced this pull request Apr 6, 2026
Add test_bitwise_deterministic.py that verifies GraphTrainer (aot_fx_trace)
and Trainer (eager) produce bitwise identical losses, model weights, and
gradients on both Llama3 and DeepSeek-v3 debug models. Uses hash_model and
hash_gradient utilities for efficient whole-model comparison.

This serves as a guardrail — all graph_trainer changes must pass this
test before proceeding with other tests.

Also adds hash_model/hash_gradient to torchtitan/tools/utils.py and
documents the guardrail in graph_trainer's CLAUDE.md.

TODO:
1. Use distributed setup for multi-GPU testing

ghstack-source-id: 3fdd7af
Pull Request resolved: #2799
@SherlockNoMad
SherlockNoMad changed the base branch from gh/SherlockNoMad/8/base to main April 6, 2026 20:16
SherlockNoMad added a commit that referenced this pull request Apr 6, 2026
Add test_bitwise_deterministic.py that verifies GraphTrainer (aot_fx_trace)
and Trainer (eager) produce bitwise identical losses, model weights, and
gradients on both Llama3 and DeepSeek-v3 debug models. Uses hash_model and
hash_gradient utilities for efficient whole-model comparison.

This serves as a guardrail — all graph_trainer changes must pass this
test before proceeding with other tests.

Also adds hash_model/hash_gradient to torchtitan/tools/utils.py and
documents the guardrail in graph_trainer's CLAUDE.md.

TODO:
1. Use distributed setup for multi-GPU testing

ghstack-source-id: 6ddf67b
Pull Request resolved: #2799
…guardrail test"

Add test_bitwise_deterministic.py that verifies GraphTrainer (aot_fx_trace)
and Trainer (eager) produce bitwise identical losses, model weights, and
gradients on both Llama3 and DeepSeek-v3 debug models. Uses hash_model and
hash_gradient utilities for efficient whole-model comparison.

This serves as a guardrail — all graph_trainer changes must pass this
test before proceeding with other tests.

Also adds hash_model/hash_gradient to torchtitan/tools/utils.py and
documents the guardrail in graph_trainer's CLAUDE.md.

TODO:
1. Use distributed setup for multi-GPU testing

[ghstack-poisoned]
Add test_bitwise_deterministic.py that verifies GraphTrainer (aot_fx_trace)
and Trainer (eager) produce bitwise identical losses, model weights, and
gradients on both Llama3 and DeepSeek-v3 debug models. Uses hash_model and
hash_gradient utilities for efficient whole-model comparison.

This serves as a guardrail — all graph_trainer changes must pass this
test before proceeding with other tests.

Also adds hash_model/hash_gradient to torchtitan/tools/utils.py and
documents the guardrail in graph_trainer's CLAUDE.md.

TODO:
1. Use distributed setup for multi-GPU testing

[ghstack-poisoned]
SherlockNoMad added a commit that referenced this pull request Apr 6, 2026
Add test_bitwise_deterministic.py that verifies GraphTrainer (aot_fx_trace)
and Trainer (eager) produce bitwise identical losses, model weights, and
gradients on both Llama3 and DeepSeek-v3 debug models. Uses hash_model and
hash_gradient utilities for efficient whole-model comparison.

This serves as a guardrail — all graph_trainer changes must pass this
test before proceeding with other tests.

Also adds hash_model/hash_gradient to torchtitan/tools/utils.py and
documents the guardrail in graph_trainer's CLAUDE.md.

TODO:
1. Use distributed setup for multi-GPU testing

ghstack-source-id: aa4e514
Pull Request resolved: #2799
…guardrail test"

Add test_bitwise_deterministic.py that verifies GraphTrainer (aot_fx_trace)
and Trainer (eager) produce bitwise identical losses, model weights, and
gradients on both Llama3 and DeepSeek-v3 debug models. Uses hash_model and
hash_gradient utilities for efficient whole-model comparison.

This serves as a guardrail — all graph_trainer changes must pass this
test before proceeding with other tests.

Also adds hash_model/hash_gradient to torchtitan/tools/utils.py and
documents the guardrail in graph_trainer's CLAUDE.md.

TODO:
1. Use distributed setup for multi-GPU testing

[ghstack-poisoned]
Add test_bitwise_deterministic.py that verifies GraphTrainer (aot_fx_trace)
and Trainer (eager) produce bitwise identical losses, model weights, and
gradients on both Llama3 and DeepSeek-v3 debug models. Uses hash_model and
hash_gradient utilities for efficient whole-model comparison.

This serves as a guardrail — all graph_trainer changes must pass this
test before proceeding with other tests.

Also adds hash_model/hash_gradient to torchtitan/tools/utils.py and
documents the guardrail in graph_trainer's CLAUDE.md.

TODO:
1. Use distributed setup for multi-GPU testing

[ghstack-poisoned]
SherlockNoMad added a commit that referenced this pull request Apr 6, 2026
Add test_bitwise_deterministic.py that verifies GraphTrainer (aot_fx_trace)
and Trainer (eager) produce bitwise identical losses, model weights, and
gradients on both Llama3 and DeepSeek-v3 debug models. Uses hash_model and
hash_gradient utilities for efficient whole-model comparison.

This serves as a guardrail — all graph_trainer changes must pass this
test before proceeding with other tests.

Also adds hash_model/hash_gradient to torchtitan/tools/utils.py and
documents the guardrail in graph_trainer's CLAUDE.md.

TODO:
1. Use distributed setup for multi-GPU testing

ghstack-source-id: adc501e
Pull Request resolved: #2799
@SherlockNoMad
SherlockNoMad merged commit 6c675c8 into main Apr 7, 2026
32 of 34 checks passed
SherlockNoMad added a commit that referenced this pull request Apr 7, 2026
Add test_bitwise_deterministic.py that verifies GraphTrainer (aot_fx_trace)
and Trainer (eager) produce bitwise identical losses, model weights, and
gradients on both Llama3 and DeepSeek-v3 debug models. Uses hash_model and
hash_gradient utilities for efficient whole-model comparison.

This serves as a guardrail — all graph_trainer changes must pass this
test before proceeding with other tests.

Also adds hash_model/hash_gradient to torchtitan/tools/utils.py and
documents the guardrail in graph_trainer's CLAUDE.md.

TODO:
1. Use distributed setup for multi-GPU testing

ghstack-source-id: 6ddf67b
Pull Request resolved: #2799
TXacs pushed a commit to McmillanTAC/torchtitan that referenced this pull request Apr 13, 2026
Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at
bottom):
* pytorch#2802
* pytorch#2799
* __->__ pytorch#2797

Add a dedicated CLAUDE.md for the graph_trainer experiment covering:
- Graph pass signature convention (gm, example_inputs, *, kwargs) -> gm
- Core modification policy (extend via subclassing, not branching)
- Local development commands for Llama3 and DeepSeek-v3 aot_fx_trace
- Unit, numerics, and integration test commands
- Reference to root CLAUDE.md for shared conventions
TXacs pushed a commit to McmillanTAC/torchtitan that referenced this pull request Apr 13, 2026
Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at
bottom):
* __->__ pytorch#2799

Add test_bitwise_deterministic.py that verifies GraphTrainer
(aot_fx_trace)
and Trainer (eager) produce bitwise identical losses, model weights, and
gradients on both Llama3 and DeepSeek-v3 debug models. Uses hash_model
and
hash_gradient utilities for efficient whole-model comparison.

This serves as a guardrail — all graph_trainer changes must pass this
test before proceeding with other tests.

Also adds hash_model/hash_gradient to torchtitan/tools/utils.py and
documents the guardrail in graph_trainer's CLAUDE.md.

TODO:
1. Use distributed setup for multi-GPU testing
jemitche1 pushed a commit to jemitche1/torchtitan that referenced this pull request Apr 14, 2026
Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at
bottom):
* pytorch#2802
* pytorch#2799
* __->__ pytorch#2797

Add a dedicated CLAUDE.md for the graph_trainer experiment covering:
- Graph pass signature convention (gm, example_inputs, *, kwargs) -> gm
- Core modification policy (extend via subclassing, not branching)
- Local development commands for Llama3 and DeepSeek-v3 aot_fx_trace
- Unit, numerics, and integration test commands
- Reference to root CLAUDE.md for shared conventions
jemitche1 pushed a commit to jemitche1/torchtitan that referenced this pull request Apr 14, 2026
Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at
bottom):
* __->__ pytorch#2799

Add test_bitwise_deterministic.py that verifies GraphTrainer
(aot_fx_trace)
and Trainer (eager) produce bitwise identical losses, model weights, and
gradients on both Llama3 and DeepSeek-v3 debug models. Uses hash_model
and
hash_gradient utilities for efficient whole-model comparison.

This serves as a guardrail — all graph_trainer changes must pass this
test before proceeding with other tests.

Also adds hash_model/hash_gradient to torchtitan/tools/utils.py and
documents the guardrail in graph_trainer's CLAUDE.md.

TODO:
1. Use distributed setup for multi-GPU testing
ACharacterInASimulation pushed a commit to ACharacterInASimulation/torchtitan that referenced this pull request Apr 21, 2026
Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at
bottom):
* pytorch#2802
* pytorch#2799
* __->__ pytorch#2797

Add a dedicated CLAUDE.md for the graph_trainer experiment covering:
- Graph pass signature convention (gm, example_inputs, *, kwargs) -> gm
- Core modification policy (extend via subclassing, not branching)
- Local development commands for Llama3 and DeepSeek-v3 aot_fx_trace
- Unit, numerics, and integration test commands
- Reference to root CLAUDE.md for shared conventions
ACharacterInASimulation pushed a commit to ACharacterInASimulation/torchtitan that referenced this pull request Apr 21, 2026
Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at
bottom):
* __->__ pytorch#2799

Add test_bitwise_deterministic.py that verifies GraphTrainer
(aot_fx_trace)
and Trainer (eager) produce bitwise identical losses, model weights, and
gradients on both Llama3 and DeepSeek-v3 debug models. Uses hash_model
and
hash_gradient utilities for efficient whole-model comparison.

This serves as a guardrail — all graph_trainer changes must pass this
test before proceeding with other tests.

Also adds hash_model/hash_gradient to torchtitan/tools/utils.py and
documents the guardrail in graph_trainer's CLAUDE.md.

TODO:
1. Use distributed setup for multi-GPU testing
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

None yet

Development

Successfully merging this pull request may close these issues.

3 participants