--- id: liger-kernel version: "0.8.1" 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) license_treatment: permissive maintenance: active --- # liger-kernel — Efficient Triton kernels for LLM Training License: permissive · Maintenance: active · Downloads: 620.8K/mo ## 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 above — 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 pip install liger-kernel uv add liger-kernel poetry add liger-kernel ## Installing 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: unspecified - Install friction: low - Maintenance: active - Downloads: 620.8K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags llm training optimization, triton kernels for pytorch, memory efficient training, fused attention operations, gpu kernel fusion, transformer training acceleration, lora and fsdp optimization, gpu-optimization, llm-training, kernel-fusion [View on SkillFed](https://skillfed.io/packages/liger-kernel) · [View on PyPI](https://pypi.org/project/liger-kernel/)