This thesis consists of three essays in quantitative macroeconomics. In Chapter 1, joint with Leonardo Melosi and Matthias Rottner, we leverage recent developments in machine learning to develop methods to solve and estimate large and complex nonlinear macroeconomic models, e.g. HANK models. Our method relies on neural networks because of their appealing feature that even models with hundreds of state variables can be solved. While likelihood estimation requires the repeated solving of the model, something that is infeasible for highly complex models, we overcome this problem by exploiting the scalability of neural networks. Including the parameters of the model as quasi state variables in the neural network, we solve this extended neural network and apply it directly in the estimation. To show the potential of our approach, we estimate a quantitative HANK model that features nonlinearities on an individual (borrowing limit) and aggregate level (zero lower bound) using simulated data. The model also shows that there is an important economic interaction between the impact of the zero lower bound and the degree of household heterogeneity. Chapter 2 studies the impact of macroprudential limits on mortgage lending in a heterogeneous agent life-cycle model with incomplete markets, long-term mortgage, and default. The model is calibrated to German economy using Household Finance and Consumption Survey data. I consider the effects of four policy instruments: loan-to-value limit, debt-toincome limit, payment-to-income limit, and maximum maturity. I find that their effect on homeownership rate is fairly modest. Only the loan-to-value limit significantly reduces the homeownership rate among young households. At the same time, it has the largest positive welfare effect. Chapter 3 explores applications of the backpropagation algorithm on heterogeneous agent models. In addition, I clarify the connection between deep learning and dynamic structural models by showing how a standard value function iteration algorithm can be viewed as a recurrent convolutional neural network. As a result, many advances in the field of machine learning can carry over to economics. This in turn makes the solution and estimation of more complex models feasible.