Skip to content

[RFC] Support sharding LM heads and adopting Online Softmax #8173

Description

@jinyouzhi

Motivation

Online softmax and in-place computation could significantly save memory, especially for OPSD teacher TP sharding.

Keypoints

  • Support the sharding LM heads with gather_output=False of ColumnParallelLinear
  • Enabling parallel CE loss feature (integrating Liger kernel)
  • Profiling the GPU footprint to evaluate
  • Unify the untied and tied path for LM heads

Revised Roadmap

PR Scope Status
#8146 Enable gather_output=True for column-parallel lm_head Merged
#8185 Uneven sharding + universal checkpoint; remove uneven-dim rowwise fallback Merged
PR-A (#8302) Lift hardcoded name == "lm_head" routing; training defaults to column parallelism; reject unsupported row-parallel training Merged
PR-B (#8309) gather_output=False + vocab-parallel cross entropy, pure PyTorch reference implementation WIP
PR-C VocabParallelEmbedding; unify tied and untied lm_head paths; fix #8290 To do
PR-D Optional Liger fused CE acceleration + memory profiling To do
PR-E Implement row-parallel lm_head training, including input slicing and backward dx all-reduce To do

Proposed PR Sequencing

#8146 ──► #8185 ──┬─► PR-A  Lift hardcoded routing; independently mergeable
                  │
                  └─► PR-B  gather_output=False + vocab-parallel CE
                        ├─► PR-C  VocabParallelEmbedding / tied-untied unification
                        └─► PR-D  Liger integration + profiling

PR-A ──► PR-E  Row-parallel lm_head training

PR-A is small and low-risk, and has no code-level dependency on gather_output;
it can be submitted against master in parallel. PR-B is the core of this RFC —
we suggest landing the pure PyTorch implementation first so that numerical
correctness can be reviewed independently, and deferring the Liger kernel
integration to PR-D.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions