gitwtfhub

wtf is megatron-lm?

nvidia/megatron-lm — explained in plain English

Analysis updated 2026-06-24

16,322PythonAudience · researcherComplexity · 5/5Setup · hard

TL;DR

NVIDIA's Python library for training very large AI language models, from 2 billion to hundreds of billions of parameters, across thousands of GPUs simultaneously, using advanced parallelism built for research and production scale.

Mindmap

mindmap
  root((Megatron-LM))
    What It Does
      Trains large LLMs
      Multi-GPU scaling
      Research and production
    Parallelism Types
      Tensor parallelism
      Pipeline parallelism
      Data parallelism
    Precision Support
      FP8 and BF16
      Mixed precision
    Components
      Megatron-LM scripts
      Megatron Core library
    Audience
      ML researchers
      LLM engineers
      GPU cluster teams

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Train a custom large language model with hundreds of billions of parameters across a multi-GPU cluster

REASON 2

Fine-tune an existing large model using Megatron Core's composable pipeline designed for framework developers

REASON 3

Benchmark GPU cluster efficiency for LLM training using tensor, pipeline, and data parallelism together

REASON 4

Test FP8 and BF16 mixed-precision training to speed up compute on H100 GPU hardware

What's in the stack?

PythonPyTorchCUDA

How it stacks up

nvidia/megatron-lmqwenlm/qwen-agentmeta-llama/codellama
Stars16,32216,32116,327
LanguagePythonPythonPython
Setup difficultyhardmoderatehard
Complexity5/53/54/5
Audienceresearcherdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · hard Time to first run · 1day+

Requires a multi-GPU cluster with CUDA, benchmarks use H100 and A100 hardware, not suitable for single-GPU or CPU setups.

Wtf does this do

Megatron-LM is a GPU-optimized Python library from NVIDIA for training very large transformer models, the class of AI architectures that powers modern large language models. It is designed for research teams and ML engineers who need to train models ranging from 2 billion to hundreds of billions of parameters across thousands of GPUs simultaneously. The repository contains two main components. Megatron-LM is the higher-level reference implementation with pre-configured training scripts, useful for learning or experimentation. Megatron Core is the lower-level, composable library that framework developers can use to build custom training pipelines. The core technical challenge it solves is distributing model training across many GPUs efficiently, through multiple parallelism strategies: tensor parallelism (splitting individual operations across GPUs), pipeline parallelism (splitting model layers across GPUs), and data parallelism (running the same model on different data batches in parallel). It also supports mixed precision training, using lower-precision number formats like FP8 and BF16 to speed up computation. According to the benchmarks, it achieves up to 47% Model FLOP Utilization (a measure of hardware efficiency) on H100 GPU clusters, tested up to a 462-billion parameter model on 6,144 GPUs. You would use Megatron-LM if you are training or fine-tuning large language models at research or production scale and need tooling designed to work across large GPU clusters. The full README is longer than what was provided.

Yoink these prompts

Prompt 1
How do I set up Megatron-LM to fine-tune a language model across 8 A100 GPUs using tensor parallelism?
Prompt 2
What is the difference between Megatron-LM and Megatron Core, and which should I use to build a custom training pipeline?
Prompt 3
Walk me through configuring tensor parallelism and pipeline parallelism in Megatron-LM for a 65B parameter model
Prompt 4
How do I enable FP8 mixed precision training in Megatron-LM on an H100 GPU cluster?
Prompt 5
What does Model FLOP Utilization mean in the Megatron-LM benchmarks and how do I measure it for my own training run?

Frequently asked questions

wtf is megatron-lm?

NVIDIA's Python library for training very large AI language models, from 2 billion to hundreds of billions of parameters, across thousands of GPUs simultaneously, using advanced parallelism built for research and production scale.

What language is megatron-lm written in?

Mainly Python. The stack also includes Python, PyTorch, CUDA.

How hard is megatron-lm to set up?

Setup difficulty is rated hard, with roughly 1day+ to a first successful run.

Who is megatron-lm for?

Mainly researcher.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.