Skip to content

Grouped Linear issue #2409

Not planned
Not planned

Description

@wukong1992

I am training a model using the Megatron-DeepSpeed framework. Previously, I was using DeepSpeed MoE (MoE layers implemented with DeepSpeed) and the training was numerically stable — the loss curve and gradient norms behaved as expected.

Recently, I replaced the DeepSpeed MoE implementation with Transformer Engine’s Grouped Linear / Grouped GEMM (for MoE experts). After switching, I observe two major issues:

  1. Loss does not match the baseline (DeepSpeed MoE)

When running the same model, same configuration, same data, and same initialization:

The loss curve diverges from the baseline almost immediately.

Loss values cannot be aligned with the previous implementation even in the very first few steps.

Forward pass outputs appear numerically different from the original MoE implementation.

This suggests that the grouped GEMM path may be producing different numerical results compared to the standard GEMM/DeepSpeed MoE path.

  1. Gradient norm becomes extremely large

After enabling TE Grouped Linear, I observe:

Very large grad norms, sometimes orders of magnitude larger than under the baseline implementation.

This seems to originate from the MoE layers using grouped GEMM.

When switching back to DeepSpeed MoE or standard Linear layers, the grad norm returns to normal.

This indicates a potential stability / scaling problem inside grouped GEMM.

Activity

  1. added
    bug
    on Nov 21, 2025
  2. sbhavani commented on Jul 24, 2026

    @sbhavani
    Collaborator

    @wukong1992 sorry for the late response, could you provide a minimal repro plus the exact TE, Megatron-DeepSpeed, CUDA/cuBLAS, GPU, dtype/FP8, and TP/EP/DP configuration?

  3. pggPL commented on Dec 1, 2026

    @pggPL
    Collaborator

    Closing due to inactivity and missing reproduction/environment details since the follow-up request in July 2026. If you still observe numerical divergence or gradient-norm spikes with GroupedLinear on a recent Transformer Engine release, please reopen or file a new issue with a minimal standalone reproducer plus your TE, CUDA/cuBLAS, GPU, dtype/FP8, and parallelism configuration.

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

    bugneedinfo

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions