Spectral Bias & Fourier Features
Why networks learn low frequencies first, and how coordinate networks get around it.
Ask a network to fit a curve made of a slow wave plus a fast wiggle, and it learns the slow wave first, every time. This spectral bias follows, in the kernel view of training, from how the tangent kernel's eigenvalues fall with frequency. It explains why a plain coordinate network paints blurry images, and why a layer of sines and cosines in front of it fixes them.
What you’ll learn
- Describe the evidence for spectral bias (the frequency principle) and its link to the growth of weight norms during training.
- Derive the linearized training dynamics, in which the residual's component along a kernel eigenvector decays like , and show that for uniform data on a circle the eigenvectors are Fourier modes with eigenvalues falling like for a two-layer ReLU network.
- Show that a Fourier feature mapping makes the tangent kernel stationary with a tunable bandwidth, and compare positional encodings, random Fourier features, sine networks and learned hash encodings for coordinate networks.
- Weigh spectral bias as an implicit regularizer against its costs, and state what is and is not known beyond the kernel regime.
Low frequencies first
Rahaman et al. (2019) trained a 6-layer ReLU network of width 256 on 200 evenly spaced samples of on , with frequencies and random phases, and tracked the Fourier spectrum of the network during full-batch training. The low frequencies were fitted first and the high ones much later, regardless of their amplitudes: the order held even when the high frequencies carried ten times the amplitude of the low ones. Xu, Zhang, Luo, Xiao & Ma (2020) found the same ordering on MNIST and CIFAR-10 and named it the frequency principle; the spectral bias is now its usual name.
Rahaman et al. also explained part of it. A ReLU network is piecewise linear, so its Fourier transform can be written out exactly. In most directions of it decays like (and never slower than ), with a prefactor bounded by the number of linear regions times the network's Lipschitz constant, and the Lipschitz constant is at most the product of the layers' spectral norms. A large high-frequency component therefore needs large weights. The weights' norms grow gradually during training, the high frequencies appear as they grow, and clipping the weights to keep their norms small stopped the network from learning the high frequencies at all.
The contrast with classical numerics is instructive. The Jacobi iteration for a linear system removes high-frequency error fastest, which is why multigrid methods exist (Xu et al., 2020). Gradient descent on a neural network does the opposite.
In Rahaman et al.'s experiments, what happened when the weights were clipped to keep their norms small during training?
- The network still learned every frequency, only more slowly
- The network learned the high frequencies first instead
- The network could no longer learn the high frequencies
- Training diverged because the loss became unbounded
Show the answer
C. The network could no longer learn the high frequencies
The Fourier components of a ReLU network are bounded by its Lipschitz constant, at most the product of the layers' spectral norms. Large high-frequency components need large weights, so capping the weights caps the spectrum.
The kernel view: training is a filter
A sharper explanation comes from linearizing the network around its initialization, the regime in which very wide networks train (the neural tangent kernel, Jacot, Gabriel & Hongler, 2018; Loss Landscapes introduces it). There training on the squared loss becomes a linear filter, and the filter's passband is the top of the kernel's spectrum.
Take the squared loss and gradient flow . By the chain rule, any output moves along the tangent kernel :
In the kernel regime stays at its initial value . On the training points, the residual then obeys a linear ODE with the positive semidefinite Gram matrix :
Expand in the eigenvectors of . Each component of the residual decays on its own clock, the large-eigenvalue directions first. Discrete gradient descent with step gives instead of :
For a finite but very wide two-layer ReLU network trained by gradient descent from a small random initialization, Arora, Du, Hu, Li & Wang (2019) proved this picture holds up to an arbitrarily small error , with high probability: the decay along each eigenvector is set by its eigenvalue.
Two components of the residual have eigenvalues and . You train (in the gradient-flow picture) until the first has shrunk to 1% of its starting size. What percentage of its starting size does the second component still have?
Show the answer
63 %
means . The second component has shrunk only by : 63% is left. A component with a hundred times smaller eigenvalue would still be at 95%. Stopping early leaves the small-eigenvalue directions almost untouched.
Basri et al. measured the number of iterations a network needed to fit a pure frequency on the circle and found growth like to , close to the predicted , not only for two-layer networks but also for a network with five hidden layers and a residual network with ten, outside the setting of the theory. Two details show how literal the prediction is. Without biases, the two-layer ReLU kernel has zero eigenvalue at every odd frequency , and such networks indeed cannot fit on the circle. And the kernel of the random-features model, which trains only the last layer, decays faster, like (Bietti & Mairal, 2019): training the first layer is what keeps moderately high frequencies within reach.
Take the model on the circle. How many times longer does gradient flow take to shrink the frequency-8 component of the residual by a given factor than the frequency-1 component?
Show the answer
64 ×
The time scale is , so the ratio is . Frequency 32 would take times longer: within a fixed training budget, the fine detail of a signal is simply never reached.
Coordinate networks and Fourier features
The bias is most visible in implicit neural representations: networks that take a coordinate as input and output the signal at that point, such as pixel position to color, 3-D position to density and color, or time to audio amplitude. The input is low-dimensional and the signal is full of detail, exactly the setting in which a plain MLP fits a blurry approximation and then stalls. The fix is to change the kernel by changing the input. Tancik et al. (2020) analyzed the Fourier feature mapping:
Map the coordinate through sinusoids with amplitudes and frequency vectors before the MLP:
The angle-difference identity makes the inner product of two mapped points depend only on their difference. It also gives every the same norm, :
On inputs of fixed norm the MLP's tangent kernel is a function of the inner product alone, so the composed kernel depends only on . It is stationary: a convolution over the input domain, whose eigenfunctions on uniform data are Fourier modes and whose spectrum is shaped by the frequencies we chose.
With random frequencies , the scale sets the kernel's bandwidth. Too small a underfits, with slow convergence and blurry, oversmoothed outputs; too large a overfits, with high-frequency artifacts between the training samples. In between, a well-tuned lets an MLP fit fine detail and still interpolate sensibly; it is an inductive-bias knob for a low-dimensional domain.
| Method | What it does | Notes |
|---|---|---|
| positional encoding (NeRF; Mildenhall et al., 2020) | each coordinate mapped to for | for 3-D positions, for viewing directions; deterministic, log-spaced, on-axis frequencies |
| random Fourier features (Tancik et al., 2020) | in all directions | one bandwidth knob , tuned per task; the same construction as Rahimi & Recht's random features for kernel machines (2007) |
| SIREN (Sitzmann et al., 2020) | sine activations in every layer, in the first | needs a matched initialization to keep activations well distributed; its derivatives are again SIRENs, so it can be fitted to gradients and solve PDEs such as Poisson's and the eikonal equation |
| multiresolution hash encoding (Müller, Evans, Schied & Keller, 2022) | trainable feature vectors on grids at many resolutions, stored in hash tables, interpolated and fed to a small MLP | the encoding itself is learned, so the network only combines local features; training takes seconds to minutes instead of hours |
Think first Why do Fourier features help a network on a 2-D image but are rarely used on, say, 1,000-dimensional tabular inputs?
The trick works by making the kernel stationary with a bandwidth matched to the signal, which needs enough frequencies to cover the domain. In two or three dimensions a few hundred sinusoids tile the frequency space densely. In a thousand dimensions they cannot, the data rarely look like a densely sampled smooth field, and the target's useful structure is usually not periodic in the raw coordinates. Tancik et al. framed the method explicitly for low-dimensional regression problems.
Blessing and curse
A regularizer. Spectral bias is one concrete form of implicit regularization. Natural targets tend to concentrate their energy in low frequencies, while label noise spreads evenly over all frequencies; gradient descent fits the first quickly and the second slowly, so stopping early acts as a low-pass filter (Early Stopping & Regularization by Time develops this spectral-filter view). For kernel regression, Canatar, Bordelon & Pehlevan (2021) derived the generalization error for any kernel and data distribution: a kernel generalizes well when the target's power lies on its top eigenfunctions, a task–model alignment. The same theory predicts non-monotonic learning curves when labels are noisy or the target is poorly aligned.
A cost. When the target is genuinely high-frequency (fine image texture, a turbulent flow, a solution of a PDE with sharp features) the same bias makes training slow or stalls it, which is why the methods in the table above exist.
A cousin: simplicity bias. Early in training, almost all of the progress of SGD on image classifiers is explained by a linear classifier, and the network learns functions of increasing complexity as training goes on (Kalimeris et al., 2019). The bias can be extreme: on datasets built with a simple and a complex predictive feature, networks relied on the simple one alone, even when it was less predictive, which makes them fragile under shift (Shah, Tamuly, Raghunathan, Jain & Netrapalli, 2020; Shortcut Learning & Spurious Correlations).
Beyond the kernel regime. The derivation assumed a fixed kernel. Real networks learn features, and their tangent kernel changes: it moves fastest early in training, and kernels taken from later in training perform much better than the initial one (Fort et al., 2020). The kernel also aligns with a few task-relevant directions as training proceeds (Baratin et al., 2021), which changes which functions are fast to learn. Low-frequency-first behavior is still observed empirically in feature-learning networks, as in Rahaman et al.'s experiments, but there is no sharp theory of its rate there. How SGD learns features beyond kernels is the subject of How SGD Learns Features.
Key takeaways
- Networks fit low frequencies before high ones regardless of their amplitudes. In ReLU networks, high-frequency components need large weights, and weight norms grow only gradually during training.
- In the kernel regime training is a linear filter: the residual along a kernel eigenvector decays like , and for uniform data on a circle the eigenvectors are Fourier modes with (two-layer ReLU with biases), or on .
- Fourier features make the tangent kernel stationary, , with a bandwidth set by the frequency scale : too small blurs, too large overfits. Positional encodings, SIREN and hash encodings are other ways to bring high frequencies within reach.
- Spectral bias acts as implicit regularization when targets are smooth and noise is broadband, and as an obstacle for detailed signals. Beyond the kernel regime the kernel itself evolves and no sharp theory exists.
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
In the kernel regime, gradient flow on the squared loss gives for the training residual. How does the component of along an eigenvector of with eigenvalue evolve?
- It decreases linearly in time, at a rate proportional to
- It decays like , independently of the other components
- All components decay at the same rate, set by the largest eigenvalue
- It decays like , so small-eigenvalue directions are fitted first
Show the answer
B. It decays like , independently of the other components
The solution is , and in the eigenbasis each component is multiplied by . Large-eigenvalue directions (low frequencies, for the ReLU kernel on the sphere) are fitted first.
A two-layer ReLU network without biases, in the kernel regime, is trained on points spread uniformly on the unit circle with target . What happens?
- It fits the target quickly, because frequency 3 is low
- It fits the target, but about nine times more slowly than
- It fits the target only if the learning rate is large enough
- It cannot fit it: the kernel's eigenvalue is zero at odd frequencies
Show the answer
D. It cannot fit it: the kernel's eigenvalue is zero at odd frequencies
Without biases, the two-layer ReLU tangent kernel annihilates the odd harmonics with (Basri et al., 2019; Bietti & Mairal, 2019), and such networks indeed fail to fit them. Adding biases gives these frequencies positive eigenvalues, decaying like .
You fit an image with an MLP on random Fourier features . The reconstruction at held-out pixels is full of high-frequency speckle. What should you change?
- Lower : the kernel's bandwidth is too high, so the network overfits between the samples
- Raise : the network needs higher frequencies to fit the image
- Remove the Fourier features and use the raw coordinates
- Train longer, so the spectral bias removes the speckle
Show the answer
A. Lower : the kernel's bandwidth is too high, so the network overfits between the samples
sets the bandwidth of the stationary kernel. Too large a lets the network fit detail that is not supported by the samples, which shows as noise between them; too small a blurs. Tancik et al. tuned per task.
For inputs uniform on the sphere , the eigenvalues of the two-layer ReLU tangent kernel at degree fall like . Under the linearized dynamics, how does the time to fit a degree- component scale?
- like
- like
- like
- independently of
Show the answer
C. like
The time scale of a component is . Higher dimensions make the spectrum fall faster, so the penalty on high degrees grows with .
Further reading
- N. Rahaman, A. Baratin, D. Arpit, F. Draxler, M. Lin, F. A. Hamprecht, Y. Bengio & A. Courville, "On the spectral bias of neural networks," ICML (2019).
- R. Basri, D. Jacobs, Y. Kasten & S. Kritchman, "The convergence rate of neural networks for learned functions of different frequencies," NeurIPS (2019).
- A. Bietti & J. Mairal, "On the inductive bias of neural tangent kernels," NeurIPS (2019).
- M. Tancik, P. P. Srinivasan, B. Mildenhall, S. Fridovich-Keil, N. Raghavan, U. Singhal, R. Ramamoorthi, J. T. Barron & R. Ng, "Fourier features let networks learn high frequency functions in low dimensional domains," NeurIPS (2020).
- A. Canatar, B. Bordelon & C. Pehlevan, "Spectral bias and task-model alignment explain generalization in kernel regression and infinitely wide neural networks," Nature Communications 12 (2021).