Pole-safe rational neural layer / README.md
Beats tuned baseline
Pole-safe rational neural layer MVP
pole_safe_experiment.py implements the guaranteed maximal-order construction for an order-two pole:
psi(z, x) = (z - beta)^2 * h_theta(x) / (||h_theta(x)|| + eps)
and evaluates
Q(z) psi(z,x), where Q(z) = Q_-2/(z-beta)^2 + Q_-1/(z-beta) + Q_0.
It compares the pole-safe branch with an unconstrained branch and an unconstrained branch using gradient clipping. All branches use the same 1,344-parameter MLP, data, optimizer, and number of steps.
Run:
/home/maxwelhelp/main/bin/python3 pole_safe_experiment.py
The run writes results.json and prints the same JSON. CUDA is used when available and falls back to CPU on CUDA runtime failure.
Observed result
The direct math check gave an unsafe log-log growth slope of approximately -2.0, as expected for the order-two pole, and a safe slope approximately 0.0. At distance 1e-5 from the pole, the unsafe norm was about 9.9e7 times its value at distance 1e-1, while the safe norm changed by only about 0.7%; the safe product's error from Q_-2 v was 1.2e-5.
In the toy regression, validation MSE was approximately:
- unconstrained:
7.996e11 - unconstrained + gradient clipping:
1.337e11 - pole-safe:
2.27e-2
Maximum output norms were approximately 1.84e7, 2.05e7, and 1.49, respectively. Thus the claimed boundedness/stability phenomenon and a strong synthetic optimization signal were observed.
This does not establish a result on a real SSM or sequence benchmark. The operator, pole, and data are synthetic; only one fixed seed and one order-two pole were tested, and the safe parameterization changes the effective feature dependence on frequency by design.