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

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

In many hierarchical systems—think of a city planner (leader) and commuters (followers), or a recommendation engine and its users—one agent shapes the environment while another reacts to it. Bilevel Reinforcement Learning (RL) is the mathematical framework for these "Stackelberg" games. Traditionally, bilevel RL assumes the leader is omniscient: it knows exactly what the follower is trying to optimize.

In the real world, this "white-box" assumption is a fantasy. We rarely know a human's internal reward function; we only see their actions. A new paper, "Reward-Estimated Hypergradient for Bilevel Reinforcement Learning with Black-Box Follower," introduces a way to bridge this gap using a method called RE-HG.

TL;DR

RE-HG enables bilevel RL when the follower's reward function is unknown (the "black-box" setting) by recovering it from observed trajectories via Inverse RL. By aggregating these estimates across the changing dynamics of the leader's own learning process, the algorithm cancels out fundamental estimation biases and achieves performance on par with—and sometimes superior to—methods that have full access to the follower's rewards.

What Problem Does This Paper Address?

The core challenge in bilevel RL is calculating the hypergradient (HG): the gradient of the leader's objective that accounts for how the follower’s "best response" will shift as the leader changes the environment.

If you don't know the follower's reward, the obvious solution is Inverse Reinforcement Learning (IRL)—observing the follower's behavior to infer what they want. However, IRL has a notorious "shaping ambiguity." It can only identify rewards up to a transformation called potential-based shaping. While this ambiguity doesn't change what the follower does (their optimal policy), it drastically changes their value function.

Since the leader's hypergradient depends directly on the follower's value function, this "harmless" IRL ambiguity becomes a fatal bias in the leader's learning process. As shown in the comparison below, existing state-of-the-art methods simply assume this problem away by requiring the true reward.

Table 1: Comparison of requirements for HG estimation methods in Bilevel RL.

Methods: The RE-HG Algorithm

The authors propose Reward-Estimated Hypergradients (RE-HG), which relies on three key pillars:

  1. Sequential IRL: At each step, the leader uses Maximum Discounted Causal Entropy IRL to estimate the follower's reward from observed trajectories.
  2. Bias Cancellation via Aggregation: The authors prove that for linear rewards, the shaping bias is a function of the environment's transition dynamics. Because the leader's updates naturally change these dynamics over time, aggregating IRL estimates across multiple iterations causes the biases to cancel out, leaving only a constant offset that doesn't affect the gradient.
  3. Eigenvalue Truncation: To handle the noise of finite samples, RE-HG standardizes the feature covariance matrix and truncates small eigenvalues. This "cleans" the identifiable subspace and keeps the linear system numerically stable.

Datasets and Benchmarks

The researchers evaluated RE-HG on three distinct types of hierarchical conflicts:

  • Discrete Toy Task: A 3-state MDP where the leader and follower have conflicting preferences for different loops. This tests if the algorithm can correctly anticipate the follower's "deflection" to a sub-optimal state for the leader.
  • Building Thermal Control (Continuous): A complex task where a leader configures insulation and airflow in an 8-zone building, while a follower controls the HVAC. One zone is "under-actuated" (no direct HVAC), forcing the follower to regulate it indirectly through the leader's configuration.
  • 2-Player Markov Game (LQR): A continuous Linear Quadratic Regulator task where agents have opposing goals (stabilization vs. oscillation).

Key Insights and Ideas

  • The Bilevel "Free Lunch": To resolve reward ambiguity in IRL, you usually need to observe behavior in multiple different environments. The "aha moment" here is that the bilevel structure provides this for free. As the leader learns, it creates those different environments, naturally supplying the diversity needed to identify the true reward.
  • Implicit Smoothing: Surprisingly, RE-HG sometimes outperforms the "Oracle" (which knows the true reward). The eigenvalue truncation acts as a form of implicit regularization. It smooths out sharp reward landscapes that cause the Oracle's gradients to explode, allowing RE-HG to avoid the local optima that trap the "perfect" baseline.
  • Shaping is Not Harmless: This paper highlights that while reward shaping is often ignored in single-agent RL, it is the fundamental obstacle to black-box bilevel optimization.

Key Results

In experiments, RE-HG demonstrated remarkable robustness:

  • Gradient Alignment: The estimated gradients maintained a high cosine similarity to the true "Oracle" gradients, proving that the reward recovery was accurate enough for optimization.
  • Performance: In the discrete toy task, RE-HG matched the Oracle, while a "No-Influence" baseline (which ignores how the follower reacts) failed to earn any reward.
  • Stability: In continuous tasks, RE-HG avoided the "gradient explosions" seen in other methods, maintaining a steady learning curve even in "hard" settings with highly skewed cost matrices.
Figure 1: Discrete toy task. (a) State transition diagram. rL | rF represents the rewards. (b) Leader’s discounted return across 3 independent training runs. For each run, performance is evaluated as the mean of 10 test rollouts. Avg. (line) and std. (shaded area) across the 3 runs are displayed.

Limitations and Future Work

While RE-HG is a significant step forward, the authors note several areas for further exploration:

  • Linearity Assumption: The current theoretical proof for bias cancellation assumes a linear reward function with known features. Extending this to non-linear, deep-learning-based reward structures is a natural next step.
  • Optimal Follower: The theory assumes the follower is always at their "best response." In reality, followers might be learning slowly or acting sub-optimally.
  • Environment Access: While RE-HG removes the need for the reward function, it still requires a simulator or transition model to "roll out" the estimated follower policy. Moving toward a fully "offline" or "model-free" version would further expand its real-world utility.

Summary updated

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.
BibTeX
@inproceedings{kusaka2026reward,
  author = {Shigeki Kusaka and Mikoto Kudo and Takumi Tanabe and Akifumi Wachi and Youhei Akimoto},
  title = {{Reward-Estimated Hypergradient for Bilevel Reinforcement Learning with Black-Box Follower}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=ijYiE70M5J},
}
Figure