On this page
Prime Euler Activations and ZetaDrop
Core Idea#
The Multiplicative PINN framework applies an arithmetic gate at the loss level:
where measures constraint violation and rescales the optimization landscape. This preserves the main data-gradient direction while adding a structured correction through
The same mechanism can be moved inside the network.
Instead of applying the arithmetic gate only to the final loss, we can apply it to activations, channels, attention heads, LoRA ranks, or experts:
The conceptual mutation is:
The resulting object is a Prime Euler activation: a neural nonlinearity whose response is modulated by a finite Euler product.
Prime Euler Gated Activation#
Let be a finite set of primes. Define a positive spectral coordinate
The Euler gate is
A direct Prime Euler activation is
A smoother practical version uses SiLU as the base activation:
and gates it:
Here PESiLU means Prime Euler Gated SiLU.
The softplus is important because the Euler product naturally wants a nonnegative coordinate:
Thus the activation does not merely ask whether , as ReLU does. It asks which arithmetic spectral coordinate the activation occupies.
Residual PESiLU#
The raw Euler product satisfies
because each factor becomes . For activations, this can over-suppress gradients. A safer version keeps the base activation alive and uses the Euler gate only as a modulation:
This gives:
In practice this is the first version to benchmark, because it preserves the stability of SiLU while injecting a controlled arithmetic response.
Constraint-Aware Activation Gate#
The activation gate can depend on a local constraint score rather than directly on .
Let
measure local violation, salience, uncertainty, curvature, or physics inconsistency. Examples include:
for smoothness,
for positivity,
for incompressibility, or a learned score
Then define
with
This moves the Multiplicative PINN mechanism from global loss space into local representation space. The network does not wait for the final loss to punish constraint violations; it routes information differently through layers depending on constraint compatibility.
Prime-Indexed Sparse Parameters#
The same gate can induce structured sparsity.
Assign each neuron, channel, attention head, LoRA rank, or expert a prime:
Then gate parameter block by
so the effective parameter is
For small ,
and therefore
This means prime-indexed blocks open at rates controlled by .
There is also an attenuation form:
This gives the opposite sparsity regime:
The opening form gives:
Together these define arithmetic structured sparsity:
ZetaDrop#
ZetaDrop is the dropout-like version of the idea.
Ordinary dropout randomly suppresses units. ZetaDrop suppresses channels according to an Euler-product arithmetic prior:
This is not random sparsity. It is spectral sparsity.
A channel with a small prime index remains active longer:
Thus the network receives a deterministic hierarchy:
Low-complexity inputs can use the small-prime core. Harder or higher-violation inputs can activate larger-prime refiners.
Prime Mixture of Experts#
A practical MoE version assigns each expert a prime . Define
or normalized weights
Then
Small-prime experts provide coarse correction. Larger-prime experts become fine-correction experts. This is MoE-style conditional computation, but with a deterministic arithmetic prior instead of a fully learned softmax router.
Spectral Gradient Engine#
The mathematical reason the gate is not an arbitrary nonlinearity is its log-gradient.
For
we have
Expanding the denominator gives
This is a finite-prime analogue of
So each gated neuron or parameter block receives a gradient correction shaped like a truncated prime-power spectrum.
Normal activations have simple response curves:
Prime Euler activations add a new layer:
Arithmetic Feature Grammar#
Prime-indexed parameters also suggest a factorization grammar for neural features.
Atomic channels are assigned primes:
Composite interactions are represented by products:
Prime powers represent repeated self-interactions:
This mirrors the logarithmic derivative of the Euler product:
The architectural claim is that a network can separate atomic features, pairwise composites, and higher-order interactions using the arithmetic topology of primes and composites.
Practical Design#
A concrete layer-level design is
Add a budget penalty:
or
This makes high-prime parameter blocks more expensive. The model learns to use small-prime blocks unless large-prime blocks are necessary.
In this sense the prime hierarchy acts as an arithmetic Occam prior:
PyTorch Sketch#
import torch
import torch.nn as nn
import torch.nn.functional as F
class PrimeEulerGate(nn.Module):
def __init__(self, primes=(2, 3, 5, 7, 11), tau=3.0, eps=1e-6, max_val=1e6):
super().__init__()
self.register_buffer(
"log_primes",
torch.log(torch.tensor(primes, dtype=torch.float32)),
)
self.tau = tau
self.eps = eps
self.max_val = max_val
def forward(self, z):
v = F.softplus(z)
terms = 1.0 - torch.exp(-self.tau * v.unsqueeze(-1) * self.log_primes)
gate = torch.prod(terms, dim=-1)
return torch.clamp(gate, self.eps, self.max_val)
class PESiLU(nn.Module):
def __init__(self, primes=(2, 3, 5, 7, 11), tau=3.0):
super().__init__()
self.gate = PrimeEulerGate(primes=primes, tau=tau)
def forward(self, z):
return F.silu(z) * self.gate(z)
class ResidualPESiLU(nn.Module):
def __init__(self, primes=(2, 3, 5, 7, 11), tau=3.0, alpha=0.1):
super().__init__()
self.gate = PrimeEulerGate(primes=primes, tau=tau)
self.alpha = nn.Parameter(torch.tensor(float(alpha)))
def forward(self, z):
return F.silu(z) * (1.0 + self.alpha * self.gate(z))
The first experiment should compare ReLU, GELU, SiLU, PESiLU, and ResidualPESiLU on:
- PINN toy PDEs.
- Monotonic regression.
- Classification calibration.
- Sparse feature routing.
- Mixture-of-experts routing.
Claim#
Prime Euler gated activations introduce a multiplicative spectral modulation whose log-gradient is a finite von Mangoldt expansion. This creates hierarchical activation sensitivity while preserving a stable base nonlinearity.
In one line:
ZetaDrop is the sparsity version:
See Also#
- Multiplicative PINN — the loss-level Euler gate that this concept extends into activations
- Prime Weighting — the foundational prime-weighting mechanism
- STOP Operators as Resolution Flows — the observer-theoretic justification for arithmetic gating
- Partition Function — the broader free-energy object this activation structure lives inside
- The Arithmetic Manifold — the unified theory