█

AI/TLDR

Buy me a coffee
Buy me a coffee

LoongForge

Baidu's training framework for LLMs, VLMs, diffusion and robot models

Efficient TrainingOpen source
Latest
v0.2.2
Updated
5 Nov 2026
Language
Python
License
Apache-2.0
$docker pull loongforge/loongforge:latest

What's new

v0.2.25 Nov 2026

Added LoongForge-VLDA, LingBot-VLA-v2, GR00T-N1.7 and Wall-OSS-0.5 recipes, Kimi-K3, GLM-5.3-flash and Qwen3.8-27B training, and the Ego2Robot data pipeline. Also brought tensor-wise Muon, FP8 gradient communication and sturdier async checkpointing.

IN SHORT

What is LoongForge?

LoongForge is an open-source training framework from the Baidu AI Cloud Baige team for large language models, vision-language models, diffusion models and embodied models such as vision-language-action (VLA) and world-action (WAM) policies. It sits in the Efficient Training category of the Training & Fine-Tuning tools and is open-source, written in Python and licensed Apache-2.0.

Updated Markdown version ↗

Overview

LoongForge is an open-source training framework from the Baidu AI Cloud Baige team for large language models, vision-language models, diffusion models and embodied models such as vision-language-action (VLA) and world-action (WAM) policies. It was open-sourced in April 2026 from AIAK-Training-LLM, the framework Baidu used for enterprise customers' models, and ships ready-to-run configs and launch scripts for 40+ open models, from DeepSeek, Qwen, GLM and Kimi to Pi0.5, GR00T and DreamZero.

Side-by-side recorded training logs for DreamZero Wan2.2-5B on 8 GPUs, the official baseline versus LoongForge, with a loss chart and a 4.38x speedup readout.
DreamZero training: LoongForge's step time against the official baseline, with the loss curves side by side.LoongForge README ↗

Because the best training strategy differs by model family, LoongForge has two backends. A Megatron backend (a patched Megatron-LM) handles LLMs, VLMs and diffusion, extended with MoE parallelism, heterogeneous per-component parallelism and long-sequence training. A torch-native backend handles embodied models with DDP, ZeRO-1, FSDP and HSDP, plus per-model optimizations of I/O, communication and kernels.

LoongForge architecture diagram: a Megatron track for LLM, VLM and diffusion models and a torch-native track for VLA and WAM models, both running on NVIDIA GPUs and Kunlun XPUs.
The two backends: a Megatron track for foundation and multimodal models, a torch-native track for embodied models.LoongForge README ↗

It supports pre-training, mid-training, supervised fine-tuning and LoRA, converts checkpoints between Megatron and Hugging Face formats, and runs on both NVIDIA GPUs and Baidu's Kunlun XPUs. The project reports training throughput from 1.45x to 5.04x over each model's open-source baseline, measured on the same hardware, with training loss kept aligned with the baseline.

What it does

  • Two backends: Megatron for LLM / VLM / diffusion training and torch-native (DDP, ZeRO-1, FSDP, HSDP) for VLA and world-action models
  • MoE optimizations: overlapped All2All with activation offload, and topology-aware replication of hot experts to balance expert-parallel load
  • Adaptive FP8 training, FP8 gradient and parameter communication, and custom fused operators such as a TileLang FusedDSA kernel
  • VLMs assembled from interchangeable ViT and LLM components purely in config, with independent parallelism and freezing per component
  • Long-sequence training with context parallelism and chunked-pipeline scheduling; Ring / Ulysses context parallelism and sample packing for video diffusion
  • Megatron ↔ Hugging Face checkpoint bridge, LeRobot data loading, an Ego2Robot video-to-robot-data pipeline and closed-loop LIBERO / CALVIN / SimplerEnv / RoboTwin / ManiSkill evaluation
Bar chart of LoongForge training throughput speedups over open-source baselines, from 1.45x on Qwen3-VL-30B-A3B to 4.38x on DreamZero and 5.04x on DeepSeek-V3.2 Lite.
Reported throughput speedups per model over each open-source baseline, on the same machine type.LoongForge README ↗

Getting started

The README's quick start uses the prebuilt Docker image on an NVIDIA GPU machine (NVIDIA Container Toolkit required) and fine-tunes Pi0.5 on LIBERO on one 8-GPU node. Source builds and Kunlun XPU installs are covered in the docs.

Pull the image and start a container

The mounted ./workspace folder keeps weights, datasets and outputs after the container exits.

bashbash
docker pull loongforge/loongforge:latest
mkdir -p workspace
docker run --gpus all --ipc=host -it --rm \
  -v "$(pwd)/workspace:/workspace/data" \
  -w /workspace/LoongForge \
  loongforge/loongforge:latest bash

Download weights, tokenizer and dataset

Inside the container, fetch the Pi0.5 base weights, the PaliGemma tokenizer and the LIBERO dataset with the Hugging Face CLI.

bashbash
hf download lerobot/pi05_base --local-dir /workspace/data/pi05_base
hf download google/paligemma-3b-pt-224 --local-dir /workspace/data/paligemma-3b-pt-224
hf download lerobot/libero_10 --repo-type dataset --local-dir /workspace/data/libero_10

Launch training

Paths come from environment variables; the script runs 20 steps by default to validate the setup. Logs and TensorBoard data land in OUTPUT_DIR. Launch scripts for every supported model live under examples/ (NVIDIA) and examples_xpu/ (Kunlun).

bashbash
export CHECKPOINT_PATH=/workspace/data/pi05_base
export TOKENIZER_PATH=/workspace/data/paligemma-3b-pt-224
export DATA_PATH=/workspace/data/libero_10
export OUTPUT_DIR=/workspace/data/outputs/pi05

bash examples/embodied/pi05/run_pi05_ddp_finetune.sh

Commands and code are distilled from the project's own documentation — always check the official repo for the latest.

When to use it

  • Pre-training or fine-tuning large MoE LLMs such as DeepSeek, GLM, Kimi or MiniMax across many GPUs with Megatron-style parallelism
  • Building a custom VLM by pairing a vision encoder with an LLM in config and training each part with its own parallel settings
  • Speeding up fine-tuning of robot policies (Pi0.5, GR00T, FastWAM, DreamZero) and evaluating them in LIBERO or RoboTwin
  • Running the same training recipes on Baidu Kunlun XPUs as well as NVIDIA GPUs

How LoongForge compares

LoongForge alongside other open-source efficient training tools AI/TLDR tracks, ranked by GitHub stars.

ToolStarsWhat it does
DeepSpeed★ 43.4kA deep learning optimization library whose ZeRO memory partitioning and offloading let you train very large models across many GPUs.
Megatron-LM★ 18.6kNVIDIA's library for training large transformer models at scale using tensor, pipeline, and sequence parallelism.
Accelerate★ 10kA library that runs the same PyTorch training code across CPUs, multiple GPUs, and TPUs while handling mixed precision, FSDP, and DeepSpeed.
DeepSpec★ 7.3kDeepSeek's codebase for training and evaluating draft models for speculative decoding, bundling data preparation, the DSpark, DFlash and Eagle3 drafters, training code and benchmarks.
TorchTitan★ 6kA PyTorch-native platform for pre-training large models that combines FSDP, tensor, pipeline, and context parallelism in one codebase.
LightlySSL★ 3.8kA modular PyTorch framework for self-supervised computer vision: losses, model heads and multi-view transforms for 20+ methods from MoCo and SimCLR to DINOv2, CAPI and LeJEPA.
Nanotron★ 2.9kHugging Face's minimal library for pre-training LLMs with 3D parallelism, designed to be readable and easy to modify.
LoongForge—Baidu's training framework for LLMs, VLMs, diffusion and robot models