Skip to content

quantize on config instead of on model - #3127

Merged
acisseJZhong merged 1 commit into
mainfrom
delete_model_convertor
Apr 28, 2026
Merged

acisseJZhong merged 1 commit into
mainfrom
delete_model_convertor

Conversation

@acisseJZhong

Copy link
Copy Markdown
Contributor

Continuation of #3032 (accidentally merged to wrong base branch). See #3032 for full description.

ghstack-source-id: 52d8d41
Pull Request resolved: #3032
@acisseJZhong
acisseJZhong merged commit 6348d93 into main Apr 28, 2026
23 of 35 checks passed
saforem2 added a commit to saforem2/torchtitan that referenced this pull request Apr 28, 2026
…ytorch#3127)

Upstream pytorch#3127 (quantize-on-config) removed model_converters from
JobConfig and from every parallelize_* signature. Quantization is now
applied to the model config at model_registry time rather than to the
runtime model.

- agpt/parallelize.py + moe/parallelize.py — drop model_converters kwarg
  and the ModelConvertersContainer import.
- ezpz/trainer.py — drop:
  - runtime config.model_converters.build()/convert(model)
  - the register_step_post_hook post_optimizer_hook (runtime quant updates
    are gone; quantization runs in forward via the converted config)
  - model_converters= kwargs from both parallelize_fn and pipelining_fn
    call sites
  - the QuantizationConverter import
  Switches has_quantization to read from model_config via
  torchtitan.components.quantization.utils.has_quantization.
saforem2 added a commit to saforem2/torchtitan that referenced this pull request Apr 28, 2026
- moe/__init__.py: extend model_registry() with a quantization parameter
  that takes list[QuantizationConverter.Config]. Each converter is
  applied to the model config via q.build().convert(config) before the
  ModelSpec is returned. Mirrors upstream's deepseek_v3 pattern.
- moe/config_registry.py: moe_671b() now re-registers via
  cfg.model_spec = model_registry("671B", quantization=[...]) instead
  of mutating cfg.model_converters (which no longer exists). Drop the
  ModelConvertersContainer import.
- upstream-sync.md: 22nd-sync entry covering pytorch#3127 (quantize-on-config),
  pytorch#2986 (LocalMapInnerAttention removal), and the MeshDimName ->
  MeshAxisName rename, plus what was replayed.
saforem2 added a commit to saforem2/torchtitan that referenced this pull request Apr 29, 2026
22nd sync (pytorch#3127 quantize-on-config, pytorch#2986 LocalMapInnerAttention removal,
pytorch#3113 MeshDimName rename). Documents the four replay commits, the
Float8GroupedMMConverter -> Float8GroupedExpertsConverter rename caught
during smoke-testing, and the smoke-test results (agpt 12.92 -> 7.14
across 50 steps, exit 0; moe in flight on the same trajectory).

# Parallel styles used for transformer block linear weights and their
# inputs may be different for float8 linears with tensorwise scaling.
if enable_float8_tensorwise_tp:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sorry for posting comment on merged PR.

But I'm curious why tensorwise was removed? We currently run an older version of torchtitan and use this, and we observe MFU drop when switching to rowwise, consistent with documentation: https://docs.pytorch.org/ao/stable/workflows/training.html

@tianyu-l @acisseJZhong

@tianyu-l

Copy link
Copy Markdown
Contributor

@zpw1337 for sure tensorwise can give faster MFU, so it's not surprise. The interesting part is the tradeoff between MFU and numerics (tensorwise is "less accurate" compared with rowwise / blockwise).

Can I ask if you have evidence that tensorwise gives better model quality?

@zpw1337

zpw1337 commented Jun 22, 2026

Copy link
Copy Markdown

@zpw1337 for sure tensorwise can give faster MFU, so it's not surprise. The interesting part is the tradeoff between MFU and numerics (tensorwise is "less accurate" compared with rowwise / blockwise).

Can I ask if you have evidence that tensorwise gives better model quality?

Thanks for the reply. I'm not implying tensorwise gives better model quality. It's just that we've been training models with preference of higher MFU. I'm wondering it would reasonable to expose both and let the user choose like before?

@tianyu-l

Copy link
Copy Markdown
Contributor

It's just that we've been training models with preference of higher MFU. I'm wondering it would reasonable to expose both and let the user choose like before?

This is where I'm interested in learning convincing benefits over blindly supporting as many features as possible.

Could you show at least one tech report / blog post which says one could train a good model with tensorwise fp8?

@YassineYousfi

Copy link
Copy Markdown
Contributor

@tianyu-l

Could you show at least one tech report / blog post which says one could train a good model with tensorwise fp8?

We trained video DiTs up to 4B params dense with tensorwise fp8, we are writing a report + open sourcing the code for them in the next couple weeks. We haven't seen much numerics degradation with tensorwise, but we don't mind moving to row/blockwise for our next bigger runs if that does not hurt MFU much.

With that said, the diff to add back support for tensorwise + enable_fsdp_float8_all_gather + precompute_float8_dynamic_scale_for_fsdp is fairly small.

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.

4 participants