bispectrum: a symmetry-invariant layer with no weights, and why it keeps the shape the power spectrum throws away
mdjsonmcp2026-11-25 · 21 min · equivariance · geometric-deep-learning · computer-vision · signal-processing · geometry · pytorch
A 3:21 narrated explainer, drawn in code. Every number and picture in it is this article's own; the sources are below.
› transcript
A digit drawn on a sphere. Turn the sphere, and a network trained on upright digits changes its mind. The power spectrum gives the same answer at every angle. The wrong one. The bispectrum reads a two every time. I'm Phasor. Let's see what a shift does to a signal's Fourier coefficients, and which products of them it cannot touch. Slide a periodic signal. Each Fourier coefficient turns by its own frequency times the shift. The first harmonic turns once, the second twice, the third three times. The power spectrum keeps each coefficient's length and drops its phase. So it never moves. That is why it is invariant. It is also why it is lossy. This twin has the same three lengths and different phases. Same power spectrum, different signal. Multiply the first and second coefficients by the conjugate of the third. Their turns cancel exactly, so the product holds still, and it still remembers how the harmonics line up. The selective version keeps n products, not every pair. The first gives the mean coefficient. The second gives the length of the first harmonic. Its phase is the one thing no invariant can know, because it is the shift. Set it to zero. Now each remaining product has exactly one unknown, the next coefficient. Walk up the spectrum. The whole signal comes back, in one fixed pose. That is completeness, with a linear number of entries. Why it matters. The full bispectrum of one 256 by 256 image is 17 GB. The selective one is 0.5 MB, and the image is still determined up to a shift. The library does this for seven group actions: rings, circles, image grids, polygons, cube rotations, the disk and the sphere. Each one is a module with no weights. On the sphere, completeness is a conjecture. The evidence is reconstruction: from 380 numbers, a solver rebuilt every digit they tried, up to a rotation. Rotated Spherical MNIST. The bispectrum plus an MLP gets 95.8 percent. The spherical CNN and the tensor-product network get 96.1. At batch 16 on an H100, 0.257 milliseconds, against 1.02 and 93.7. The power spectrum, just as invariant, stops at 77.7. I ran the authors' script on a 3090. 95.74 against 96.11, the power spectrum at 77.90, the planar CNN at 13.47. Same table, one seed. The layer has no weights. The MLP behind it has more parameters than the spherical CNN. With less data, the learned spherical CNN wins. And on the sphere, selection only saves a factor of three. The speed comes from skipping learned tensor products. Triple products cancel the symmetry and keep the phases. A linear subset of them is enough to rebuild the signal. Invariant, complete, and small enough to use. See you next time. Every source is in the full article. I'm Phasor. Bye!
Why read this
Essentialtop 10%Derives why the bispectrum is complete, runs the library's C_n formulas live, and reproduces the Spherical MNIST table and invariance on an RTX 3090.
- Checked against the source
- Interactive explanations
- Runs on a consumer GPU
Developer tools & infraMITResearch tool
How this was scored
- Is it new?
- 2 of 3: A real new idea, method or capability
- Can I trust it?
- 3 of 3: Reproduces the headline result, or shows from primary files it is wrong
- Can I run it?
- 2 of 3: Open code or weights with real limits
- Will I understand it?
- 3 of 3: Mechanism carried by interactives built from real code or data
- 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 76 of 100, ranked 53 of 784 rated articles. Each question is answered 0–3 by hand, and a 3 is rare. How articles are scored
Johan Mathe posted on 24 November: "Today we're introducing bispectrum: symmetry invariance, training-free, as a PyTorch library! Our layer without any weights + a small MLP lands within 0.3 pp of equivariant networks on rotated Spherical MNIST, and runs up to 360x faster!" The paper is arXiv 2605.07270, "bispectrum: Selective G-Bispectra Made Practical", by Johan Mathe (Atmo), Adele Myers Lantow and Nina Miolane (UC Santa Barbara) and Simon Mataigne (UCLouvain). It went up on 8 May, the version I read is v2 from 9 November, and it is a NeurIPS 2026 paper. The code is MIT and installs with pip install bispectrum. The authors also wrote an interactive explainer, which is good and worth a visit.
I read the paper, the library's cn_on_cn.py and the Spherical MNIST experiment code at commit fbda28f (11 November), then ran the library and the authors' experiment scripts on an RTX 3090. The mechanism is old and lovely, the library is careful, and the headline numbers check out, against the paper's own tables and in my run, with two qualifications I get to below: the "weightless" layer is followed by an MLP with more parameters than the spherical CNN it is compared with, and the sphere is where completeness is conjectured rather than proven.
Fast, exact, lossless symmetry invariants for PyTorch.
- license
- MIT
- branch
- main
- forks
- 1
- open issues
- 0
- source
- 1.2 MB
- commit date
- 2026-11-11
Read at fbda28f (11 November 2026). The cyclic module is src/bispectrum/cn_on_cn.py (forward, _forward_selective, invert); the sphere is src/bispectrum/so3_on_s2.py; the Spherical MNIST run is experiments/spherical_mnist/train.py with model.py and baselines.py; end-to-end latency is experiments/tooling/benchmark_smnist_models.py.
GitHub REST API, 2026-11-25 — branch, commit, commitDate, createdAt, description, forks, homepage, languages, license, openIssues, pushedAt, stars, topics
The problem with an invariant that forgets
A digit on a sphere is still the same digit after you rotate the sphere. A classifier should not care, and there are three usual ways to make it not care. The thread puts the first two plainly: "Data augmentation: the network learns invariance approximately and only from the poses it has seen. Max pooling / power spectrum: exact, but lossy. Different inputs can end up with the same features." The third is an equivariant network (a spherical CNN, a tensor-product network built with e3nn) that carries the rotation through every layer and then still needs an invariant pooling step at the end. The paper's introduction makes the point that the common pooling choices, norm, gate and max, are all incomplete: "max pooling over keeps only the largest response across the group, so two feature maps that share their maximum but differ everywhere else are mapped to the same invariant descriptor."
So there are two properties you want from the last step, and the paper's explainer states them as one line:
The right-to-left direction is invariance: every pose of a signal gets the same features. The left-to-right direction is completeness: two signals get the same features only if one is a transformed copy of the other. Max pooling and the power spectrum have the first. The bispectrum has both.
Shifts, and the phase that the power spectrum drops
Start with the simplest group, the cyclic group acting on a periodic signal of samples by shifting it. Write the discrete Fourier transform as
Shift the signal by samples and every coefficient picks up a phase that depends on its own frequency:
The magnitude does not change, so the power spectrum is invariant. That is the whole trick behind "Fourier magnitudes" as an invariant feature, and it is why the power spectrum is lossy: the phases carry where each harmonic's peaks sit relative to the others, and the power spectrum throws every one of them away. Two signals with the same and different phases have the same power spectrum and can look nothing alike.
The bispectrum keeps a product of three coefficients whose shift phases cancel:
Under the shift, the three factors pick up , and , and those multiply to 1. So is invariant, exactly. What survives is the phase combination , which is a statement about how the harmonics line up with each other, the thing the power spectrum lost. This is Tukey's bispectrum from 1953; the paper's contribution is not the idea.
Why a linear subset is enough
The full bispectrum on has a coefficient for every pair : CnonCn(selective=False) keeps the upper triangle, entries. That is where the quadratic cost in the thread comes from. But you do not need all the pairs to pin the signal down. The library's selective forward keeps exactly entries, the index set , and its inversion shows why those suffice. From cn_on_cn.py:
# k = 1,...,n-2: beta_{1,k} = fhat[1] * fhat[k] * conj(fhat[k+1])
beta[:, 2:] = fhat[:, 1:2] * fhat[:, 1 : n - 1] * torch.conj(fhat[:, 2:n])Read it as a chain. gives . then gives . The phase of is the one thing no invariant can know, because it is the shift itself, so the inversion sets it to zero ("Phase of fhat[1] fixed to 0 (absorbed by the character action indeterminacy)", in the code's comment). After that, every has one unknown, , and the recursion
walks up the spectrum. numbers in, the whole spectrum out, up to the shift you gave away. The recursion divides by every up to , which is the "generic signal" condition in the completeness theorem (Mataigne et al., ICML 2024): a signal with a Fourier coefficient that is exactly zero falls outside it, and the code raises instead of producing infinities.
The widget runs those formulas on a 16-sample signal, the library's selective forward and its invert, computed in your browser. Shift the signal and the Fourier needles spin, each at its own rate, while the power-spectrum bars and all 16 bispectrum dials hold still. Switch to the twin, which I built by keeping every and moving the phases: the power spectrum matches the original bar for bar, the waveform is different, and the bispectrum says so. "Rebuild from β" inverts the 16 numbers and draws the waveform it gets back, and it always lands in the same pose whatever shift you set: completeness and invariance at once. One detail the code's docstring is candid about: the recursion recovers the spectrum up to a phase ramp over , "in the complex signal model even if the original signal was real-valued". For a real signal the widget applies one more ramp, , which makes the spectrum conjugate-symmetric again, and what comes out is an integer cyclic shift of the original.
From shifts to other groups
For a non-commutative group the Fourier coefficients are matrices, one per irreducible representation, and the scalar product becomes a Kronecker product with a Clebsch–Gordan change of basis (the paper's Equation 2). The structure is the same: a product of transforms whose group action cancels. The selective idea carries over too. For finite groups, Mataigne et al. (2024) find a linear-size complete subset by a breadth-first search over the group's table of which irreducibles appear in each tensor product. The paper's example: the octahedral group drops "from 576 to 172 scalars". For images on a disk under rotation, Myers Lantow and Miolane (2026) keep one product per disk-harmonic coefficient, instead of , and prove that complete as well.
The library wraps seven of these as torch.nn.Modules named {Group}on{Domain}, with no trainable parameters, the transform tables precomputed as buffers, and the same three methods on each: forward, fourier and invert.
| Module | Group acting on domain | Output | Proven complete? |
|---|---|---|---|
CnonCn | on itself (cyclic shifts) | selective + full | yes, generic signals |
SO2onS1 | rotations of the circle | selective + full | as CnonCn on its samples (it subclasses it) |
TorusOnTorus | , translations of images and grids | selective + full | yes |
DnonDn | dihedral group | selective | yes |
OctaonOcta | chiral octahedral group (24 rotations of a cube) | selective | yes |
SO2onDisk | rotations of the disk | selective | yes |
SO3onS2 | 3D rotations of the sphere | selective + full | conjectured |
What the selective trick saves, in bytes
The thread's size claim is "one 256x256 image = 2.1B entries = 17 GB", against 0.5 MB selective. That is an image on the torus: translations. The full upper triangle is entries, and at 8 bytes per complex64 entry that is 17.2 GB. The selective version keeps one entry per translation, bytes, 0.5 MB. My arithmetic, the post's numbers, the same answer. The paper's Appendix B states the ratio as "32,768× fewer coefficients" at that size, which is rounded down.

On the sphere the saving is much smaller, and that matters for reading the speed numbers. The paper's Table 5: at band limit , the classifier's setting, the augmented selective spherical bispectrum has 380 real entries and the full one 1,124. Three times fewer. The asymptotic win is against , a factor of , not of the pixel count.
The sphere, where the paper adds something
Spherical harmonics play the role of frequencies on . A signal band-limited at degree has one coefficient vector of length per degree, and a rotation multiplies each by its Wigner D-matrix. The power spectrum here is per degree: 16 numbers at , which is the "power spectrum (16 features)" row in the paper's capacity table. The bispectrum couples three degrees through Clebsch–Gordan coefficients (Equation 5), and the full set has entries.
The existing completeness theorem (Kakarala, 2012) needs full-rank matrix coefficients, and on the sphere they are vectors, so it does not apply. The paper's new piece, the augmented selective spherical bispectrum, is built degree by degree so that each new degree is pinned down by the ones below it. At each degree it takes bispectral entries (one per real unknown in ), adds some self-couplings and up to seven "CG-power" scalars , and drops entries that vanish identically on real signals. The test suite checks that the Jacobian of each degree's entries has full rank for . It also has to tell a signal from its mirror image, which is not a rotation of it; the paper shows the first entry that can is , and includes it.
Full rank is local, so it does not prove completeness. The evidence is reconstruction: at , a degree-by-degree Levenberg–Marquardt solver recovered all 32 targets they tried (8 digits in two orientations each, and 16 random band-limited signals) from the 380 numbers alone, invariants matched "to better than ", and "No run found two signals in different orbits with equal invariants." Plain gradient descent from noise recovered 9 of 16 digits and none of the random signals, which the authors put down to the optimizer. Their conclusion is careful and I would keep it that way: "This does not prove completeness. We conjecture that is generically complete."

Spherical MNIST: 95.8% and the latency behind "360x"
The experiment: MNIST digits stereographically projected onto a grid on the sphere, trained upright and tested on randomly rotated digits (the NR/R protocol of Cohen et al., 2018), five seeds. The bispectrum model computes the 380 invariants at , applies to the real and imaginary parts (760 channels, half of them identically zero by parity, which the paper admits it keeps "for simplicity"), and feeds a three-layer MLP. The comparisons are matched in size and run in the same pipeline.


The numbers, from the paper's Section 6.2 and Figure 4:
- Accuracy. Bispectrum + MLP 95.8% on the rotated test. The matched S2CNN with BatchNorm 96.1%, "on par" (). The e3nn tensor-product network 0.25 pp higher, and that gap is significant (). The post's "within 0.3 pp" is the 0.25 rounded.
- Latency. End-to-end, spherical grid in and logits out, float32, batch 16, median on an idle H100: 0.257 ms, 1.02 ms, 93.7 ms. and , which is the abstract's "4×" and "364×". The post's "up to 360x" is that, rounded down.
- Controls. The planar CNN collapses from 99.1% to 13.4% on unseen rotations. The power spectrum, "equally invariant", reaches 77.7%; widening its MLP 48 times to 550K parameters lifts it to 80.1%, below the bispectrum with a 25K-parameter MLP (94.1%). Capacity does not fix a feature that has already lost the phases.
Two qualifications. First, "without any weights" is true of the layer, not of the model: the MLP behind it has 230K parameters against the spherical CNN's 155K. The comparison is fair (the paper calls them matched in size), but the bispectrum model is not the small one. Second, the learned network is more sample-efficient. S2CNN leads at every training-set size below the full set, "by 13.0 pp at ". A fixed invariant plus an MLP has to learn from 760 numbers what a spherical CNN learns from the grid with rotation built into every filter. The paper says this itself in "When not to use the bispectrum", which is a section I wish more papers had.
Where the speed comes from is also worth getting right. The selective layer is fast, but at it is only three times smaller than the full set; what makes the model 364 times faster than the tensor-product network is that it computes the invariant once, with no learned tensor products, and then runs a small dense MLP. The tensor-product network does Clebsch–Gordan products in every layer. The paper's Table 3 makes the per-layer point: SO3onS2 at takes 0.63 ms with autograd (0.20 ms in inference mode, where it replays a CUDA graph) and the full version 53.61 ms. Appendix B adds that at batch 16 the cheap modules are "bound by host-side kernel launches rather than by the GPU", which is why the consumer RTX 4090 is 1.5 to 1.7 times slower than the H100 on most of them and slightly faster on the sphere.
Beyond digits
On finite groups the paper puts the selective bispectrum at the end of -equivariant CNNs in place of max or norm pooling. On PatchCamelyon () it matches every baseline. On OrganMNIST3D (the octahedral group) it beats max pooling on the same backbone by 5.0 pp at full data, 78.54% against 73.56%. Across 46 seed-level comparisons it is "never significantly worse than any baseline". That is a modest, honest result: it is a better pooling layer, not a new state of the art, and its gain should grow with how much the pooling it replaces throws away (max keeps one of values, so more is lost at than at 8).
The same run on an RTX 3090
I ran the library on an RTX 3090 (24 GB, CUDA 13.0, PyTorch 2.11.0, bispectrum 0.5.1 from PyPI, the experiment code at fbda28f). Everything below is one job, about 20 minutes of GPU time, plus a short CPU check of the inversion, and one seed where training is involved. The paper averages five.
Rotated Spherical MNIST, trained upright, seed 42, the paper's tuned settings (bispectrum batch 32 at lr , S2CNN+BN batch 32 at lr , 30 epochs, best-validation checkpoint), through the authors' own train.py:
| Model | Parameters | Upright test | Rotated test | Paper, rotated (5 seeds) | Training time |
|---|---|---|---|---|---|
| Selective bispectrum + MLP | 229,770 | 95.70% | 95.74% | 95.8% | 259 s |
| S2CNN + BatchNorm | 154,750 | 96.99% | 96.11% | 96.1% | 453 s |
| Power spectrum + MLP | 11,466 | 77.87% | 77.90% | 77.7% | 80 s |
| Planar CNN | 184,778 | 99.18% | 13.47% | 13.4% | 147 s |
That reproduces the paper's Figure 4 to within a tenth of a point on every row, including the shape of it: the bispectrum loses nothing between upright and rotated (95.70 against 95.74), the spherical CNN gives up 0.88 points, and the planar CNN falls off a cliff. I did not train the tensor-product network; at the latency below, 30 epochs would have taken hours.
End-to-end latency (the authors' benchmark_smnist_models.py: spherical grid in, logits out, float32 inference, batch 16, median), with the tensor product at the paper's 24 channels:
| Model | RTX 3090 | Paper, H100 |
|---|---|---|
| Selective bispectrum + MLP | 0.669 ms | 0.257 ms |
| S2CNN + BatchNorm | 3.297 ms | 1.02 ms |
| Tensor-product network | 190.146 ms | 93.7 ms |
| Power spectrum + MLP | 5.014 ms | 1.68 ms |
| Planar CNN | 0.523 ms | 0.20 ms |
On the 3090 the bispectrum model is 4.9 times faster than the spherical CNN and 284 times faster than the tensor-product network (my arithmetic: 3.297 / 0.669 and 190.146 / 0.669). So the ordering holds and the gap to e3nn is the same order of magnitude; "360x" is an H100 number. One oddity: the power-spectrum model, which computes less, is seven times slower than the bispectrum model here. Version 0.5.1 wraps the bispectrum modules' forward in a captured CUDA graph (@cuda_graphed in cn_on_cn.py and its siblings), and the power-spectrum baseline is plain PyTorch, so it pays every kernel launch. That is the launch-bound behaviour Appendix B describes, showing up as a ranking.
Per module, at the paper's Table 3 sizes and batch 16. The authors' device script in inference mode gives, in milliseconds: CnonCn 0.061, TorusOnTorus 0.049, DnonDn 0.073, SO2onDisk 0.111, SO3onS2 0.307, OctaonOcta 0.082. All under a millisecond, as claimed, and several are below the H100 row of the README, which was measured on 0.4.x; I would not read a 3090-beats-H100 result into that, only that 0.5.1 graphs more of the work. With autograd on, as in training, my own torch.utils.benchmark timing is slower and still small: 0.536 ms for CnonCn, 1.442 ms for SO3onS2, 2.689 ms for OctaonOcta. The full bispectrum, where the library has one, is where the cost shows: CnonCn at takes 27.551 ms for its 8,256 entries, SO3onS2 at 196.327 ms for 1,341.
Invariance, checked numerically. For each finite group I applied every group element (127 shifts on , 77 translations on a torus, all 63 rotations and reflections of , the 23 non-identity rotations of the octahedral group, the three quarter turns of the disk) and took the largest relative change in the output. In float32 it is at most ; in float64, at most . That is "invariant up to floating-point error", literally. On the sphere, a rotation about the pole is an exact shift of grid columns, and it moves the 380 features by . A random 3D rotation has to resample the grid, and that moves them by up to 2.5%, which is the "few percent, the grid's resampling error" the post's code example warns about: the invariance is exact, the rotated input is not.
The power-spectrum collision. On a 128-sample random signal I kept every and replaced the phases with random ones. The two power spectra agree to relative; the selective bispectra differ by 0.85 relative. The widget above, at full size.
The inversion. I fed the library's own CnonCn.invert four random signals each at and , in float64 on CPU. Undoing the phase ramp gives back the original spectrum to relative at and at . Applying the widget's extra ramp and searching the cyclic shifts, the rebuilt real signal matches the original to and absolute. Completeness on the cyclic group is not a statistical claim; this is just the recursion, run.
Sizes. TorusOnTorus(ns=(256, 256)) returns 65,536 complex64 entries for one image, 524,288 bytes, and the full count is 2,147,516,416 entries, 17,180,131,328 bytes by the formula; I did not try to allocate that. The full bispectrum at , which the library does compute, has 8,390,656 entries, the paper's number for that size, and takes 67 MB.
A pooling layer I would try first
The library is the contribution, and it is a good one. The bispectrum has been around for seventy years and keeps getting re-implemented, one group and one codebase at a time; seven groups behind one tested interface, sub-millisecond, with invert where it exists, is what makes it something you try in an afternoon instead of a reimplementation project. The sphere result is the scientific novelty, and it is stated as a conjecture with reconstruction evidence, which is the right status for it.
Would I use it? For a pipeline where the symmetry is known and exact (signals on a ring, rotations of a sphere, the 24 rotations of a voxel grid) and the network is small, yes: it is a free, complete invariant, and the widget above is the whole argument for preferring it to a power spectrum. For a problem where the symmetry is approximate, or where data is scarce, the paper's own data-efficiency curve says a learned equivariant network still wins. And on a band-limited sphere at , remember that "selective" buys you a factor of three in size; the 360× is about skipping learned tensor products, not about the selection.