liger-kernel
Efficient Triton kernels for LLM Training
What it is and what it does
Liger Kernel is a collection of Triton-based GPU kernels optimized specifically for large language model training. It implements fused operations for common LLM layers—RMSNorm, RoPE, SwiGLU, CrossEntropy, and post-training losses like DPO, ORPO, and CPO—that reduce memory overhead and increase computational efficiency through kernel fusion and in-place operations. The package requires only torch and triton as dependencies and integrates with PyTorch FSDP, DeepSpeed, and popular training frameworks like Hugging Face Trainer and Lightning.
The package is designed to work out of the box: you can patch a Hugging Face model with a single line of code or compose custom models using Liger's module APIs. It supports multi-GPU training across CUDA, ROCm, and Ascend NPU platforms. All computations are exact—no approximations—with forward and backward passes validated against standard implementations. The project is actively maintained by LinkedIn, with recent releases adding support for new loss functions and hardware platforms.
Use it for:
- Fine-tune large language models like LLaMA 3-8B on consumer-grade or enterprise GPU clusters with reduced memory footprint and faster training time
- Implement post-training alignment tasks (DPO, ORPO, CPO) with up to 80% memory savings for distillation and preference optimization
- Train vision-language models (e.g., Qwen2-VL) on multi-GPU setups using FSDP or DeepSpeed with kernel-fused operations
- Extend context length or batch size in existing training pipelines by reducing per-layer memory overhead through kernel fusion
- Integrate optimized kernels into custom training loops or frameworks that already use torch and triton
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Liger Kernel provides optimized Triton kernels for LLM training, implementing fused operations like RMSNorm, RoPE, SwiGLU, and CrossEntropy to reduce memory usage and increase training throughput.
Yes, if you are training LLMs on GPU hardware. The package has low install friction, active maintenance, permissive licensing, no known vulnerabilities, and integrates cleanly with standard PyTorch training workflows. Start with a trial on a small model to verify the stated performance gains apply to your setup; the exact speedup and memory savings depend on your hardware, model size, and training configuration.
Install
liger-kernel on PyPI
pip
pip install liger-kerneluv
uv add liger-kernelpoetry
poetry add liger-kernelInstalling liger-kernel
Before you install
Low friction install with only torch and triton as runtime dependencies. The package is actively maintained with a recent release 22 days ago and 6567 repository stars, indicating solid community adoption and ongoing development.
License in practice
BSD 2-Clause permissive license allows commercial and private use with minimal restrictions, requiring only copyright notice retention in source and binary distributions.
Quickstart
pip install liger-kernel
from liger_kernel.chunked_loss import LigerFusedLinearORPOLoss
orpo_loss = LigerFusedLinearORPOLoss()
y = orpo_loss(lm_head.weight, x, target)
Requires torch >= 2.1.2 and triton >= 2.3.0 for CUDA; ROCm and Ascend NPU have different version requirements. GPU hardware (NVIDIA, AMD, or Ascend) is necessary for kernel execution.
Verify before relying
- Whether the stated 20% throughput increase and 60% memory reduction apply to your specific model architecture and hardware setup
- Compatibility with specific transformer frameworks beyond those mentioned (Axolotl, LLaMA-Factory, etc.)
- Performance characteristics on non-A100 GPU hardware
Package facts
| License | BSD 2-CLAUSE LICENSE Copyright 2024 LinkedIn Corporation All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the… (full text in the JSON record) (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — torch, triton |
| Maintenance | actively maintained — 22 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 620,759/month — #5,723 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: liger_kernel-0.8.1-py3-none-any.whl
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
sgl-kernelsgl-kernel provides optimized CUDA compute…
permissive · top 15,000 on PyPI
helionHelion is a Python-embedded domain-specific…
unclear · top 15,000 on PyPI
sglang-kernelsglang-kernel provides optimized CUDA compute…
permissive · top 15,000 on PyPI
triton-ascendTriton Ascend is a compiler framework that…
unclear · top 15,000 on PyPI
transformer-engine-cu12Accelerates Transformer model training and…
unclear · top 15,000 on PyPI
flashinfer-pythonFlashInfer provides optimized GPU kernels for…
permissive · top 5,000 on PyPI
torchaoTorchAO applies quantization and sparsity…
unclear · top 5,000 on PyPI
transformer-engineTransformer Engine accelerates Transformer…
unclear · top 15,000 on PyPI
tokenspeed-tritonTriton is a language and compiler for writing…
permissive · top 5,000 on PyPI
llamafactoryLLaMA Factory provides a unified framework for…
permissive · top 15,000 on PyPI