linkedin/Liger-Kernel
Efficient Triton Kernels for LLM Training
What it solves
Training large language models (LLMs) is slow and memory-hungry. Liger Kernel provides a set of optimized building blocks that make LLM training faster (20% more throughput) and use less memory (60% less), letting you use longer contexts, larger batches, or bigger vocabularies without hitting hardware limits.
How it works
It replaces standard PyTorch layers (like RMSNorm, RoPE, SwiGLU, and CrossEntropy) with custom Triton implementations that fuse operations, reuse memory in place, and chunk computations. These kernels are designed to work seamlessly with popular training frameworks like Hugging Face, PyTorch FSDP, DeepSpeed, and more. You can either patch your existing Hugging Face model with a single line of code or compose your own model using these ready-made modules. It also offers optimized kernels for post-training alignment losses (like DPO, ORPO, SimPO) that cut memory use by up to 80%. The computation is exact—no approximations—and the project has minimal dependencies (just Torch and Triton).
Who it’s for
AI engineers and researchers who train or fine-tune LLMs and want to speed up training and reduce memory costs without rewriting their entire pipeline. It's designed for teams working with multi-GPU setups (FSDP, DeepSpeed, DDP) and who want drop-in compatible kernels.
Highlights
- Increase multi-GPU training throughput by 20% and reduce memory usage by 60%.
- Works out-of-the-box with Hugging Face models, PyTorch FSDP, Microsoft DeepSpeed, and more.
- Provides exact, tested implementations—no approximations.
- Lightweight: only requires Torch and Triton.
- Includes optimized kernels for post-training alignment losses (DPO, ORPO, SimPO, etc.) with up to 80% memory savings.
- Simple one-line integration with existing Hugging Face models.
Related
- Project
- Project
- Dispatch
- Project
- Dispatch