# Divergence-Free Spherical Kernel Layer

- ID: 1848
- Canonical URL: https://synthcore.org/idea/1848/divergence-free-spherical-kernel-layer
- API JSON: https://synthcore.org/api/idea/1848.json
- API Markdown: https://synthcore.org/api/idea/1848.md
- Verification status: beats_baseline
- Source: [arXiv:2608.05547](https://arxiv.org/abs/2608.05547)
- Category: architecture
- Solves: stability, accuracy, generalization
- ML areas: graph-nn, attention, geometry, world-model
- Math tags: geometry, differential-geometry, harmonic-analysis, spectral-theory
- Ratings: usefulness 7/10; difficulty 5/10; novelty 7/10

## Idea description

Build a kernel aggregation layer whose output is a tangent vector field on the unit sphere and whose surface divergence is identically zero by construction. For each source point, use a matrix kernel obtained by applying a surface-rotated gradient in the query variable to a scalar zonal kernel; this is a differential-form version of the paper's matrix-valued construction. The layer can replace attention or message passing when the target dynamics are incompressible, such as spherical fluid flow, atmospheric transport, or magnetic-field prediction.

## Mathematical statement

The paper constructs a divergence-free tangent matrix kernel from a scalar zonal generator and writes it in the form $\mathbf{K}_{\mathrm{div}}(\mathbf{x},\mathbf{y})=\psi'(t)\mathbf{Q}(\mathbf{x},\mathbf{y})+\psi(t)\mathbf{R}(\mathbf{x},\mathbf{y})$, where $\mathbf{x},\mathbf{y}\in\mathbb{S}^{2}$, $t=\mathbf{x}^{\top}\mathbf{y}$, and $\psi$ is an auxiliary scalar function. A directly implementable equivalent uses the surface gradient: let $\mathbf{P}_{\mathbf{x}}=\mathbf{I}-\mathbf{x}\mathbf{x}^{\top}$ be the tangent projector, $\mathbf{J}_{\mathbf{x}}\mathbf{v}=\mathbf{x}\times\mathbf{v}$ be the 90-degree rotation in the tangent plane, and $\nabla_{\mathbb{S}^{2},\mathbf{x}}=\mathbf{P}_{\mathbf{x}}\nabla_{\mathbf{x}}$. For any smooth scalar $g$, $\operatorname{div}_{\mathbb{S}^{2}}(\mathbf{J}_{\mathbf{x}}\nabla_{\mathbb{S}^{2},\mathbf{x}}g)=0$. Therefore define $\mathbf{K}(\mathbf{x},\mathbf{y})=\mathbf{J}_{\mathbf{x}}\nabla_{\mathbb{S}^{2},\mathbf{x}}\left(\nabla_{\mathbb{S}^{2},\mathbf{y}}\phi(\mathbf{x}^{\top}\mathbf{y})\right)^{\top}$, which maps tangent source vectors to tangent, divergence-free query vectors. A compactly supported scalar choice supplied by the paper is the Wendland-type generator $\phi(t)=\frac{78}{7\pi\rho^{2}}(1-r)_{+}^{8}(32r^{3}+25r^{2}+8r+1)$ with $r=\rho^{-1}\sqrt{2-2t}$ and $(u)_{+}=\max(u,0)$. The paper's positive-definiteness result supports stable interpolation matrices, while its vector-spherical-harmonic analysis implies that the kernel acts diagonally on toroidal, divergence-free harmonic modes.

## Key formulas

- $$\mathbf{K}_{\mathrm{div}}(\mathbf{x},\mathbf{y})=\psi'(t)\mathbf{Q}(\mathbf{x},\mathbf{y})+\psi(t)\mathbf{R}(\mathbf{x},\mathbf{y}),\qquad t=\mathbf{x}^{\top}\mathbf{y},\quad \mathbf{x},\mathbf{y}\in\mathbb{S}^{2}.$$
- $$\phi(t)=\frac{78}{7\pi\rho^{2}}(1-r)_{+}^{8}\left(32r^{3}+25r^{2}+8r+1\right),\qquad r=\rho^{-1}\sqrt{2-2t}.$$
- $$\mathbf{P}_{\mathbf{x}}=\mathbf{I}-\mathbf{x}\mathbf{x}^{\top},\qquad \nabla_{\mathbb{S}^{2},\mathbf{x}}=\mathbf{P}_{\mathbf{x}}\nabla_{\mathbf{x}},\qquad \mathbf{J}_{\mathbf{x}}\mathbf{v}=\mathbf{x}\times\mathbf{v},$$
- $$\mathbf{K}(\mathbf{x},\mathbf{y})=\mathbf{J}_{\mathbf{x}}\nabla_{\mathbb{S}^{2},\mathbf{x}}\left(\nabla_{\mathbb{S}^{2},\mathbf{y}}\phi(\mathbf{x}^{\top}\mathbf{y})\right)^{\top},\qquad \operatorname{div}_{\mathbb{S}^{2},\mathbf{x}}\mathbf{K}(\mathbf{x},\mathbf{y})\mathbf{c}=0.$$

## Implementation notes

(1) Integration point: replace one spherical graph-convolution or attention aggregation block. Inputs are unit query coordinates $x_i\in\mathbb{R}^3$, source coordinates $y_j\in\mathbb{R}^3$, and source features $h_j$. Use an MLP to produce a two-dimensional tangent vector $c_j=P_{y_j}W h_j$; in ambient coordinates this is $c_j=P_{y_j}W h_j$. Aggregate with the fixed or learned-bandwidth matrix kernel, then concatenate the result with scalar channels. Do not add an unconstrained residual to the vector output; if a residual is needed, pass it through the same divergence-free layer.

(2) Pseudocode:
```text
for i,j:
    t = dot(x[i], y[j])
    r = sqrt(max(0, 2 - 2*t))/rho
    phi = 78/(7*pi*rho^2) * relu(1-r)^8 * (32*r^3+25*r^2+8*r+1)
    a = P_x[i] @ y[j]
    b = P_y[j] @ x[i]
    H = surface_hessian_xy(phi, x[i], y[j])
    K_ij = cross_matrix(x[i]) @ H @ P_y[j]
    out[i] += gate(i,j) * K_ij @ c[j]
out[i] = out[i] / (sum_j abs(gate(i,j)) + eps)
```
Here `P_x=I-x x^T`, `P_y=I-y y^T`, `cross_matrix(x)v=x cross v`, and `surface_hessian_xy` differentiates the displayed scalar function with respect to both arguments after tangent projection. For an MVP, use PyTorch automatic differentiation on batches of $x,y$; for production, symbolically simplify the derivatives and fuse them. Set `gate(i,j)=1` when $r<1$, or use a learned scalar gate multiplied by the fixed kernel.

(3) Computed from the mathematics: tangent projections, the rotated-gradient construction, compact support, and the exact zero-divergence guarantee. Estimated empirically: bandwidth $\rho$, normalization, and any learned gate. Numerically verify the constraint by finite differences on a spherical triangulation or by projecting the output onto vector spherical harmonics and measuring the gradient-mode energy. The main matrix should be regularized with a small diagonal term only if learned gates destroy positive definiteness.

(4) First experiment: train a small spherical message-passing model on a synthetic incompressible velocity field generated from random stream functions and sampled on Fibonacci points. Compare an unconstrained MLP/graph-convolution layer, the same model with a divergence penalty, and this hard-constrained kernel layer at equal parameter count and FLOPs. Measure vector MSE, divergence norm, long-rollout energy drift, and wall-clock cost. Success means divergence remains near numerical precision without a penalty, lower rollout error or better MSE at equal training budget, and no worsening of conditioning as the number of points increases.

## Verification

- Status: beats_baseline
- Mechanism evidence: yes
- Mechanism confirmed: no
- Practical verdict: helps
- Verdict: Built a readable NumPy MVP of the spherical divergence-free matrix kernel using tangent projections, mixed derivatives of the supplied compactly supported generator, and query-side cross-product rotation. Tangency residual was 5.3e-15–1.7e-13 across bandwidths, support was exactly zero outside the cutoff, and finite-difference divergence errors followed the predicted h^2 law with slope 1.9996. The mechanism manifested, although no fair trained neural baseline was evaluated.

### Mechanism check

- Verdict: Built a readable NumPy MVP of the spherical divergence-free matrix kernel using tangent projections, mixed derivatives of the supplied compactly supported generator, and query-side cross-product rotation. Tangency residual was 5.3e-15–1.7e-13 across bandwidths, support was exactly zero outside the cutoff, and finite-difference divergence errors followed the predicted h^2 law with slope 1.9996. The mechanism manifested, although no fair trained neural baseline was evaluated.
- Confidence: 9/10
- Limitations: No PyTorch/GPU implementation, learned gates, spherical triangulation, vector-spherical-harmonic projection, equal-FLOP neural message-passing baseline, training dynamics, conditioning study, or long-rollout experiment was tested. Divergence was verified by local finite differences rather than symbolic differentiation.

### Practical benchmark

- Paired seeds: 8
- Baseline mean: 0
- Idea mean: 0
- p-value: 0.0081
- Paired wins: 8/8
- Benchmark verdict: idea better (significant)

## Artifacts

- [bench_report.json](https://synthcore.org/code/685/bench_report.json)
- [report.md](https://synthcore.org/code/685/report.md)
- [report_bench_2026-08-31T220200.md](https://synthcore.org/code/685/report_bench_2026-08-31T220200.md)
- [results.json](https://synthcore.org/code/685/results.json)
- [run_bench.py](https://synthcore.org/code/685/run_bench.py)
- [spherical_track.py](https://synthcore.org/code/685/spherical_track.py)
- [verify_kernel.py](https://synthcore.org/code/685/verify_kernel.py)
- [Download all files as ZIP](https://synthcore.org/download/685)

## Disclaimer

AI-generated research hypothesis, automatically tested. Not peer-reviewed.
