Formula

Derivation of the KL Divergence Objective for Policy Optimization

The RLHF policy optimization objective can be reformulated by substituting the definition of the optimal reward-weighted policy, π(yx)\pi^{*}(\mathbf{y}|\mathbf{x}). This transforms the objective into one that minimizes the Kullback-Leibler (KL) divergence between the learned policy, πθ(x)\pi_{\theta}(\cdot|\mathbf{x}), and the optimal policy. The substitution yields: θ~=argminθExDEyπθ(x)[logπθ(yx)logπ(yx)logZ(x)]\tilde{\theta} = \arg \min_{\theta} \mathbb{E}_{\mathbf{x} \sim \mathcal{D}} \mathbb{E}_{\mathbf{y} \sim \pi_{\theta}(\cdot|\mathbf{x})} \left[ \log \pi_{\theta}(\mathbf{y}|\mathbf{x}) - \log \pi^{*}(\mathbf{y}|\mathbf{x}) - \log Z(\mathbf{x}) \right] Because the expectation of the difference in log-probabilities over πθ\pi_{\theta} corresponds to the definition of KL divergence, this simplifies to: θ~=argminθExD[KL(πθ(x)π(x))logZ(x)]\tilde{\theta} = \arg \min_{\theta} \mathbb{E}_{\mathbf{x} \sim \mathcal{D}} \left[ \text{KL}(\pi_{\theta}(\cdot|\mathbf{x}) || \pi^{*}(\cdot|\mathbf{x})) - \log Z(\mathbf{x}) \right] This derivation shows that the objective is equivalent to minimizing the KL divergence from the optimal policy, offset by the normalization term logZ(x)\log Z(\mathbf{x}).

Image 0

0

1

Updated 2026-06-21

Contributors are:

Who are from:

Tags

Ch.4 Alignment - Foundations of Large Language Models

Foundations of Large Language Models

Foundations of Large Language Models Course

Computing Sciences

Related