linkedin/Liger-Kernel
Efficient Triton Kernels for LLM Training
What it solves
Liger Kernel addresses the memory and throughput bottlenecks associated with training Large Language Models (LLMs). It reduces memory usage by up to 60% and increases multi-GPU training throughput by approximately 20%, enabling the use of larger batch sizes, longer context lengths, and larger vocabularies without running out of memory (OOM).
How it works
The project provides a collection of optimized Triton kernels that replace standard PyTorch layers. It uses techniques such as kernel fusion, in-place replacement, and chunking to optimize the forward and backward passes of critical LLM components. It implements Hugging Face compatible versions of RMSNorm, RoPE, SwiGLU, and CrossEntropy (including FusedLinearCrossEntropy). It also provides specialized kernels for post-training alignment and distillation tasks (e.g., DPO, ORPO, CPO, SimPO, KTO).
Who it’s for
It is designed for AI researchers and engineers training or fine-tuning LLMs who want to maximize hardware efficiency on NVIDIA (CUDA), AMD (ROCm), or Ascend NPU hardware.
Highlights
- High Efficiency: Increases throughput by 20% and reduces memory usage by 60% for general training, with up to 80% memory savings for post-training kernels.
- Ease of Use: Can be integrated into Hugging Face models with a single line of code or used as standalone modules.
- Broad Compatibility: Works out of the box with Flash Attention, PyTorch FSDP, Microsoft DeepSpeed, and various trainer frameworks like Axolotl and LLaMA-Factory.
- Exact Computation: Ensures mathematical accuracy with no approximations, verified via rigorous unit tests and convergence testing.
- Hardware Support: Supports CUDA, ROCm, and Ascend NPU, with optional high-performance backends like cuTile and CuTe DSL for Hopper and Blackwell architectures.
Related
- Project
- Project
- Project
- Project
- Dispatch