~/satyajit

Learnable Spectral Activations: stop picking frequencies, learn how to mix them

mdjsonmcp

2026-10-23 · 19 min · 3d · representation-learning · computer-vision · audio · benchmarks · reproducibility

A 1:51 narrated explainer, drawn in code. Every number and picture in it is this article's own; the sources are below.

› transcript

Hi, I'm Soffit! Here is how one small change to an activation helps a network draw sharp edges. A coordinate network turns a position into a value. Earlier fixes chose its frequencies. This one learns how each neuron mixes them. Fourier features, SIREN and FINER change the menu. Each neuron still emits one fixed waveform, welded to its feature. Here the weights still pick the feature. A short list of learned numbers decides the waveform. Here is the formula. It starts as the identity, so the network begins almost linear. Then it adds whole-number harmonics of the same input. Each harmonic gets a learned amplitude, shared by the whole layer. A coordinate goes through the weights, which choose what this neuron looks at. The same value is fed to a bank of sines, one per harmonic. Learned amplitudes weight and sum them, so one neuron can make a square edge on its own. The output is linear in those amplitudes, so tuning the spectrum is a direct problem. In the paper's toy test, SIREN and FINER need more atoms to fit a wiggly signal. The learned harmonic unit fits it with one. The target suits it, so this shows the mechanism. On twenty four Kodak photos the paper reports about thirty eight decibels, just ahead of FINER and three ahead of SIREN. The parameters are almost free. The compute is not: a step takes nearly seven times as long as FINER's. The idea to keep: give each layer a learned recipe for mixing harmonics, and let the weights just pick features. Frequencies picked. Harmonics mixed. Better fits, slower steps. Every source is in the full article. I'm Soffit. Bye!

Why read this

Hightop 30%

LSA's harmonic activation from the code up, paper tables rechecked, and a CPU run pricing its per-step lead against wall time.

  • Original analysis
  • Runs on a consumer GPU
  • A lasting reference

3D & spatialNo licenceResearch paper

How this was scored
Is it new?
2 of 3: A real new idea, method or capability
Can I trust it?
2 of 3: Measures key facts from files, code or configs
Can I run it?
2 of 3: Open code or weights with real limits
Will I understand it?
2 of 3: Mechanism from first principles with figures
Can I act on it?
2 of 3: A concrete recipe, numbers or comparison
Will it last?
2 of 3: A reference for a year or more
Does it affect many?
1 of 3: A specialist community
Only here?
2 of 3: A teardown or measurement few others did

Score 67 of 100, ranked 178 of 607 rated articles. Each question is answered 0–3 by hand, and a 3 is rare. How articles are scored

An implicit neural representation (INR) stores a signal as a function. Give a small MLP a coordinate (a time stamp, a pixel position, a point and a view direction) and it returns the value there (an audio sample, an RGB triple, a density and a colour). There is no grid. You can query it between samples, take its derivative analytically, and optimise through it. NeRF is the famous instance; signed distance fields, like the one inside OREN's octree mapper, are another.

The catch is old and well known. A plain ReLU MLP fed raw coordinates learns smooth functions first and fine detail last, sometimes never. That is spectral bias: gradient descent fits the low-frequency part of the target much faster than the high-frequency part. A photo through a ReLU MLP comes out blurry, and an audio clip comes out as mush.

Learnable Spectral Activations (LSA), by Tamir Shor, Or Litany and Alex Bronstein (Technion, NVIDIA, ISTA), arXiv 2610.07419, NeurIPS 2026, comes with code. Litany's pitch on X: prior INR work tunes which frequencies are available; LSA learns how to compose them. Below: what that means for one neuron, the tables checked against the paper and code, and a small CPU run.

tamirshor7/Learnable-Spectral-Activations@35a040b · snapshot 2026-10-23
tracked files
44
branch
HEAD
tests
none found
source
82.9 kB
commit date
2026-10-07
source by language
Python82.9 kB(19)

by size of tracked source at this commit, file counts in brackets; docs, data and vendored trees excluded

local clone, 2026-10-23 at 35a040b — branch, commit, commitDate, fileCount, hasTests, languages

Every fix so far changes the frequency menu

The cleanest way to read INR design is the structured dictionary view of Yüce et al. (2022), which the paper adopts. Feed a network a sinusoid of frequency ω\omega, push it through a nonlinearity ρ\rho, and you get harmonics: ρ(ejωx)=∑kαkejkωx\rho(e^{j\omega x}) = \sum_k \alpha_k e^{jk\omega x}. Stack layers and the network's output is a weighted sum of sinusoidal atoms whose frequencies come from a set H(Ω)\mathcal{H}(\Omega) the architecture induces:

f(x)=∑ω′∈H(Ω)cω′sin⁡(⟨ω′,x⟩+ϕω′)f(x) = \sum_{\omega' \in \mathcal{H}(\Omega)} c_{\omega'} \sin(\langle \omega', x \rangle + \phi_{\omega'})

Read the popular fixes through that lens and they all edit the menu:

The paper's argument is that all of these decide which atoms exist and leave the neuron's own waveform prescribed. A SIREN unit's output is sin⁡(ω0w⊤z)\sin(\omega_0 w^\top z): one sinusoid of the projection w⊤zw^\top z. Its harmonic content is fixed by the same weights ww that choose which feature the unit looks at. To build an edge, which needs many harmonics in fixed amplitude ratios, the network has to recruit several such units and line them up. The waveform and the feature are welded together.

The activation

LSA unwelds them. At hidden layer ℓ\ell the activation is a residual, truncated Fourier series of the scalar pre-activation uu (paper, Eq. 2):

ϕ(ℓ)(u)=u+∑k=1Kak(ℓ)sin⁡(2πku)\phi^{(\ell)}(u) = u + \sum_{k=1}^{K} a^{(\ell)}_k \sin(2\pi k u)

Three properties fall out of the form.

The waveform is decoupled from the feature. ww still decides what the unit looks at. The coefficients decide what it does with it: the same uu goes through KK harmonics at once, and their relative amplitudes are learned. One unit can emit a square-ish wave, a sawtooth, or something with a notch.

It is affine in the coefficients. For fixed pre-activations, ϕ\phi is linear in aa. The gradient for aka_k is the residual's correlation with the propagated harmonic sin⁡(2πku(ℓ))\sin(2\pi k u^{(\ell)}). The paper writes this as an exact finite-width identity for full-batch gradient flow (Eq. 4):

−L˙=ηw∥Jw⊤r∥2+ηa∥Ψ⊤r∥2-\dot{\mathcal{L}} = \eta_w \lVert J_w^\top r \rVert^2 + \eta_a \lVert \Psi^\top r \rVert^2

where rr is the residual, JwJ_w the Jacobian with respect to ordinary weights and Ψ\Psi the Jacobian with respect to the harmonic coefficients. The second term is extra descent the coefficients add whenever the residual has any projection onto the harmonic directions. Equivalently, the empirical neural tangent kernel gains a positive semidefinite term ηaΨ0Ψ0⊤\eta_a \Psi_0 \Psi_0^\top of rank at most (layers ×K\times K). That is the formal content of "spectral tuning becomes a more direct subproblem".

It does not expand what the network can represent. The paper is careful here and I will be too: a wide enough periodic INR can already represent the same signals. LSA changes the factorisation, not the function class. The claim is about optimisation: the same target is easier to reach.

The widget below is one LSA activation with K=6K = 6. Left: ϕ(u)\phi(u) against the identity it starts from and against a single sine. Right: its spectrum, which for this form is just the coefficient vector, one bar per harmonic. A SIREN unit has one bar.

The fit edge button makes the affine point concrete. The target is a soft square wave, 0.45tanh⁡(8sin⁡2πu)0.45 \tanh(8 \sin 2\pi u), added on top of uu. Because ϕ\phi is linear in aa, the best coefficients are a least-squares solve, not a search. The best root-mean-square gap with only the first harmonic, which is all a single sine can do, is 0.155 against a target RMS of 0.431. Adding harmonics two and three brings it to 0.089, and five or six bring it to 0.057 (measured, in the widget and in numpy). The even harmonics get zero weight: the target is an odd square wave, and a square wave has no even harmonics. A SIREN or FINER network gets there too, but by recruiting more units at different frequencies and phases, which costs width and gradient steps.

The paper's own version of this is Figure 1a: a 1D target fitted with a budget of one to four atoms.

Three rows of four panels each, SIREN, FINER and Learned Harmonic, fitting the same wiggly 1D signal with one to four atoms. SIREN reaches 10.8, 14.8, 20.0 and 103.0 dB PSNR; FINER reaches 11.1, 16.0, 19.1 and 25.4 dB; the learned-harmonic row reaches 120.0 dB with a single atom.
A controlled 1D phantom with a limited atom budget. SIREN and FINER improve as atoms are added; the learned-harmonic unit fits with one. Read it as an illustration: the target looks like a short sum of harmonics of one base frequency, which a single learned-harmonic unit can represent exactly (LSA paper, Figure 1a).

Take the 120 dB with a grain of salt. The phantom appears to be built from a few harmonics of one fundamental, which is the one case where a single learned-harmonic unit is an exact fit (reasoned from the figure; the paper does not give the phantom's formula). It shows the mechanism, not a margin.

What the released code actually does

The repository ships the audio and 2D image experiments only. NeRF and the neural acoustic fields are not in it (measured, at commit 35a040b, 7 October 2026). It also has no licence file. The THIRD_PARTY.md lists the FINER, STAF and SL2A sources, and the STAF and SL2A licences are kept, but the repo itself grants nothing, so treat it as all rights reserved until that changes.

The image activation in image_2d/lsa/models.py is ten lines:

image_2d/lsa/models.py (released)
class SpectralActivation(nn.Module):
    def __init__(self, harmonics=32, init_scale=1e-3, residual=True):
        super().__init__()
        self.harmonics = int(harmonics)
        self.residual = bool(residual)
        self.coeffs = nn.Parameter(init_scale * torch.randn(self.harmonics))
 
    def forward(self, x):
        y = 0.0
        for i in range(self.harmonics):
            y = y + self.coeffs[i] * torch.sin(2.0 * math.pi * (i + 1) * x)
        return x + y if self.residual else y

Two details matter that the equations do not show (measured from the code):

  1. The forward pass is a Python loop over KK. Every harmonic is a separate sin, a separate multiply-add and a separate saved tensor for autograd. That is the cost the paper's resource appendix measures, and the cost my CPU run hits.
  2. The first layer has no ω0\omega_0. Its weights and biases are uniform in ±1/2\pm 1/2 (that is, ±1/fan-in\pm 1/\text{fan-in} with two input coordinates), and the activation multiplies the pre-activation by 2πk2\pi k for kk up to 32. So the first LSA layer is, in effect, a Fourier-feature bank along each neuron's direction ww, with frequencies up to 2π⋅32⋅∣w∣2\pi \cdot 32 \cdot |w| and amplitudes learned per layer (reasoned). Hidden layers use SIREN's initialisation bound, 6/256/30\sqrt{6/256}/30. The harmonic basis is where the high frequencies come from, which sits a little awkwardly next to "LSA does not change which frequencies are available". It does not change the asymptotic menu; it does change what a finite network reaches from initialisation.

The training loop puts the coefficients in their own Adam group at a higher learning rate: twice the weight rate for images, three times for audio (act_lr_mult in image_2d/configs/kodak_core.yaml and audio/run_core.py).

Checking the results

All numbers in this section are reported: the paper's, on an NVIDIA RTX A6000, not re-run. Where I combine them, it is reasoned.

Images: Kodak

Twenty-four 768×512 photos, raw coordinates, width 256, four nonlinear layers, 5,000 Adam updates, seed 0, best PSNR along the trajectory. Mean PSNR:

MethodMean PSNR (dB)Setup
LSA (K=32K = 32)38.110199,043 params, 5,000 updates
FINER37.317198,915 params, 5,000 updates
WIRE36.596up to 10,000 updates
STAF (global config)35.369matched budget
MFN GaborNet35.151up to 10,000 updates
SIREN34.990198,915 params, 5,000 updates

LSA beats FINER on 21 of 24 images and SIREN on all 24. The gap over FINER is 0.79 dB (reasoned). The paper selects LSA's configuration on six calibration images (kodim02, 05, 07, 10, 13, 23); on the other 18, LSA reports 38.045 dB.

Bar chart of best PSNR for each of the 24 Kodak images, four bars per image for FINER, SIREN, STAF and LSA. Legend means: FINER 37.32, SIREN 34.99, STAF 35.37, LSA 38.11. LSA's green bar is highest on most images, FINER's blue bar close behind.
Per-image Kodak PSNR under fixed configurations and 5,000 updates. The error bars are not defined in the caption or text; each image is a single seed-0 fit (LSA paper, Figure 4).

Three things to hold the table to:

Two Kodak images, a lighthouse and a mountain stream, each reconstructed by LSA, FINER and SIREN, with a row of spatial residual maps and a row of Fourier-domain residual maps underneath. Titles: lighthouse 38.67, 36.92, 34.52 dB; stream 31.91, 30.75, 27.77 dB. LSA's residual maps are darkest.
kodim21 and kodim13 with spatial and spectral residuals on a shared display scale. The paper notes these two were chosen for clarity; the dataset-level evidence is the table above (LSA paper, Figure 6).

Audio: where the gap is largest, and needs Fourier features

One-second clips at 48 kHz, 10 from NSynth and 40 from LibriSpeech, width 256, four layers, 5,000 full-batch updates. Each method gets the same 16 Gaussian Fourier-feature bands at each bandwidth σ\sigma, and the paper sweeps σ\sigma from 0 (raw coordinates) to 100.

Two line charts of mean PSNR against Fourier-feature bandwidth sigma from 0 to 100, for NSynth and LibriSpeech. On both, LSA starts below FINER at sigma 0, then climbs above it from sigma 20, reaching roughly 87 dB on NSynth and 91 dB on LibriSpeech at sigma 100. FINER stays in the 60s. SIREN is lowest and drops when Fourier features are added.
On-grid audio PSNR against Fourier-feature bandwidth. Shaded bands are standard deviations across clips (LSA paper, Figure 2).

At σ=100\sigma = 100 LSA reports 86.72 dB on NSynth and 90.78 dB on LibriSpeech. The strongest STAF setting reaches 68.79 and 68.40 dB; FINER reaches 67.19 and 66.32 dB. Read three things off the figure before quoting those:

The released README notes that the core audio targets are zero-mean and unit-peak, while the appendix says amplitudes are used "on the decoded floating-point audio scale". It is applied identically to every method in the core comparison, so it does not tilt the table, but the two descriptions do not match (measured from both files).

NeRF: a tie on PSNR, a small SSIM edge

Blender, eight scenes, FINER's reduced-view protocol (every fourth training image, 200×200), an Instant-NGP-style backbone with width 182, 150,000 steps, final checkpoint. LSA uses K=24K = 24.

Mean over 8 scenesPSNR (dB)SSIM
SIREN28.990.932
FINER29.260.932
LSA29.290.938

The means are reasoned from the paper's Table 1. LSA is best on PSNR in five scenes and FINER in the other three; the mean PSNR gap to FINER is 0.03 dB, with Lego going 0.65 dB the other way. SSIM is the more consistent signal: LSA is best on seven of eight scenes. The paper calls these gains "moderate", which is accurate. One run per scene, and LSA's learning rate is three times the baselines' ("best stable settings"), so this is a parity result with a mild structural-similarity edge, not a NeRF upgrade.

Neural acoustic fields

Here LSA (K=8K = 8) replaces the activation in the NAF decoder and nothing else. Log-spectral L1 improves by 44.90% (macro over four scenes), MRSTFT log-L1 by 45.97% and the interaural time-delay error from 122.4 to 39.7 samples; waveform PSNR improves by 0.43 dB. The largest relative effect in the paper, and the one I can least check: the NAF code is not released, and the baseline (waveform PSNR 11.417 dB) is far from the ground truth.

What it costs

Here the paper is direct. The parameters are free: depth 4 with K=16K = 16 adds 64 scalars to a 206,337-parameter audio MLP. The compute is not. On full-grid 48k audio fitting with 16 Fourier bands, an A6000 step takes (reported, Table 16):

Depth 4, width 256Train step (ms)Train peak mem (GB)Eval (ms)
SIREN8.260.483.56
FINER14.200.855.55
LSA, K=16K = 1697.937.5335.08

That is 6.9× FINER's step time and 8.9× its memory (reasoned; the paper rounds to 7× and 9×). Both scale linearly in KK: at K=64K = 64 a step takes 341.09 ms and 29.55 GB. The cause is the one in the code: the activation evaluates batch × width × layers × KK sines and autograd keeps each one. An "accumulate" implementation cuts inference memory, and the paper points at a fused kernel as future work. The math is a natural fit for one: the derivative of ∑kaksin⁡(2πku)\sum_k a_k \sin(2\pi k u) is ∑k2πk akcos⁡(2πku)\sum_k 2\pi k\, a_k \cos(2\pi k u), and both sums can come from one Chebyshev-style recurrence on sin⁡\sin and cos⁡\cos of 2πu2\pi u without storing KK tensors (reasoned; nobody has shipped it).

The paper leaves quality against wall clock to future work. That is the experiment I could run.

Running it: one image on a CPU

Setup (measured). The released LSAImageMLP and the released SIREN and FINER classes (image_2d/third_party/finer.py), imported from the clone; my own training loop mirroring image_2d/lsa/train.py (Adam, learning rate decayed to 0.1× over the run, LSA coefficients at twice the weight rate, targets in [−1,1][-1, 1]). A fourth baseline is a ReLU MLP with NeRF-style positional encoding (L=10L = 10 octaves, width trimmed to 121 to match parameters). The image is scikit-image's astronaut (NASA, public domain) at 128×128, full batch. Width 128, four nonlinear layers, K=32K = 32. Every model has about 50,000 parameters. Hardware: a shared 4-core Intel Xeon at 2.10 GHz cloud VM, CPU only, PyTorch 2.14.1, two threads, nice 19, with other jobs running.

Total compute for the run was about 28 minutes of wall time, over the 20-minute budget I set myself, almost all of it the LSA model.

500 steps, ~50k paramsFinal PSNR (dB)ms per stepTraining time (s)
FINER41.669748.5
SIREN37.808241.0
LSA, K=32K = 3235.122,7671,383
ReLU + positional encoding24.755025.0
SIREN, run for 2,000 steps48.6192184

What the run shows (all measured, one seed, one image):

Treat this as a smoke test of the released code and a price check, not a replication. Reproducing the Kodak table needs a GPU, 768×512 images, width 256 and 5,000 steps per fit, and the released image_2d/run_core.py does exactly that.

Where this leaves LSA

The idea is small and sound: learned, layer-shared harmonic amplitudes cut the tie between a neuron's waveform and its feature for KK parameters per layer, and give the optimiser clean new descent directions. On images that buys a consistent 0.8 dB over FINER and 3 dB over SIREN at matched width and steps. On audio it buys a lot once Fourier features are present, and nothing without them. On NeRF it buys parity.

What I would want before adopting it:

Related reading: RoPE applies the same sinusoidal-feature idea to token positions; the Gaussian-splat appearance benchmark is a field where the frequency question moved out of the MLP into spherical harmonics; and functional gradient descent is another way to think about optimising a function rather than its weights.

Cite this article

For attribution, please use the following reference or BibTeX:

Satyajit Ghana, "Learnable Spectral Activations: stop picking frequencies, learn how to mix them", ai.thesatyajit.com, October 2026.

bibtex
@misc{ghana2026learnablespectralactivations,
  author = {Satyajit Ghana},
  title  = {Learnable Spectral Activations: stop picking frequencies, learn how to mix them},
  url    = {https://ai.thesatyajit.com/articles/learnable-spectral-activations},
  year   = {2026}
}
share