Building on the PINN foundations of Chapter Chapter 7, this chapter develops the full continuous-time heterogeneous-agent framework: the coupled system of the Hamilton--Jacobi--Bellman equation (for individual optimization) and the Kolmogorov forward equation (for the stationary wealth distribution), closed by a market-clearing condition. This is the continuous-time analogue of the discrete-time Krusell--Smith economy of Chapter Chapter 6. The primary reference is Achdou et al. (2022); for pedagogical background on the continuous-time methods, see also Moll’s lecture notes.[1]
In the previous chapter, we applied PINNs to individual PDEs (ODEs, the Poisson equation, the HJB for cake-eating, and the Black--Scholes equation). This chapter makes the leap to equilibrium systems: coupled PDEs that arise when a continuum of heterogeneous agents interact through prices. The theoretical framework draws on the Bewley--Huggett--Aiyagari tradition, formulated in continuous time following Achdou et al. (2022). We derive the two core PDEs, the Hamilton--Jacobi--Bellman (HJB) equation for individual optimization and the Kolmogorov forward equation (KFE) for the cross-sectional density, and show how they are coupled through market clearing. The chapter culminates with the master equation, a single (infinite-dimensional) PDE that encapsulates the full equilibrium, and with EMINNs, introduced by Gu et al. (2024), which solve it using deep learning.
8.0.0.1Companion notebook.¶
One notebook accompanies this chapter and the Lecture 13 numerical deck: lecture_13_08_Aiyagari_Continuous_Time_FD_and_PINN_PyTorch.ipynb. It first computes the stationary Aiyagari equilibrium with an upwind finite-difference solver, then freezes those equilibrium prices and trains a PINN for the coupled HJB--KFE system at them (with normalization, boundary-flux, state-constraint, and aggregate-capital diagnostics) -- so the PINN stage is an equilibrium-consistency and representation exercise, not a price-discovery algorithm. For transparency the notebook specializes the general CRRA/switching equations below to log utility () and symmetric two-state Poisson switching; the formulas in this chapter are the general case. The detailed upwind finite-difference scheme and PINN losses are developed in the accompanying Lecture 13 deck; this chapter focuses on the continuous-time equilibrium equations and the conceptual bridge to master-equation methods. (A partial-equilibrium HJB on its own is just a single-PDE PINN problem of the kind treated in Chapter Chapter 7; here we go straight to the coupled equilibrium system.)
8.0.0.2Where does come from?¶
Before turning to the PDEs themselves, it is worth fixing the economic picture. The model has a continuum of agents, each indexed by an idiosyncratic state comprising wealth and a labor or productivity component . Each agent solves its own HJB equation taking the prices as given, which yields an optimal savings policy that pushes mass through wealth space. The Kolmogorov forward equation tracks how this aggregate mass evolves, and its stationary solution is the cross-sectional density that the general-equilibrium clearing equations integrate against to obtain aggregate capital, , and aggregate labor, .
8.1Why Continuous Time?¶
Chapters Chapter 2--Chapter 6 formulated heterogeneous-agent models in discrete time. Working in continuous time offers several complementary advantages:
Analytical tractability. Itô calculus provides clean first-order conditions, and the separation between the backward HJB and the forward KFE is sharper than in discrete time.
No expectations operator. Conditional expectations are replaced by differential operators, avoiding numerical integration over shock distributions.
Powerful numerical methods. Finite differences, PINNs, and deep learning methods (EMINNs) can be applied directly to the PDE system.
Connection to mean field games. The coupled HJB--KFE system is precisely a mean field game (MFG) in the sense of Lasry & Lions (2007): each atomistic agent solves an HJB taking the cross-sectional density as given, while the density itself evolves via a KFE driven by those individual best responses. Equilibrium is the fixed point of this two-way coupling. Recasting the problem in MFG language gives access to a large mathematical literature on existence, uniqueness, and numerical analysis Carmona & Delarue, 2018Cardaliaguet et al., 2019.
8.1.0.1Historical context.¶
The models in this chapter build on a long tradition: Bewley (1986) introduced precautionary savings with borrowing constraints; Huggett (1993) studied endowment economies with incomplete markets; Aiyagari (1994) added production and general equilibrium; and Krusell & Smith (1998) incorporated aggregate uncertainty. Achdou et al. (2022) reformulated these models in continuous time and demonstrated that finite-difference methods can solve the coupled HJB--KFE system efficiently. More recently, Gu et al. (2024) introduced EMINNs to solve the master equation globally, enabling treatment of aggregate shocks without moment-based approximations.
8.2Stochastic Calculus Refresher¶
We briefly review the stochastic calculus tools needed for continuous-time models; for a standard finance-oriented textbook treatment, see Shreve (2004).
8.2.0.1Quick reference.¶
Appendix Appendix C contains a one-page summary of the same material (Brownian motion, Itô’s lemma, ergodicity in one paragraph) for readers who want a compact reminder rather than the full exposition below.
8.2.1Brownian Motion¶
Key properties include , , nowhere-differentiable paths, and quadratic variation . Brownian motion arises as the scaling limit of a random walk: if with equiprobably, then as (Donsker’s theorem). The scaling ensures that in the limit. Figure Figure 8.1 shows three discretized sample paths with the same variance scaling.
Figure 8.1:Three simulated standard Brownian sample paths , generated with discretization step and Gaussian increments , . Paths are jagged at the chosen ; limiting Brownian paths are continuous almost surely but nowhere differentiable, with .
8.2.2Itô Processes and SDEs¶
An Itô process satisfies the stochastic differential equation (SDE):
where is the drift (deterministic trend) and is the diffusion coefficient (volatility). Readers unfamiliar with Itô calculus will benefit from Shreve (2004) as a prerequisite; the key fact is what forces the second-order term in Itô’s lemma below. Two important special cases recur throughout this chapter:
Geometric Brownian motion (GBM): (stock prices, GDP).
Ornstein--Uhlenbeck (OU) process: (productivity, interest rates). The OU process is mean-reverting with stationary distribution . It will model aggregate TFP in the Krusell--Smith economy below.
For discrete income switching, we use a continuous-time Markov chain: a labor state that switches with Poisson intensities (from to ) and (from to ), yielding ergodic probabilities and .
8.2.3Itô’s Lemma¶
The key difference from ordinary calculus is the second-order correction , which arises because . The differential algebra rules are: , , .
8.2.3.1Worked example.¶
For GBM , applying Itô’s lemma to gives , so . The Itô correction explains why the expected log return differs from the expected return for volatile assets.
8.2.3.2Time-dependent version.¶
For where :
With Poisson jumps of intensity and jump size , an additional term appears.
8.3The Kolmogorov Forward Equation¶
The Kolmogorov forward equation (KFE), also known as the Fokker--Planck equation, describes how the probability density of a stochastic process evolves over time. It was introduced by Kolmogorov (1931) and, independently in the physics literature, by Fokker (1914) and Planck (1917) to describe diffusion of particles. In stationary equilibrium, and the KFE reduces to an elliptic PDE for the cross-sectional density (used throughout Section 8.5--Section 8.6); when aggregate shocks make prices time-varying, the parabolic time-dependent form returns and motivates the master-equation reformulation of Section 8.7.
8.3.1Derivation from First Principles¶
Consider a population of particles, each independently following with constant coefficients. If the initial density is , what is the density at time ?
The derivation proceeds in four steps. (i) For any smooth test function , . (ii) Differentiate with respect to and apply Itô’s lemma: . (iii) Integrate by parts. Take to be compactly supported: this kills the boundary terms cleanly and costs nothing here, since the identity must hold for every such . We obtain and . (The natural-looking assumption at is automatic for any continuous density, but it is not by itself enough: what is needed is that the product vanishes at infinity, which compact support of delivers for free. Spatial boundaries, e.g. a borrowing constraint, require separate treatment in the next subsection.) (iv) Since the identity holds for all test functions , we obtain:
The two terms on the right encode competing effects: is advection (drift transports the density), and is diffusion (noise spreads the density).
8.3.1.1General form.¶
For state-dependent coefficients , the KFE in divergence form is:
where is the probability flux. The identity is a conservation law: probability is neither created nor destroyed. When depends on , the diffusion coefficient must be written inside the second derivative; in particular, , with the two expressions differing by . This distinction is invisible in the constant-coefficient case but is what keeps the operator self-adjoint and probability-conserving when varies.
8.3.2Examples¶
8.3.2.1Heat equation.¶
With and constant , the KFE reduces to , the classical heat equation. Starting from a point mass , the solution is a Gaussian with variance growing linearly: .
8.3.2.2Ornstein--Uhlenbeck process.¶
For , the KFE is . Setting and trying a Gaussian ansatz , the advection and diffusion terms balance when , giving the stationary distribution : mean reversion concentrates mass around , while diffusion spreads it, and the balance produces a Gaussian steady state.
8.3.2.3Reading the SDE qualitatively.¶
It is worth pausing to read the drift sign by eye, because students are often trained to compute with differential equations but rarely to look at them. When , the drift is positive and pushes upward; when , the drift is negative and pushes downward, hence the name mean-reverting. Flipping the sign () gives a mean-repelling, unstable process that drifts away from without bound. Closely related cubic SDEs make the same point sharply. The process uses the cubic well as a restoring force and is well-posed with a stationary distribution, while blows up in finite time, and a naive Euler discretization produces NaNs almost immediately. Throughout this chapter the same qualitative reading is what carries intuition over from SDEs to KFEs and HJBs.
8.3.3From Physics to Economics: A Continuum of Agents¶
Consider a continuum of agents , each independently following with independent idiosyncratic Brownian motions . By the law of large numbers at the population level, the cross-sectional density evolves deterministically, even though each individual path is random. The density satisfies the KFE (8.5).
8.3.3.1KFE with income switching.¶
When agent has wealth and income state switching with Poisson intensities, and wealth evolves as with , the cross-sectional density satisfies:
where denotes the complementary income state. The three terms represent: flow of agents along the wealth axis (savings), agents leaving state , and agents entering state from .
8.3.3.2Boundaries and mass points.¶
At the borrowing constraint , the no-flux boundary condition prevents the absolutely continuous density from flowing below . If households are constrained at this boundary, a boundary atom may be needed in addition to the interior density; finite-difference implementations represent that atom as mass in the first grid cell. This is the continuous-time counterpart of the characteristic left spike observed in empirical wealth distributions.
8.3.3.3When does the KFE become stochastic?¶
With purely idiosyncratic shocks (Aiyagari), the KFE is deterministic. When aggregate shocks are present (Krusell--Smith), prices depend on the aggregate state , making the drift stochastic and the density a stochastic process adapted to the filtration generated by the aggregate Brownian motion. This is the “master equation” setting discussed in Section Section 8.7.
8.4The Hamilton--Jacobi--Bellman Equation¶
Individual optimality in continuous-time heterogeneous-agent models is characterized by the HJB equation. This section gives the full five-step derivation from Itô’s lemma; readers who saw the motivating overview of the continuous-time heterogeneous-agent setting in Section 7.7 can treat the present section as its formal counterpart.
8.4.0.1The agent’s problem.¶
Agent with state chooses consumption to maximize:
subject to and , where is CRRA utility, is the discount rate, and are factor prices. The standard transversality condition along optimal paths, the continuous-time no-Ponzi requirement, is imposed throughout.
8.4.0.2The value function.¶
The value function records the maximum expected discounted utility starting from state . It is increasing and concave in , and when .
8.4.0.3Deriving the HJB.¶
The derivation follows five steps; each unpacks one ingredient of equation (8.11) below.
Step (i): Dynamic programming principle. For small ,
This is Bellman’s principle of optimality applied to a continuous-time problem.
Step (ii): Itô’s lemma between income jumps. Conditional on the income state not changing on , wealth follows the deterministic ODE (there is no Brownian forcing on wealth in this model), so
The second-order Itô correction vanishes because the wealth diffusion is zero between jumps; this is the most subtle step and is what distinguishes the income-switching HJB from a standard diffusion HJB.
Step (iii): Account for Poisson jumps in expectation. Adding the Poisson-jump contribution and taking expectations,
where is the intensity of switching out of state and is the complementary state.
Step (iv): Substitute into the DPP and let . Plugging the expectation back into the Bellman expression, dividing by , and taking yields a flow equation in which the discount on the left balances the flow utility plus expected change on the right.
Step (v): Optimize over . Imposing the first-order condition over consumption gives the HJB equation:
8.4.0.4Interpretation.¶
The HJB is an asset pricing equation: the left side is the “required return” on the value function (discount rate times “asset value”), and the right side is the “total return” consisting of the flow dividend , the capital gain from saving, and the expected gain/loss from income switching.
8.4.0.5Optimal policy.¶
The first-order condition gives the consumption function:
Substituting back eliminates the maximization, yielding a nonlinear PDE in . The savings function is .
8.4.0.6Boundary conditions.¶
At the borrowing constraint , consumption must keep the drift feasible: , or equivalently . The boundary HJB is therefore the constrained maximization
For CRRA utility this gives the boundary policy and . This is the state-constraint form of the borrowing limit; numerical solvers usually impose it with one-sided derivatives, a constrained policy rule, or a penalty on negative boundary drift.
8.4.0.7Boundary atoms in the stationary distribution.¶
When the borrowing constraint binds on a positive mass of agents, the stationary measure is not absolutely continuous with respect to Lebesgue measure: it carries a Dirac atom at . The decomposition is , where is the absolutely-continuous interior density and is the constrained mass for income state . The KFE (8.6) as written governs only the interior part ; the atomic mass is determined by a separate flux-balance equation that equates inflows from the no-flux boundary condition with the income-driven outflow back into the interior. Finite-difference implementations typically represent as the mass in the first grid cell, and PINN implementations either absorb the atom implicitly into a smooth density approximation (with corresponding accuracy loss near ) or explicitly parameterize alongside the interior network.
8.4.0.8Variant: continuous (diffusion) income.¶
A natural variant replaces the two-state Poisson process with a continuously distributed earnings state following an Ornstein--Uhlenbeck diffusion, (with idiosyncratic Brownian motion ). The agent’s state is then , the value function is smooth in both arguments, and Itô’s lemma along the -diffusion produces a genuine second-order term. After substituting the first-order condition the HJB becomes the elliptic PDE
with the borrowing-constraint state condition at , a Neumann (FOC) condition on the truncated upper wealth boundary, and reflecting conditions at the -boundaries. This is the smallest model in the chapter that carries the diffusion second-order term in the individual HJB: the income-switching HJB (8.11) has none, because wealth carries no Brownian forcing between jumps, while the master equation (8.16) carries only for the aggregate TFP state .
8.5Competitive Equilibrium: Huggett and Aiyagari¶
The HJB gives individual optimal behavior for given prices; the KFE tracks the resulting distribution. Market clearing pins down prices, closing the system. Figure Figure 8.2 summarizes this fixed-point structure.
8.5.1The Coupled HJB--KFE System¶
Figure 8.2:Stationary continuous-time heterogeneous-agent equilibrium as a coupled HJB--KFE--market-clearing loop. Given prices, the HJB determines optimal savings; the KFE maps that policy into a stationary density; aggregating the density updates capital, labor, and therefore prices.
The solution method for the stationary equilibrium (no aggregate shocks) iterates: guess solve HJB for solve KFE for compute update from the firm FOC. Under standard regularity conditions on preferences, technology, and the income process, aggregate capital supply is monotone decreasing in over the relevant range, which makes the bisection (or fixed-point iteration) on well-posed; see Achdou et al. (2022) [§2] for the full statement.
8.5.2Huggett (1993): Endowment Economy¶
Huggett’s model is an endowment economy with idiosyncratic income , a single risk-free bond paying instantaneous return , and bonds in zero net supply. The HJB is , and the KFE determines the stationary density . An equilibrium return is a value satisfying the asset-market-clearing condition ; uniqueness requires standard monotonicity assumptions on aggregate bond demand Achdou et al., 2022.
The mechanism is that the risk-free rate is pinned down by precautionary self-insurance demand, not by a production FOC: agents desire to hold positive bond positions for precautionary reasons, and the return must adjust downward until bond demand equals zero net supply.
8.5.3Aiyagari (1994): Production Economy¶
Aiyagari’s model adds a representative firm with Cobb--Douglas production . The household asset is now a claim on aggregate capital, and the firm’s FOCs yield and . The equilibrium condition is , where is capital supplied by households (via HJB + KFE) and is capital demanded by the firm (inverse of the firm FOC). Table Table 8.1 highlights the key distinction between the endowment and production versions.
8.5.3.1What changes from Huggett to Aiyagari?¶
Both models share the same household problem (HJB) and the same cross-sectional law of motion (KFE). What differs is the equilibrium concept. In Huggett the equilibrium is the single price that clears a zero-net-supply bond market, ; the rate is pinned down by precautionary self-insurance demand alone, with no production side. In Aiyagari the equilibrium is a fixed point in that matches household supply to firm demand , with prices determined jointly by household savings and the firm FOCs. Numerically, both reduce to a one-dimensional root-finding problem in , but the economic mechanism (precautionary saving vs. marginal-product-of-capital pinning) is qualitatively different.
8.5.3.2Adding aggregate TFP.¶
When aggregate TFP is allowed to vary (e.g., the OU process introduced in Section 8.7 below for Krusell--Smith), the firm FOCs generalize to and . Aiyagari is recovered when ; the same expression covers both calibrations, which is convenient for the master-equation analysis below.
Table 8.1:Huggett and Aiyagari as two continuous-time incomplete-markets benchmarks. Huggett clears a zero-net-supply bond market by adjusting the bond return; Aiyagari clears a positive capital market with prices pinned down by firm first-order conditions.
| Huggett (1993) | Aiyagari (1994) | |
|---|---|---|
| Economy | Endowment | Production () |
| Asset | Bond | Capital claim |
| Net supply | Zero () | Positive () |
| Price determined by | Bond return | Interest rate , wage |
| Wealth distribution | Centered around 0, mass at | Right-skewed, long right tail |
Figure Figure 8.3 contrasts the two stationary densities visually. In Huggett (left), bonds are in zero net supply, so the cross-sectional density is centred near , with a Dirac atom at the borrowing limit carried entirely by constrained low-productivity households; high-productivity households are smoothly distributed and never bind. In Aiyagari (right), agents hold positive capital in equilibrium, so the same atom now sits at but the bulk of the mass is shifted right with a long upper tail.
Figure 8.3:Stationary cross-sectional densities in the two benchmarks, by productivity type (low and high). In both economies, only the constrained low-productivity type supports a Dirac atom at the borrowing constraint (blue spike): high-productivity households are not bound. Left: Huggett, bonds with limit and zero net supply, so the bulk of mass sits around . Right: Aiyagari, capital with limit and positive aggregate , shifting the unconstrained mass to the right with a long upper tail. The blue spikes visualize the Dirac atom in the decomposition introduced in the boundary-atom paragraph above. These curves are schematic TikZ illustrations of the qualitative contrast (zero-net-supply bonds versus positive capital), not direct exports; the exact densities depend on calibration and boundary treatment.
8.5.3.3Connection to HANK.¶
These models are the building blocks of Heterogeneous Agent New Keynesian (HANK) models Kaplan et al., 2018, which replace the representative agent in New Keynesian frameworks with an Aiyagari economy. Adding nominal rigidities allows monetary policy to affect consumption heterogeneously: agents near the borrowing constraint have high marginal propensities to consume and respond strongly to fiscal stimulus, while wealthy agents absorb shocks through savings.
8.6A PINN Solver for the Stationary Huggett--Aiyagari System¶
The stationary equilibrium of Section 8.5 couples five conditions: the HJB equation for the value function , the consumption first-order condition , the KFE for the stationary density with savings drift , the no-flux boundary condition at the borrowing constraint , mass normalization , and the market-clearing condition that pins down prices. The traditional solver iterates a fixed point over (guess solve HJB for solve KFE for aggregate capital update from the firm FOC); a PINN instead trains all of them jointly.
A PINN implementation uses two networks, trained jointly:
: approximates the value function. Its derivative is computed via automatic differentiation, and the implied consumption policy is .
: approximates the stationary density, with a positivity transform (e.g., softplus or ) ensuring .
The joint loss has four components:
where and are mean squared PDE residuals computed on collocation points, enforces the no-flux boundary conditions , and the mass term enforces normalization. The integral is evaluated numerically (quadrature or Monte Carlo on the collocation points). The aggregate-flux identity at each interior -- which follows from the no-flux boundary and total-mass conservation within each -slice -- is a free consistency check at solution time and is sometimes added as an auxiliary loss term.
Balancing the four loss components is critical: the HJB and KFE residuals can differ by orders of magnitude, so adaptive loss balancing (ReLoBRaLo, Chapter Chapter 4) is strongly recommended. Practical considerations include using separate learning-rate schedules for the two networks, concentrating collocation points near the borrowing constraint where the density can become sharply peaked, and verifying that the consumption policy satisfies everywhere. If the true stationary distribution contains an atom at the borrowing constraint (as in both Huggett and Aiyagari, Figure Figure 8.3), a continuous density network alone cannot represent it; one must add a separate boundary-mass variable or use a discretization that permits a point mass.
This continuous-time PINN approach and the discrete-time DEQN with Young’s method (Chapter Chapter 6) address the same economic question -- how heterogeneous agents interact through prices when markets are incomplete -- but differ in the mathematical formulation summarized in Table Table 8.2.
Table 8.2:Discrete- and continuous-time formulations of incomplete-markets heterogeneous-agent models. The economic object is the same in both columns, but the numerical residual changes from a discrete-time law of motion plus Euler equation to a coupled HJB--KFE PDE system.
| Discrete time (Ch. Chapter 6) | Continuous time (this chapter) | |
|---|---|---|
| Distribution | Histogram | Density |
| Evolution | Young’s redistribution | KFE PDE |
| Individual opt. | Euler equation | HJB PDE |
| Solver | DEQN (TensorFlow) | PINN (PyTorch) |
| Key reference | Krusell & Smith (1998) | Achdou et al. (2022) |
Both approaches can incorporate aggregate shocks, multiple assets, and general equilibrium; the choice between them depends primarily on whether the underlying economic model is formulated in discrete or continuous time. For the aggregate-shock case the natural continuous-time object is the master equation (Section 8.7), solved with EMINNs (Section 8.8).
8.7The Master Equation¶
When aggregate TFP follows an OU process (with mean-reversion speed ; not the OLG TFP shock or the network learning rate of earlier chapters), the value function depends on the entire wealth distribution: . The HJB becomes a PDE with a functional argument, and the “curse of infinite dimensionality” strikes: the functional derivative makes the problem intractable by standard methods. The master equation approach, which originated in the mean field games literature Lasry & Lions, 2007 and is developed systematically in the monograph of Cardaliaguet et al. (2019), reformulates this coupled HJB--KFE system as a single PDE on the extended state space that retains the distribution argument explicitly but is amenable to neural network approximation.
8.7.0.1Why collapse the coupled system?¶
Without aggregate shocks, solving the stationary equilibrium as a fixed point in over the coupled HJB--KFE system is straightforward (Section 8.5). With aggregate shocks, however, every realization of would in principle require its own coupled solve, and no parametric guess for can be informed by the cross-section unless the cross-section is treated as an explicit argument. The master equation reformulation lifts into the state space so a single PDE in encodes the entire economy, which makes a global neural-network ansatz feasible (Section Section 8.8). The price of this convenience is the appearance of the functional-derivative term , which the rest of this section unpacks.
8.7.0.2The master equation.¶
The key idea is to substitute the KFE, market clearing, and belief consistency directly into the HJB, collapsing the coupled system into a single PDE:
where is the KFE drift computed from the optimal savings policy, and the last line encodes how changes in the distribution affect the value function through prices. The kernel is the infinite-dimensional analogue of a gradient: it measures how the value function at the individual state responds to an infinitesimal redistribution of probability mass to wealth level in the cross-section; the remark below makes this precise. Mass conservation guarantees (the KFE flux integrates to zero under no-flux boundary conditions), so the integrand of the last line pairs with a mean-zero test perturbation in exactly the sense required by the functional-derivative remark below.
8.7.0.3The envelope condition.¶
Following Gu et al. (2024), it is more convenient to work with , which directly gives the consumption policy via . The master equation for takes the form:
where captures individual state dynamics (savings, income switching), captures TFP dynamics, and captures distribution dynamics.
8.8EMINNs: Solving the Master Equation with Deep Learning¶
Economic Model Informed Neural Networks (EMINNs), introduced by Gu et al. (2024), solve the master equation by (i) approximating the infinite-dimensional distribution by a finite-dimensional object , and (ii) parameterizing by a neural network trained to minimize the master equation residual. A teaching-scale companion notebook for EMINNs is forthcoming; in the present edition, the master-equation discussion is text-only and the Aiyagari notebook (lecture_13_08_Aiyagari_Continuous_Time_FD_and_PINN_PyTorch.ipynb) is the closest computational reference.
8.8.1Three Approximation Approaches for the Distribution¶
The infinite-dimensional distribution must be replaced by a finite-dimensional approximation so that . Table Table 8.3 summarizes the three approaches used in Gu et al. (2024).
Table 8.3:Finite-dimensional representations of the cross-sectional distribution in EMINNs. Here denotes a Dirac measure centered at , not the depreciation rate of Chapters Chapter 2--Chapter 6.
| Finite population | Discrete state | Projection | |
|---|---|---|---|
| Masses on grid | Basis coefficients | ||
| Dimension |
8.8.1.1Finite population ().¶
Replace the continuum by agents with states . Aggregate capital is . Sampling individual states and distribution states separately during training keeps manageable; the law of large numbers provides accurate aggregate capital even with 40 agents.
8.8.1.2Discrete state (200 grid points).¶
Discretize wealth on a grid and represent the distribution as masses at each . The KFE becomes a finite-difference mass evolution, and the functional derivative becomes a partial derivative .
8.8.1.3Projection (5 components).¶
Project onto eigenfunctions of the steady-state KFE operator . These are the most persistent density components, carrying the most price-relevant information. Only 5 basis functions suffice, yielding the lowest-dimensional representation, but the setup requires computing eigenfunctions and choosing appropriate test functions for the KFE evolution.
8.8.2The EMINN Algorithm¶
A neural network with parameterizes the marginal value of wealth. The output uses a softplus activation to ensure , and consumption follows directly from the envelope condition: . Algorithm Algorithm 8.1 gives the resulting residual-minimization loop.
This is precisely a PINN applied to the master equation: the “physics” is the economic equilibrium structure, and all derivatives, including those with respect to the distribution parameters , are computed by automatic differentiation.
The master equation residual decomposes as:
where captures savings and income switching, captures the OU aggregate shock, and captures distribution evolution.
8.8.2.1Computing the drift coefficients .¶
The coefficients describing how the finite-dimensional approximation of the cross-sectional density evolves in time are not given for free. Recovering them is a genuine algorithmic step, and it is the place where the three approximation choices in Section Section 8.8.1 differ most sharply:
Finite-population approximation. is the empirical measure of a finite particle system, so is the SDE drift of particle , available in closed form from the underlying individual problem.
Discrete-state (grid) approximation. is the mass at ; the discretized KFE evaluated at that node returns directly. This is also where an upwind scheme reappears (see the remark after (7.18)): the side of used in the discretization is selected by the sign of the drift .
Projection / basis expansion. . The KFE returns as a function of ; one then recovers by least-squares projection of onto . This is the only step of EMINN that genuinely depends on the choice of approximation, and it is where most of the practical art lives.
Concretely, between the forward pass and the residual evaluation in Algorithm Algorithm 8.1, an additional sub-step computes for the current ; the chain rule through then propagates these coefficients into .
8.8.3Shape Constraints and Training Stability¶
A key practical challenge in training EMINNs is that neural networks may converge to “cheat solutions” (constant, non-increasing, or non-concave value functions that produce small residuals but are economically meaningless). Shape penalties are added to the loss to enforce economic structure:
Concavity: penalize non-concavity (i.e., violations of the standard condition) via , which is positive only when at some collocation point.
Monotonicity: in calibrations where higher TFP lowers the marginal value of liquid wealth, penalize violations of the model-specific restriction .
Initialization: set as a simple decreasing initial marginal-value profile.
Architectural encoding: if the chosen formulation has known boundary asymptotics for or , multiply the network by an appropriate boundary factor rather than asking the optimizer to learn the singular shape from scratch.
Active sampling: concentrate collocation points where the residual is large.
8.8.4Results and Method Comparison¶
For the Aiyagari model (no aggregate shocks), Gu et al. (2024) report master-equation residuals of order 10-5 and mean squared errors against finite-difference benchmarks of order 10-5, with close agreement in consumption policies, marginal value functions, and stationary distributions across the finite-population and discrete-state approaches.
For the Krusell--Smith model (with aggregate shocks), their reported results show master-equation training losses of order 10-5 across all three approximation approaches and similar time paths for aggregate variables (capital, interest rate, wage). In that experiment, the projection approach achieves the lowest reported loss () with only 5 distribution parameters, while the finite-population approach () offers the simplest implementation.
Table Table 8.4 gives the practical method comparison for this chapter.
Table 8.4:Finite differences, PINNs, and EMINNs for the continuous-time heterogeneous-agent problems covered in this chapter. The entries are practical guidance, not universal impossibility results: finite differences remain the benchmark in low dimension, while EMINNs target the global master-equation setting with the distribution as a state.
| Finite differences | PINN | EMINN | |
|---|---|---|---|
| Stationary equilibrium | Benchmark method | Works, validate carefully | Works, but overkill |
| Aggregate shocks | Local/low-dimensional only | Coupled system, not full master equation | Designed for global master equation |
| Grid required | Yes | No state grid | No state grid |
| High-dimensional scaling | Limited by grids | Better, optimization-limited | Better, distribution-state approximation needed |
| Handles as state | Not in standard stationary FD | No | Yes, through |
| Convergence theory | Strong for low-dimensional monotone schemes | Limited | Limited |
| Low-dimensional accuracy | Often | Problem-dependent; validate | Reported |
For stationary, low-dimensional problems, finite differences remain fast and reliable and should be used as the benchmark. For models with aggregate shocks and high-dimensional state spaces, EMINNs are, among the methods surveyed here, one of the few approaches demonstrated on global master-equation solutions for this class of benchmarks. PINNs serve as a useful intermediate step: they share the same code philosophy as EMINNs (automatic differentiation of PDE residuals) but apply to the coupled HJB--KFE system rather than the master equation.
8.9Further Reading¶
Achdou et al. (2022), the canonical continuous-time HA reference.
Gu et al. (2024), the EMINN paper.
Lasry & Lions (2007) Carmona & Delarue (2018)Cardaliaguet et al. (2019), mean-field-games foundations.
Shreve (2004), stochastic-calculus textbook.
Moll’s online lecture notes (https://
benjaminmoll .com /lectures/), pedagogical complement.
8.10Exercises¶
Worked solutions and guidance for these exercises appear in Appendix Appendix F.
- Achdou, Y., Han, J., Lasry, J.-M., Lions, P.-L., & Moll, B. (2022). Income and wealth distribution in macroeconomics: A continuous-time approach. The Review of Economic Studies, 89(1), 45–86.
- Gu, Z., Lauriere, M., Merkel, S., & Payne, J. (2024). Global Solutions to Master Equations for Continuous Time Heterogeneous Agent Macroeconomic Models. https://arxiv.org/abs/2406.13726
- Lasry, J.-M., & Lions, P.-L. (2007). Mean Field Games. Japanese Journal of Mathematics, 2(1), 229–260.
- Carmona, R., & Delarue, F. (2018). Probabilistic Theory of Mean Field Games with Applications I–II (Vols. 83–84). Springer.
- Cardaliaguet, P., Delarue, F., Lasry, J.-M., & Lions, P.-L. (2019). The Master Equation and the Convergence Problem in Mean Field Games. Princeton University Press.
- Bewley, T. (1986). Stationary monetary equilibrium with a continuum of independently fluctuating consumers. In W. Hildenbrand & A. Mas-Colell (Eds.), Contributions to Mathematical Economics in Honor of Gérard Debreu (pp. 79–102). North-Holland.
- Huggett, M. (1993). The Risk-Free Rate in Heterogeneous-Agent Incomplete-Insurance Economies. Journal of Economic Dynamics and Control, 17(5–6), 953–969. 10.1016/0165-1889(93)90024-M
- Aiyagari, S. R. (1994). Uninsured Idiosyncratic Risk and Aggregate Saving. The Quarterly Journal of Economics, 109(3), 659–684.
- Krusell, P., & Smith, A. A., Jr. (1998). Income and wealth heterogeneity in the macroeconomy. Journal of Political Economy, 106(5), 867–896.
- Shreve, S. E. (2004). Stochastic Calculus for Finance II: Continuous-Time Models. Springer.
- Kaplan, G., Moll, B., & Violante, G. L. (2018). Monetary Policy According to HANK. American Economic Review, 108(3), 697–743.