Hugging Face Blog

Policy Gradient with PyTorch

arXiv Machine Learning
Oct 19

Is the Policy Gradient a Gradient?

The paper investigates whether the policy gradient update used in many reinforcement learning algorithms—specifically the episode-summed, on‑policy update that omits the outer discount factor—can be interpreted as the gradient of any objective function. The authors prove that this update does not necessarily correspond to the gradient of any function and provide a counterexample where the update drives the policy toward a globally pessimal deterministic limit while the parameters diverge. They also highlight that this theoretical ambiguity has led to widespread misstatements in the literature, even in highly cited works from top conferences.

By Chris Nota, Philip S. Thomas
arXiv Machine Learning
Oct 23

Analysis of On-policy Policy Gradient Methods under the Distribution Mismatch

The paper investigates how distribution mismatch—when the sampling distribution used to estimate policy gradient updates differs from the discounted state distribution required by theory—affects on‑policy policy gradient methods. For tabular direct and softmax parameterizations, it proves global convergence of objective values under biased updates and, for tabular softmax policies, derives exact leading‑order coefficients of asymptotic objective errors, providing a criterion to determine whether mismatch speeds up or slows convergence. The analysis is extended to general policy parameterizations, yielding explicit bounds on state distribution mismatch and normalized policy‑gradient mismatch in both episodic and continuing MDPs, showing these mismatches vanish at least linearly as the discount factor approaches one and bounding the squared norm of the normalized exact policy‑gradient direction under smoothness assumptions.

By Weizhen Wang, Xinzhe Zhou, Jianping He, Xiaoming Duan
arXiv Machine Learning
Sep 15

Learning to Solve Stochastic Controls with Unknown Drifts and Running Rewards: Theory, Algorithms and Convergence

The paper investigates continuous‑time stochastic control problems with unknown drift and running reward functions, using an exploratory reinforcement learning framework that incorporates relaxed controls and entropy regularization. It develops policy‑iteration algorithms based on probabilistic representations of the optimal value function and its gradient, proving convergence and demonstrating performance through numerical examples. The study also extends to a special case with control‑dependent diffusion, requiring a Hessian representation.

By Jin Ma, Gaozhan Wang, Jianfeng Zhang, Xunyu Zhou
arXiv Machine Learning
Nov 2

rl_rob: A transparent, from-scratch Python library for teaching reinforcement learning from tabular methods to deep policy gradients

rl_rob is an open‑source Python library designed for teaching reinforcement learning, covering a full curriculum from tabular temporal‑difference learning to deep value‑based and policy‑gradient methods. Every algorithm is implemented from first principles, making the update rules transparent and concise. The library provides a unified interface for all agents, enabling direct comparison across stages and allowing students to implement, modify, and explain update rules rather than merely producing working code.

By Abdulrahman Altahhan