GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - NVIDIA/Megatron-LM: Ongoing research training transformer models at scale

BranchesTags
Open more actions menu

Latest commit

 

History

10,472 Commits
10,472 Commits

Folders and files

NameName
Last commit message
Last commit date
.agents
.agents
 
 
.claude
.claude
 
 
.github
.github
 
 
.gitlab
.gitlab
 
 
docker
docker
 
 
docs
docs
 
 
examples
examples
 
 
experimental/agent_compose
experimental/agent_compose
 
 
images
images
 
 
megatron
megatron
 
 
scripts
scripts
 
 
skills
skills
 
 
tasks
tasks
 
 
tests
tests
 
 
tools
tools
 
 
.cursorrules
.cursorrules
 
 
.gitignore
.gitignore
 
 
.gitlab-ci.yml
.gitlab-ci.yml
 
 
.pre-commit-config.yaml
.pre-commit-config.yaml
 
 
.pylintrc
.pylintrc
 
 
.python-version
.python-version
 
 
AGENTS.md
AGENTS.md
 
 
CLAUDE.md
CLAUDE.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
MANIFEST.in
MANIFEST.in
 
 
README.md
README.md
 
 
SECURITY.md
SECURITY.md
 
 
codecov.yml
codecov.yml
 
 
gpt_builders.py
gpt_builders.py
 
 
greptile.json
greptile.json
 
 
hybrid_builders.py
hybrid_builders.py
 
 
mamba_builders.py
mamba_builders.py
 
 
model_provider.py
model_provider.py
 
 
pretrain_gpt.py
pretrain_gpt.py
 
 
pretrain_hybrid.py
pretrain_hybrid.py
 
 
pretrain_mamba.py
pretrain_mamba.py
 
 
pretrain_vlm.py
pretrain_vlm.py
 
 
pyproject.toml
pyproject.toml
 
 
setup.py
setup.py
 
 
style-guide.md
style-guide.md
 
 
train_rl.py
train_rl.py
 
 
uv.lock
uv.lock
 
 

Repository files navigation

Megatron-LM and Megatron Core

GPU-optimized library for training transformer models at scale

Documentation version license

About

This repository contains two components: Megatron-LM and Megatron Core.

Megatron-LM is a reference example that includes Megatron Core plus pre-configured training scripts, ideal for research teams, learning distributed training, and quick experimentation.

Megatron Core is a composable library with GPU-optimized building blocks for custom training frameworks. It provides transformer building blocks, advanced parallelism strategies (TP, PP, DP, EP, and CP), mixed precision support (FP16, BF16, FP8, and FP4), and model architectures, ideal for framework developers and ML engineers building custom training pipelines.

Megatron Bridge provides bidirectional Hugging Face ↔ Megatron checkpoint conversion with production-ready recipes.

Getting Started

Compatibility: Python 3.12+ and PyTorch 2.6.0+ recommended. For source development, the tested NGC PyTorch base images are pinned in docker/.ngc_version.dev and docker/.ngc_version.lts.

Install from PyPI:

uv pip install megatron-core

Or clone and install from source:

git clone https://github.com/NVIDIA/Megatron-LM.git
cd Megatron-LM
uv pip install -e .

Note: Building from source can use a lot of memory. If the build runs out of memory, limit parallel compilation jobs by setting MAX_JOBS (for example, MAX_JOBS=4 uv pip install -e .).

For NVIDIA GPU Cloud (NGC) container setup and all installation options, review the Installation Guide.

  • Your First Training Run - End-to-end training examples with data preparation
  • Parallelism Strategies - Scale training across GPUs with TP, PP, DP, EP, and CP
  • Contribution Guide - How to contribute to Megatron Core
  • Style Guide - Python style overrides

Latest News

  • [2026/10] Scale Bitwise-Deterministic Pretraining with NVIDIA Megatron Core - A guide to reproducing training runs, validating checkpoint resume, and reducing determinism overhead at scale with Megatron Core.
  • [2026/08] Megatron Core 0.19 - Introduces HybridModel, quantile-based MoE router balancing, packed-sequence MoE dispatch, and CUDA Graph-compatible activation offloading.
  • [2026/07] DeepSeek-V3 pretraining on GB300 NVL72 - Megatron Core achieves 1,648 TFLOPs/s per GPU for DeepSeek-V3 671B on 256 GPUs.
  • [2026/05] DeepSeek-V4 initial support - Megatron Core's dev branch includes the initial DeepSeek-V4 implementation; Megatron Bridge provides conversion, inference, and pretraining recipes.
  • [2026/04] Advancing Emerging Optimizers for Accelerated LLM Training with NVIDIA Megatron - Muon and other emerging optimizers are now supported in Megatron Core via the new Emerging-Optimizers library.

Previous News

Project Structure

Megatron-LM/
├── megatron/
│   ├── core/                    # Megatron Core (kernels, parallelism, building blocks)
│   │   ├── models/              # Transformer, hybrid, and multimodal models
│   │   ├── transformer/         # Transformer building blocks
│   │   ├── tensor_parallel/     # Tensor parallelism
│   │   ├── pipeline_parallel/   # Pipeline parallelism
│   │   ├── context_parallel/    # Context parallelism
│   │   ├── distributed/         # Distributed training (Megatron FSDP, DDP)
│   │   ├── dist_checkpointing/  # Distributed checkpoint saving, loading, and resharding
│   │   ├── optimizer/           # Optimizers
│   │   ├── datasets/            # Dataset loaders
│   │   ├── inference/           # Inference engines and server
│   │   └── export/              # Model export (example: TensorRT-LLM)
│   ├── training/                # Training scripts
│   └── post_training/           # Post-training (quantization, distillation, pruning, etc.)
└── examples/                    # Ready-to-use training examples

Performance Benchmarking

The NVIDIA Megatron Bridge Performance Summary publishes training throughput, system configurations, parallelism settings, and links to performance recipes and reproduction instructions. Use the container and matching code version specified by those instructions when reproducing a result.

Selected results from the 26.08.01 NeMo container (August 2026):

Model System GPUs Precision Sequence length Tokens/s/GPU Model TFLOPs/s/GPU
DeepSeek-V3 DGX-GB300 256 MXFP8 4,096 6,288 1,636
DeepSeek-V3 DGX-GB200 256 MXFP8 4,096 4,912 1,277
Qwen3-235B-A22B DGX-GB300 256 MXFP8 4,096 8,832 1,306
Nemotron 3 Ultra DGX-GB300 256 NVFP4 8,192 3,744 1,348

See the summary for the full batch sizes and parallelism configurations. MoE benchmarks use force-balanced expert routing and do not drop tokens. These results measure performance under the published benchmark conditions; throughput depends on the model, precision, hardware, and configuration.

Roadmaps

  • 2026 Q3 Megatron Core Roadmap
  • 2026 Q3 MoE Roadmap [dev branch first developments]
  • 2026 Q3 Megatron FSDP v2 Roadmap [experimental]

Resources

Getting Help

  • 📖 Documentation - Official guides and API reference
  • 🐛 Issues - Bug reports and feature requests

Contributing

Contributions are welcome. Ways to contribute:

  • 🐛 Report bugs - Help improve reliability
  • 💡 Suggest features - Shape the future of Megatron Core
  • 📝 Improve docs - Make Megatron Core more accessible
  • 🔧 Submit PRs - Contribute code improvements

→ Contributing Guide

Citation

If you use Megatron in your research or project, use the following citation:

@article{megatron-lm,
  title={Megatron-LM: Training Multi-Billion Parameter Language Models Using Model Parallelism},
  author={Shoeybi, Mohammad and Patwary, Mostofa and Puri, Raul and LeGresley, Patrick and Casper, Jared and Catanzaro, Bryan},
  journal={arXiv preprint arXiv:1909.08053},
  year={2019}
}

About

Ongoing research training transformer models at scale

docs.nvidia.com/megatron-core/developer-guide/latest/get-started/quickstart.html

Topics

large-language-modelsmodel-paratransformers

Resources

Readme
License

Contributing

Contributing

Security policy

Security policy
Activity
Custom properties

Stars

18.4k stars

Watchers

162 watching

Forks

4.7k forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.