Zhigang Feng · Professor of Economics
E-mail: z.feng2@gmail.com
Twelve topics, organized by subject rather than by calendar date, so this works as a taught course or as self-study. Every topic has a deck; most have a lab; and most were taught on camera — see the recordings. The written counterpart is the textbook 机器学习与数量宏观经济学.
The AI frontier — language models as measurement, retrieval, and agentic research pipelines — is the sister course, AI for Economic Research: Dynamic Models, Language, and Agents. Together:
Classical Methods → ML & Deep Learning → Agentic AI Research
This site is the first two stages.
This course prepares economists for a change in what the job requires. As AI takes over more of the code, the economist's advantage moves to critical validation and economic safeguarding — designing algorithms, directing tools deliberately, and auditing what comes back for both technical correctness and economic sense. The name for that role in this course is the Research Architect.
You will work through the computational and statistical tools for analyzing structural economic models, with the traditional methods (dynamic programming, perturbation, projection) and the modern ones (deep learning, reinforcement learning) treated as one toolkit rather than two camps. Python and PyTorch are the implementation languages throughout, and high-performance computing gets its own topic.
It is no longer writing code. It is knowing what code to write, how to establish that it works, and whether the results mean anything economically. Your advantage is not syntax. It is translating economic problems into precise algorithmic specifications, recognizing when numerical output violates economic principles, auditing generated code for the subtle bugs that quietly corrupt an economic conclusion, and using AI as a complement that amplifies you rather than a substitute that replaces you.
Master the economic theory and the numerical method on paper, before touching code — the core models, and both conventional computation (VFI, perturbation, projection) and ML/RL-based approaches. This logic is human-driven and tool-agnostic. It is the part that cannot be outsourced, and the foundation everything else rests on.
The goal is not to become an expert programmer. It is to understand the computational landscape well enough to direct tools effectively and evaluate what they return.
Collaborate with AI coding assistants through specification-driven development: turn the algorithmic logic from Competency 1 into a specification detailed enough — pseudocode, data structures, objectives, validation criteria — that a tool can produce working code from it while you stay the architect. This is the fastest-moving competency in the course; the landscape shifts every few months and the material shifts with it.
This is the heart of the course. It determines whether you control the tools or the tools control you.
By the end you should be able to:
This curriculum has been developed and refined since 2019 through teaching at Zhongnan University of Economics and Law (2021–2024), the University of International Business and Economics (2023–2025), Huazhong University of Science and Technology (2019), Iowa State University (2025), the University of Miami (2025–2026), and Wuhan University (2024–2025).
The hands-on sessions are the core of the course, not an appendix to it. Each one follows the same five-step workflow, which is the Research Architect role made into a procedure:
This is not a set of static pre-AI notebooks. The implementation is live, customizable and expandable, and you are in an interactive loop with the tool — using it to fill gaps ("explain this PyTorch function") while you safeguard the output with economic and computational judgment.
The sessions are designed to prove a specific point: your background understanding matters. Several deliberately start from a vague prompt that yields a flawed or naive answer, so you can see what detailed, economically-informed instruction and rigorous validation actually buy you.
Subject to change as the field moves and depending on class interest. Each topic below links to its deck, its lab, and its recording where one exists.
Objective. Demonstrate concretely how a precise, specification-driven prompt outperforms a generic request.
Activities. Solve the classical optimal growth model (which has a closed-form solution, so correctness is checkable); estimate an AR(1) process for TFP shocks; then compare the generic and specification-driven outputs for correctness and economic plausibility, and discuss why they differ.
Objective. Get a working Python environment, then apply the Research Architect workflow to simulate the Solow growth model.
Activities. Install Python (Anaconda) and
VS Code; see why 0.1 + 0.2 ≠ 0.3 and what that implies for convergence
tests; translate the Solow model into pseudocode and then into Python loops; move from loops
to vectorized NumPy.
numpy.linalg.Objective. Solve a two-period consumption-saving problem, bridging standard economic modelling (SciPy) and modern AI frameworks (PyTorch tensors).
Outcome. Organize economic models with Python classes, perform numerical optimization for intertemporal choice, and run basic linear algebra in both NumPy and PyTorch with a feel for the performance difference.
Activities. Build an Agent class
encapsulating parameters (β, r) and utility; solve with scipy.optimize; visualize
how optimal consumption responds to the interest rate; create tensors and see the CPU/GPU
distinction; benchmark matrix operations across pure Python, NumPy and PyTorch.
A standalone session that formalizes the Research Architect workflow for AI-assisted macro coding. The organizing idea is to separate algorithm design from code implementation: the economist defines theory, numerical method and validation criteria; the tool handles implementation loops under supervision.
CLAUDE.md for project context,
skills for reusable workflows, agents for specialized review, rules for always-on
constraints.Objective. Implement and validate a dynamic equilibrium model with a structured, specification-first workflow.
Outcome. Convert an economic specification into a reproducible pipeline, enforce validation gates, and organize project memory with skills, agents and rules.
Activities. Start from the provided template; implement a baseline version with explicit convergence and Euler-error diagnostics; add one extension at a time, validating each before moving on; run specialized review checks for numerical stability and economic consistency.
scipy.optimize,
scipy.interpolate, NumPy.Objective. Implement the core numerical algorithms and manage the research code lifecycle with Git and GitHub.
Outcome. Initialize a repository for your research, select and implement appropriate SciPy solvers for equilibrium and optimization problems, and discretize stochastic processes for dynamic models.
Activities. Set up a repository, write a
.gitignore, make the first commit/push; solve for market-clearing prices in a
non-linear supply/demand system with Newton-Raphson; solve a constrained utility maximization
and validate the first-order conditions; approximate a production function with linear versus
cubic splines; discretize an AR(1) productivity shock with Tauchen and check the moments
against simulation.
torch.nn; training loops and
optimizers (SGD, Adam, RMSprop); distributed data parallelism; CPU versus GPU device
management.Objective. Build a network from scratch in PyTorch to fit synthetic policy functions and then real economic data, including fetching it from an online API.
Outcome. Construct a feedforward network with
torch.nn.Module, write a training loop with backpropagation, manage train/test
splits, and interpret predictions in economic terms.
Activities. Train a network to learn a known
non-linear consumption function; write the training loop by hand (forward pass, loss,
backpropagation, optimizer step); pull unemployment and inflation from FRED with
pandas_datareader; fit a Phillips curve and visualize the learned relationship;
use learning curves to diagnose overfitting.
Objective. Solve the stochastic optimal growth model first with classical grid-based VFI to establish a benchmark, then reframe it as supervised learning and solve it with neural networks.
Outcome. Understand where grid-based methods run out (the curse of dimensionality) and how networks get around it, by implementing an actor-critic architecture where one network approximates the value function and another the policy.
Activities. Lab 6A — classical VFI with
discretization, producing the reference solution. Lab 6B — build a
ValueNet and a PolicyNet in PyTorch; implement alternating updates
(minimizing Bellman error against maximizing expected utility); then overlay the network
solution on the VFI solution and quantify the gap.
Objective. Implement the foundational numerical methods for the stochastic growth model, by grid-based dynamic programming and by Euler equation methods.
Outcome. Calibrate the RBC model, construct appropriate grids, implement VFI with various interpolation schemes, implement time iteration, and compare the two on implementation complexity and performance.
Activities. Calibrate to US business-cycle moments; build capital grids and discretize productivity shocks; implement VFI with linear and cubic spline interpolation; implement time iteration on the consumption Euler equation; monitor convergence and visualize policy functions; simulate and compute business-cycle statistics.
Objective. Implement acceleration techniques and EGM, and build the habit of rigorously checking whether a numerical solution is actually right.
Outcome. Implement Howard's improvement and EGM, compute Euler equation errors across the state space, run systematic accuracy comparisons, and choose methods based on the problem rather than on habit.
Activities. Implement Howard's policy improvement and measure the speedup; exploit monotonicity via binary search; implement EGM for the RBC model; compute and visualize Euler equation errors; run sensitivity analysis over grid density, tolerance and interpolation method; generate impulse responses and check them for economic plausibility.
Objective. Implement first- and second-order perturbation and Chebyshev projection for the RBC model, and compare local against global accuracy in different regions of the state space.
Activities. Compute the deterministic steady state; derive and implement the first-order log-linear approximation; check Blanchard-Kahn conditions; implement second-order perturbation with pruning; generate impulse responses; implement Chebyshev approximation of the policy functions, choosing collocation nodes and solving for the coefficients; then compare perturbation, Chebyshev and VFI on accuracy across the state space — near the steady state and far from it — and on solution time and memory.
The notebook for this session is still being written; the recording works through the material in the meantime.
MPI_Init,
MPI_Comm_rank, MPI_Comm_size; point-to-point
(Send/Recv) and collective operations
(Gather, Scatter, Bcast, Reduce);
mpi4py for Python..to(device);
nn.DataParallel for single-machine multi-GPU;
DistributedDataParallel for multi-node; efficient GPU utilization; profiling.Objective. Parallelize the VFI solver both the traditional way (MPI) and the modern way (PyTorch DDP), and compare how each scales.
Activities. Analyze the VFI algorithm for parallelization opportunities;
partition the state space across processes; write mpi4py code distributing grid
points to workers with gather/scatter for value function updates; handle communication
overhead and synchronization; parallelize neural VFI with DDP; write SLURM scripts for CPU and
GPU jobs; run a scaling study and measure speedup against cores/GPUs; see Amdahl's law bite in
practice; profile to separate computation from communication cost.
Notebook in preparation. The
deck's mpi4py and SLURM snippets are runnable as
they stand.
Objective. Implement and compare stationary and global solution methods for heterogeneous-agent models, from canonical Aiyagari to Krusell-Smith with aggregate shocks.
Outcome. Compute stationary equilibria, diagnose distributional dynamics, train DeepHAM-style value/policy approximations, and implement Euler-based DEQN training.
Activities. Build the canonical Aiyagari loop (policy solution, stationary distribution, market-clearing rate); check the uniqueness and convergence assumptions and the solver's numerical robustness; extend to Krusell-Smith, treating the distribution (or its moments) as an evolving state; train DeepHAM and track learning stability; train DEQN by minimizing Euler residuals across many parallel economies; compare the two on accuracy, speed and scalability.
Objective. Solve a stationary OLG model with idiosyncratic risk by traditional methods, then extend it with ML to include aggregate uncertainty, bonds and government policy.
Outcome. Implement backward induction for lifecycle problems, compute stationary distributions across age and wealth, solve for general equilibrium prices, implement networks with embedded market clearing, and apply homotopy methods for training stability.
Activities. Set up demographics, lifecycle income and retirement; implement backward induction from terminal age; build the transition matrix across ages with survival probabilities; forward-iterate to the stationary distribution over (age, wealth, productivity); clear markets by iterating on the interest rate and wage; analyze lifecycle consumption, saving and wealth accumulation. Then add aggregate shocks; design an age-conditioned architecture; implement the market clearing layer; write the custom loss weighting Euler and market-clearing errors; use Fisher-Burmeister for complementarity; implement homotopy training from a simpler model upward; pre-train on fixed prices before going endogenous; validate the ML solution against the traditional one in the stationary case; and simulate transition dynamics after an aggregate shock.
Every topic here except 3, 10 and 12 was taught on camera in the 2026 University of Miami offering: nine lectures, about nine and a half hours, free and without registration. Four earlier series going back to 2024 cover the same ground more slowly, and the 2025 Miami series is the best treatment of Topic 3.
All recordings, mapped topic by topic · 2026 series on Bilibili
机器学习与数量宏观经济学 (Machine Learning and Quantitative Macroeconomics) by Zhigang Feng bridges classical numerical methods and modern deep learning for dynamic economic models. It is the primary written reference for this course.
AI for Economic Research: Dynamic Models, Language, and Agents continues where Topic 12 stops: reinforcement learning in depth, language models as economic measurement, retrieval-augmented generation, and running a research pipeline with agentic AI. Four topics that used to close this syllabus now live there — see retired topics.
I gratefully acknowledge insightful discussions with the colleagues below, and the teaching experiences at the institutions that follow.
Huazhong University of Science and Technology · Iowa State University · University of International Business and Economics · University of Miami · Wuhan University · Xiamen University · Zhongnan University of Economics and Law