Skip to content

Own Float8 and NVFP4 quantized autograd - #4820

Merged
anijain2305 merged 9 commits into
mainfrom
gh/anijain2305/33/head
Sep 22, 2026
Merged

anijain2305 merged 9 commits into
mainfrom
gh/anijain2305/33/head

Conversation

@anijain2305

@anijain2305 anijain2305 commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

TorchTitan now owns dense and grouped Float8/NVFP4 autograd and FSDP-managed weight operands; TorchAO supplies only low-level quantization and GEMM kernels.

Ran bitwise tests to check equivalence

This PR just moves the impl to titan. We should also do another pass on what to deprecate.

[ghstack-poisoned]
[ghstack-poisoned]
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 21, 2026
[ghstack-poisoned]
@anijain2305 anijain2305 changed the title Own Float8 and NVFP4 linear autograd Own Float8 and NVFP4 quantized autograd Sep 21, 2026
anijain2305 added a commit that referenced this pull request Sep 21, 2026
Move Float8 and NVFP4 into packages matching the MXFP8 layout, with optional dependency handling limited to package imports. TorchTitan now owns dense and grouped Float8 autograd and FSDP-managed weight operands; TorchAO supplies only low-level quantization and GEMM kernels.

ghstack-source-id: a3f5d7b

Pull-Request: #4820
@anijain2305 anijain2305 added ciflow/h100.8 Trigger H100.8 CI ciflow/b200 Trigger B200 CI labels Sep 21, 2026
[ghstack-poisoned]
anijain2305 added a commit that referenced this pull request Sep 21, 2026
Move Float8 and NVFP4 into packages matching the MXFP8 layout, with optional dependency handling limited to package imports. TorchTitan now owns dense and grouped Float8 autograd and FSDP-managed weight operands; TorchAO supplies only low-level quantization and GEMM kernels.

ghstack-source-id: bb315d9

Pull-Request: #4820
[ghstack-poisoned]
anijain2305 added a commit that referenced this pull request Sep 21, 2026
Move Float8 and NVFP4 into packages matching the MXFP8 layout, with optional dependency handling limited to package imports. TorchTitan now owns dense and grouped Float8 autograd and FSDP-managed weight operands; TorchAO supplies only low-level quantization and GEMM kernels.

ghstack-source-id: af0d9bf

Pull-Request: #4820
@anijain2305
anijain2305 marked this pull request as ready for review September 21, 2026 19:37
@pytorch-bot pytorch-bot Bot added the ciflow/fake-pg Run 1-GPU Fake PG integration tests label Sep 21, 2026

@tianyu-l tianyu-l left a comment

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.

didn't read carefully, patterns seem following mxfp8


For scaling strategy, we support rowwise dynamic scaling (alpha).

### TorchAO and TorchTitan boundary

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.

I wonder if we only need one such disclaimer under quantization/ for multiple formats

_nvfp4_linear_import_error = import_error


def nvfp4_bf16_tail_fqns(num_layers: int, bf16_tail_fraction: float) -> list[str]:

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.

sounds like should go to nvfp4/utils.py

Comment thread README.md Outdated
- [Interoperable checkpoints](docs/checkpoint.md) which can be loaded directly into [`torchtune`](https://github.com/pytorch/torchtune) for fine-tuning
5. `torch.compile` support
6. [Float8](https://discuss.pytorch.org/t/distributed-w-torchtitan-enabling-float8-all-gather-in-fsdp2/209323) support ([how-to](torchtitan/quantization/float8.md))
6. [Float8](https://discuss.pytorch.org/t/distributed-w-torchtitan-enabling-float8-all-gather-in-fsdp2/209323) support ([how-to](torchtitan/quantization/float8/README.md))

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.

maybe unify float8, nvfp4, mxfp8 under a single quantization bullet point

Comment thread README.md Outdated
* [torchtitan/distributed/pipeline_parallel.py](torchtitan/distributed/pipeline_parallel.py) - helpers for applying Pipeline Parallel to the model
* [torchtitan/components/checkpointer/dcp.py](torchtitan/components/checkpointer/dcp.py) - utils for saving/loading distributed checkpoints
* [torchtitan/quantization/float8.py](torchtitan/quantization/float8.py) - utils for applying Float8 techniques
* [torchtitan/quantization/float8/](torchtitan/quantization/float8/) - Float8 training components

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.

very outdated, let's remove this section

@tianyu-l
tianyu-l requested a review from vkuzo September 22, 2026 00:47
[ghstack-poisoned]
anijain2305 added a commit that referenced this pull request Sep 22, 2026
Move Float8 and NVFP4 into packages matching the MXFP8 layout, with optional dependency handling limited to package imports. TorchTitan now owns dense and grouped Float8 autograd and FSDP-managed weight operands; TorchAO supplies only low-level quantization and GEMM kernels.

ghstack-source-id: 69b9005

Pull-Request: #4820
@anijain2305
anijain2305 changed the base branch from gh/anijain2305/33/base to main September 22, 2026 02:42
@anijain2305
anijain2305 changed the base branch from main to gh/anijain2305/33/base September 22, 2026 02:43
[ghstack-poisoned]
[ghstack-poisoned]
anijain2305 added a commit that referenced this pull request Sep 22, 2026
Move Float8 and NVFP4 into packages matching the MXFP8 layout, with optional dependency handling limited to package imports. TorchTitan now owns dense and grouped Float8 autograd and FSDP-managed weight operands; TorchAO supplies only low-level quantization and GEMM kernels.

ghstack-source-id: ae864b3

Pull-Request: #4820
@anijain2305
anijain2305 changed the base branch from gh/anijain2305/33/base to main September 22, 2026 02:45
@anijain2305
anijain2305 changed the base branch from main to gh/anijain2305/33/base September 22, 2026 03:02
[ghstack-poisoned]
anijain2305 added a commit that referenced this pull request Sep 22, 2026
Move Float8 and NVFP4 into packages matching the MXFP8 layout, with optional dependency handling limited to package imports. TorchTitan now owns dense and grouped Float8 autograd and FSDP-managed weight operands; TorchAO supplies only low-level quantization and GEMM kernels.

ghstack-source-id: 40ca836

Pull-Request: #4820
@anijain2305
anijain2305 changed the base branch from gh/anijain2305/33/base to main September 22, 2026 03:04
@anijain2305
anijain2305 merged commit c883f88 into main Sep 22, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/b200 Trigger B200 CI ciflow/fake-pg Run 1-GPU Fake PG integration tests ciflow/h100.8 Trigger H100.8 CI 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.

2 participants