An operator library of PyTorch-compatible LLM kernels written in Triton, designed to run across multiple AI accelerator backends.
linkedin/Liger-Kernel
Efficient Triton GPU kernels for LLM training that fuse common layers and losses to cut memory use and raise throughput.
- Stars
- 6,665
- Forks
- 627
- Open issues
- 197
- Last commit
- 10 hours ago
What is it?
Liger Kernel is a collection of Triton kernels for training large language models. It provides drop-in replacements for common operations such as RMSNorm, RoPE, SwiGLU, CrossEntropy and a fused linear cross-entropy, which reduce memory traffic and allow longer context lengths or larger batches on the same GPUs.
Users can patch supported Hugging Face models with a single call, such as apply_liger_kernel_to_llama, or compose individual kernel modules into their own models. The project also includes post-training losses like DPO, ORPO, SimPO, KTO and CPO that avoid materializing full logits, plus distillation losses such as JSD and KL divergence. It works with PyTorch FSDP, DeepSpeed and DDP, and requires only Torch and Triton as core dependencies.
The repository lists support for many model families including Llama, Qwen, Gemma, Mistral, Phi3 and DeepSeek, and includes backends for CUDA, ROCm, Intel GPU and Ascend NPU, with optional cuTile and CuTe DSL implementations on NVIDIA hardware.
Key features
- 01Drop-in Triton kernels for RMSNorm, RoPE, SwiGLU, CrossEntropy and fused linear cross-entropy.
- 02One-line patching for many supported Hugging Face model families.
- 03Memory-efficient DPO, ORPO, SimPO, KTO and CPO losses for post-training.
- 04Distillation losses including JSD, KL divergence and TVD.
- 05Compatible with PyTorch FSDP, DeepSpeed and DDP with minimal dependencies.
- 06Backends for NVIDIA CUDA, AMD ROCm, Intel GPU and Ascend NPU.
Use cases
- Speeding up full fine-tuning of Llama or Qwen models on multi-GPU clusters.
- Reducing memory to train with longer context lengths or larger vocabularies.
- Running memory-heavy preference optimization such as DPO or ORPO on limited GPUs.
- Adding efficient distillation losses to a training pipeline.
Topics
FAQ
- What is Liger-Kernel?
- Efficient Triton GPU kernels for LLM training that fuse common layers and losses to cut memory use and raise throughput. Liger Kernel is a collection of Triton kernels for training large language models. It provides drop-in replacements for common operations such as RMSNorm, RoPE, SwiGLU, CrossEntropy and a fused linear cross-entropy, which reduce memory traffic and allow longer context lengths or larger batches on the same GPUs.
- Is Liger-Kernel free to use? What license does it have?
- Liger-Kernel is open source under the BSD-2-Clause license. Check the license terms before using it in commercial products.
- Is Liger-Kernel still maintained?
- Actively maintained. The last commit to Liger-Kernel was on Oct 22, 2026.
- What can I use Liger-Kernel for?
- Speeding up full fine-tuning of Llama or Qwen models on multi-GPU clusters. Reducing memory to train with longer context lengths or larger vocabularies. Running memory-heavy preference optimization such as DPO or ORPO on limited GPUs. Adding efficient distillation losses to a training pipeline.
- Where can I get Liger-Kernel?
- The source code and installation instructions are on GitHub: https://github.com/linkedin/Liger-Kernel
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
Triton-based kernels and training-ready layers for linear attention, sparse attention, state space and hybrid LLM architectures.
Open-source library for training large language models with 3D parallelism, ZeRO memory optimization and Hugging Face integration, built on PyTorch and Triton.
A minimal, hackable harness that covers the full LLM pipeline from tokenization and pretraining to finetuning, evaluation and chat, runnable on a single GPU node.
A PyTorch-based toolkit of from-scratch LLM implementations for pretraining, finetuning, evaluating and serving 20+ open-weight models.
Companion code for the book Build a Large Language Model (From Scratch), implementing a GPT-like LLM in PyTorch step by step.