Liger Kernel

Triton kernels from LinkedIn that raise LLM training throughput about 20 percent and cut memory 60 percent.

Open SourceSelf HostedOffline CapableGPU Required
0.0 (0)

About

A single line of code, AutoLigerKernelForCausalLM, patches optimized Triton kernels into a Hugging Face model, which is how LinkedIn's Liger Kernel raises multi-GPU training throughput by about 20 percent while cutting memory use around 60 percent. The library swaps RMSNorm, RoPE, SwiGLU, cross entropy, and fused linear cross entropy operations for exact fused implementations with no approximations, and adds chunked post-training loss kernels for DPO, ORPO, SimPO, and KTO that reduce alignment and distillation memory by up to 80 percent. It works alongside PyTorch FSDP, DeepSpeed, and Flash Attention, covers more than 30 architectures including Llama, Mistral, Gemma, and Qwen, and runs on NVIDIA CUDA, AMD ROCm, and Ascend NPU hardware. Installation is pip install liger-kernel with torch 2.1.2 and triton 2.3.0 or newer on the CUDA path. Axolotl, LLaMA-Factory, and Hugging Face TRL have adopted it as a standard efficiency layer, the BSD-2-Clause license permits commercial use, and the project holds around 6,500 GitHub stars.

Should you use Liger Kernel?

Pick it when

Use it when Hugging Face training on Llama, Mistral, Gemma, or Qwen is memory or throughput bound and you want a one-line patch with exact fused kernels, including DPO, ORPO, and KTO losses, that also works under FSDP or DeepSpeed.

Look elsewhere when

It is not a trainer, so you still need TRL, Axolotl, or LLaMA-Factory around it, and those already integrate it. Architectures outside its supported list get no benefit; on one GPU, Unsloth bundles its own patches into a full workflow.

Alternatives to Liger Kernel

  • FlashAttention

    Optimizes attention only, while Liger fuses norms, RoPE, SwiGLU, and loss; Liger is built to run alongside it, so most stacks use both.

  • Unsloth

    Bundles its own kernels into a full fine-tuning workflow, simpler on one GPU, but you adopt its patches rather than your own trainer.

  • xFormers

    Meta's attention and fused-op building blocks used across diffusion and LLM stacks; more general, no one-line model patching.

  • DeepSpeed

    Saves memory by sharding optimizer state across GPUs rather than fusing kernels; complementary, and Liger runs on top of it.

Reviews (0)

Leave a Review

No reviews yet. Be the first to review!

Details

Price
Free
Platform
Local/Desktop
Difficulty
Intermediate (3/5)
License
BSD-2-Clause
Added
Jul 29, 2026

Tags