Table of Contents
Fetching ...

A Note on Hybrid Online Reinforcement and Imitation Learning for LLMs: Formulations and Algorithms

Yingru Li, Ziniu Li, Jiacai Liu

TL;DR

This work presents a unified framework for fine-tuning large language models by combining imitation learning through a Dense gradient and reinforcement learning through a Sparse gradient, derived from a trajectory-level KL divergence and reward objective. The key contribution is a per-step gradient decomposition that separates an analytic imitation signal from a long-horizon reward signal, enabling efficient logit-level computation and GPU-friendly implementation. The framework is shown to be mathematically equivalent to KL-regularized RLHF and unifies methods such as online imitation learning, DAPO, and standard KD under different hyperparameter choices, with a natural curriculum for balancing imitation and reward. The proposed approach offers practical pathways for scaling LLM fine-tuning with stable on-policy learning and flexible extension to multiple teachers and rewards, holding promise for more robust and aligned models in real-world applications.

Abstract

We present a unified framework for Large Language Model (LLM) fine-tuning that integrates Imitation Learning and Reinforcement Learning. By analyzing the gradient of a composite objective combining trajectory-level KL divergence with task rewards, we derive a natural decomposition into two components: (1) an analytically computable Dense Gradient for token-level imitation, and (2) a Monte Carlo estimated Sparse Gradient for long-horizon reward optimization. The Dense Gradient admits a closed-form logit-level formula, enabling efficient GPU implementation.

A Note on Hybrid Online Reinforcement and Imitation Learning for LLMs: Formulations and Algorithms

TL;DR

This work presents a unified framework for fine-tuning large language models by combining imitation learning through a Dense gradient and reinforcement learning through a Sparse gradient, derived from a trajectory-level KL divergence and reward objective. The key contribution is a per-step gradient decomposition that separates an analytic imitation signal from a long-horizon reward signal, enabling efficient logit-level computation and GPU-friendly implementation. The framework is shown to be mathematically equivalent to KL-regularized RLHF and unifies methods such as online imitation learning, DAPO, and standard KD under different hyperparameter choices, with a natural curriculum for balancing imitation and reward. The proposed approach offers practical pathways for scaling LLM fine-tuning with stable on-policy learning and flexible extension to multiple teachers and rewards, holding promise for more robust and aligned models in real-world applications.

Abstract

We present a unified framework for Large Language Model (LLM) fine-tuning that integrates Imitation Learning and Reinforcement Learning. By analyzing the gradient of a composite objective combining trajectory-level KL divergence with task rewards, we derive a natural decomposition into two components: (1) an analytically computable Dense Gradient for token-level imitation, and (2) a Monte Carlo estimated Sparse Gradient for long-horizon reward optimization. The Dense Gradient admits a closed-form logit-level formula, enabling efficient GPU implementation.
Paper Structure (27 sections, 5 theorems, 31 equations, 1 algorithm)

This paper contains 27 sections, 5 theorems, 31 equations, 1 algorithm.

Key Result

Theorem 1

The gradient of objective eq:objective at step $t$ decomposes as: where the expectation is over $x \sim \mathcal{D}$ and $y \sim \pi_\theta(\cdot|x)$.

Theorems & Definitions (16)

  • Definition 1: Autoregressive Policy
  • Definition 2: Instantaneous Divergence Cost
  • Remark 1: Connection to Online Imitation Learning
  • Definition 3: Future Return
  • Theorem 1: Gradient Decomposition
  • Lemma 2: Vanishing Score Function
  • Lemma 3: Causality
  • Proposition 4: Dense Term Equals Token-Level KL Gradient
  • Proposition 5: Logit-Level Gradient
  • Remark 2: Discounting Convention
  • ...and 6 more