Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Principle:OpenRLHF OpenRLHF KL Divergence Estimation

From Leeroopedia


Knowledge Sources
Domains Reinforcement_Learning, Loss_Functions
Last Updated 2026-02-07 00:00 GMT

Overview

An approximation technique for estimating KL divergence between policy distributions from log-probability samples, used as a penalty in RLHF training.

Description

KL Divergence Estimation computes an approximate KL divergence between the current policy and a reference policy using only sampled log-probabilities (no full distribution access needed). This is used as a regularization penalty in PPO/GRPO training to prevent the policy from diverging too far from the reference model, maintaining response quality.

Three estimators are available with different bias-variance tradeoffs.

Usage

Used in PPO and Math-GRPO workflows during reward computation. The KL penalty is added to the per-token reward signal.

Theoretical Basis

k1 estimator (standard): Simple log-ratio KLk1=logπθ(a|s)πref(a|s)

k2 estimator (non-negative): Squared log-ratio KLk2=12(logπθ(a|s)πref(a|s))2

k3 estimator (non-negative, Schulman): KLk3=πref(a|s)πθ(a|s)1logπref(a|s)πθ(a|s)

All estimators are clamped to [-10, 10] for numerical stability.

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment