TL;DR
Many physics problems ask for a function that makes some total energy as small as possible. The Deep Ritz method, by Weinan and Yu, represents that function with a neural network and then trains the network to minimise the energy directly, using the same stochastic gradient descent that trains image classifiers. The paper reports that the method is adaptive, handles problems of ten dimensions and more, and matches or beats a standard grid method on some cases with fewer parameters.
Where you'll see it: in the numerical solution of partial differential equations in engineering, and in the search for the lowest energy state of a quantum system, where the same energy-minimising idea appears as the eigenvalue problem.
The problem
A large class of physical laws can be written as "nature picks the state with the lowest energy". A stretched membrane settles into the shape that minimises its stored energy. A quantum particle settles into the state with the lowest energy level. Turning such a law into a usable answer means solving a variational problem: find the function that makes a total energy smallest.
The classical numerical route is to chop the domain into a grid and solve for the value at each grid point, as in the Finite Difference Method. That works well in two or three dimensions. It breaks down in high dimensions, because a grid with ten points along each side already has ten billion points in ten dimensions. Grids also need care where the answer changes sharply, and they need the same fine grid everywhere even when only one small region is hard. The paper asks whether a different representation of the answer can avoid these costs.
Key idea
Instead of storing a value at every grid point, represent the whole answer by one compact function: a neural network with a modest number of parameters . Then the original problem turns into one ordinary optimisation: choose to make the energy as small as possible. That is the same kind of problem as training a network to classify images, so the tools of deep learning apply directly.
Two things follow. The network is not tied to a grid, so the representation can bend wherever the answer needs detail, which the authors call natural adaptivity. And the energy can be estimated by picking random points, which is the same as the random mini-batches used in training. The optimisation is a non-convex problem, which the paper says openly is a risk, and the authors treat it as an empirical question.
The method
The energy
Take the simplest variational problem in the paper. Let be a domain, a given forcing, and define
The solution is the function that makes smallest among the admissible functions. Its minimiser satisfies the Poisson equation with the boundary condition that is prescribed on the edge of . The first term is the energy stored in the slope of , and the second term rewards for lining up with the forcing.
The network
The trial function is built from a stack of residual blocks. Each block takes a vector and returns
with the activation function and , , , trainable weights of width . The added is the residual connection. It gives gradients a short path backwards, which the paper cites as the way to avoid vanishing gradients. After a stack of blocks, the output is . For the activation the paper chooses because smoothness of mattered a great deal for accuracy. For the eigenvalue problems it uses a Dense-network style, where each layer sees the outputs of all earlier layers, with .
The loss and the penalty
Substituting the network into gives a function to minimise. The boundary condition is enforced by a penalty, the usual boundary condition trick: add to the energy with a large . The paper uses in two dimensions and in the ten-dimensional test. For problems with a Neumann (zero-slope) boundary condition, the boundary term is built into the energy and no penalty is needed.
The integral is a random average
The integral over is not computed in closed form, which is impossible for a network. It is replaced by an average over points, and this is where Monte Carlo ideas enter. At each step, sample a mini-batch of points in uniformly at random and use the average of the integrand over those points as the estimate. A fixed grid of quadrature nodes would let the optimiser cheat by making the integrand small only at those nodes. Random points avoid that, and they fit exactly with Stochastic Gradient Descent, which uses one random term of a sum at each step. The paper trains with the Adam variant of SGD (Adam Optimizer).
Results
The paper tests the method on five problems. The numbers below are from its tables.
The corner problem (two dimensions). The Poisson equation on an L-shaped domain has a corner singularity, where the true solution behaves like and changes sharply. A network of four blocks (eight fully connected layers, 811 parameters) was the main model, and it was compared with a uniform finite-difference grid. In the paper's Table 1, the relative error was:
| Method | Parameters | Relative error |
|---|---|---|
| Deep Ritz, 3 blocks | 591 | 0.79% |
| Deep Ritz, 4 blocks | 811 | 0.72% |
| Deep Ritz, 5 blocks | 1031 | 0.65% |
| Deep Ritz, 6 blocks | 1251 | 0.57% |
| Finite differences | 625 | 1.25% |
| Finite differences | 2401 | 0.63% |
At about 600 parameters the Deep Ritz error is about 0.8% against 1.25% for the grid. The grid needs 2401 parameters to reach 0.63%, and the Deep Ritz method with 1031 parameters gets 0.65%, close to that but not better. The fair summary is that the method is competitive per parameter on this problem, not that it is uniformly better.
- Deep Ritz
- finite differences
High dimensions. For a ten-dimensional Poisson problem with an exact polynomial solution, the network had 671 parameters and reached a relative error of about 0.4% after 50,000 training steps. A one-hundred-dimensional problem with three blocks of width 100 reached about 2.2%. A grid with even two points per side would already need points, which is why these runs matter. The paper does not claim these are the best achievable errors.
Neumann boundary. With a zero-slope boundary condition and no penalty, the relative error was 1.3% in five dimensions and 1.9% in ten.
Transfer. When the forcing changed, starting from weights trained on a related problem sped up early training considerably. The paper notes the gain is largest when the accuracy target is loose.
Eigenvalues. For the smallest eigenvalue of an operator of the form , the method minimises the Rayleigh quotient, the ratio of energy to the squared size of . Adding a normalisation penalty made training faster. For the infinite potential well, which has the known lowest eigenvalue , the error was 0.20% in one dimension, 0.11% in five, and 6.43% in ten. For the harmonic oscillator, where the answer is , the errors were 0.16%, 1.6% and 12.6% in one, five and ten dimensions. The errors grow quickly with dimension, so the eigenvalue results do not show the same high-dimensional advantage as the Poisson runs.
Why it mattered
The paper showed that a neural network could be used as the trial function of a classical variational method, and that the resulting optimisation is exactly the kind deep learning already knows how to solve. That made the method a candidate for problems where grids are too expensive. It opened a line of work on neural solvers for partial differential equations, and it sits beside the authors' parallel work on high-dimensional equations (the Deep BSDE method, reference 3 in the paper). Later work on physics-informed networks grew from the same idea that a loss built from a physical law can train a network to satisfy it. The paper's own list of open problems, which included non-convexity, convergence rates and boundary handling, is still a guide to what remains.
Reading guide
Read the paper in this order, with these lessons in hand.
- Section 2 (The Deep Ritz Method). Needs Calculus of Variations (the energy ), PDEs and boundary conditions.
- Section 2.1 (Building trial functions). Needs Feedforward Neural Network, Residual Connection and Activation Function. The rule is the one choice you can skip on a first read.
- Section 2.2 (SGD and the quadrature rule). Needs Stochastic Gradient Descent and Monte Carlo Method. Read the paragraph on fixed nodes carefully: it is the paper's main argument for random sampling.
- Section 3.1 (Poisson equation). Needs Finite Difference Method for the comparison and Gradient for why the optimiser moves downhill.
- Section 3.4 (Transfer learning). Needs Transfer Learning.
- Section 3.5 (Eigenvalue problems). Needs Eigenvalues and Eigenvectors and the Rayleigh quotient, defined in the text. Read the dense-style network in Figure 6 after you know skip connections.
Sections 3.2 and 3.3 use the same machinery; skim them once you have 3.1.
Check yourself
QuestionWhy does the Deep Ritz method replace the integral in the energy with an average over random points rather than a fixed grid?Show answer
A fixed set of quadrature nodes lets the optimiser make the integrand small at exactly those nodes while the true energy stays large elsewhere. Random points sampled freshly at every step cover the whole domain over time, and they match the way stochastic gradient descent already uses random mini-batches. The paper argues this is why SGD fits the problem naturally.
QuestionIn Table 1 of the paper, the finite-difference grid with 625 values has relative error 1.25%. Which Deep Ritz row has about the same number of parameters, and what is its error?Show answer
The 591-parameter, three-block network, with relative error 0.79%. The two networks have nearly the same size, and the Deep Ritz error is about 37% lower than the grid error on this problem.
QuestionThe energy has a boundary term added with weight . What is that term for, and what happens to the solution if is too small?Show answer
It enforces the boundary condition softly. A large weight makes any boundary violation expensive, so the minimiser stays close to the prescribed boundary values. If is too small, the optimiser can trade a boundary error for a lower interior energy and return a function that does not match the boundary condition.
QuestionThe paper says the method is naturally adaptive. In one sentence, what does that mean, and why might the authors believe it helps accuracy on the corner problem?Show answer
The network is a smooth, compact function whose parameters are all adjusted together, so it can concentrate its flexibility where the solution changes sharply, without the user choosing a refined grid in advance. The authors believe this helps near the corner, where the solution changes sharply, which is consistent with the better accuracy they see per parameter.