Skip to content

UX feat: default fp32 master weights for full-parameter training with torch.optim #2475

Description

@yuhezhang-ai

Background

The dtype-handling bug fixes are now merged (#2419 and related). The framework now correctly wires model.torch_dtype through to optimizer state, sharding, and checkpointing. What remains is a UX / default-behavior problem, tracked here separately because it needs broad validation.

Problem

For long full-parameter training (pre-training or extended fine-tuning), the safe pattern is fp32 master weights + fp32 optimizer state. But today, if a user leaves model.torch_dtype unset (or auto/bfloat16) and uses torch.optim.AdamW, the resident params and the AdamW EMA buffers (exp_avg, exp_avg_sq) end up in bf16. This is silently fragile: bf16 EMA quantization can slow convergence (higher final loss) or, in worse cases, cause unstable grad_norm / loss spikes / divergence. Users have to know to set torch_dtype: float32 themselves.

See the mixed-precision guide for the full explanation.

Proposed change

Default model.torch_dtype to float32 for full-parameter training when the optimizer is a torch.optim.* optimizer (TE FusedAdam and PEFT/LoRA are unaffected). The resolver (resolve_storage_dtype) is already implemented but left dormant/unwired from the bug-fix PR — this issue is about turning it on.

Why this is longer-term

Enabling the fp32 default increases resident memory, so a number of existing example configs will likely OOM and need retuning (lower micro-batch, more GPUs, or activation checkpointing). This requires GPU validation across the affected configs before flipping the default.

Scope / tasks

  • Wire resolve_storage_dtype into the recipes (train_ft, vlm/finetune, train_seq_cls, retrieval/train_bi_encoder).
  • Audit and update example configs that OOM under the new default.
  • Ensure benchmark/generation paths opt out (throughput/inference don't want the fp32 default).
  • Update docs to describe the new default behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions