Scale-invariant Learning by Physics Inversion
Abstract
Solving inverse problems, such as parameter estimation and optimal control, is a vital part of science.
Many experiments repeatedly collect data and rely on machine learning algorithms to quickly infer solutions to the associated inverse problems.
We find that state-of-the-art training techniques are not well-suited to many problems that involve physical processes.
The highly nonlinear behavior, common in physical processes, results in strongly varying gradients that lead first-order optimizers like SGD or Adam to compute suboptimal optimization directions.
We propose a novel hybrid training approach that combines higherorder optimization methods with machine learning techniques.
We take updates from a scale-invariant inverse problem solver and embed them into the gradientdescent-based learning pipeline, replacing the regular gradient of the physical process.
We demonstrate the capabilities of our method on a variety of canonical physical systems, showing that it yields significant improvements on a wide range of optimization and learning problems.
Introduction
Inverse problems that involve physical systems play a central role in computational science.
This class of problems includes parameter estimation [54] and optimal control [57].
Among others, solving inverse problems is integral in detecting gravitational waves [22], controlling plasma flows [38], searching for neutrinoless double-beta decay [3, 1] and testing general relativity [19, 35].
Decades of research in optimization have produced a wide range of iterative methods for solving inverse problems [47].
Higher-order methods such as limited-memory BFGS [36] have been especially successful.
Such methods compute or approximate the Hessian of the optimization function in addition to the gradient, allowing them to locally invert the function and find stable optimization directions.
Gradient descent, in contrast, only requires the first derivative but converges more slowly, especially in ill-conditioned settings [49].
Despite the success of iterative solvers, many of today’s experiments rely on machine learning methods and especially deep neural networks to find unknown parameters given the observations [11, 15, 22, 3].
While learning methods typically cannot recover a solution up to machine precision, they have a number of advantages over iterative solvers.
First, their computational cost for inferring a solution is usually much lower than with iterative methods.
This is especially important in timecritical applications, such as the search for rare events in data sets comprising of billions of individual recordings for collider physics.
Second, learning-based methods do not require an initial guess to solve a problem.
With iterative solvers, a poor initial guess can prevent convergence to a global optimum or lead to divergence (see Appendix C.1).
Third, learning-based solutions can be less prone to finding local optima than iterative methods because the parameters are shared across a large collection of problems [30].
Combined with the stochastic nature of the training process, this allows gradients from other problems to push a prediction out of the basin of attraction of a local optimum.
Practically all state-of-the-art neural networks are trained using only first order information, mostly due to the computational cost of evaluating the Hessian w.r.t.
the network parameters.
Despite the many breakthroughs in the field of deep learning, the fundamental shortcomings of gradient descent persist and are especially pronounced when optimizing non-linear functions such as physical systems.
In such situations, the gradient magnitudes often vary strongly from example to example and parameter to parameter.
In this paper, we show that inverse physics solvers can be embedded into the traditional deep learning pipeline, resulting in a hybrid training scheme that aims to combine the fast convergence of higherorder solvers with the low computational cost of backpropagation for network training.
Instead of using the adjoint method to backpropagate through the physical process, we replace that gradient by the update computed from a higher-order solver which can encode the local nonlinear behavior of the physics.
These physics updates are then passed on to a traditional neural network optimizer which computes the updates to the network weights using backpropagation.
Thereby our approach maintains compatibility with acceleration schemes [18, 33] and stabilization techniques [32, 31, 7] developed for training deep learning models.
The replacement of the physics gradient yields a simple mathematical formulation that lends itself to straightforward integration into existing machine learning frameworks.
In addition to a theoretical discussion, we perform an extensive empirical evaluation on a wide variety of inverse problems including the highly challenging Navier-Stokes equations.
We find that using higher-order or domain-specific solvers can drastically improve convergence speed and solution quality compared to traditional training without requiring the evaluation of the Hessian w.r.t.
the model parameters.
Scale-invariance in Optimization
We consider unconstrained inverse problems that involve a differentiable physical process P : X ⊂ R d x → Y ⊂ R d y which can be simulated.
Here X denotes the physical parameter space and Y the space of possible observed outcomes.
Given an observed or desired output y ∗ ∈ Y , the inverse problem consists of finding optimal parameters
[Equation]
Such problems are classically solved by starting with an initial guess x 0 and iteratively applying updates x k +1 = x k + ∆ x k .
Newton’s method [5] and many related methods [10, 36, 23, 41, 46, 8, 12, 6] approximate L around x k as a parabola ˜ L ( x ) =
L ( x k ) + ∂L ( x k ) ∂x k
( x − x
[Equation] +
[Equation] H k ( x − x k )where H k denotes the Hessian or an approximation thereof.
Inverting ˜ L and walking towards its minimum with step size η yields
[Equation]
The inversion of H results in scale-invariant updates, i.e. when rescaling x or any component of x , the optimization will behave the same way, leaving L ( x k ) unchanged.
An important consequence of scale-invariance is that minima will be approached equally quickly in terms of L no matter how wide or deep they are.
Newton-type methods have one major downside, however.
The inversion depends on the Hessian H which is expensive to compute exactly, and hard to approximate in typical machine learning settings with high-dimensional parameter spaces [25] and mini-batches [51].
Instead, practically all state-of-the-art deep learning relies on first-order information only.
Setting
H to the identity in Eq.
2 yields gradient descent updates ∆ x = − η · (cid:0) ∂L ∂x (cid:1) T which are not scaleinvariant.
Rescaling x by λ also scales ∆ x by λ , inducing a factor of λ 2 in the first-order-accurate loss change L ( x ) − L ( x + ∆ x ) = − η · ( ∂L∂x ) 2 + O (∆ x 2 ) .
Gradient descent prescribes small updates to parameters that require a large change to decrease L and vice-versa, typically resulting in slower convergence than Newton updates [56].
This behavior is the root cause of exploding or vanishing gradients in deep neural networks.
The step size η alone cannot remedy this behavior whenever ∂L∂x varies along x .
Figure 1 shows the optimization trajectories for the simple problem P ( x ) =
( x 1 , x 22 ) to illustrate this problem.   x    x  y     y1 3, *'
When training a neural network, the effect of scaling-variance can be reduced through normalization in intermediate layers [32, 7] and regularization [37, 53] but this level of control is not present in most other optimization tasks, such as inverse problems (Eq. 1).
More advanced first-order optimizers try to solve the scaling issue by approximating higher-order information [33, 29, 18, 39, 40, 55, 45, 50], such as Adam where H ≈ diag (cid:0)
| ∂L∂x | (cid:1) , decreasing the loss scaling factor from λ 2 to λ .
However, these methods lack the exact higherorder information which limits the accuracy of the resulting update steps when optimizing nonlinear functions.
Scale-invariant Physics and Deep Learning
We are interested in finding solutions to Eq.
1 using a neural network, x ∗ =
NN( y ∗ | θ ) , parameterized by θ .
Let Y ∗ =
{ y ∗ i | i = 1 , ..., N } denote a set of N inverse problems involving P .
Then training the network means finding
[Equation]
Assuming a large parameter space θ and the use of mini-batches, higher-order methods are difficult to apply to this problem, as described above.
Additionally, the scale-variance issue of gradient descent is especially pronounced in this setting because only the network part of the joint problem NN ◦ P can be properly normalized while the physical process P is fixed.
Therefore, the traditional approach of computing the gradient ∂L∂θ using the adjoint method (backpropagation) can lead to undesired behavior.
Consider the problem P ( x ) =
e x with observed data y ∗ ∈ (0 , 1] (Appendix C.2).
Due to the exponential form of P , the curvature around the solutions x ∗ = log( y ∗ ) strongly depends on y ∗ .
This causes first-order network optimizers such as SGD or Adam to fail in approximating the correct solutions for small y ∗ because their gradients are overshadowed by larger y ∗ (see Fig. 2).
Scaling the gradients to unit length in x drastically improves the prediction accuracy, which hints at a possible solution: If we could employ a scale-invariant physics solver, we would be able to optimize all examples, independent of the curvature around their respective minima.
3.1 Derivation
If P has a unique inverse and is sufficiently well-behaved, we can split the joint optimization problem (Eq. 3) into two stages.
First, solve all inverse problems individually, constructing a set of unique solutions X sv = { x sv i =
P − 1 ( y ∗ i ) } where P − 1 denotes the inverse problem solver.
Second, use X sv as labels for supervised training
[Equation]
[Equation] This enables scale-invariant physics (SIP) inversion while a fast first-order method can be used to train the network which can be constructed to be normalized using state-of-the-art procedures [32, 7, 53].
Unfortunately, this two-stage approach is not applicable in multimodal settings, where x sv depends on the initial guess x 0 used in the first stage.
This would cause the network to interpolate between possible solutions, leading to subpar convergence and generalization performance.
To avoid these problems, we alter the training procedure from Eq.
4 in two ways.
First, we reintroduce P − 1 into the training loop, yielding
[Equation]
Next, we condition P − 1 on the neural network prediction by using it as an initial guess, P − 1 ( y ∗ ) →
P − 1 ( y ∗ | NN( y ∗ | θ )) .
This makes training in multimodal settings possible because the embedded solver P − 1 searches for minima close to the prediction of the NN .
Therefore θ can exit the basin of attraction of other minima and does not need to interpolate between possible solutions.
Also, since all inverse problems from Y ∗ are optimized jointly, this reduces the likelihood of any individual solution getting stuck in a local minimum, as discussed earlier. 
[Figure]
6*' $GDP 5HVFDOHG
The obvious downside to this approach is that P −must be run for each training step.
When P − 1 is an iterative solver, we can write it as P − 1 ( y ∗ | NN( y ∗ | θ )) =
NN( y ∗ | θ ) + ∆ x 0 + ... + ∆ x n .
We denote the first update ∆ x 0 ≡ U ( y ∗ | θ ) .
Instead of computing all updates ∆ x , we approximate
P − 1 with its first update U .
Inserting this into Eq.with ( ◦ ) ≡ ( y ∗ i | θ ) yields
[Equation]
This can be further simplified to (cid:80) [Equation] ∥ U [Equation]
y
[Equation]
i | [Equation] but this form is hard to optimize directly as is requires backpropagation through U .
In addition, its minimization is not sufficient, because all fixed points of U , such as maxima or saddle points of L , can act as attractors.
Instead, we make the assumption ∂ P − 1 ∂y = 0 to remove the ( ◦ ) dependencies in Eq. 6, treating them as constant.
This results in a simple L 2 loss for the network output.
As we will show, this avoids both issues.
It also allows us to factor the optimization into a network and a physics graph (see Fig. 3), so that all necessary derivative computations only require data from one of them.
3.2 Update Rule
The factorization described above results in the following update rule for training with SIP updates, shown in Fig.
Pass the network prediction x 0 to the physics graph and compute ∆ x 0 ≡ U ( y ∗ i | x 0 ) for all examples in the mini-batch.
Send ˜ x ≡ x 0 + ∆ x 0 back and compute the network loss ˜ L = 12 || x 0 − ˜ x
|| 22 . 3.
Update θ using any neural network optimizer, such as SGD or Adam, treating ˜ x as a constant.
To see what updates ∆ θ result from this algorithm, we compute the gradient w.r.t.
θ ,
[Equation]
Comparing this to the gradient resulting from optimizing the joint problem NN ◦ P with a single optimizer (Eq. 3),
[Equation]
where ∆ y i = P [Equation] NN( y ∗ i | θ ) (cid:1) − y ∗
i , we see that U takes the place of ∆ y i · ∂ P ∂x , the adjoint vector that would otherwise be computed by backpropagation.
Unlike the adjoint vector, however, ˜ x = x 0 + U encodes an actual physical configuration.
Since ˜ x can stem from a higher-order solver, the resulting updates ∆ θ can also encode non-linear information about the physics without computing the Hessian w.r.t.
θ .
3.3 Convergence
It is a priori not clear whether SIP training will converge, given that ∂ P − 1 ∂y is not computed.
We start by proving convergence for two special choices of the inverse solver P − 1 before considering the general case.
We assume that NN is expressive enough to fit our problem and that it is able to converge to every point x for all examples using gradient descent:
[Equation]
9) where θ n is the sequence of gradient descent steps
[Equation]
[Equation]
with η > 0 .
Large enough networks fulfill this property under certain assumptions [17] and the universal approximation theorem guarantees that such a configuration exists [13].
In the first special case, U ( x ) ≡ U ( y ∗ | x ) points directly towards a solution x ∗ .
This models the case of a known ground truth solution in a unimodal setting.
For brevity, we will drop the example indices and the dependencies on y ∗ .
Theorem 1.
If ∀ x ∃ λ ∈ (0 , 1] : U ( x ) = λ ( x ∗ − x ) , then the gradient descent sequence NN θ n with θ n +
= θ n + η (cid:0) ∂
NN ∂θ (cid:1) T U ( x ) converges to x ∗ .
Proof.
Rewriting U ( x ) = − ∂∂x (cid:0) λ
2 || x − x ∗
|| 22 (cid:1) yields the update θ n +1 − θ n = − η (cid:16) ∂ ˆ L∂x ∂
NN ∂θ (cid:17) T where ˆ L = λ
2 || x − x ∗ || 22 . This describes gradient descent towards x ∗ with the gradients scaled by λ .
Since λ ∈ (0 , 1] , the convergence proof of gradient descent applies.
The second special case has U ( x ) pointing in the direction of steepest gradient descent in x space.
Theorem 2.
If ∀ x ∃ λ ∈ (0 , 1] : U ( x ) = − λ (cid:0) ∂L∂x (cid:1) T , then the gradient descent sequence NN θ n with θ n +1 = θ n + η (cid:0) ∂ NN ∂θ (cid:1) T U ( x ) converges to minima of L .
Proof.
This is equivalent to gradient descent in L ( θ ) ≡ (NN ◦ L )( θ ) .
Rewriting the update yields θ n +1 − θ n = − ηλ (cid:0) ∂L∂x ∂ NN ∂θ (cid:1) T which is the gradient descent update scaled by λ .
Next, we consider the general case of an arbitrary P − 1 and U .
We require that U decreases L by a minimum relative amount specified by τ ,
[Equation]
To guarantee convergence to a region, we also require
[Equation]
Theorem 3.
There exists an update strategy θ n +1 = S ( θ n ) based on a single evaluation of U for which L (NN θ n ( y )) converges to a minimum x ∗ or minimum region of L for all examples.
Proof.
We denote ˜ x n ≡ x n + U ( x n ) and ∆ L ∗ =
L ( x n ) − L ( x ∗ ) .
Let I 2 denote the open set of all x for which L ( x ) − L ( x n ) > τ 2 ∆ L ∗ .
Eq.
11 provides that ˜ x n ∈ I 2 .
Since I 2 is open, ∃ ϵ > 0 : ∀ x ∈ B ϵ (˜ x n ) :
L ( x n ) − L ( x ) > τ 2 ∆ L ∗ where B ϵ ( x ) denotes the open set containing all x ′ ∈ R d for which || x ′ − x || 2 < ϵ , i.e. there exists a small ball around ˜ x n which is fully contained in
I 2 (see sketch in Fig. 4).
Using Eq.
9, we can find a finite n ∈ N for which NN θ n ∈ B ϵ (˜ x n ) and therefore L ( x n ) − L (NN θ n ) > τ 2 ∆ L ∗ .
We can thus use the following strategy S for minimizing L : First, compute ˜ x n = x n + U ( x n ) .
Then perform gradient descent steps in θ with the effective objective function 12 || NN θ − ˜ x n || 22 until L ( x n ) − L (NN θ ) ≥ τ 2 ∆ L ∗ .
Each application of S reduces the loss to ∆ L ∗ n +1 ≤ (1 − τ 2 )∆ L ∗ n so any value of L > L ( x ∗ ) can be reached within a finite number of steps.
Eq.
12 ensures that
||
U ( x ) ||
→ 0 as the optimization progresses which guarantees that the optimization converges to a minimum region.
[Figure] of theorem 3. All shown objects are visualized in x space for one example i .
While this theorem guarantees convergence, it requires potentially many gradient descent steps in θ for each physics update U .
This can be advantageous in special circumstances, e.g. when U is more expensive to compute than an update in θ , or when θ is far away from a solution.
However, in many cases, we want to re-evaluate U after each update to θ .
Without additional assumptions about U and NN θ , there is no guarantee that L will decrease every iteration, even for infinitesimally small step sizes.
Despite this, there is good reason to assume that the optimization will decrease L over time.
This can be seen visually in Fig.
4 where the next prediction x n + is guaranteed to lie within the blue circle.
The region of increasing loss is shaded orange and always fills less than half of the volume of the circle, assuming we choose a sufficiently small step size.
We formalize this argument in appendix A.2.
Remarks and lemmas We considered the case that U ≡ ∆ x 0 .
This can be trivially extended to the case that U ≡ ∆ x 0 + ... + ∆ x m for any m ∈ N .
When we let the solver run to convergence, i.e. m large enough, theorem 1 guarantees convergence if P − 1 consistently converges to the same x ∗ i .
Also note that any minimum θ ∗ found with SIP training fulfills U = 0 for all examples, i.e. we are implicitly minimizing (cid:80) N i =1 1 2 ∥ U ( y ∗ i | θ ) ∥ 22 .
3.4 Experimental Characterization
We first investigate the convergence behavior of SIP training depending on characteristics of P .
We construct the synthetic two-dimensional inverse process
[Equation]
where R ϕ ∈ SO(2) denotes a rotation matrix and γ > 0 .
The parameters ξ and ϕ allow us to continuously change the characteristics of the system.
The value of ξ determines the conditioning of P with large ξ representing ill-conditioned problems while ϕ describes the coupling of x [-
 andx-]1 and x 2 .
When ϕ = 0 , the off-diagonal elements of the Hessian vanish and the problem factors into two independent problems.
Fig.
5a shows one example loss landscape.
We train a fully-connected neural network to invert this problem (Eq. 3), comparing SIP training using a saddle-free Newton solver [14] to various state-of-the-art network optimizers.
We select the best learning rate for each optimizer independently.
For ξ = 0 , when the problem is perfectly conditioned, all network optimizers converge, with Adam converging the quickest (Fig. 5b).
Note [Figure] that the relatively slow convergence of SIP mostly stems from it taking significantly more time per iteration than the other methods, on average 3 times as long as Adam.
As we have spent little time in eliminating computational overheads, SIP performance could likely be significantly improved to near-Adam performance.
When increasing ξ with ϕ = 0 fixed (Fig. 5d), the accuracy of all traditional network optimizers decreases because the gradients scale with (1 /ξ, ξ ) in x , elongating in x 2 , the direction that requires more precise values.
SIP training uses the Hessian to invert the scaling behavior, producing updates that align with the flat direction in x to avoid this issue.
This allows SIP training to retain its relative accuracy over a wide range of ξ .
At ξ = 32 , only SIP and Adam succeed in optimizing the network to a significant degree (Fig. 5c).
Varying ϕ with ξ = 32 fixed (Fig. 5e) sheds light on how Adam manages to learn in ill-conditioned settings.
Its diagonal approximation of the Hessian reduces the scaling effect when x 1 and x 2 lie on different scales, but when the parameters are coupled, the lack of off-diagonal terms prevents this.
SIP training has no problem with coupled parameters since its updates are based on the full-rank
Hessian ∂ 2 L ∂x 2 .
3.5 Application to High-dimensional Problems
Explicitly evaluating the Hessian is not feasible for high-dimensional problems.
However, scaleinvariant updates can still be computed, e.g. by inverting the gradient or via domain knowledge.
We test SIP training on three high-dimensional physical systems described by partial differential equations: Poisson’s equation, the heat equation, and the Navier-Stokes equations.
This selection covers ubiquitous physical processes with diffusion, transport, and strongly non-local effects, featuring both explicit and implicit solvers.
All code required to reproduce our results is available at https: //github.com/tum-pbs/SIP .
A detailed description of all experiments along with additional visualizations and performance measurements can be found in appendix B.
Poisson’s equation Poisson’s equation, P ( x )
= ∇ − 2 x , plays an important role in electrostatics,
Newtonian gravity, and fluid dynamics [4].
It has the property that local changes in x can affect P ( x ) globally.
Here we consider a two-dimensional system and train a U-net [48] to solve inverse problems (Eq. 1) on pseudo-randomly generated y ∗ .
We compare SIP training to SGD with momentum, Adam,
AdaHessian [55], Fourier neural operators (FNO) [34] and Hessian-free optimization (H-free) [39].
Fig.
6b shows the learning curves.
The training with SGD, Adam and AdaHessian drastically slows within the first 300 iterations.
FNO and H-free both improve upon this behavior, reaching twice the accuracy before slowing.
For SIP, we construct scale-invariant ∆ x based on the analytic inverse of Poisson’s equation and use Adam to compute ∆ θ .
The curve closely resembles an exponential curve, which indicates linear convergence, the ideal case for first-order methods optimizing an L 2 objective.
During all of training, the SIP variant converges exponentially faster than the traditional optimizers, its relative performance difference compared to Adam continually increasing from a factor of 3 at iteration 60 to a full order of magnitude after 5k iterations.
This difference can be seen in the inferred solutions (Fig. 6a) which are noticeably more detailed.
Heat equation Next, we consider a system with fundamentally non-invertible dynamics.
The heat equation, ∂u∂t = ν · ∇ 2 u , models heat flow in solids but also plays a part in many diffusive systems [16].
It gradually destroys information as the temperature equilibrium is approached [26], causing ∇P to become near-singular.
Inspired by heat conduction in microprocessors, we generate [Figure] examples x GT by randomly scattering four to ten heat generating rectangular regions on a plane and simulating the heat profile y ∗ =
P ( x GT ) as observed from outside a heat-conducting casing.
The learning curves for the corresponding inverse problem are shown in Fig.
6d.
When training with SGD, Adam or AdaHessian, we observe that the distance to the solution starts rapidly decreasing before decelerating between iterations 30 and 40 to a slow but mostly stable convergence.
The sudden deceleration is rooted in the adjoint problem, which is also a diffusion problem.
Backpropagation through P removes detail from the gradients, which makes it hard for first-order methods to recover the solution.
H-free initially finds better solutions but then stagnates with the solution quality slowly deteriorating.
FNO performs poorly on this task, likely due to the sharp edges in x ∗ .
The information loss in P prevents direct numerical inversion of the gradient or Hessian.
Instead, we add a dampening term to derive a numerically stable scale-invariant solver which we use for SIP training.
Unlike SGD and Adam, the convergence of SIP training does not decelerate as early as the other methods, resulting in an exponentially faster convergence.
At iteration 100, the predictions are around 34% more accurate compared to Adam, and the difference increases to 130% after 10k iterations, making the reconstructions noticeably sharper than with traditional training methods (Fig. 6c).
To test the dependence of SIP on hyperparameters like batch size or learning rate, we perform this experiment with a range of values (see appendix B.3).
Our results indicate that SIP training and Adam are impacted the same way by non-optimal hyperparameter configurations.
Navier-Stokes equations Fluids and turbulence are among the most challenging and least understood areas of physics due to their highly nonlinear behavior and chaotic nature [21].
We consider a two-dimensional system governed by the incompressible Navier-Stokes equations: ∂v∂t = ν ∇ 2 v − v · ∇ v − ∇ p , ∇ · v = 0 , where p denotes pressure and ν the viscosity.
At t = 0 , a region of the fluid is randomly marked with a massless colorant m 0 that passively moves with the fluid, ∂m∂t = − v · ∇ m .
After time t , the marker is observed again to obtain m t .
The fluid motion is initialized as a superposition of linear motion, a large vortex and small-scale perturbations.
An example observation pair y ∗ = { m 0 , m t } is shown in Fig.
7a.
The task is to find an initial fluid velocity x ≡ v 0 such that the fluid simulation P matches m t at time t .
Since P is deterministic, x encodes the complete fluid flow from 0 to t .
We define the objective in frequency space with lower frequencies being weighted more strongly.
This definition considers the match of the marker distribution on all scales, from the coarse global match to fine details, and is compatible with the definition in Eq.
We train a U-net [48] to solve these inverse problems; the learning curves are shown in Fig.
7b.
When training with Adam, the error decreases for the first 100 iterations while the network learns to infer velocities that lead to an approximate match.
The error then proceeds to decline at a much lower rate, nearly coming to a standstill.
This is caused by an overshoot in terms of vorticity, as visible in
Fig.
7a right.
While the resulting dynamics can roughly approximate the shape of the observed m t , [Figure] they fail to match its detailed structure.
Moving from this local optimum to the global optimum is very hard for the network as the distance in x space is large and the gradients become very noisy due to the highly non-linear physics.
A similar behavior can also be seen when optimizing single inverse problems with gradient descent where it takes more than 20k iterations for GD to converge on single problems.
For SIP training, we run the simulation in reverse, starting with m t , to estimate the translation and vortex of x in a scale-invariant manner.
When used for network training, we observe vastly improved convergence behavior compared to first-order training.
The error rapidly decreases during the first 200 iterations, at which point the inferred solutions are more accurate than pure Adam training by a factor of 2.3.
The error then continues to improve at a slower but still exponentially faster rate than first-order training, reaching a relative accuracy advantage of 5x after 20k iterations.
To match the network trained with pure Adam for 20k iterations, the SIP variant only requires 55 iterations.
This improvement is possible because the inverse-physics solver and associated SIP updates do not suffer from the strongly-varying gradient magnitudes and directions, which drown the first-order signal in noise.
Instead, the SIP updates behave much more smoothly, both in magnitude and direction.
The inference time is given per example in batch mode, followed by the number of iterations in parentheses. Method
[Table]
[Equation]
Comparing the inferred solutions from the network to an iterative approach shows a large difference in inference time (table 1).
To reach the same solution quality as the neural network prediction, P − 1 NS needs 7 iterations on average, which takes more than 10,000 times as long, and gradient descent (GD) does not reach the same quality even after 20k iterations.
This difference is caused by P − 1 NS having to run the full forward and backward simulation for each iteration.
This cost is also required for each training iteration of the network but once converged, its inference is extremely fast, solving around 9000 problems per second in batch mode.
For both iterative solver and network, we used a batch size of 64 and divide the total time by the batch size.
3.6 Limitations and Discussion
While SIP training manages to find vastly more accurate solutions for the examples above, there are some caveats to consider.
First, an approximately scale-invariant physics solver is required.
While in low-dimensional x spaces Newton’s method is a good candidate, high-dimensional spaces require another form of inversion.
Some equations can locally be inverted analytically but for complex problems, domain-specific knowledge may be required.
However, this is a widely studied field and many specialized solvers have been developed [9].
Second, SIP uses traditional first-order optimizers to determine ∆ θ .
As discussed, these solvers behave poorly in ill-conditioned settings which can also affect SIP performance when the network outputs lie on different scales.
Some recent works address this issue and have proposed network optimization based on inversion [39, 40, 20].
Third, while SIP training generally leads to more accurate solutions, measured in x space, the same is not always true for the loss L = (cid:80) i L i .
SIP training weighs all examples equally, independent of the curvature | ∂ 2 L ∂x 2 | near a chosen solution.
This can cause small errors in examples with large curvatures to dominate L .
In these cases, or when the accuracy in x space is not important, like in some control tasks, traditional training methods may perform better than SIP training.
Conclusions
We have introduced scale-invariant physics (SIP) training, a novel neural network training scheme for learning solutions to nonlinear inverse problems.
SIP training leverages physics inversion to compute scale-invariant updates in the solution space.
It provably converges assuming enough network updates ∆ θ are performed per solver evaluation and we have shown that it converges with a single ∆ θ update for a wide range of physics experiments.
The scale-invariance allows it to find solutions exponentially faster than traditional learning methods for many physics problems while keeping the computational cost relatively low.
While this work targets physical processes, SIP training could also be applied to other coupled nonlinear optimization problems, such as differentiable rendering or training invertible neural networks.
Scale-invariant optimizers, such as Newton’s method, avoid many of the problems that plague deep learning at the moment.
While their application to high-dimensional parameter spaces is currently limited, we hope that our method will help establish them as commonplace tools for training neural networks in the future.
A Convergence
Here we give a more detailed explanation of some of the convergence arguments made in the paper.
A.1 Assumptions
The following is a sufficient, self-contained list of all assumptions required for the theorems in the main text.
Let L =
{ L i : R d → R | i = 1 , ..., N } be a finite set of functions and let x ∗
i ∈ R
d be any global minima of L i . 2.
Let U =
{ U i : R d → R d | i = 1 , ..., N } be a set of update functions for L i such that ∃ τ > 0 : ∀ x ∈ R
d
: L i ( x ) − L i ( x + U i ( x )) ≥ τ ( L ( x ) − L ( x ∗ )) and ∃ K > 0 : ∀ x ∈ R d : || U i ( x ) || ≤ K ( L ( x ) − L ( x ∗ )) . 3.
Let NN θ : R m → R d be differentiable w.r.t.
θ with the property that ∃ η > 0 : ∀ i ∈ 1 , ..., N ∀ x i ∈ R d ∀ ϵ > 0 ∃ n ∈ N : || NN θ xin ( y i ) − x i || 2 ≤ ϵ where θ xn is the sequence of gradient descent steps with θ xn +
=
θ xn − η (cid:0) ∂
NN θ ∂θ (cid:1) T (NN θ n − x ) , η > 0 .
Given these assumptions, SIP training with sufficiently many network optimization steps n is guaranteed to converge to an optimum point or region.
In the two special cases mentioned in the main text, it is guaranteed to converge even for n = 1 .
If we are interested in convergence to a global optimum, we may additionally require that L is convex.
A.2 Probable Loss Decrease for the Case n =
[Equation] [Figure] [Equation]
[Figure]
example i .
To show that the loss decreases on average, we require the the assumption that an update of the neural network weights θ does not systematically distort the update direction in x .
More formally, we update θ to minimize
[Equation]
where ˜ x denotes the target in x space which is computed using
U as defined above.
This can be done with gradient descent,
[Equation]
, or any other method.
In fact, recent works have shown that the Jacobian ∂ NN θ ∂θ can be inverted numerically to compute more precise θ updates [50].
The updated network will predict a new vector NN θ +∆ θ ( y ) and we will denote the shift in x space resulting from the update ∆ θ as ∆NN ≡ NN θ +∆ θ ( y ) −
NN θ ( y ) .
This shift is guaranteed to lie closer to ˜ x
(within the blue circle in Fig.
8) as long as we choose η appropriately.
We also know that at ˜ x itself, as well as in a small region around ˜ x , the loss L is smaller than L ( x ) .
We denote the region of decreased loss I = { x ∈ R d : L ( x ) <
L ( x n ) } .
Note that the circle radius || ˜ x − x || 2 scales with the step size of the higher-order optimizer since ˜ x = x + U ( x ) .
Factoring out this step size and integrating it into η allows us to arbitrarily scale our problem in x space.
In particular, when choosing η to be small, we can linearly approximate the loss landscape (Fig. 8b).
Its boundary becomes a straight line separating increased and decreased regions of the loss, and must cut the circle so that more than half of it lies within I .
More importantly, the expectation of L integrated over the circle is smaller than L ( x ) .
Therefore, if ∆NN points towards ˜ x on average, i.e. E [∆NN] = λ (˜ x − x ) with λ ∈ (0 , 1] , and we choose η small enough, the loss must decrease on average.
While the assumption that updates of θ do not systematically distort the direction in x may not hold for all problems or network architectures, we have empirically observed it to be true over a wide range of tests.
B Detailed Description of the Experiments
Here, we give a more detailed description of our experiments including setup and analysis.
The implementation of our experiments is based on the Φ Flow (PhiFlow) framework [30] and uses TensorFlow [2] and PyTorch [44] for automatic differentiation.
All experiments were run on an NVidia GeForce
RTX 2070 Super.
Our code is open source, available at https://github.com/tum-pbs/SIP .
In all of our experiments, we compare SIP training to standard neural network optimizers.
To make this comparison as fair as possible, we try to avoid other factors that might prevent convergence, such as overfitting.
Therefore, we perform our experiments with effectively infinite training sets, sampling target observations y ∗ on-the-fly.
This setup ensures that all optimizers can, in principle, converge to zero loss.
Since a numerical simulation of the forward problem is assumed to be available, unlimited amounts of synthetic training data can always be generated, further justifying this assumption.
To check for possible biases introduced by this procedure, we also performed our experiments with finite training sets but did not observe a noticeable change in performance as long as the data set sizes were reasonable, e.g. 1000 samples for the characterization (sine) experiment.
B.1 Characterization with two-dimensional sine function
In this experiment, we consider the nonlinear process
P ( x ) = (cid:18) sin(ˆ x 1 ) ξ , ξ · ˆ x(cid:19) with x ˆ x = γ · R ϕ · x and R ϕ = (cid:18) cos( ϕ ) − sin( ϕ ) sin( ϕ ) cos( ϕ ) (cid:19) where γ denotes a global scaling factor.
We set γ = 10 as this value leads to the fastest convergence when training the network with traditional optimizers like Adam.
The conditioning factor ξ continuously scales any compact solution manifold, elongating it along one axis and compressing it along the other.
Therefore, the range of values required for a solution manifold scales linearly with ξ , in both x 1 and x 2 if ϕ ̸ = 0 .
To take this into account, we show the relative accuracy || x − x ∗ || 2 ξ in Fig.
5d, as described in the main text.
To measure || x − x ∗ || 2 , we find the true solution x ∗ analytically using sin − 1 and determining which solution is closest.
Saddle-free Newton
For SIP training, we use a variant of Newton’s method.
Without modification,
Newton’s method also approaches maxima and saddle points which exist in this experiment.
To avoid these, we project the Newton direction and gradient into the eigenspace of the Hessian, similar to [14].
There, we can easily flip the Newton update along eigenvectors of the Hessian to ensure that the update always points in the direction of decreasing loss.
Neural network training We sample target states y ∗ =
( y ∗ 1 , y ∗ 2 ) uniformly in the range [ − 1 , 1] each, and feed y ∗ to a fully-connected neural network that predicts x = ( x 1 , x 2 ) .
The network consists of three hidden layers with 32, 64 and 32 neurons, respectively, and uses ReLU activations.
The final layer has no activation function and outputs two values that are interpreted as x .
We always train the network with a batch size of 100 and chose the best learning rate for each optimizer.
We determined the following learning rates to work the best for this problem: SIP training with Adam η = 10 − 3 , Adam η = 10 − 3 , SGD η = 10 − 2 /ξ 2 , Adadelta η = 3 · 10 − 3 , Adagrad η = 3 · 10 − 3 ,
RMSprop η = 3 · 10 − 5 .
For Fig.
5d and e, we run each optimizer for 10 minutes for each sample point which is enough time for more than 50k iterations with all traditional optimizers and around 15k iterations with SIP training.
We then average the last 10% of recorded distances for the displayed value.
B.2 Poisson’s equation
We consider Poisson’s equation, ∇ 2 y = x where x is the initial state and y is the output of the simulator.
We set up a two-dimensional simulation with 80 by 60 cubic cells.
Our simulator computes y = P ( x ) = ∇ − 2 x implicitly via the conjugate gradient method.
The inverse problem consists of finding an initial value x ∗ for a given target y ∗ such that ∇ 2 y ∗ = x ∗ .
We formulate this problem as minimizing L ( x ) = 12 ||P ( x ) − y ∗ || 22 = 12 ||∇ − 2 ( x − x ∗ )
|| 22 .
We now investigate the computed updates ∆ x of various optimization methods for this problem.
Gradient descent Gradient descent prescribes the update ∆ x = − η · (cid:0) ∂L∂x
[Equation]
) which requires an additional implicit solve for each optimization step.
This backward solve produces much larger values than the forward solve, causing GD-based methods to diverge from oscillations unless η is very small.
We found that GD requires η ≤ 2 · 10 − 5 , while the momentum in Adam allows for larger η .
For both GD and Adam, the optimization converges extremely slowly, making
GD-based methods unfeasible for this problem.
SIP Gradients via analytic inversion Poisson’s equation can easily be inverted analytically, yielding x = ∇ 2 y .
Correspondingly, we formulate the update step as ∆ x = − η · ∂x∂y · ( y − y ∗ )
= − η · ∇ 2 ( y − y ∗ ) which directly points to x ∗ for η = 1 .
Here the Laplace operator appears in the computation of the optimization direction.
This is much easier to compute numerically than the
Poisson operator used by gradient descent.
Consequently, no additional implicit solve is required for the optimization and the cost per iteration is less than with gradient descent.
This computational advantages also carries over to neural network training where this method can be integrated into the backpropagation pipeline as a gradient.
Neural network training We first generate ground truth solutions x ∗ by adding fluctuations of varying frequencies with random amplitudes.
From these x ∗ , we compute y ∗ =
P ( x ∗ ) to form the set of target states Y .
This has the advantage that learning curves are representative of both test performance as well as training performance.
The top of Fig.
9 shows some examples generated this way.
All training methods except for the Fourier neural operators (FNO) use a a U-net [48] with a total of 4 resolution levels and skip connections.
The network receives the feature map y ∗ as input.
Max pooling is used for downsampling and bilinear interpolation for upsampling.
After each downsampling or upsampling operation, two blocks consisting of 2D convolution with kernel size of 3x3, batch normalization and ReLU activation are performed.
For training with AdaHessian, we also tested tanh for activation but observed no difference in performance.
All of these convolutions output 16 feature maps and a final 1x1 convolution brings the output down to one feature map.
The network contains a total of 37,697 trainable parameters.
We use a mini-batch size of 128 for all methods.
For SGD and Adam training, the composite gradient of NN ◦ P is computed with TensorFlow or
PyTorch, enabling an end-to-end optimization.
The learning rate is set to η = 10 − 3 with Adam and η = 3 · 10 − 12 for SGD.
The extremely small learning rate for SGD is required to balance out the large gradients and is consistent with the behavior of gradient-descent optimization on single examples where an η = 2 · 10 − 5 was required.
We use a typical value of 0.9 for the momentum of SGD and
Adam.
For training with AdaHessian [55], we use the implementation from torch-optimizer [43] and found the best learning rate to be η = 10 − 6 which, similar to SGD, is much smaller than what is used on well-conditioned problems.
However for η > = 10 − 4 AdaHessian diverges on the
Poisson equation, independent of which activation function is used.
The Hessian power is another hyperparameter of the AdaHessian optimizer and we set it to the standard value of 0.5 which converges much better than a value of 1.0.
For training with the Hessian-free optimizer [39], we use the PyTorchHessianFree implementation from https://github.com/ltatzel/PyTorchHessianFree .
We use the generalized GaussNewton matrix to approximate the local curvature because it yields more stable results than the
Hessian approximation in our tests.
The optimizer uses a learning rate of η = 1 . 0 and adaptive damping during training.
On this problem, the Hessian-free optimizer takes between 300 andseconds to compute a single update step.
This is largely due to the CG loop, performing betweenand 250 iterations for each update.
The solution error drops to 900 within the plotted time frame in
Fig.
6b, corresponding to less then 6 iterations.
Convergence speed then slows continuously, reaching a MAE of 500 after about 6 hours.
For the training using Adam with SIP gradients, we compute ∆ x as described above and keep η = 10 − 3 .
For each case, we set the learning rate to the maximum value that consistently converges.
The learning curves for three additional random network initializations are shown at the bottom of
Fig.
9, while Fig.
15 shows the computation time per iteration.
Training a Fourier neural operator network [34] on the same task requires a different network architecture.
We use a standard 2D FNO architecture with width 32 and 12 modes along x and y. This results in a much larger network consisting of 1,188,353 parameters.
Despite its size, its performance
[Figure]
measured against wall clock time is superior to that of smaller versions we tested.
We train the FNO using Adam with η = 0 .
003 , which yields the best results, converging in a stable manner.
B.3 Heat equation
We consider a two-dimensional system governed by the heat equation ∂u∂t = ν · ∇ 2 u .
Given an initial state x = u 0 at t 0 , the simulator computes the state at a later time t ∗ via y = u ∗ =
P ( x ) .
Exactly inverting this system is only possible for t · ν = 0 and becomes increasingly unstable for larger t · ν because initially distinct heat levels even out over time, drowning the original information in noise.
Hence the Jacobian of the physics ∂y∂x is near-singular.
In our experiment we set t · ν = 8 on a domain consisting of 64x64 cells of unit length.
This level of diffusion is challenging, and diffuses most details while leaving the large-scale structure intact.
We apply periodic boundary conditions and compute the result in frequency space where the physics can be computed analytically as ˆ y
= ˆ x · e − k 2 ( t ∗ − t 0 ) where ˆ y k ≡ F ( y ) k denotes the k -th element of the Fourier-transformed vector y .
Here, high frequencies are dampened exponentially.
The inverse problem can thus be written as minimizing L ( x ) = 12 ||P ( x ) − y ∗ ||
[Equation]
Gradient descent Using the analytic formulation, we can compute the gradient descent update as
[Equation]
GD applies the forward physics to the gradient vector itself, which results in updates that are stable but lack high frequency spatial information.
Consequently, GD-based optimization methods converge slowly on this task after fitting the coarse structure and have severe problems in recovering highfrequency details.
This is not because the information is fundamentally missing but because GD cannot adequately process high-frequency details.
Stable SIP gradients The frequency formulation of the heat equation can be inverted analytically, yielding ˆ x k
= ˆ y k · e k 2 ( t ∗ − t 0 ) .
This allows us to define the update
[Equation]
Here, high frequencies are multiplied by exponentially large factors, resulting in numerical instabilities.
When applying this formula directly to the gradients, it can lead to large oscillations in ∆ x .
This is the opposite behavior compared to Poisson’s equation where the GD updates were unstable and the SIP stable.
The numerical instabilities here can, however, be avoided by taking a probabilistic viewpoint.
The observed values y contain a certain amount of noise n , with the remainder constituting the signal s = y − n .
For the noise, we assume a normal distribution n ∼ N (0 , ϵ · y ) with ϵ > 0 and for the signal, we assume that it arises from reasonable values of x so that s ∼ N (0 , δ · e − k 2 ) with δ > 0 .
Then we can estimate the probability of an observed value arising from the signal using Bayes’ theorem p ( s | y ) = [Equation]
· p [Equation] ) where we assume the priors p ( s ) = p ( n ) = 12 .
Based on this probability, we dampen the amplification of the inverse physics which yields a stable inverse.
Gradients computed in this way hold as much high-frequency information as can be extracted given the noise that is present.
This leads to a much faster convergence and more precise solution than any generic optimization method.
Neural network training For training, we generate x ∗ by randomly placing between 4 andhot rectangles of random size and shape in the domain and computing y
= P ( x ∗ ) .
For the neural network, we use the same U-net and FNO architectures as in the previous experiment.
We train all methods with a batch size of 128.
A learning rate of η = 10 − 3 yields the best results for SGD,
Adam, AdaHessian, FNO and SIP training.
Unlike the Poisson experiment, where such large learning rates lead to divergence due to the large gradient magnitudes, the heat equation produces relatively small and predictable gradients.
Larger η can still result in divergence, especially with AdaHessian.
For the Hessian-free optimizer, we use η = 1 . 0 with adaptive damping during training.
Due to the
[Figure]
more compute-intensive updates
, we plot the running average over 8 mini-batches for Hessian-free in
Fig.
6, instead of the usual 64.
Fig.
10 shows two examples from the data set, along with the corresponding inferred solutions, as well as the network learning curves for two network initializations.
The measured computation time per iteration is shown in Fig.
We perform additional hyperparameter studies on this experiment to better gauge how SIP training compares to traditional network optimization in a variety of settings.
Fig.
11 shows the learning curves for a varying learning rate η and batch size b .
The best performance of both methods is achieved at η = 10 − 3 and b = 128 .
Additionally, we evaluate the methods on finite data sets with sizes between 32 and 2048 examples while also varying the batch size.
Fig.
12 shows the performance on both the training and the test set.
Both SIP training and Adam exhibit overfitting under the same conditions.
For data set sizes ofand less, both methods start to overfit early on.
This is especially pronounced for large batch sizes where less randomness is involved.
In the cases where the batch size is equal to or larger than the data set size, no mini-batching is used.
We tile the data set where needed.
For very small data sets, SIP training seems to exhibit stronger overfitting but this can be explained by its superior performance.
The test performance of SIP training always surpasses the Adam variant, even on small data sets.
We also run iterative optimizers on individual examples of the data set.
Fig.
13 shows the optimization curves of gradient descent and L-BFGS-B and compares them to the network predictions.
L-BFGS-B converges faster than gradient descent but both iterative optimizers progress slowly on this inverse problem due to its ill-conditioned nature.
After 500 iterations, L-BFGS-B matches the solution accuracy of the neural network trained with Adam.
We have run both traditional optimizers foriterations, representing 102 seconds for BFGS and 36 seconds for gradient descent.
This is about 1000 times longer than the network predictions, which finish within 64 ms.
B.4 Navier-Stokes equations
Here, we give additional details on the simulation, data generation, SIP gradients and network training procedure for the fluid experiment.
Simulation details We simulate the fluid dynamics using a direct numerical solver.
We adopt the marker-in-cell (MAC) method [28, 27] which guarantees stable simulations even for large velocities or time increments.
The velocity vectors are sampled in staggered form at the face centers of grid cells while the marker density is sampled at the cell centers.
The initial velocity v 0 is specified at cell centers and resampled to a staggered grid for the simulation.
Our simulation employs a second-order advection scheme [52] to transport both the marker and the velocity vectors.
This step introduces significant amount of numerical diffusion which can clearly be seen in the final marker distributions.
Hence, we do not numerically solve for adding additional viscosity.
Incompressibility is achieved via
Helmholz decomposition of the velocity field using a conjugate gradient solve.
Neither pressure projection nor advection are energy-conserving operations.
While specialized energyconserving simulation schemes for fluids exist [24, 42], we instead enforce energy conservation by normalizing the velocity field at each time step to the total energy of the previous time step.
Here, the energy is computed as E = (cid:82) R 2 dx v ( x ) 2 since we assume constant fluid density.
Data generation The data set consists of marker pairs { m 0 , m t } which are randomly generated on-the-fly.
For each example, a center position for m 0 is chosen on a grid of 64x64 cells.
m 0 is then generated from discretized noise fluctuations to fill half the domain size in each dimension.
The number of marked cells is random.
Next, a ground truth initial velocity v 0 is generated from three components.
First, a uniform velocity field moves the marker towards the center of the domain to avoid boundary collisions.
Second, a large vortex with random strength and direction is added.
The velocity magnitude of the vortex falls off with a Gaussian function depending on the distance from the vortex center.
Third, smaller-scale vortices of random strengths and sizes are added additionally perturb the flow fields.
These are generated by assigning a random amplitude and phase to each frequency making up the velocity field.
The range from which the amplitudes are sampled depends on the magnitude frequency.
[Figure]
Given m 0 and v 0 , a ground truth simulation is run for t = 2 with ∆ t = 0 .
The resulting marker density is then used as the target for the optimization.
This ensures that there exists a solution for each example.
Computation of SIP gradients To compute the SIP gradients for this example, we construct an explicit formulation ˆ v 0 =
P − 1 ( m 0 , m t | x 0 ) that produces an estimate for v 0 given an initial guess x 0 by locally inverting the physics.
From this information, it fits the coarse velocity,
i
[Figure]
e. the uniform velocity and the vortex present in the data.
This use of domain knowledge, i.e., enforcing the translation and rotation components of the velocity field as a prior, is what allows it to produce a much better estimate of v 0 than the regular gradient.
More formally, it assumes that the solution lies on a manifold that is much more low-dimensional than v 0 .
On the other hand, this estimator ignores the small-scale velocity fluctuations which limits the accuracy it can achieve.
However, the difficulty of fitting the full velocity field without any assumptions outweighs this limitation.
Nevertheless, GD could eventually lead to better results if trained for an extremely long time.
[Figure]
over 64 mini
-batches.
Overfitting occurs in both SIP training and Adam when no mini-batches are used, |T | ≤ b , and for small b where the convergence is unstable.
[Figure]
To estimate the vortex strength, the estimator runs a reverse Navier-Stokes simulation.
The reverse simulation is initialized with the marker m rev t = m t and velocity v rev t = v t from the forward simulation.
The reverse simulation then computes m rev and v rev for all time steps by performing simulation steps with ∆ t = − 0 .
Then, the update to the vortex strength is computed from the differences m rev − m at each time step and an estimate of the vortex location at these time steps.
Neural network training We train a U-net [48] similar to the previous experiments but withresolution levels.
The network contains a total of 49,570 trainable parameters.
The network is given the observed markers m 0 and m t , resulting in an input consisting of two feature maps.
It outputs two feature maps which are interpreted as a velocity field sampled at cell centers.
The objective function is defined as |F ( P ( x ) − y ∗ ) |· w where F denotes the two-dimensional Fourier transform and w is a weighting vector that factors high frequencies exponentially less than low frequencies.
We train the network using Adam with a learning rate of 0.005 and mini-batches containingexamples each, using PyTorch’s automatic differentiation to compute the weight updates.
We found that second-order optimizers like L-BFGS-B yield no significant advantage over gradient descent, and typically overshoot in terms of high-frequency motions.
Example trajectories and reconstructions are shown in Fig.
14 and performance measurements are shown in Fig.
S
I P
S
I P
S I P
[Figure]
i
[Figure]
/ i t e r a t i o n
[Figure]
C Additional Experiments
Here, we describe the additional experiments that were referenced in sections 1 and 2.
C.1 Wave packet localization
As we state in the introduction, one advantage of solution inference using neural networks is that no initial guess needs to be provided for each problem.
Of course the network starts off with some initialization but we observe that the network can explore a much larger area of the solution space than any iterative solver.
To our knowledge this claim has not been verified as of yet.
However, as it is not directly relevant to our method, we do not discuss it in detail in the main text.
Instead, we provide a simple example here.
The wave packet localization experiment is an instance of a generic curve fitting problem.
The task is to find an offset parameter t 0 that results in least mean squared error between a noisy recorded curve and the model.
Data generation.
We simulate an observed time series y ∗ from a random ground truth position x ∗ = t 0 .
Each time series contains 256 entries and consists of the wave packet and superimposed noise.
For the wave packet, we sample t 0 ∈ [25 . 6 , 128) from a uniform distribution.
The wave packet has the functional form
[Equation]
where we set A
= 1 , f = 0 .
7 and σ = 20 constant for all data.
For the noise, we superimpose random values sampled from the normal distribution N (0 , 0 . 1) at each point.
Network architecture.
We construct the neural network from convolutional blocks, followed by fully-connected layers, all using the ReLU activation function.
The input is first processed by five blocks, each containing a max pooling operation and two 1D convolutions with kernel size 3.
Each convolution outputs 16 feature maps.
The downsampled result is then passed to two fully connected layers with 64 and 32 and 2 neurons, respectively, before a third fully-connected layer produces the predicted t 0 which is passed through a Sigmoid activation function and normalized to the range of possible values.
Training and fitting.
We fit the data using L-BFGS-B with a centered initial guess ( t 0 = 76 . 8 ) and the network output is offset by the same amount.
Both network and L-BFGS-B minimize the squared loss ||
y ( t 0 ) − y ∗
|| 22 and the resulting performance curves along with example fits are shown in Fig.
We observe that L-BFGS-B manages to fit the wave packet perfectly when it is located very close to the center where the initial guess predicts it.
When the wave packet is located slightly to either side, L-BFGS-B gets stuck in a local optimum that corresponds to an integer phase shift.
When the wave packet is located further away from the initial guess, L-BFGS-B does not find it and instead fits the noise near the center.
The neural network is trained using Adam with learning rate η = 10 − 3 and a batch size of 100.
Despite the simpler first-order updates, the network learns to localize most wave packets correctly, outperforming L-BFGS-B after 30 to 40 training iterations.
This improvement is possible because of the network’s reparameterization of the problem, allowing for joint parameter optimization using all data.
When the prediction for one example is close to a local optimum, updates from different examples can prevent it from converging to that sub-optimal solution.
Conclusion This example shows that neural networks have the capability to explore the solution space much better than iterative solvers, at least in some cases.
Employing neural networks should therefore be considered, even when problems can be solved iteratively.
[Figure]
C.2 Gradient normalization for the exponential function
The task in this simple experiment is to learn to invert the exponential function P ( x ) =
e x .
As described in the text, both SGD and Adam converge very slowly on this task due to the gradients scaling linearly with e x .
Gradient normalization We introduce a gradient normalization which first computes the gradient ∂L∂x .
It then normalizes this adjoint vector for each example in the batch to unit length, ∆ x = sign (cid:0) ∂L∂x (cid:1) .
∆ x is then passed on to the network optimizer, replacing the standard adjoint vector for x .
Like with SIP training, we implement this using an L 2 loss for the effective network objective ˜
[Equation]
Neural network training For training data, we sample x ∗ uniformly in the range [ − 12 , 0] and compute y ∗ =
e x ∗ .
We train a fully-connected neural network with three hidden layers, each using the Sigmoid activation function and consisting of 16, 64 and 16 neurons, respectively.
The network has a single input and output neuron.
We train the network for 10k iterations with each method, using the learning rates η = 10 − 3 for Adam, η = 10 − 2 for SGD and η = 10 − 3 for Adam with x normalization.
Each mini-batch consists of 100 randomly sampled values.