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.
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.

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.

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

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.
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 bashDownload 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.
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_10Launch 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).
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.shCommands 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.
| Tool | Stars | What it does |
|---|---|---|
| DeepSpeed | ★ 43.4k | A deep learning optimization library whose ZeRO memory partitioning and offloading let you train very large models across many GPUs. |
| Megatron-LM | ★ 18.6k | NVIDIA's library for training large transformer models at scale using tensor, pipeline, and sequence parallelism. |
| Accelerate | ★ 10k | A library that runs the same PyTorch training code across CPUs, multiple GPUs, and TPUs while handling mixed precision, FSDP, and DeepSpeed. |
| DeepSpec | ★ 7.3k | DeepSeek'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 | ★ 6k | A PyTorch-native platform for pre-training large models that combines FSDP, tensor, pipeline, and context parallelism in one codebase. |
| LightlySSL | ★ 3.8k | A 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.9k | Hugging 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 |
