Skip to content

gpt-oss implementationΒ #1739

Closed
Closed

Description

@sbhavani

Description

This outlines the current status of gpt-oss features that need to be implemented in Megatron Core, leveraging Transformer Engine.

βœ… UPDATE: All core GPT-OSS functionality is now available in Megatron Core (training) and Megatron Bridge (checkpoint conversion).

MoE Layer

Enabled Bias

Attention Mechanisms

Alternating Sliding-Window Attention Pattern

  • Status: βœ… Supported - Infrastructure exists for per-layer patterns and sliding window attention using TE

Attention Sinks

Activation Functions

Custom SwiGLU with Clamping

  • Status: βœ… Supported
  • Implementation: Megatron Core added partially fused version as "custom quick GeGLU"

FP8-aware fused kernel merged into Transformer Engine

Positional Encodings

YaRN RoPE Scaling

  • Status: βœ… Fully Supported
  • Implementation:
    • YaRN scaling to 128k+ context
    • Integration with existing RoPE
    • YaRN for general RoPE/GPT models
    • Convergence validation
  • Usage: --position-embedding-type yarn with YaRN configuration parameters
  • Reference: arXiv:2309.00071

Megatron Bridge Support

Megatron Bridge provides full GPT-OSS integration:

  • βœ… Checkpoint Conversion: Hugging Face ↔ Megatron format
  • βœ… Pre-configured Providers: GPTOSSProvider20B and GPTOSSProvider120B
  • βœ… Quantization Support: Handles MXFP4 weight dequantization

Megatron Bridge + Megatron-LM Example

PR: #2383 provides end-to-end example scripts covering checkpoint conversion (convert_mcore_bf16_checkpoint_from_hf.py) and training/fine-tuning (training_gptoss_20b_h100_bf16_fp8.sh)

Credits: @cuichenx for core implementation, @yiakwy-xpu-ml-framework-team for example scripts

Activity

  1. changed the title [-]GPT-OSS Implementation[/-] [+]gpt-oss Implementation[/+] on Aug 11, 2025
  2. changed the title [-]gpt-oss Implementation[/-] [+]gpt-oss implementation[/+] on Aug 11, 2025
  3. Pikachu1412 commented on Aug 13, 2025

    @Pikachu1412

    So how can I train gptoss by this branch?

  4. sbhavani commented on Aug 13, 2025

    @sbhavani
    ContributorAuthor

    We have a guide in NeMo Framework (using Megatron Core): https://docs.nvidia.com/nemo-framework/user-guide/latest/llms/gpt_oss.html.

    Megatron-LM training scripts will be added soon

  5. self-assigned this
    on Sep 2, 2025
  6. liuqianchao commented on Oct 2, 2025

    @liuqianchao

    how is the progress of support gpt-oss

  7. jgcb00 commented on Oct 3, 2025

    @jgcb00

    Hi, is there any plan to implement intra-doc masking (Attention being only compute on a document not on the full sequence length) ?

    Best regards

  8. tushtush-mc commented on Oct 9, 2025

    @tushtush-mc

    @cuichenx Any update on long seq optimisations?

    Or for this branch to be merged in main?

  9. JimmyAwoe commented on Oct 23, 2025

    @JimmyAwoe

    Thanks for contribution first. So has this implementation already finished or closing? I haven't see any related argument about sliding attention window in megatron/training/argument.py.

  10. yiakwy-xpu-ml-framework-team commented on Nov 22, 2025

    @yiakwy-xpu-ml-framework-team

    @JimmyAwoe GPTOSS model is now provided in megatron bridge.

    They use megatron bridge to provide model variants now.

  11. yiakwy-xpu-ml-framework-team commented on Nov 24, 2025

    @yiakwy-xpu-ml-framework-team

    I have given GPT OSS training support here :

    #2383

    Image

    @JimmyAwoe simply try it out

  12. radna0 commented on Jan 7, 2026

    @radna0

    @sbhavani is gpt-oss now supported in megatron bridge? I'm getting
    Model architecture 'GptOssForCausalLM' is not yet supported
    this is in megatron-bridge==0.2.0rc6 and megatron-lm==core_r0.15.0

  13. sbhavani commented on Jan 7, 2026

    @sbhavani
    ContributorAuthor

    @radna0 what's your transformers version? it might work after you upgrade that.

    If you're still blocked please file an issue in Megatron Bridge and we'll take a look.

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

Metadata

Metadata

Assignees

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