arXiv:2611.11998cs.LGNov 2026

Manuscript Offprint

arXiv:2611.11998

Reward-Estimated Hypergradient for Bilevel Reinforcement Learning with Black-Box Follower

Shigeki Kusaka, Mikoto Kudo, Takumi Tanabe, Akifumi Wachi, Youhei Akimoto

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Hypergradient (HG) methods for bilevel reinforcement learning (RL) typically assume a white-box follower whose reward is known. In practice, however, the leader rarely knows the follower's reward function and can only observe its trajectories. We address this black-box setting and propose Reward-Estimated Hypergradients (RE-HG), which recovers the follower's reward from these trajectories via inverse RL (IRL). Yet IRL identifies the reward only up to potential-based shaping, a transformation that leaves the follower's behavior unchanged but biases the HG. We prove that, for linear rewards, this bias cancels when IRL estimates are aggregated across sufficiently diverse dynamics, which the leader's own updates naturally supply. To handle finite samples, RE-HG truncates small eigenvalues of the aggregated feature covariance, restoring the identifiable subspace and stabilizing the estimation. Experiments show that RE-HG estimates gradients aligned with a white-box Oracle and achieves comparable performance; empirically, the truncation also suppresses HG explosions, letting RE-HG avoid local optima that trap the Oracle in sharp reward landscapes.

1 Introduction

Reinforcement Learning (RL) (Sutton and Barto, 2018) has achieved remarkable success in games (Silver et al., 2016; Samvelyan et al., 2019), robotics (Levine et al., 2016), and the fine-tuning of large language models (Ouyang et al., 2022; Guo et al., 2025). Many real-world deployments, however, involve multiple agents whose interaction is hierarchical: one agent, the leader, shapes the environment in which another agent, the follower, learns. Bilevel RL (Hong et al., 2023) models this structure as a nested optimization problem, in which the leader optimizes its objective while anticipating the follower's best response:

max⁡θ∈ΘJL(θ,gθ†)\max_{\theta \in \Theta} J_L(\theta, g^{\theta\dagger})

(Leader)

s.t. gθ†=arg⁡max⁡g∈GJθ(g).\text{s.t. } g^{\theta\dagger} = \arg\max_{g \in \mathcal{G}} J_\theta(g).

(Follower)

Here, θ\theta parameterizes the leader, JLJ_L is the leader's objective, and gθ†g^{\theta\dagger} is the follower's best response, which maximizes the follower's own objective JθJ_\theta defined by its reward function. The standard approach to optimizing the leader is to compute the hypergradient (HG), the gradient of JLJ_L with respect to θ\theta that accounts for how the follower's best response gθ†g^{\theta\dagger} changes with θ\theta.

40th Conference on Neural Information Processing Systems (NeurIPS 2026).

Existing HG methods, however, assume a white-box follower: they require the follower's reward function and, in some cases, its policy or value function (Table 1). In practice, this assumption rarely holds: the follower's preferences are often implicit, as with human arm movements (Albrecht et al., 2012) or human drivers in mixed traffic (Shi et al., 2025), and manually engineering a reward function that reflects them is notoriously difficult. To the best of our knowledge, no established method computes the HG in this black-box follower setting, where the leader can observe only the follower's trajectories.

A natural approach is to recover the follower's reward from its trajectories by inverse RL (IRL) and to compute the HG with the recovered reward. However, IRL identifies the reward only up to potential-based shaping (Ng et al., 1999): shaped rewards induce the same optimal policy, so the follower's trajectories cannot distinguish between them. In single-agent RL, this ambiguity is harmless, since shaping adds no bias to the policy gradient. The HG, in contrast, depends directly on the follower's value function, which shaping shifts by an arbitrary potential, so the ambiguity left by IRL becomes an arbitrary bias in the HG.

Our key observation is that the bilevel structure itself supplies the information needed to resolve this ambiguity. Prior work has shown that a reward can be identified up to a constant when expert behavior is observed under multiple transition dynamics (Cao et al., 2021; Rolland et al., 2022). In bilevel RL, such observations arise naturally: each leader update changes the dynamics that the follower faces, and the follower responds with a new best response. We show that, under a linear reward assumption, aggregating the IRL estimates obtained across these iterations cancels the shaping bias and recovers the reward up to a constant offset, which leaves the HG unchanged. To make this aggregation reliable with finite samples, we truncate the small eigenvalues of the aggregated feature covariance, which restores the identifiable subspace and keeps the estimation numerically stable. Combining these components, we propose Reward-Estimated Hypergradient (RE-HG), which computes the HG from observed trajectories alone.

The main contributions of this work are as follows:

(i) We identify reward-shaping ambiguity as the fundamental obstacle to HG estimation with a black-box follower.

(ii) We prove that, under a linear reward assumption, aggregating IRL estimates across the dynamics induced by the leader's updates cancels this bias (Theorem 1), and that the remaining reward error controls the HG error (Proposition 2).

(iii) We propose RE-HG, which combines this aggregation with eigenvalue truncation to compute the HG from trajectories alone with finite samples.

(iv) Experiments on discrete and continuous bilevel tasks show that RE-HG estimates gradients aligned with a white-box ORACLE and achieves comparable performance. Empirically, eigenvalue truncation also suppresses HG explosions, letting RE-HG avoid local optima that trap the ORACLE in sharp reward landscapes.

Our code is available at https://github.com/akimotolab/RE-HG.

References (71)