---
title: "🐯 Liger GRPO meets TRL"
description: "Liger's chunked loss, extended to GRPO and integrated into TRL's GRPOTrainer, cuts peak training memory by up to 40% with no change in reward curves."
url: "https://swe.quest/articles/liger-grpo-meets-trl-4a551ec5e4d7e307"
canonical: "https://huggingface.co/blog/liger-grpo"
source: "Hugging Face"
published: "2025-05-25"
difficulty: "hard"
kind: "Deep dive"
reading_minutes: 13
tags: ["model-training","llms","performance"]
---

# 🐯 Liger GRPO meets TRL

A post on [Hugging Face](https://swe.quest/sources/hugging-face.md), published 2025-05-25, 13 min read, Deep dive. Original: [https://huggingface.co/blog/liger-grpo](https://huggingface.co/blog/liger-grpo)

## Summary

Liger's chunked loss, extended to GRPO and integrated into TRL's GRPOTrainer, cuts peak training memory by up to 40% with no change in reward curves. It chunks the lm\_head input along the batch and computes each chunk's gradients during the forward pass, so full logits never need to be held for backward. Benchmarks on Qwen3-0.6B with gsm8k show savings growing with batch size. FSDP and PEFT support allow 1.5–1.8x larger batch sizes across Qwen3 sizes, and LoRA removes the need for a separate reference model. Setup is a \`use\_liger\_loss=True\` flag, with optional vLLM-server generation for faster rollouts.

Written by swe.quest, not by the author.

**Difficulty:** Hard: written for specialists in the field

## Topics

- [Model training](https://swe.quest/tags/model-training.md) (AI & ML)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)

## Prerequisites

- reinforcement learning fine-tuning of LLMs ([easy posts on Model training](https://swe.quest/tags/model-training.md?difficulty=easy))
- PyTorch autograd
- GPU memory in training ([easy posts on Hardware](https://swe.quest/tags/hardware.md?difficulty=easy))

## Keywords

Liger Kernel, TRL, GRPO, FSDP, PEFT, LoRA, vLLM, Qwen3

## Related posts

- [Make LLM Fine-tuning 2x faster with Unsloth and 🤗 TRL](https://swe.quest/articles/make-llm-fine-tuning-2x-faster-with-unsloth-and-trl-5db8c0b6a40cf74e.md): Hugging Face · 2024-01-10 · Medium · 5 min read · Model training, LLMs, Performance engineering, Python
  Unsloth speeds up QLoRA fine-tuning of Llama and Mistral-family models by rewriting PyTorch modules as Triton kernels with manually derived backpropagation.
- [TRL v1.0: Post-Training Library Built to Move with the Field](https://swe.quest/articles/trl-v1-0-post-training-library-built-to-move-with-the-field-09da5ced251e79bc.md): Hugging Face · 2026-03-31 · Medium · 15 min read · Model training, Open source, API design, Python, LLMs
  TRL v1.0 turns Hugging Face's post-training codebase, now covering 75+ methods and downloaded 3M times a month, into a library with an explicit stability contract.
- [Fixing Gradient Accumulation](https://swe.quest/articles/fixing-gradient-accumulation-48a9d96c28c11b53.md): Hugging Face · 2024-10-16 · Medium · 4 min read · Model training, Python, Debugging
  Gradient accumulation in the transformers Trainer did not match full-batch training because the default model loss averaged per-batch cross-entropy instead of summing token losses across all accumulated batches and dividing by the total count of non-padding tokens.
- [Putting RL back in RLHF](https://swe.quest/articles/putting-rl-back-in-rlhf-dbdbc5d62840e65d.md): Hugging Face · 2024-06-12 · Hard · 11 min read · Model training, LLMs, Python
  RLOO (REINFORCE Leave-One-Out) is now available as a trainer in Hugging Face TRL.
- [Async GRPO with LoRA across HF Jobs: a bucket, a proxy, and no NCCL](https://swe.quest/articles/async-grpo-with-lora-across-hf-jobs-a-bucket-a-proxy-and-no-nccl-a625fff69adbae9a.md): Hugging Face · 2026-09-10 · Hard · 29 min read · Model training, Inference & serving, Caching, Load balancing, LLMs
  TRL v1.14's AsyncGRPOTrainer can train a LoRA adapter and sync only that adapter to vLLM, which lets the trainer and inference replicas run as separate Hugging Face Jobs on separate machines without NCCL.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
