Economics-Inspired Neural Networks with Stabilizing Homotopies

28 Pages Posted: 16 Mar 2023 Last revised: 5 Apr 2023

Date Written: March 13, 2023


Contemporary deep learning based solution methods used to compute approximate equilibria of high-dimensional dynamic stochastic economic models are often faced with two pain points. The first problem is that the loss function typically encodes a diverse set of equilibrium conditions, such as market clearing and households' or firms' optimality conditions. Hence the training algorithm trades off errors between those --- potentially very different --- equilibrium conditions. This renders the interpretation of the remaining errors challenging. The second problem is that portfolio choice in models with multiple assets is only pinned down for low errors in the corresponding equilibrium conditions. In the beginning of training, this can lead to fluctuating policies for different assets, which hampers the training process. To alleviate these issues, we propose two complementary innovations. First, we introduce Market Clearing Layers, a neural network architecture that automatically enforces all the market clearing conditions and borrowing constraints in the economy. Encoding economic constraints into the neural network architecture reduces the number of terms in the loss function and enhances the interpretability of the remaining equilibrium errors. Furthermore, we present a homotopy algorithm for solving portfolio choice problems with multiple assets, which ameliorates numerical instabilities arising in the context of deep learning. To illustrate our method we solve an overlapping generations model with two permanent risk aversion types, three distinct assets, and aggregate shocks.

Keywords: computational economics, deep learning, deep neural networks, implicit layers, market clearing, global solution method, life-cycle, occasionally binding constraints, overlapping generations

JEL Classification: C61, C63, C68, E21

Suggested Citation

Azinovic, Marlon and Žemlička, Jan, Economics-Inspired Neural Networks with Stabilizing Homotopies (March 13, 2023). Available at SSRN: or

Marlon Azinovic

University of Pennsylvania ( email )

Philadelphia, PA 19104
United States

Jan Žemlička (Contact Author)

CERGE-EI ( email )

Politickych veznu 7
Prague, 111 21
Czech Republic


Do you have negative results from your research you’d like to share?

Paper statistics

Abstract Views
PlumX Metrics