Structural
Reinforcement Learningfor Heterogeneous Agent Macroeconomics

Global solutions from simulated equilibrium prices.

* Equal contribution

The simulated economy

gt, zt

Full distribution.
Rich aggregate dynamics.

Market clearing
The individual’s decision state

st, zt, pt

Own state. Aggregate shocks.
Low-dimensional prices.

The distribution evolves in the simulation. The policy conditions on individual states and prices.

01 / The method

Sidestep the Master equation.

Keep the economy’s heterogeneity. Change the state representation used to make decisions.

In heterogeneous-agent models with aggregate risk, equilibrium prices generally depend on the full cross-sectional distribution. Tracking that distribution as a state variable creates a high-dimensional Master equation.

SRL works with a low-dimensional policy π(s, z, p) and evaluates lifetime utility along simulated equilibrium price paths. It combines reinforcement learning with structural knowledge of individual dynamics.

  1. 01

    Use the structure you know.

    Budget constraints and idiosyncratic transitions are encoded in the policy-dependent transition matrix Aπ. Differentiate the simulated objective through these known individual dynamics.

  2. 02

    Sample equilibrium price paths.

    Simulate aggregate shocks and prices to estimate expected lifetime utility. Policies double as demand schedules, so markets can clear along each rollout, including under a candidate policy.

  3. 03

    Improve the policy, taking prices as given.

    Structural policy gradient updates the low-dimensional policy. A stop-gradient through price formation implements competitive price-taking; the individual does not internalize its effect on equilibrium prices.

With the restricted decision state, the equilibrium concept is a sequential restricted perceptions equilibrium. The full distribution continues to evolve in the environment. Policies can also be extended to condition on price histories.

Inside the structural policy gradient

Known individual transitions carry the gradient; simulated aggregate histories supply the price paths. Monte Carlo sampling still introduces uncertainty in the estimated objective.

The structural policy gradient computational graph, from the slides. Original PDF

02 / Benchmark results

A familiar benchmark.
Closely matched dynamics.

In the Krusell–Smith model, compare SRL with a full rational-expectations solution computed using DeepHAM.

Krusell–Smith validation: both methods start from the same cross-sectional distribution and receive identical aggregate shock paths. Original PDF

Global solutions, in seconds to minutes.

The same method handles implicit market clearing in Huggett, forward-looking price setting in HANK, and portfolio choice with two endogenous asset prices.

JAX implementation on a single NVIDIA A100 GPU in Google Colab. Reported times are means over 10 runs, from the slides’ computational experiments.

Average runtime per solution
ModelTimeSeconds
Krusell–Smith37 sec36.77
Huggett + aggregate risk46 sec45.91
HANK + aggregate risk4.1 min246.49
Huggett + portfolio choice9.3 min559.50

Huggett partial-equilibrium reference: 24.50 seconds. Tutorial runtimes depend on the notebook and hardware; see the repository.

03 / Portfolio choice

Two assets.
Two market-clearing prices.

Extend Huggett with a risk-free bond and a risky stock. Both asset prices are pinned down by market clearing.

Individual policies determine asset demand. Aggregating across households yields demand schedules for both markets; their intersection identifies the joint clearing prices.

Joint market clearing

The two zero-excess-demand loci. Original PDF

Bond market

Bond demand at the clearing price. Original PDF

Equity market

Equity demand at the clearing price. Original PDF

Portfolio-choice results and the SSJ comparisons below are presented in the newer slides; the linked working paper is the March 2026 version.

Household policies and the cash-on-hand distribution

Consumption

Consumption by income state. Original PDF

Equity share

Equity share by income state. Original PDF

Cash-on-hand distribution

Distribution by income state. Original PDF

04 / Global and local solutions

Where nonlinearities matter.

The portfolio example illustrates differences between SRL and first-, second-, and third-order sequence-space approximations.

Portfolio experiment from the slides. Original axes, specifications and legends are retained. Original PDF

A global comparison beyond small shocks.

In the two-asset model, local approximations can deviate materially from the SRL solution as the aggregate shock moves away from the steady state. Higher approximation order does not uniformly close the gap in this example.

0.13%

Reported average SRL Euler equation error,
as a share of consumption.

Top panels: asset-price responses. Bottom panels: percentage deviations from SRL. Solid and dashed SRL curves distinguish the shock-volatility specifications shown in the original legend.

One-asset comparison from the notebook; note its distinct shock range and specifications. Original PDF

The one-asset benchmark is different.

In the one-asset Huggett example, the sequence-space approximations and SRL are closely aligned over the displayed shock range. The lower panels make the small remaining deviations visible.

0.096%

Reported average SRL Euler equation error
for the one-asset example in the slides.

These are different model experiments with different shock ranges and specifications. Switching views compares their findings, rather than holding the calibration fixed.

05 / Further validation

What changes the learned policy?

Inspect how a richer price history affects consumption policies.

Does adding a lagged price change decisions?

Richer price information.

In the Huggett experiment, allowing the policy to condition on one lagged bond price changes consumption policies only slightly over the displayed states.

This is an empirical robustness check in the benchmark, rather than a general result that current prices are sufficient in every economy.

Huggett price-history robustness: current-price policies versus one-price-lag policies. Original PDF

06 / Learn by building

From the household problem
to aggregate risk.

Seven pedagogical JAX notebooks introduce one idea at a time. Start with familiar value function iteration, then build up to structural RL.

00

Household problem, in NumPy

Establish the value function iteration benchmark.

Open in Colab
01

The same problem, in JAX

Change the tooling; keep the model and method.

Open in Colab
02

The same problem, by policy gradient

Maximize lifetime utility by automatic differentiation.

Open in Colab
03

The household with moving prices

Introduce an exogenous stochastic price process.

Open in Colab
04

Huggett without aggregate risk

Clear the bond market inside the simulated environment.

Open in Colab
05

Huggett with aggregate risk

Learn endogenous price dynamics from simulated paths.

Open in Colab
06

Huggett with Epstein–Zin preferences

Separate risk aversion and intertemporal substitution.

Open in Colab

Each notebook can run in Google Colab or locally. The repository is a tutorial implementation, rather than the complete replication package for every experiment on this page.

Read the full syllabus

07 / Read & cite

Explore the research.

The working paper develops the framework and benchmark experiments. The slides also cover the portfolio-choice extension and comparisons with higher-order SSJ.

Cite SRL

@misc{SRL,
  title = {Structural Reinforcement Learning for
    Heterogeneous Agent Macroeconomics},
  author = {Yucheng Yang and Chiyuan Wang and
    Andreas Schaab and Benjamin Moll},
  year = {2025},
  eprint = {2512.18892},
  archivePrefix = {arXiv},
  primaryClass = {econ.TH},
  url = {https://arxiv.org/abs/2512.18892}
}

Research figure

Original PDF