BurnyCoder commited on
Commit
c9a41de
·
verified ·
1 Parent(s): 5c11fee

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -39,3 +39,4 @@ reports/paper/figures/fig3_mechanistic_comparators.png filter=lfs diff=lfs merge
39
  reports/paper/figures/fig4_output_examples.png filter=lfs diff=lfs merge=lfs -text
40
  reports/paper/figures/fig5_zeroshot_and_scale_cliff.png filter=lfs diff=lfs merge=lfs -text
41
  reports/paper/figures/fig6_ablations_and_training.png filter=lfs diff=lfs merge=lfs -text
 
 
39
  reports/paper/figures/fig4_output_examples.png filter=lfs diff=lfs merge=lfs -text
40
  reports/paper/figures/fig5_zeroshot_and_scale_cliff.png filter=lfs diff=lfs merge=lfs -text
41
  reports/paper/figures/fig6_ablations_and_training.png filter=lfs diff=lfs merge=lfs -text
42
+ reports/paper.pdf filter=lfs diff=lfs merge=lfs -text
reports/experiments/experiments.md CHANGED
@@ -24,4 +24,4 @@
24
  | `stage-4b-pnn-ladder-and-scaling` | 4B | `PolyPairwiseRank`, `LearnedWire`, `DeepSetsPoly`, `PiNet`, `PolyMLP`, $n=4..128$ | **Done** | Full pure-PNN ladder complete: `polysort_adaptive_m2` reaches `82.0%` Ex@0.05 at $n=16$ vs `0.7%` (`DeepSetsPoly`) and `0.0%` (`PiNet`/`PolyMLP`/`Pairwise`); stage-adaptive gain grows monotonically `-6.2% -> -31.5%` from $n=4 \to 32$. |
25
  | `stage-4c-baselines-and-controls` | 4C | `ShuffledTarget`, `DiffSort` (Logistic/Cauchy), `ReLU-MLP`, `SetTransformer` | **Done** | Zero leakage verified (`ShuffledTarget` MAE `0.21–0.28`); `PolySortNet-m2` beats `ReLU-MLP` by $6.5\times$ ($n=16$) and beats 96.6k-param `SetTransformer` on Shift $+100$ ($12{,}500\times$), Zero-Shot $n=128$ ($2.65\times$), and Near-Ties $10^{-3}$; `DiffSort` leads ID & Scale $5\times$ via transcendental $\exp/\arctan$. |
26
  | `stage-4d-ablations` | 4D | 6 Causal Ablation Families (A1–A6, 30 runs) | **Done** | **2 honest falsifications + 4 causal proofs:** Unconstrained odd poly cuts MAE 26–30% (`0.0234/0.0273`) via late-stage domain contraction (`s_5(1)=-444..-1038`) at cost of `R_stab: 1.3->1.1` (H6.1 falsified); flat deg-9 beats `L=2,d=3` at iso-deg (H3.1 falsified), while iso-param **`L=4,d=3` (deg 81) crushes flat deg-9 by $4.28\times$** (`0.0132/0.0163`, `Ex@0.05=91.8%/61.4%`) & widens `R_stab=1.50`! Random wiring fails (`0.00%` Mono); Batcher Odd-Even Merge beats Bitonic; A6 max-abs norm proves scale cliff (`R_stab=5.0`) while breaking Shift $+100$ (`0.455`). |
27
- | `stage-4e-multiseed-and-sensitivity` | 4E | 5-Seed Statistical Rigor (80 new runs, 100 core cells) + Hyperparam/Batch/Float64 Sweeps (15 runs) | **In Progress** | — |
 
24
  | `stage-4b-pnn-ladder-and-scaling` | 4B | `PolyPairwiseRank`, `LearnedWire`, `DeepSetsPoly`, `PiNet`, `PolyMLP`, $n=4..128$ | **Done** | Full pure-PNN ladder complete: `polysort_adaptive_m2` reaches `82.0%` Ex@0.05 at $n=16$ vs `0.7%` (`DeepSetsPoly`) and `0.0%` (`PiNet`/`PolyMLP`/`Pairwise`); stage-adaptive gain grows monotonically `-6.2% -> -31.5%` from $n=4 \to 32$. |
25
  | `stage-4c-baselines-and-controls` | 4C | `ShuffledTarget`, `DiffSort` (Logistic/Cauchy), `ReLU-MLP`, `SetTransformer` | **Done** | Zero leakage verified (`ShuffledTarget` MAE `0.21–0.28`); `PolySortNet-m2` beats `ReLU-MLP` by $6.5\times$ ($n=16$) and beats 96.6k-param `SetTransformer` on Shift $+100$ ($12{,}500\times$), Zero-Shot $n=128$ ($2.65\times$), and Near-Ties $10^{-3}$; `DiffSort` leads ID & Scale $5\times$ via transcendental $\exp/\arctan$. |
26
  | `stage-4d-ablations` | 4D | 6 Causal Ablation Families (A1–A6, 30 runs) | **Done** | **2 honest falsifications + 4 causal proofs:** Unconstrained odd poly cuts MAE 26–30% (`0.0234/0.0273`) via late-stage domain contraction (`s_5(1)=-444..-1038`) at cost of `R_stab: 1.3->1.1` (H6.1 falsified); flat deg-9 beats `L=2,d=3` at iso-deg (H3.1 falsified), while iso-param **`L=4,d=3` (deg 81) crushes flat deg-9 by $4.28\times$** (`0.0132/0.0163`, `Ex@0.05=91.8%/61.4%`) & widens `R_stab=1.50`! Random wiring fails (`0.00%` Mono); Batcher Odd-Even Merge beats Bitonic; A6 max-abs norm proves scale cliff (`R_stab=5.0`) while breaking Shift $+100$ (`0.455`). |
27
+ | `stage-4e-multiseed-and-sensitivity` | 4E | 5-Seed Statistical Rigor (80 new runs, 100 core cells) + Hyperparam/Batch/Float64 Sweeps (15 runs) | **Done** | **178/178 runs complete!** `float64` matches `float32` to 6 decimals even at deg 81; `PolySortNet-Adaptive m=2` achieves `0.00724±0.00000` ($n=8$) / `0.00981±0.00008` ($n=16$) across 5 seeds ($9{,}078\times$ lower seed SD than `PiNet`), beats `ReLU-MLP` $4.9\times/6.5\times$ and `DeepSets-Poly` $4.6\times/4.2\times$ ($p_{\text{holm}}<10^{-300}$, 5/5 seeds), and beats 96.6k-param `SetTransformer` on 5-seed Near-Ties $10^{-3}$, 50% Duplicates, Zero-Shot $n=128$, and Shift $+100$! |
reports/experiments/learnings.md CHANGED
@@ -70,3 +70,14 @@ This living log documents every key insight gained from the literature review, m
70
 
71
  12. **Topology-Dependent Reversal Asymmetry (A4):**
72
  - Batcher Odd-Even Merge improves MAE by 10–13% over Bitonic and preserves exact sorted/reversed symmetry (`EdgeS == EdgeR`), while Habermann Odd-Even Transposition achieves the highest monotonicity (`99.30% / 96.77%`) at the cost of $2.74\times$ higher error on reversed inputs at $n=16$ (`0.1349` vs `0.0493`).
 
 
 
 
 
 
 
 
 
 
 
 
70
 
71
  12. **Topology-Dependent Reversal Asymmetry (A4):**
72
  - Batcher Odd-Even Merge improves MAE by 10–13% over Bitonic and preserves exact sorted/reversed symmetry (`EdgeS == EdgeR`), while Habermann Odd-Even Transposition achieves the highest monotonicity (`99.30% / 96.77%`) at the cost of $2.74\times$ higher error on reversed inputs at $n=16$ (`0.1349` vs `0.0493`).
73
+
74
+ ---
75
+
76
+ ## Learnings from Stage 4E (Sensitivity Sweeps & 5-Seed Statistical Rigor)
77
+
78
+ 13. **Zero `float32` Optimization Drift Even at Degree 81:**
79
+ - Full `float64` training matched `float32` to 6 decimal places on both $L=3$ (`0.033254`) and $L=4$ (`0.013222`), confirming fixed-point odd Chebyshev bounds protect single-precision gradients.
80
+ 14. **Four Orders of Magnitude Lower Seed Variance & Fair Baseline LR Audit:**
81
+ - Across 5 seeds (`42, 123, 456, 789, 1024`), 36-param `PolySortNet-Adaptive (m=2)` exhibits seed SD `5.8e-7` (`n=8`) vs `5.2e-3` (`PiNet`) and `2.9e-3` (`PolyMLP`). Baseline LR tuning lifted `PiNet` from `0.0529 -> 0.0423` at `lr=0.01` (reported honestly; still $5.85\times$ behind `PolySortNet-Adaptive m=2`).
82
+ 15. **Mechanistic Bitonic Stride-Reset Rediscovery (Visual Audit of Fig. 3C):**
83
+ - Visually inspecting our stage-adaptive slope plot revealed that gradient descent autonomously drops comparator origin slope $s'(0)$ at every fresh long-stride Bitonic merge boundary (Stage 3 for $n=8$; Stages 1, 3, 6 for $n=16$) and ramps slope monotonically as stride halves `8 -> 4 -> 2 -> 1`.
reports/experiments/stage-4e-multiseed-and-sensitivity/experiment.md ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Experiment Stage 4E: Sensitivity Sweeps & 5-Seed Statistical Rigor (Final Experimental Stage)
2
+
3
+ **Author:** Libor "Burny" Burian
4
+ **Date:** 2026-11-25
5
+ **Runs Covered:** 95 new runs (**15** hyperparameter / batch-size / `float64` sensitivity runs + **80** multi-seed replication runs across seeds `123, 456, 789, 1024`), combined with seed `42` from Stages 4A–4C to form **100 core 5-seed cells** (`10 models × 2 lengths × 5 seeds`) and **178 / 178 total preregistered runs**.
6
+ **Execution Order Note:** Executed strictly as the **very last experimental stage** after all main models, baselines, controls, and causal ablations finished.
7
+
8
+ ---
9
+
10
+ ## 1. Plain-Language Summary
11
+
12
+ Before making final scientific claims, we subjected our entire experiment suite to two rigorous stress tests:
13
+ 1. **Hyperparameter, Batch-Size, and Precision Audit (`4e_sens`, 15 runs):** We checked whether our findings were artifacts of learning rate, weight decay, GPU batch size (`4096` vs `512`), or `float32` roundoff. **Result:** Training in `float64` matched `float32` to **6 decimal places** even at degree 81 (`L=4`), weight decay had zero effect (`< 4e-6`), and `bs=4096` was actually *slightly conservative* against `PolySortNet`. Crucially, tuning `PiNet-NCP-Skip` up to `lr=0.01` improved its $n=8$ MAE from `0.0529 -> 0.0423` — an important fairness catch that we report openly, though it still trails 36-parameter `PolySortNet-Adaptive (m=2)` (`0.00724`) by **$5.85\times$**.
14
+ 2. **5-Seed Statistical Replication (`4e_seeds`, 80 new runs / 100 core cells):** Every primary comparison was repeated across 5 independent random seeds (`42, 123, 456, 789, 1024`) and tested with paired Wilcoxon signed-rank tests (50,000 pooled paired lists per comparison), 10,000-resample bootstrap 95% CIs, and Holm-Bonferroni multiple-testing control. **Result:** Structured `PolySortNet` models exhibit **orders-of-magnitude lower seed variance** (`SD = 5.8e-7` for `Adaptive m=2` at $n=8$, vs `5.2e-3` for `PiNet` and `2.9e-3` for `PolyMLP`), and **100% of our 5-seed directional rankings hold across all 5/5 seeds** (except the honest cubic $m=1$ vs `DeepSets-Poly` near-tie at $n=8$, where `DeepSets-Poly` wins 4/5 seeds by `0.00028` MAE!).
15
+
16
+ ---
17
+
18
+ ## 2. Part I: Hyperparameter, Batch-Size & `float64` Sensitivity Sweep (`n=8`, Seed 42)
19
+
20
+ | Sweep Axis | Run ID | Setting | ID MAE ($\downarrow$) | ID RMSE ($\downarrow$) | Mono% ($\uparrow$) | Ex@0.05% ($\uparrow$) | Kendall $\tau$ ($\uparrow$) | $R_{\text{stable}}$ | Train Time (s) |
21
+ | :--- | :--- | :--- | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
22
+ | **PolySort LR** | `sens_polysort_lr_0.0003` | `lr=3e-4` | `0.057026` | `0.070598` | `91.80%` | `0.65%` | `0.99128` | `0.00` | `84.5` |
23
+ | **PolySort LR** | `sens_polysort_lr_0.001` | `lr=1e-3` | `0.038448` | `0.048371` | `87.27%` | `9.51%` | `0.98839` | `1.30` | `71.5` |
24
+ | **PolySort LR** | `sens_polysort_lr_0.003` | `lr=3e-3` | `0.033753` | `0.042550` | `93.77%` | `16.11%` | `0.99461` | `1.30` | `72.6` |
25
+ | **PolySort LR** | `main_polysort_adaptive` (ref) | `lr=8e-3` | `0.033254` | `0.041907` | `94.09%` | `16.38%` | `0.99494` | `1.30` | `66.1` |
26
+ | **PolySort LR** | `sens_polysort_lr_0.01` | `lr=1e-2` | **`0.033236`** | `0.041891` | `94.14%` | `16.60%` | `0.99497` | `1.30` | `73.6` |
27
+ | **PiNet LR** | `sens_pinet_lr_0.0003` | `lr=3e-4` | `0.077068` | `0.099430` | `95.33%` | `0.38%` | `0.99486` | `0.00` | `69.1` |
28
+ | **PiNet LR** | `sens_pinet_lr_0.001` | `lr=1e-3` | `0.074510` | `0.096460` | `96.65%` | `0.50%` | `0.99629` | `0.00` | `70.1` |
29
+ | **PiNet LR** | `sens_pinet_lr_0.003` | `lr=3e-3` | `0.051979` | `0.068675` | `93.38%` | `3.25%` | `0.99346` | `0.00` | `67.2` |
30
+ | **PiNet LR** | `sens_pinet_lr_0.01` | `lr=1e-2` | **`0.042324`** | `0.056386` | `90.60%` | **`7.73%`** | `0.99081` | **`1.10`** | `71.5` |
31
+ | **Weight Decay** | `sens_polysort_wd_0` | `wd=0.0` | `0.033254` | `0.041907` | `94.09%` | `16.38%` | `0.99494` | `1.30` | `70.4` |
32
+ | **Weight Decay** | `sens_polysort_wd_0.01` | `wd=1e-2` | `0.033258` | `0.041914` | `94.02%` | `16.37%` | `0.99486` | `1.30` | `69.2` |
33
+ | **Batch Size** | `sens_polysort_bs_512` | `bs=512, 40ep` | **`0.031651`** | `0.039713` | `94.29%` | `20.84%` | `0.99507` | `1.20` | `440.3` |
34
+ | **Batch Size** | `sens_polysort_bs_2048` | `bs=2048, 40ep` | `0.033208` | `0.041887` | `94.08%` | `16.69%` | `0.99491` | `1.30` | `107.7` |
35
+ | **Batch Size** | `sens_polysort_bs_4096` | `bs=4096, 40ep` | `0.033272` | `0.041929` | `94.05%` | `16.39%` | `0.99487` | `1.30` | `50.6` |
36
+ | **Float64 Train** | `sens_polysort_L3_f64` | `L=3, float64` | **`0.033254`** | `0.041907` | `94.09%` | `16.38%` | `0.99494` | `1.30` | `62.8` |
37
+ | **Float64 Train** | `sens_polysort_L4_f64` | `L=4, float64` | **`0.013222`** | `0.017113` | `96.22%` | `91.80%` | `0.99691` | `1.50` | `75.1` |
38
+
39
+ ---
40
+
41
+ ## 3. Part II: 5-Seed Statistical Replication Tables (`5 seeds × 10,000 lists = 50,000` Evaluations/Model)
42
+
43
+ ### 3.1 List Length $n = 8$ (5 Seeds: `42, 123, 456, 789, 1024`)
44
+
45
+ | Model | Pure Poly? | Params | Test MAE (Mean $\pm$ SD) | 95% Boot CI | Mono% | Ex@0.05% | Kendall $\tau$ | Shift $+100$ | Near-Ties $10^{-3}$ | Dup 50% | $R_{\text{stable}}$ |
46
+ | :--- | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
47
+ | `SetTransformer` (non-poly) | No | 96,577 | `0.00218 ± 0.00022` | `[0.00217, 0.00219]` | `99.92%` | `99.9%` | `0.9999` | `99.502` | `0.00665` | `0.00737` | `1.50` |
48
+ | `DiffSort-Cauchy` (non-poly) | No | 1 | `0.00306 ± 0.00000` | `[0.00306, 0.00307]` | `100.0%` | `100.0%` | `1.0000` | `0.00307` | `0.00275` | `0.00277` | `5.00` |
49
+ | **`PolySortNet-Adaptive (m=2)`** | **Yes** | **36** | **`0.00724 ± 0.00000`** | **`[0.00722, 0.00727]`** | **`95.86%`** | **`95.9%`** | **`0.9966`** | **`0.00726`** | **`0.00659`** | **`0.00660`** | `1.00` |
50
+ | `DeepSets-Poly` | Yes | 130,920 | `0.03300 ± 0.00069` | `[0.03288, 0.03312]` | `94.33%` | `21.6%` | `0.9952` | `inf` | `0.06327` | `0.07464` | `1.05` |
51
+ | **`PolySortNet-Adaptive (m=1)`** | **Yes** | **18** | `0.03327 ± 0.00002` | `[0.03318, 0.03337]` | `94.10%` | `16.3%` | `0.9949` | **`0.03344`** | `0.03268` | `0.03240` | **`1.30`** |
52
+ | `ReLU/GELU-MLP` (non-poly) | No | 35,208 | `0.03549 ± 0.00122` | `[0.03538, 0.03560]` | `90.90%` | `15.2%` | `0.9928` | `27.482` | `0.06418` | `0.06564` | `1.42` |
53
+ | **`PolySortNet-Shared (m=1)`** | **Yes** | **3** | `0.03776 ± 0.00000` | `[0.03766, 0.03787]` | `90.03%` | `9.8%` | `0.9898` | **`0.03770`** | `0.03513` | `0.03464` | **`1.30`** |
54
+ | `PolyPairwiseRank` (Mazzone) | Yes | 12 | `0.04232 ± 0.00038` | `[0.04206, 0.04259]` | `66.50%` | `13.6%` | `0.9629` | `9.934` | `0.05729` | `0.05847` | `1.01` |
55
+ | `PiNet-NCP-Skip` | Yes | 201,608 | `0.05426 ± 0.00523` | `[0.05409, 0.05443]` | `93.65%` | `2.7%` | `0.9936` | `2.8e17` | `0.08936` | `0.09201` | `0.21` |
56
+ | `PolyMLP` ($x^2+x$) | Yes | 36,744 | `0.05984 ± 0.00293` | `[0.05962, 0.06007]` | `93.17%` | `1.5%` | `0.9932` | `inf` | `0.09798` | `0.10116` | `0.00` |
57
+
58
+ ### 3.2 List Length $n = 16$ (5 Seeds: `42, 123, 456, 789, 1024`)
59
+
60
+ | Model | Pure Poly? | Params | Test MAE (Mean $\pm$ SD) | 95% Boot CI | Mono% | Ex@0.05% | Kendall $\tau$ | Shift $+100$ | Near-Ties $10^{-3}$ | Dup 50% | $R_{\text{stable}}$ |
61
+ | :--- | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
62
+ | `SetTransformer` (non-poly) | No | 96,577 | `0.00377 ± 0.00045` | `[0.00376, 0.00378]` | `99.79%` | `99.7%` | `1.0000` | `99.562` | `0.00781` | `0.00856` | `1.42` |
63
+ | `DiffSort-Cauchy` (non-poly) | No | 1 | `0.00424 ± 0.00000` | `[0.00424, 0.00424]` | `99.93%` | `99.9%` | `1.0000` | `0.00423` | `0.00401` | `0.00404` | `5.00` |
64
+ | **`PolySortNet-Adaptive (m=2)`** | **Yes** | **60** | **`0.00981 ± 0.00008`** | **`[0.00979, 0.00984]`** | **`82.19%`** | **`81.8%`** | **`0.9963`** | **`0.00976`** | **`0.01062`** | **`0.01045`** | `1.00` |
65
+ | **`PolySortNet-Adaptive (m=1)`** | **Yes** | **30** | `0.03693 ± 0.00001` | `[0.03686, 0.03701]` | `75.75%` | `1.0%` | `0.9942` | **`0.03699`** | `0.03902` | `0.03961` | **`1.30`** |
66
+ | `DeepSets-Poly` | Yes | 131,696 | `0.04122 ± 0.00014` | `[0.04112, 0.04131]` | `92.91%` | `0.7%` | `0.9980` | `inf` | `0.06682` | `0.07042` | `1.05` |
67
+ | **`PolySortNet-Shared (m=1)`** | **Yes** | **3** | `0.04842 ± 0.00000` | `[0.04833, 0.04852]` | `73.56%` | `0.0%` | `0.9924` | **`0.04846`** | `0.04869` | `0.04897` | **`1.30`** |
68
+ | `PiNet-NCP-Skip` | Yes | 205,712 | `0.06236 ± 0.00003` | `[0.06221, 0.06251]` | `98.73%` | `0.0%` | `0.9994` | `6.1e15` | `0.08911` | `0.09068` | `0.00` |
69
+ | `ReLU/GELU-MLP` (non-poly) | No | 37,264 | `0.06361 ± 0.00054` | `[0.06347, 0.06376]` | `99.24%` | `0.0%` | `0.9998` | `70.241` | `0.09035` | `0.09269` | `0.00` |
70
+ | `PolyMLP` ($x^2+x$) | Yes | 38,800 | `0.06482 ± 0.00178` | `[0.06468, 0.06497]` | `98.21%` | `0.0%` | `0.9993` | `inf` | `0.09189` | `0.09376` | `0.00` |
71
+ | `PolyPairwiseRank` (Mazzone) | Yes | 12 | `0.07380 ± 0.00012` | `[0.07361, 0.07399]` | `0.11%` | `0.0%` | `0.9242` | `12.099` | `0.08859` | `0.09148` | `0.00` |
72
+
73
+ ---
74
+
75
+ ## 4. Part III: Holm-Bonferroni Paired Wilcoxon Hypothesis Tests (34 Planned Comparisons)
76
+
77
+ All 34 paired Wilcoxon signed-rank tests (from `results/statistical_tests.json`, 10,000-resample bootstrap CIs on paired differences `A - B`, negative = A better) are statistically significant after Holm-Bonferroni familywise error control at $\alpha = 0.05$:
78
+ - **H1 (`PolySortNet-Adaptive m=2` vs. pure-PNN ladder):** Beats `DeepSets-Poly` ($4.56\times$ at $n=8$, $4.20\times$ at $n=16$, 5/5 seeds, $r_{rb} = -1.000$), `PiNet-NCP-Skip` ($7.49\times / 6.35\times$, 5/5 seeds, $r_{rb} = -1.000$), and `PolyMLP` ($8.26\times / 6.61\times$, 5/5 seeds, $r_{rb} = -1.000$), all $p_{\text{holm}} < 10^{-300}$. **Honest H1d nuance:** At cubic $m=1$, `DeepSets-Poly` beats `PolySortNet-Adaptive (m=1)` by `0.00028` MAE at $n=8$ (4/5 seeds, $r_{rb} = +0.056$, $p_{\text{holm}} = 8.47 \times 10^{-28}$), while `PolySortNet-Adaptive (m=1)` wins 5/5 seeds at $n=16$ (`0.03693` vs `0.04122`, $r_{rb} = -0.339$).
79
+ - **H2 (Learned vs. Analytical CKKS & Stage-Adaptive vs. Shared):** `Adaptive m=1` beats Cheon $f_1^{(3)}$ ($3.42\times / 3.94\times$) and HiGHS Remez $L=3$ ($1.60\times / 2.00\times$); `Adaptive m=2` beats Cheon/Hong/Mazzone $f_3 \circ g_3$ ($3.85\times / 3.85\times$); `Adaptive m=1` beats `Shared m=1` 5/5 seeds at both $n=8$ ($1.14\times$, $r_{rb}=-0.542$) and $n=16$ ($1.31\times$, $r_{rb}=-0.923$).
80
+ - **H3 (Iso-Degree Falsification vs. Iso-Parameter Separation):** `L=2, d=3` loses to flat `L=1, d=9` at iso-degree $D=9$ ($r_{rb} = +0.847 / +0.892$, falsifying H3 Part 1); iso-parameter `L=4, d=3` crushes flat `L=1, d=9` by $4.28\times / 4.13\times$ ($r_{rb} = -1.000$).
81
+ - **H4 (`PolyPairwiseRank`):** `PolySortNet-Adaptive m=2` beats `PolyPairwiseRank` 5/5 seeds by $5.84\times$ ($n=8$) and $7.52\times$ ($n=16$, $r_{rb} = -1.000$).
82
+ - **H6 (Parameterization Falsification & Wiring Causality):** Unconstrained odd Chebyshev beats fixed-point on ID MAE ($r_{rb} = +0.901 / +0.940$, falsifying H6 Part 1, at cost of $R_{\text{stable}}: 1.3 \to 1.1$); Bitonic beats Random Fixed Wiring by $11.6\times / 11.8\times$ ($r_{rb} = -1.000$); Batcher Odd-Even Merge beats Bitonic by $1.15\times / 1.11\times$ ($r_{rb} = -0.431 / -0.442$).
83
+ - **Non-Poly Baselines (`B1–B3`):** `PolySortNet-Adaptive m=2` beats `ReLU/GELU-MLP` 5/5 seeds by **$4.90\times$ ($n=8$) and $6.48\times$ ($n=16$)** ($r_{rb} = -1.000$), while honestly lagging `DiffSort-Cauchy` ($0.42\times / 0.43\times$) and `SetTransformer` ($0.30\times / 0.38\times$) on ID MAE (yet beating 96.6k-param `SetTransformer` on 5-seed mean **Near-Ties $10^{-3}$** `0.00659` vs `0.00665`, **50% Duplicates** `0.00660` vs `0.00737`, **Zero-Shot $n=128$** $2.65\times$, and **Shift $+100$** $13{,}714\times$!).
reports/experiments/stage-4e-multiseed-and-sensitivity/learnings.md ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Learnings from Stage 4E: Sensitivity Sweeps & 5-Seed Replication
2
+
3
+ **Author:** Libor "Burny" Burian
4
+ **Date:** 2026-11-25
5
+
6
+ 1. **Zero `float32` vs. `float64` Optimization Drift Even at Degree 81:**
7
+ - Training `PolySortNet-Adaptive` in full `float64` matched `float32` to **6 decimal places** on both $L=3$ (deg 27: `0.033254`) and $L=4$ (deg 81: `0.013222`). Fixed-point Chebyshev anchoring keeps all intermediate wire activations cleanly inside $[-1, 1]$, preventing polynomial gradient overflow in single precision.
8
+ 2. **Dramatic Seed-Stability Gap Between Structured and Unstructured PNNs:**
9
+ - Across 5 independent seeds, 36-parameter `PolySortNet-Adaptive (m=2)` had seed SD `5.76e-7` at $n=8$ (`CV = 0.008%`) — **$9{,}078\times$ lower variance** than `PiNet-NCP-Skip` (`SD = 5.23e-3`), **$5{,}082\times$ lower** than `PolyMLP` (`2.93e-3`), and **$374\times$ lower** than `SetTransformer` (`2.16e-4`). Low-dimensional structured polynomial landscapes behave nearly convexly around Cheon initialization!
10
+ 3. **Why Running Hyperparameter Sensitivity on Baselines Matters (Scientific Integrity):**
11
+ - Sweeping `lr` on `PiNet-NCP-Skip` revealed that `lr=0.01` drops its $n=8$ MAE from `0.0529 -> 0.0423` (improving it 20% over our default `lr=2e-3`). Auditing baseline LRs prevented us from overclaiming `PiNet`'s weakness while still confirming a massive **$5.85\times$** gap vs. `PolySortNet-Adaptive (m=2)`.
12
+ 4. **Windows Atomic-Write File-Lock Engineering Fix:**
13
+ - On run `177 / 178`, `os.replace(tmp_live, live_state_path)` hit `[WinError 5] Access is denied` when colliding with the live dashboard server reading `live_dashboard_state.json`. Adding a 5-retry `PermissionError` backoff in `trainer.py` resolved the race cleanly, and our atomic checkpointing resumed seamlessly at run 177 with zero lost compute.
14
+ 5. **5-Seed OOD Victory Over `SetTransformer`:**
15
+ - Averaged across all 5 seeds at $n=8$, 36-parameter strictly pure-polynomial `PolySortNet-Adaptive (m=2)` outperformed 96,577-parameter softmax `SetTransformer` on **Near-Ties $10^{-3}$** (`0.00659` vs `0.00665`), **50% Duplicates** (`0.00660` vs `0.00737`), and **Shift $+100$** (`0.00726` vs `99.50`, $13{,}714\times$) — showing that algebraic symmetry beats raw attention capacity outside the training distribution.
reports/paper.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f49fc8ff47dc0fdcb47bf80317c464037ea0ceeaf9988949a089d82dc745b4a5
3
+ size 3409589
reports/paper/figures/fig1_architecture.png CHANGED

Git LFS Details

  • SHA256: f37c16a0ed8de981da47c694b0a898db304862259ed454139218c9275107b09e
  • Pointer size: 131 Bytes
  • Size of remote file: 334 kB

Git LFS Details

  • SHA256: 1d7a2b71d298e88b93a38c95f412d2598f3c5e301d173ef9b6000e85f5128007
  • Pointer size: 131 Bytes
  • Size of remote file: 370 kB
reports/paper/figures/fig2_main_comparison.png CHANGED

Git LFS Details

  • SHA256: bf2070b5d15320f923f250b57f66cb23e1b41b5485d5c0d66eded19a9770c03f
  • Pointer size: 131 Bytes
  • Size of remote file: 605 kB

Git LFS Details

  • SHA256: bc2259475fc67a21515d5d1b430e508b2357b7bf39d56af635cfb7a71cb6974b
  • Pointer size: 131 Bytes
  • Size of remote file: 605 kB
reports/paper/figures/fig3_mechanistic_comparators.png CHANGED

Git LFS Details

  • SHA256: 3e5b2b6541638753e6304df14d996985d7902f8f30f498584c9ace0c8839fc32
  • Pointer size: 131 Bytes
  • Size of remote file: 617 kB

Git LFS Details

  • SHA256: ea416d2f5ab677308e128ab527696d38d023645747ec5f4af3c670eb8fc0601b
  • Pointer size: 131 Bytes
  • Size of remote file: 636 kB
reports/paper/figures/fig4_output_examples.png CHANGED

Git LFS Details

  • SHA256: 19cc886bb98b42b21014ec573b964896fe07421a614d69ca959f40b27874039c
  • Pointer size: 131 Bytes
  • Size of remote file: 629 kB

Git LFS Details

  • SHA256: 435a4a0581c46057c6aee9a10dcad1be6b50c9b45eb9a56ab77c2e1f9ffbc4e5
  • Pointer size: 131 Bytes
  • Size of remote file: 635 kB
reports/paper/figures/fig5_zeroshot_and_scale_cliff.png CHANGED

Git LFS Details

  • SHA256: 11b0ff77b955c2603fba7f51cf3c5b437ba86b145112cda28983de61beb85ad7
  • Pointer size: 131 Bytes
  • Size of remote file: 418 kB

Git LFS Details

  • SHA256: 62e7d420457d78d7d080b75d773bcd28b42c9d52d1f33e42077a0825bf289add
  • Pointer size: 131 Bytes
  • Size of remote file: 411 kB
reports/paper/figures/fig6_ablations_and_training.png CHANGED

Git LFS Details

  • SHA256: c18413923a987b5aa00797911316f7914e4bf4f9a91c82cbd9e250c2ce381b15
  • Pointer size: 131 Bytes
  • Size of remote file: 497 kB

Git LFS Details

  • SHA256: 5a9b8a52fd1d16ddc4972c388d5b984b5ea8c6543db8085521c7c735f07bde8a
  • Pointer size: 131 Bytes
  • Size of remote file: 520 kB
reports/paper/paper.typ ADDED
@@ -0,0 +1,297 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #set document(
2
+ title: "Strictly Pure Polynomial Neural Networks for Sorting Continuous Lists",
3
+ author: "Libor \"Burny\" Burian",
4
+ date: datetime(year: 2026, month: 11, day: 25),
5
+ )
6
+ #set page(
7
+ paper: "a4",
8
+ margin: (x: 1.75cm, y: 1.9cm),
9
+ numbering: "1",
10
+ header: align(right, text(size: 8pt, fill: luma(110))[Strictly Pure Polynomial Neural Networks for Sorting — Libor "Burny" Burian (2026-11-25)]),
11
+ )
12
+ #set text(font: "New Computer Modern", size: 9.5pt, lang: "en")
13
+ #set par(justify: true, leading: 0.62em)
14
+ #set heading(numbering: "1.1")
15
+ #show link: set text(fill: rgb("#005a9c"))
16
+ #show table.cell.where(y: 0): strong
17
+ #set table(
18
+ stroke: (x, y) => if y == 0 { (top: 1pt + black, bottom: 0.8pt + black) } else { (bottom: 0.35pt + luma(200)) },
19
+ inset: (x: 4.5pt, y: 3.5pt),
20
+ fill: (_, y) => if y == 0 { rgb("#eef4fa") } else if calc.odd(y) { white } else { rgb("#fafbfc") },
21
+ )
22
+
23
+ #align(center)[
24
+ #text(size: 14.2pt, weight: "bold")[Strictly Pure Polynomial Neural Networks for Sorting Continuous Lists:\ Inductive Bias, Composite Depth Separation, and Fundamental Algebraic Boundaries]
25
+ #v(0.5em)
26
+ #text(size: 11pt, weight: "medium")[Libor "Burny" Burian] \
27
+ #text(size: 9pt, fill: luma(80))[2026-11-25 #h(1em)•#h(1em) #link("https://github.com/BurnyCoder/polynomial-neural-network-sort-list")[GitHub Repository] #h(0.8em)•#h(0.8em) #link("https://huggingface.co/BurnyCoder/polynomial-neural-network-sort-list")[Hugging Face Checkpoints] #h(0.8em)•#h(0.8em) #link("https://burnycoder.github.io/polynomial-neural-network-sort-list/")[Live Browser Pure-Polynomial Sorter]]
28
+ ]
29
+
30
+ #v(0.6em)
31
+ #rect(fill: rgb("#f4f7fb"), stroke: (left: 2.5pt + rgb("#0072B2")), inset: 9pt, radius: 3pt)[
32
+ #text(weight: "bold")[Abstract.]
33
+ Can a neural network composed _exclusively_ of additions, subtractions, and multiplications—with zero piecewise activations (`ReLU`/`GELU`), zero transcendental functions (`exp`/`atan`/`tanh`/`softmax`), zero divisions, and zero normalization layers—learn to sort lists of continuous real numbers accurately? Prior work is split across three disconnected communities: deep polynomial neural networks ($Pi$-Nets) rarely remove normalization and have not been studied on non-smooth algorithmic sorting; differentiable sorting networks (`diffsort`) rely on non-polynomial sigmoids or Cauchy CDFs; and homomorphic encryption (CKKS) sorting uses fixed analytical minimax polynomials optimizing unweighted worst-case sign error rather than end-to-end value-sorting accuracy.
34
+ We bridge all three domains in a preregistered, mechanically verified (PyTorch FX) empirical study of *178 runs* spanning 17 architectures, 5 random seeds (100 core cells; $N_"test" = 10,000$ lists per run), 10 out-of-distribution (OOD) suites, and 6 causal ablation suites.
35
+ *Positive results:* Replacing discrete compare-and-swap (CAS) gates in Batcher's Bitonic network with end-to-end gradient-trained composite odd Chebyshev polynomials (`PolySortNet`) achieves held-out 5-seed Value MAE `0.00724 ± 0.00000` ($n=8$, 36 params, `95.9%` Exact\@0.05) and `0.00981 ± 0.00008` ($n=16$, 60 params, `81.8%` Exact\@0.05)—beating analytical CKKS composite polynomials (Cheon $f_1^((3))$, HiGHS Remez $L=3$, Cheon/Hong/Mazzone $f_3 compose g_3$) by *1.6×–3.9×*, unstructured pure PNNs ($Pi$-Nets, PolyMLP) by *6.4×–8.3×*, permutation-invariant `DeepSets-Poly` (131k params) by *4.2×–4.6×*, and non-polynomial `ReLU/GELU-MLP` by *4.9×–6.5×* (all Holm-Bonferroni paired Wilcoxon $p_"holm" < 10^(-300)$, 5/5 seeds). A 6-parameter shared-gate `PolySortNet` trained only on $n=8$ extrapolates *16× zero-shot to $n=128$* (`MAE = 0.0200`, Kendall $tau = 0.9978$), beating a 96.6k-parameter `SetTransformer` by *2.65×* on $n=128$, *13,714×* on Shift $+100$ (`0.00726` vs. `99.50`), and on 5-seed Near-Ties $10^(-3)$ (`0.00659` vs. `0.00665`), while preserving exact float64 sum conservation ($2.1 times 10^(-16)$) and shift equivariance ($6.6 times 10^(-14)$). Mechanistic weight inspection reveals that stage-adaptive polynomials autonomously rediscover Bitonic merge-block stride resets.
36
+ *Honest negative results and falsified hypotheses:* Two preregistered hypotheses were explicitly falsified: (1) removing fixed-point anchoring $h(1)=1$ (H6 Part 1) _reduces_ ID MAE by 26–30% via late-stage domain contraction ($s_5(1) = -445$ to $-1038$) at the causal cost of shrinking the upper scale stability radius $R_"stable"$ from `1.3 -> 1.1`; (2) at strict iso-degree $D=9$ (H3 Part 1), a 4-param/stage flat polynomial beats a 2-param/stage composite `L=2, d=3` network on ID MAE before suffering Runge blow-up (`R_stable = 0.0`), whereas iso-parameter composite `L=4, d=3` (deg 81) beats flat deg-9 by *4.28×* and expands $R_"stable"$ to `1.50`. Moreover, non-polynomial `DiffSort` (`0.00041`–`0.00424`) and `SetTransformer` (`0.00218`–`0.00377`) retain sharper in-distribution precision, and every strictly pure polynomial inevitably encounters a finite upper scale blow-up cliff ($s = 1.5$–$2.0$), causally isolated via a non-polynomial `max(|x|)` wrapper (`R_stable: 1.3 -> 5.0`, at the cost of breaking Shift $+100$).
37
+ ]
38
+
39
+ = Context, Motivation, and Introduction
40
+
41
+ Sorting a continuous vector $x = (x_1, dots, x_n) in [-1, 1]^n$ into non-decreasing order $S(x) = (x_((1)), dots, x_((n)))$ is a canonical non-smooth algorithmic map: it is globally 1-Lipschitz, permutation-invariant, shift-equivariant ($S(x + c bold(1)) = S(x) + c bold(1)$), sum-conserving ($sum_k x_((k)) = sum_i x_i$), and non-differentiable along all $binom(n, 2)$ hyperplanes $x_i = x_j$. Because every finite-degree polynomial is $C^infinity$ analytic, no finite polynomial can represent $S(x)$ identically on any open set intersecting $x_i = x_j$. Yet strictly pure polynomials—evaluating _only_ additions, subtractions, and multiplications—are the exact computational substrate of approximate Fully Homomorphic Encryption (CKKS) #link("https://eprint.iacr.org/2019/1234")[(Cheon et al., 2020)], verifiable arithmetic circuits, and polynomial neural architectures #link("https://arxiv.org/abs/2006.13026")[(Chrysos et al., 2021)].
42
+
43
+ Despite parallel progress in three communities—deep polynomial neural networks ($Pi$-Nets; #link("https://arxiv.org/abs/2006.13026")[Chrysos et al., 2021]), differentiable sorting networks (`diffsort`; #link("https://arxiv.org/abs/2105.04019")[Petersen et al., 2021]\; #link("https://arxiv.org/abs/2203.09630")[Petersen et al., 2022]), and CKKS polynomial sorting (#link("https://eprint.iacr.org/2019/1234")[Cheon et al., 2020]\; #link("https://eprint.iacr.org/2020/834")[Lee et al., 2022]\; #link("https://arxiv.org/abs/2412.15126")[Mazzone et al., 2025])—no prior study has systematically investigated *end-to-end gradient-trained strictly pure Polynomial Neural Networks (PNNs)* for continuous list sorting across the full architectural inductive-bias spectrum, nor directly benchmarked learned composite PNNs against analytical CKKS minimax polynomials at matched polynomial degree and multiplicative depth.
44
+
45
+ == Explicit Statement of Novelty
46
+
47
+ 1. *Unification & Mechanical Purity Enforcement:* We formulate and mechanically audit (via PyTorch FX graph tracing, zero hidden activations/divisions/norms) a 5-tier ladder of strictly pure PNN sorters: `PolyMLP`, $Pi$-Net (`NCP-Skip`), `DeepSets-Poly`, constant-depth `PolyPairwiseRank` (with Mazzone's exact quadratic tie correction $E = 4C(1-C)$), and our end-to-end trained composite polynomial sorting network `PolySortNet`.
48
+ 2. *Gradient-Trained Composite Polynomials Surpass Analytical CKKS at Iso-Degree:* Analytical CKKS polynomials minimize unweighted worst-case sign error $sup_(u in [delta, 1]) |1 - s(u)|$, whereas value sorting minimizes *value-weighted* comparator error $e_"val"(Delta) = |Delta| dot |1 - s(|Delta|)|$ across non-uniform, stage-shrinking pairwise gap distributions. Training composite odd Chebyshev coefficients end-to-end achieves 1.6×–3.9× lower Value MAE than Cheon $f_1^((3))$, HiGHS Remez $L=3$, and Cheon/Hong/Mazzone $f_3 compose g_3$ using only 3–60 learnable scalars.
49
+ 3. *Mechanistic Discoveries & Honest Falsifications:* Direct float64 transfer inspection uncovers three structural phenomena: (a) stage-adaptive polynomials autonomously rediscover Bitonic merge-block stride resets; (b) removing $h(1)=1$ fixed-point anchoring improves ID MAE by 26–30% via late-stage domain contraction ($s_5(1) = -445..-1038$) while sacrificing scale stability ($R_"stable": 1.3 -> 1.1$); and (c) deep low-degree composition (`L=4, d=3`, deg 81) dominates iso-parameter flat degree-9 by 4.28× on MAE while simultaneously avoiding Runge boundary explosion (`R_stable: 0.0 -> 1.50`).
50
+
51
+ = Background and Mathematical Foundations
52
+
53
+ == Approximation of $|u|$: Flat vs. Composite Polynomials
54
+ For two scalars $a, b in [-1, 1]$, define midpoint $mu = (a+b)/2$ and half-difference $Delta = (b-a)/2 in [-1, 1]$. Then
55
+ $ min(a, b) = mu - |Delta|, quad max(a, b) = mu + |Delta|. $
56
+ By Bernstein's theorem (1914) and high-precision Remez computations by Varga & Carpenter (1985, 1987), the best uniform degree-$D$ polynomial approximation to $|u|$ on $[-1, 1]$ decays only algebraically: $E_D(|u|) tilde.op beta / D$ with $beta approx 0.2801694990$. Consequently, flat polynomials require $D = Theta(1/epsilon)$ parameters and degree. Conversely, composing $L$ low-degree odd polynomials $s(u) = (h_L compose dots.c compose h_1)(u)$ of degree $d = 2m+1$ attains total degree $D = (2m+1)^L$ with only $O(L m)$ parameters and sequential multiplications (#link("https://eprint.iacr.org/2019/1234")[Cheon et al., 2020]\; #link("https://eprint.iacr.org/2020/834")[Lee et al., 2022]).
57
+
58
+ == Algebraic Invariants & Rolle's Theorem Trade-Off
59
+ Replacing $|Delta|$ with $Delta dot s(Delta)$ for any odd polynomial $s(-u) = -s(u)$ defines a *pure-polynomial compare-and-swap (CAS) gate*:
60
+ $ hat(min)_s (a, b) = mu - Delta dot s(Delta), quad hat(max)_s (a, b) = mu + Delta dot s(Delta). $
61
+ This gate satisfies four exact algebraic invariants for *every* odd polynomial $s$:
62
+ 1. *Exact Sum Conservation:* $hat(min)_s (a, b) + hat(max)_s (a, b) = 2 mu = a + b$, so by induction across any sorting network $sum_k hat(y)_k = sum_i x_i$.
63
+ 2. *Exact Shift Equivariance:* Because $Delta = ((b+c)-(a+c))/2 = (b-a)/2$ is strictly invariant to additive shifts $c in RR$, $hat(min)_s (a+c, b+c) = hat(min)_s (a,b) + c$, extending by induction to $f_theta(x + c bold(1)) = f_theta(x) + c bold(1)$ for arbitrary $c$ (e.g., $c = 100$).
64
+ 3. *Domain-Boundedness:* Whenever $|s(u)| <= 1$ on $[-1, 1]$, both outputs lie strictly inside $[min(a,b), max(a,b)] subset.eq [-1, 1]$, keeping wire activations bounded across arbitrary sorting depth without normalization and inheriting Theorem 9 of #link("https://arxiv.org/abs/2203.09630")[Petersen et al. (2022)]: if single-gate error $Delta|1 - s(Delta)| <= epsilon$, an $ell$-stage network has $L_infinity$ error $<= epsilon dot ell$.
65
+ 4. *Rolle's Theorem Monotonicity Constraint:* By Theorem 5 of #link("https://arxiv.org/abs/2203.09630")[Petersen et al. (2022)], strict global monotonicity requires $f'(x) in Omega(1/x^2)$ (satisfied by Cauchy CDF $arctan$, impossible for bounded-degree polynomials). Indeed, if $s(0)=0$, $s(1)=1$, and $s(u) < 1$ on $(0,1)$, then $hat(min)_s (2, 0) = 0$ while $hat(min)_s (x, 0) > 0$ on $(0, 2)$, so by Rolle's theorem $partial_x hat(min)_s (x, 0) < 0$ somewhere on $(0, 2)$. Exact boundary fidelity at $u=1$ thus precludes strict global monotonicity, explaining why pure polynomial sorters trade a small fraction of near-tie inversions against sharp value fidelity.
66
+ 5. *Unavoidable Upper Scale Blow-Up:* Any non-affine polynomial $p$ of degree $D >= 2$ diverges as $O(||x||^D)$ outside its contractive basin, guaranteeing a finite upper scale stability radius $R_"stable" < infinity$—unlike transcendental `diffsort` ($exp$/$arctan$), which saturates globally as $|Delta| -> infinity$.
67
+
68
+ = Method
69
+
70
+ == `PolySortNet` and Fixed-Point Odd Chebyshev Parameterization
71
+ `PolySortNet` instantiates a fixed Knuth 0-1 verified sorting network (default: Batcher's Bitonic network, $ell = frac(1,2) log_2 n (log_2 n + 1)$ parallel stages, $n/2$ gates/stage) whose CAS gates use an $L$-layer composite polynomial $s_k (Delta) = (h_(k,L) compose dots.c compose h_(k,1))(Delta)$. Each layer uses our *fixed-point odd Chebyshev parameterization* with $m$ learnable scalars $c_(k,ell,0), dots, c_(k,ell,m-1)$:
72
+ $ h_(k,ell)(u) = u + u(1 - u^2) sum_(j=0)^(m-1) c_(k,ell,j) T_(2j)(u), $
73
+ where even Chebyshev terms are computed strictly via additions and multiplications using $T_(2j)(u) = T_j (2u^2 - 1)$. This form algebraically enforces $h(0)=0$, $h(plus.minus 1) = plus.minus 1$, odd symmetry, and exact subsumption of both the identity map ($c=0$) and Cheon et al.'s (2020) analytical $f_m (u) = sum_(i=0)^m 4^(-i) binom(2i, i) u(1-u^2)^i$ (verified symbolically in SymPy to $< 10^(-13)$). We evaluate two weight-sharing regimes:
74
+ - *`PolySortNet-Shared`:* One shared comparator across all stages ($L dot m$ total parameters: *3* for $m=1, L=3$, deg 27; *6* for $m=2, L=3$, deg 125). Supports *zero-shot length generalization* to any power-of-2 length $n in {4, 8, 16, 32, 64, 128}$.
75
+ - *`PolySortNet-Adaptive`:* Distinct coefficients per parallel stage ($ell dot L dot m$ total parameters: 18/30 for $m=1$, 36/60 for $m=2$ at $n in {8, 16}$), allowing each stage to specialize to its local gap distribution.
76
+
77
+ #figure(
78
+ image("figures/fig1_architecture.png", width: 100%),
79
+ caption: [*PolySortNet architecture and 5-tier Pure-PNN inductive-bias ladder.* (A) Fixed Bitonic wiring guarantees zero-shot length extensibility, sum conservation, and shift equivariance. (B) Strictly pure-polynomial CAS gate using $L$-layer composite fixed-point odd Chebyshev blocks (mechanically FX-verified). (C) Five pure-PNN tiers evaluated from unstructured `PolyMLP` up to `PolySortNet`.],
80
+ )
81
+
82
+ == Full Architecture Ladder, Analytical CKKS, Controls, and Baselines
83
+ Every model tagged `is_pure_polynomial=True` is mechanically audited via `torch.fx.symbolic_trace` (`src/pnn_sort/audit.py`), whitelisting only `+`, `-`, `*`, constant scalar division, and linear/index permutations while rejecting all non-polynomial ops (verified by 62/62 passing unit tests including 18 purity proofs and 5 negative rejection tests):
84
+ 1. *Unstructured & Symmetric Pure PNNs:* `PolyMLP` ($x^2+x$ activations, 37–39k params); `PiNet-NCP-Skip` (#link("https://arxiv.org/abs/2006.13026")[Chrysos et al., 2021], Eq. 10, strictly without BN/`tanh`, 202–206k params); `DeepSets-Poly` (#link("https://arxiv.org/abs/1703.06114")[Zaheer et al., 2017], Chebyshev power-sum encoder with latent width $>= 2n$ respecting #link("https://arxiv.org/abs/1901.09006")[Wagstaff et al., 2019], 131–132k params); `PolySortNet-LearnedWire` (orthogonal linear routers + poly CAS, 466–2.8k params); and `PolyPairwiseRank` (#link("https://arxiv.org/abs/2412.15126")[Mazzone et al., 2025] constant-depth all-to-all ranking with exact quadratic tie correction $E=4C(1-C)$, 12 params).
85
+ 2. *Zero-Training Analytical CKKS Baselines (Pure Poly, 0 trained params):* Cheon $f_1^((3))$ (deg 27), Cheon $f_2^((2))$ (deg 25), Cheon/Hong/Mazzone mixed $f_3 compose g_3$ (deg 49, exact coefficients from #link("https://arxiv.org/abs/2412.15126")[Mazzone et al., 2025] Sec. 2.2), and #link("https://eprint.iacr.org/2020/834")[Lee et al. (2022)] Algorithm 2 composite Remez minimax solved via exact HiGHS convex LP (`scipy.optimize.linprog`) at $L=3, m=1$ ($delta=0.10$) and $L=3, m=2$ ($delta=0.03$).
86
+ 3. *Controls:* `Identity`, OLS `LinearControl`, untrained random `PolySortNet`/`PiNet`, `ShuffledTarget` leakage control (permuted targets), and `RandomFixedWiring` topology control.
87
+ 4. *Non-Polynomial Reference Baselines:* `DiffSort-Logistic` ($sigma(beta Delta)$) and monotonic `DiffSort-Cauchy` ($frac(1, pi) arctan(beta Delta) + frac(1,2)$) (#link("https://arxiv.org/abs/2203.09630")[Petersen et al., 2022]), `ReLU/GELU-MLP` (35–37k params), `SetTransformer` (#link("https://arxiv.org/abs/1810.00825")[Lee et al., 2019], 96.6k params), and non-poly `ScaleNorm` wrapper (Ablation A6).
88
+
89
+ = Experimental Setup and Statistical Rigor
90
+
91
+ All hypotheses (`H1–H6`), metrics, splits, and falsification criteria were locked in `reports/preregistration.md` and pushed to GitHub (`879258c`) _prior to executing any training or evaluation_.
92
+ - *Zero-Leakage Datasets:* Independent SHA-256 keyed streams generate $200,000$ training lists, $10,000$ validation lists, and $10,000$ test lists i.i.d. from $"Uniform"[-1, 1]^n$, plus 10 OOD stress suites ($2,000$ lists each): Gaussian, Bimodal, Skewed Beta, Discrete Integers, 50% Duplicates, Near-Ties ($delta in {10^(-2), 10^(-3), 10^(-4)}$), Edge Sorted/Reversed, Shift ($c in {1, 10, 100}$), Scale ($s in [0.1, 5.0]$), and Zero-Shot Lengths ($n in {4..128}$).
93
+ - *Training Protocol & Compute:* AdamW with cosine decay, warmup, and gradient clipping on a single NVIDIA RTX 5070 Laptop GPU (8 GB VRAM, PyTorch 2.11+cu128). Compact sorting networks train with `batch_size=4096, lr=8e-3, epochs=50` (logged WDDM throughput optimization, verified against `bs=512` and `float64` in Stage 4E); dense networks train with `batch_size=2048, lr=2e-3, epochs=60`. All 178 runs completed with atomic resumable checkpoints ($approx 5$ hours total GPU wall-clock).
94
+ - *Metrics & Statistical Testing:* We co-report Value MAE, RMSE, Wasserstein-1 $W_1$, Sum Error, Monotonicity Rate, Kendall's $tau$, Value-Matched Exact Sort Rate (`Ex@0.05`: monotonic AND $L_infinity < 0.05$, preventing constant-output monotonicity gaming), and Upper Scale Stability Radius $R_"stable"$ (largest $s >= 1.0$ with $"MAE"/s < 0.05$). All 10 core models are replicated across *5 independent seeds* (`42, 123, 456, 789, 1024`; 100 cells) and evaluated with 10,000-resample bootstrap 95% CIs, two-sided paired Wilcoxon signed-rank tests (50,000 pooled paired lists per 5-seed test), rank-biserial effect sizes $r_"rb"$, and Holm-Bonferroni correction across all 34 planned tests.
95
+
96
+ = Empirical Results (Positive and Negative Findings)
97
+
98
+ == Core 5-Seed Benchmarks ($n = 8$ and $n = 16$)
99
+
100
+ Table 1 reports the complete 5-seed benchmarks alongside single-seed analytical CKKS and control references (visualized in Figure 2). Key findings:
101
+ 1. *Inductive Bias Ladder (H1, 5/5 seeds, $p_"holm" < 10^(-300)$):* Pure-polynomial `PolySortNet-Adaptive (m=2)` (36/60 params) achieves 5-seed MAE `0.00724 ± 0.00000` ($n=8$, `95.9%` Ex\@0.05) and `0.00981 ± 0.00008` ($n=16$, `81.8%` Ex\@0.05)—outperforming `DeepSets-Poly` (131k params) by *4.56× / 4.20×*, `PiNet-NCP-Skip` (202–206k params) by *7.49× / 6.35×*, `PolyMLP` by *8.26× / 6.61×*, and non-poly `ReLU/GELU-MLP` by *4.90× / 6.48×*. At $n=16$, all unstructured networks (`PiNet`, `PolyMLP`, `ReLU-MLP`, `PolyPairwiseRank`) collapse to `0.0%` Ex\@0.05 despite high vacuous monotonicity (`98–99%`), confirming that monotonicity alone is severely misleading without value-matched error!
102
+ 2. *Honest H1 Cubic Caveat:* At lower comparator degree $m=1$ (deg 27), 18-param `PolySortNet-Adaptive` slightly trails 131k-param `DeepSets-Poly` on $n=8$ ID MAE (`0.03327` vs. `0.03300`, `DeepSets-Poly` wins 4/5 seeds, $r_"rb" = +0.056$) before overtaking it 5/5 seeds at $n=16$ (`0.03693` vs. `0.04122`) and dominating on Duplicates (`0.0324` vs. `0.0746`) and Shift $+100$ (`0.0334` vs. `inf`).
103
+ 3. *Four Orders of Magnitude Lower Seed Variance:* `PolySortNet-Adaptive (m=2)` has seed SD `5.76e-7` at $n=8$ (`CV = 0.008%`)—*9,078× smaller* than `PiNet-NCP-Skip` (`5.23e-3`) and *374× smaller* than `SetTransformer` (`2.16e-4`).
104
+ 4. *Surpassing Analytical CKKS at Iso-Depth (H2):* At exact iso-degree ($L=3, m=1$, deg 27), learned `PolySortNet-Adaptive` cuts MAE by *3.42× / 3.94×* vs. Cheon $f_1^((3))$ (`0.1136 / 0.1457`) and *1.60× / 2.00×* vs. HiGHS Remez $L=3$ (`0.0531 / 0.0740`). At $m=2$ (deg 125), `PolySortNet-Adaptive (m=2)` beats Cheon/Hong/Mazzone mixed $f_3 compose g_3$ (`0.0279 / 0.0375`) by *3.85×* at both lengths, while unscaled analytical Remez $m=2$ diverges (`inf`). Stage-adaptive gains over shared gates grow monotonically with list length: `-6.2%` ($n=4$) $->$ `-11.9%` ($n=8$) $->$ `-23.7%` ($n=16$) $->$ `-31.5%` ($n=32$).
105
+ 5. *Honest Non-Poly Ceiling vs. OOD Reversal:* Non-polynomial `DiffSort-Logistic` (`0.00041 / 0.00069`), `DiffSort-Cauchy` (`0.00306 / 0.00424`), and `SetTransformer` (`0.00218 / 0.00377`) remain more accurate in-distribution. *Yet* averaged across all 5 seeds at $n=8$, 36-parameter pure-polynomial `PolySortNet-Adaptive (m=2)` *outperforms* 96.6k-parameter `SetTransformer` on *Near-Ties $10^(-3)$* (`0.00659` vs. `0.00665`), *50% Duplicates* (`0.00660` vs. `0.00737`), and *Shift $+100$* (`0.00726` vs. `99.50`, *13,714×*)!
106
+ 6. *Constant-Depth Crossover (H4) & Leakage Verification:* `PolyPairwiseRank` (12 params) beats unstructured `PiNet`/`PolyMLP` at $n=8$ (`0.04232` vs. `0.05426`/`0.05984`) before degrading sharply at $n=16$ (`0.07380`, `0.11%` Mono) and losing shift equivariance (`Shift +100 = 9.93–12.10` because indicator weights do not sum identically to 1). `ShuffledTarget` scores `0.210 / 0.282` (`0.0%` Ex\@0.05), confirming zero data leakage.
107
+
108
+ #figure(
109
+ text(size: 7.9pt)[#table(
110
+ columns: (2.35fr, 0.55fr, 0.9fr, 1.45fr, 0.85fr, 1.45fr, 0.85fr, 0.95fr, 0.65fr),
111
+ align: (left, center, right, right, right, right, right, right, right),
112
+ [Model], [Poly], [Params], [MAE ($n=8$)], [Ex05 ($8$)], [MAE ($n=16$)], [Ex05 ($16$)], [Shift $+100$], [$R_"stab"$],
113
+ [*PolySortNet-Adapt ($m=2$)* (5s)], [*Yes*], [36/60], [*0.00724 ± .00000*], [*95.9%*], [*0.00981 ± .00008*], [*81.8%*], [*0.0073*], [1.00],
114
+ [*PolySortNet-Shared ($m=2$)* (1s)], [*Yes*], [6/6], [0.00794], [92.2%], [0.01108], [72.5%], [*0.0079*], [1.00],
115
+ [*PolySortNet-Adapt $L=4$* (1s)], [*Yes*], [24/40], [0.01322], [91.8%], [0.01631], [61.4%], [*0.0133*], [*1.50*],
116
+ [Analytical Cheon $f_3 compose g_3$], [Yes], [0], [0.02788], [27.5%], [0.03749], [0.3%], [0.0279], [1.10],
117
+ [DeepSets-Poly (5s)], [Yes], [131k], [0.03300 ± .00069], [21.6%], [0.04122 ± .00014], [0.7%], [`inf`], [1.05],
118
+ [*PolySortNet-Adapt ($m=1$)* (5s)], [*Yes*], [18/30], [0.03327 ± .00002], [16.3%], [0.03693 ± .00001], [1.0%], [*0.0334*], [1.30],
119
+ [*PolySortNet-Shared ($m=1$)* (5s)], [*Yes*], [3/3], [0.03776 ± .00000], [9.8%], [0.04842 ± .00000], [0.0%], [*0.0377*], [1.30],
120
+ [PolyPairwiseRank (5s)], [Yes], [12/12], [0.04232 ± .00038], [13.6%], [0.07380 ± .00012], [0.0%], [9.934], [1.01],
121
+ [Analytical Remez $L=3$], [Yes], [0], [0.05309], [1.7%], [0.07400], [0.0%], [0.0533], [0.00],
122
+ [PiNet-NCP-Skip (5s)], [Yes], [202k], [0.05426 ± .00523], [2.7%], [0.06236 ± .00003], [0.0%], [2.8e17], [0.21],
123
+ [PolyMLP ($x^2+x$) (5s)], [Yes], [37k], [0.05984 ± .00293], [1.5%], [0.06482 ± .00178], [0.0%], [`inf`], [0.00],
124
+ [PolySortNet-LearnedWire], [Yes], [466/2.8k], [0.09666], [0.0%], [0.07535], [0.0%], [`inf`], [0.00],
125
+ [Analytical Cheon $f_1^((3))$], [Yes], [0], [0.11362], [0.0%], [0.14568], [0.0%], [0.1131], [0.00],
126
+ [Linear / Shuffled Ctrl], [Yes], [72/18], [0.1346 / 0.2101], [0.0%], [0.0986 / 0.2817], [0.0%], [26.6 / 0.21], [0.00],
127
+ [DiffSort-Logistic (non-poly)], [No], [1], [0.00041], [99.9%], [0.00069], [99.2%], [0.0004], [5.00],
128
+ [SetTransformer (non-poly, 5s)], [No], [96.6k], [0.00218 ± .00022], [99.9%], [0.00377 ± .00045], [99.7%], [99.502], [1.50],
129
+ [DiffSort-Cauchy (non-poly, 5s)], [No], [1], [0.00306 ± .00000], [100%], [0.00424 ± .00000], [99.9%], [0.0031], [5.00],
130
+ [ReLU/GELU-MLP (non-poly, 5s)], [No], [35k], [0.03549 ± .00122], [15.2%], [0.06361 ± .00054], [0.0%], [27.482], [1.42],
131
+ )],
132
+ caption: [*Primary benchmark table across strictly pure PNNs, analytical CKKS polynomials, controls, and non-polynomial baselines* (`5s` = 5-seed mean ± SD over $5 times 10,000$ lists; `Ex05` = monotonic AND $L_infinity < 0.05$; `Shift +100` shown for $n=8$). Note that tuning `PiNet` LR to `0.01` improves its $n=8$ MAE to `0.04232` (Appendix B), still 5.85× worse than `PolySortNet-Adapt (m=2)`.],
133
+ )
134
+
135
+ #figure(
136
+ image("figures/fig2_main_comparison.png", width: 100%),
137
+ caption: [*Held-out Value MAE (log scale) across all architectures at $n=8$ and $n=16$* with 5-seed SD error bars and `Ex@0.05` annotations. Strictly pure `PolySortNet` (blue) fills the gap between unstructured PNNs/CKKS polynomials and transcendental upper bounds.],
138
+ )
139
+
140
+ == Mechanistic Inspection: Value-Weighted Error & Rediscovery of Bitonic Stride Resets
141
+
142
+ Evaluating trained comparator polynomials directly in `float64` (Figure 3) explains *mechanistically* why end-to-end training beats analytical CKKS polynomials by up to 3.9×:
143
+ 1. *Overshoot-and-Contract Rediscovery:* `PolySortNet-Shared (m=1)` learns monotonically decreasing layer coefficients `[[1.4017], [0.8521], [0.7530]]`, yielding origin slope $s'(0) = 7.80$ vs. Cheon $f_1^((3))$'s $1.5^3 = 3.38$. Early layers amplify small pairwise gaps aggressively (controlled intermediate overshoot analogous to Cheon's hand-crafted $g_3$), while the final layer contracts values back to $plus.minus 1$, slashing single-gate peak value error $max_Delta Delta|1 - s(Delta)|$ from `0.080` (Cheon $f_1^((3))$) and `0.084` (Remez $L=3$) down to `0.034` ($m=1$) and `0.011` ($m=2$).
144
+ 2. *Autonomous Rediscovery of Bitonic Merge-Block Strides (Figure 3C):* Rather than rising monotonically across all stages, stage-adaptive origin slope $s'(0)$ exhibits sharp *resets* at Stage 3 ($n=8$) and Stages 1, 3, and 6 ($n=16$)—the _exact_ entry stages of each new Bitonic merge block where comparator stride doubles and incoming pairwise gaps $|Delta|$ abruptly jump back up—before climbing monotonically as stride halves ($8 -> 4 -> 2 -> 1$).
145
+
146
+ #figure(
147
+ image("figures/fig3_mechanistic_comparators.png", width: 100%),
148
+ caption: [*Mechanistic comparator analysis.* (A) Transfer curve $s(Delta)$. (B) Single-gate value error $Delta|1 - s(Delta)|$ showing why trained PNNs beat analytical uniform-sign polynomials. (C) Stage-adaptive origin slope $s'(0)$ autonomously dipping at every Bitonic long-stride merge boundary.],
149
+ )
150
+
151
+ == Zero-Shot Length Extrapolation, Output Examples, and the Scale Blow-Up Cliff (H5)
152
+
153
+ Figure 4 displays concrete output examples on both *positive scenarios* (in-distribution Uniform and Shift $+100$) and *honest negative failure modes* (Scale $2.0 times$ blow-up and Random-Wiring collapse). Figure 5 quantifies both OOD boundaries:
154
+ - *Zero-Shot $16 times$ Length Scaling (Positive):* Trained solely on $n=8$, 6-parameter `PolySortNet-Shared (m=2)` extrapolates smoothly to $n=128$ (28 Bitonic stages) with `MAE = 0.02001`, $tau = 0.9978$—beating 96.6k-param `SetTransformer` (`0.05311`, *2.65×*) and analytical Cheon $f_3 compose g_3$ (`0.05135`, *2.57×*) while trailing only transcendental `DiffSort-Cauchy` (`0.00858`). In `float64`, sum conservation error is $2.1 times 10^(-16)$ and Shift $+100$ equivariance $L_infinity$ is $6.6 times 10^(-14)$.
155
+ - *Scale-Extrapolation Cliff (Predicted Negative Boundary):* Every strictly pure polynomial exhibits an abrupt divergence cliff outside $[-1, 1]$: `m=2` blows up at $s = 1.5$ ($R_"stable" = 1.00$), `m=1` at $s = 2.0$ ($R_"stable" = 1.30$), and `L=4, d=3` at $s = 2.0$ ($R_"stable" = 1.50$). Wrapping the exact same polynomial in non-polynomial `x / max(|x|)` (Ablation A6) immediately restores $R_"stable" = 5.00$ (`Scale 5x` MAE `0.146 / 0.176`), proving H5 causally—while exposing an inverse symmetry trade-off: uncentered `max(|x|)` scaling breaks Shift $+100$ equivariance (`0.033 -> 0.455`) by shrinking shifted differences $101 times$.
156
+
157
+ #figure(
158
+ image("figures/fig4_output_examples.png", width: 100%),
159
+ caption: [*Concrete output examples across positive wins and negative failures ($n=8$).* Row 1 (ID): 36-param `PolySortNet-Adapt m=2` closely matches ground truth (`0.0048`). Row 2 (Shift $+100$): `PolySortNet` retains exact shift equivariance (`0.0048`) while `PiNet` diverges ($1.9 times 10^(17)$) and `SetTransformer` collapses to `mean ~0.8` (`MAE = 99`). Row 3 (Scale $2 times$): pure polynomial blows up (`INF`), whereas non-poly `DiffSort-Cauchy` stays exact (`0.0031`).],
160
+ )
161
+
162
+ #figure(
163
+ image("figures/fig5_zeroshot_and_scale_cliff.png", width: 100%),
164
+ caption: [*OOD generalization boundaries (H5).* (A) Zero-shot list-length extrapolation from $n=4$ to $n=128$ (16× training length). (B) Scale extrapolation sweep $s in [0.1, 5.0]$ isolating the sharp pure-polynomial divergence cliff vs. A6 non-poly scaling and `DiffSort-Cauchy`.],
165
+ )
166
+
167
+ == Causal Ablations (A1–A6) and Honest Hypothesis Falsifications
168
+
169
+ Table 2 and Figure 6 summarize all 30 Stage-4D causal interventions against `PolySortNet-Adaptive` ($L=3, m=1$, fixed-point odd Chebyshev, Bitonic wiring, Cheon init, MSE):
170
+ 1. *A1 Parameterization — H6 Part 1 FALSIFIED on ID MAE, Refined as Pareto Frontier:* Removing $h_k (1) = 1$ (`unconstrained_odd_cheby`, `raw_monomial`, `general_cheby`) *reduces* ID MAE by 26–30% (`0.0234 / 0.0273` vs. `0.0333 / 0.0369`, $r_"rb" = +0.90$ and $+0.94$) and cuts $n=16$ Bimodal MAE 2.2× (`0.0389` vs. `0.0858`). *Mechanism:* Because late Bitonic stages only receive small $|Delta| lt.tilde 0.4$, unconstrained polynomials contract their valid domain to boost Stage-5 slope ($9.58 -> 14.3$), letting $s_5 (1.0)$ explode to $-444.7$ through $-1037.7$ and causing immediate blow-up at Scale $1.3 times$ ($R_"stable": 1.3 -> 1.1$). Fixed-point anchoring is thus a *scale-stability regularizer*, not an ID-MAE maximizer.
171
+ 2. *A2 Depth Separation — H3 Part 1 FALSIFIED at Iso-Degree $D=9$, CONFIRMED at Iso-Parameter:* At strict iso-degree $D=9$, 4-param/stage flat `L=1, d=9` (`0.0566 / 0.0674`) beats 2-param/stage composite `L=2, d=3` (`0.0771 / 0.0831`) because the 2D composite manifold is strictly contained in the 4D flat degree-9 space—yet flat deg-9 suffers severe Runge boundary explosion ($s(1.1)=1.92 => R_"stable" = 0.00$). At *equal parameter budget (4 params/stage)*, composite *`L=4, d=3` (degree 81)* crushes flat deg-9 by *4.28× / 4.13×* (`0.0132 / 0.0163`, `Ex@0.05 = 91.8% / 61.4%` vs. `1.4% / 0.0%`) while simultaneously expanding stability to *$R_"stable" = 1.50$* (`|s(1.5)| <= 1.005`), strictly dominating quintic `m=2` (`R_stable = 1.00`) on stability!
172
+ 3. *A3 Init, A4 Wiring (H6 Part 2), and A5 Loss:* Cheon init beats identity ($c=0$) and random init by 4–8% MAE with 0% divergence across all three. Replacing valid wiring with `RandomFixed` causes total collapse (`0.00%` Mono, MAE `0.386 / 0.436`), proving wiring causality. *Batcher Odd-Even Merge* beats Bitonic by 10–13% MAE (`0.0288 / 0.0333`) and halves Scale $1.5 times$ error (`0.0839` vs. `0.1532`). *Habermann Odd-Even Transposition* hits `99.30% / 96.77%` Mono ($tau = 0.9988$ and $0.9983$) at the cost of a 2.74× reversed-input asymmetry at $n=16$ (`EdgeR = 0.1349` vs. `EdgeS = 0.0493`). Adding a monotonicity hinge (`w=0.1`, A5) lifts $n=16$ Mono by +6.71 pp (`75.81% -> 82.52%`) at +3.7% MAE cost.
173
+
174
+ #figure(
175
+ text(size: 8.1pt)[#table(
176
+ columns: (2.8fr, 0.55fr, 0.85fr, 1.0fr, 1.0fr, 0.95fr, 0.95fr, 0.65fr),
177
+ align: (left, center, right, right, right, right, right, right),
178
+ [Ablation Intervention (vs. Ref $L=3, m=1$)], [Poly], [Params], [MAE ($8$)], [MAE ($16$)], [Mono ($16$)], [Ex05 ($16$)], [$R_"stab"$],
179
+ [*Reference:* `PolySortNet-Adapt` (Fixed-Pt, Bitonic, MSE)], [Yes], [18 / 30], [0.03325], [0.03694], [75.81%], [0.95%], [1.30],
180
+ [A1: Unconstrained Odd Cheby (*H6.1 falsified*)], [Yes], [36 / 60], [*0.02342*], [0.02783], [84.66%], [9.21%], [1.10],
181
+ [A1: Raw Monomial Basis (*H6.1 falsified*)], [Yes], [36 / 60], [0.02381], [*0.02731*], [88.16%], [11.23%], [1.10],
182
+ [A1: General Cheby (no odd symmetry)], [Yes], [72 / 120], [0.02341], [0.02809], [82.36%], [8.32%], [1.10],
183
+ [A2: Flat `L=1, d=9` (4p/st, deg 9; *Runge cliff*)], [Yes], [24 / 40], [0.05662], [0.06742], [90.41%], [0.00%], [0.00],
184
+ [A2: Comp `L=2, d=3` (2p/st, deg 9; *H3.1 falsified*)], [Yes], [12 / 20], [0.07712], [0.08312], [90.26%], [0.00%], [0.00],
185
+ [A2: *Comp `L=4, d=3` (4p/st, deg 81; Best Frontier)*], [Yes], [24 / 40], [*0.01322*], [*0.01631*], [81.47%], [*61.38%*], [*1.50*],
186
+ [A3: Identity Init ($c=0$) / Random Init], [Yes], [18 / 30], [0.0348 / 0.0344], [0.0389 / 0.0399], [73.3% / 67.3%], [0.6% / 0.5%], [1.30],
187
+ [A4: *Batcher Odd-Even Merge Wiring*], [Yes], [18 / 30], [*0.02884*], [*0.03326*], [80.85%], [2.29%], [1.30],
188
+ [A4: Habermann Odd-Even Transposition], [Yes], [24 / 48], [0.03830], [0.04114], [*96.77%*], [0.41%], [1.30],
189
+ [A4: Random Fixed Wiring (*Negative Control*)], [Yes], [18 / 30], [0.38611], [0.43629], [0.00%], [0.00%], [0.00],
190
+ [A5: Huber Loss / MSE + Mono Hinge ($lambda = 0.1$)], [Yes], [18 / 30], [0.0322 / 0.0333], [0.0364 / 0.0383], [73.1% / 82.5%], [1.4% / 0.7%], [1.30],
191
+ [A6: Non-Poly `max(|x|)` Wrapper (*H5 Causal Proof*)], [No], [18 / 30], [0.02934], [0.03512], [76.34%], [1.56%], [*5.00*],
192
+ )],
193
+ caption: [*Causal ablation matrix (Stage 4D, 30 runs, seed 42).* Every row modifies a single causal factor relative to `PolySortNet-Adapt`.],
194
+ )
195
+
196
+ #figure(
197
+ image("figures/fig6_ablations_and_training.png", width: 100%),
198
+ caption: [*Causal ablations (A1–A4) and validation convergence.* (A) Iso-degree vs. iso-parameter depth separation. (B) Accuracy-vs-$R_"stable"$ Pareto frontier. (C) Wiring topology causality. (D) Validation MAE trajectories on $n=16$.],
199
+ )
200
+
201
+ = Claims, Evidence Strength Taxonomy, and Preregistration Verdict
202
+
203
+ Following truth-seeking scientific reporting standards (#link("https://arxiv.org/abs/1807.03341")[Lipton & Steinhardt, 2018]\; #link("https://www.lesswrong.com/s/5GT3yoYM9gRmMEKqL")[Nanda, 2022]), Table 3 classifies every claim by confidence tier and exact evidence modality:
204
+
205
+ #figure(
206
+ table(
207
+ columns: (auto, auto, auto, auto),
208
+ align: (left, center, center, left),
209
+ [Scientific Claim / Hypothesis], [Confidence Tier], [Evidence Type], [Grounding & Honest Qualification],
210
+ [Exact sum conservation & shift equivariance of odd-CAS `PolySortNet`], [*Guarantee*], [Algebraic Proof + f64 Audit], [Holds for all $x in RR^n, c in RR$; verified to $2.1 times 10^(-16)$ and $6.6 times 10^(-14)$ in float64.],
211
+ [Finite scale stability radius for all non-affine pure PNNs (H5)], [*Guarantee* + Causal], [Math Proof + A6 Intervention], [Polynomial growth $O(||x||^D)$ forces divergence; A6 `max(|x|)` restores $R_"stable" = 5.0$.],
212
+ [H1: `PolySortNet-m2` beats unstructured PNNs & `DeepSets-Poly`], [*Systematic* (narrow to $m >= 2$ or $n >= 16$)], [5-Seed Paired Wilcoxon], [5/5 seeds, $4.2 times - 8.3 times$ MAE reduction, $r_"rb" = -1.000, p_"holm" < 10^(-300)$. *Caveat:* cubic $m=1$ ties `DeepSets-Poly` at $n=8$.],
213
+ [H2: Learned composite PNNs beat analytical CKKS at iso-degree], [*Systematic*], [Iso-Depth Benchmark + Weight Audit], [1.6×–3.9× lower MAE vs. Cheon $f_1^((3))$, Remez $L=3$, and $f_3 compose g_3$ ($p_"holm" < 10^(-300)$).],
214
+ [H3: Composite depth separation vs. flat polynomial], [*Refined* (H3.1 *Falsified*; Iso-Param Confirmed)], [Causal Ablation A2], [Flat `L=1, d=9` beats `L=2, d=3` at iso-degree $D=9$; iso-param `L=4, d=3` beats flat deg-9 by 4.28× and widens $R_"stable"$ $0 -> 1.50$.],
215
+ [H4: `PolyPairwiseRank` crossover ($n=8$ vs. $n=16$)], [*Systematic*], [5-Seed Paired Wilcoxon], [Beats `PiNet`/`PolyMLP` at $n=8$; degrades to `0.0738` (`0.11%` Mono) at $n=16$ ($7.52 times$ behind `PolySortNet-m2`).],
216
+ [H6.1: Fixed-point anchor improves ID MAE], [*FALSIFIED*], [Causal Ablation A1 + Transfer Audit], [Unconstrained odd polynomials cut MAE 26–30% via late-stage domain contraction ($s_5(1)=-445..-1038$), trading $R_"stable": 1.3 -> 1.1$.],
217
+ [H6.2: Sorting-network wiring is causally necessary], [*Causal Proof*], [Ablation A4], [Random fixed wiring fails (`0.00%` Mono, 11.8× worse MAE); Batcher Odd-Even Merge beats Bitonic 10–13%.],
218
+ ),
219
+ caption: [*Calibrated claims and evidence taxonomy* distinguishing mathematical guarantees, causal interventions, systematic multi-seed results, and explicit preregistration falsifications.],
220
+ )
221
+
222
+ = Related Work, Discussion, and Limitations
223
+
224
+ *Related Work.* Classical polynomial architectures include GMDH (Ivakhnenko, 1971) and Pi-Sigma networks (Shin & Ghosh, 1991). #link("https://arxiv.org/abs/1905.12207")[Kileel et al. (2019)] analyzed functional varieties of deep polynomial networks, while #link("https://arxiv.org/abs/2006.13026")[Chrysos et al. (2021)] scaled high-order tensor-factorized $Pi$-Nets (`CCP`, `NCP`, `NCP-Skip`)—usually inserting normalization or `tanh`. #link("https://arxiv.org/abs/2405.07200")[Sidharth et al. (2024)] introduced `ChebyKAN` using `tanh`-clamped Chebyshev bases; our fixed-point CAS formulation eliminates `tanh` entirely. On sets, #link("https://arxiv.org/abs/1703.06114")[Zaheer et al. (2017)] and #link("https://arxiv.org/abs/1901.09006")[Wagstaff et al. (2019)] characterized power-sum symmetric encoders, and #link("https://arxiv.org/abs/1810.00825")[Lee et al. (2019)] introduced `SetTransformer`. Differentiable sorting relaxations—`NeuralSort` (#link("https://arxiv.org/abs/1903.08850")[Grover et al., 2019]), Sinkhorn OT (#link("https://arxiv.org/abs/1905.11885")[Cuturi et al., 2019]), permutahedron projection (#link("https://arxiv.org/abs/2002.08871")[Blondel et al., 2020]), `SoftSort` (#link("https://arxiv.org/abs/2006.16038")[Prillo & Eisenschlos, 2020]), and `diffsort` (#link("https://arxiv.org/abs/2105.04019")[Petersen et al., 2021]\; #link("https://arxiv.org/abs/2203.09630")[Petersen et al., 2022])—all require non-polynomial operations. Conversely, homomorphic encryption (CKKS) sorting (#link("https://eprint.iacr.org/2019/1234")[Cheon et al., 2020]; Hong et al., 2021; #link("https://eprint.iacr.org/2020/834")[Lee et al., 2022]\; #link("https://arxiv.org/abs/2412.15126")[Mazzone et al., 2025]) operates strictly in the polynomial ring but relies on fixed analytical coefficients.
225
+
226
+ *Implications for Encrypted Inference (CKKS) and Circuit Design.* Our results have an immediate practical implication for CKKS encrypted sorting: *training composite comparator polynomials end-to-end on the target data distribution cuts value sorting error by 1.6×–3.9× at the exact same multiplicative depth and bootstrapping budget!* Furthermore, our A2 ablation identifies `L=4, d=3` (fixed-point nested cubics) as a superior accuracy–stability operating point ($R_"stable" = 1.50$, `91.8%` Ex\@0.05 at $n=8$) compared to quintic `L=3, m=2` ($R_"stable" = 1.00$), and A4 identifies Batcher Odd-Even Merge as strictly better than Bitonic at identical stage count.
227
+
228
+ *Limitations.* (1) *Fixed input scale domain:* Pure polynomials require inputs within their stability radius (typically $s <= 1.0$–$1.5$); unbounded inputs require external rescaling (e.g., centered non-poly scaling `(x - mean)/max(|x - mean|)` to preserve both shift and scale equivariance). (2) *Multiplicative depth scaling:* `PolySortNet` has sequential depth $O(L log^2 n)$, whereas `PolyPairwiseRank` has constant depth $O(1)$ but loses fidelity at $n >= 16$ unless rank-indicator degree scales with $n$. (3) *Power-of-2 wiring:* Bitonic/Odd-Even Merge natively sort power-of-2 lengths (arbitrary $n$ requires padding with $+1$ sentinels). (4) *Single-seed ablations:* Stages 4D and 4E-sens ran on seed `42` (mitigated by verifying near-zero `PolySortNet` seed variance `SD <= 8e-5` across all 5 seeds in Stage 4E). (5) *Non-polynomial ceiling:* When strict polynomiality is unnecessary (standard plaintext ML), `DiffSort` and `SetTransformer` achieve 2.3×–14× lower in-distribution MAE.
229
+
230
+ = Conclusion
231
+
232
+ We presented the first preregistered, mechanically purity-audited scientific study of strictly pure Polynomial Neural Networks for continuous list sorting across 178 experimental runs. Algorithmic inductive bias—combining data-oblivious sorting-network wiring with deep composite odd Chebyshev comparators—bridges nearly the entire accuracy gap between unstructured high-order PNNs and transcendental neural sorters while using *3–60 parameters*, outperforming hand-crafted CKKS minimax polynomials by up to *3.9×* at iso-depth, extrapolating *16× zero-shot to $n=128$*, and beating a 96.6k-parameter `SetTransformer` on Shift $+100$, Near-Ties, Duplicates, and Zero-Shot $n=128$. Equally importantly, our causal ablations honestly falsified two preregistered expectations—uncovering the late-stage domain-contraction trade-off behind fixed-point anchoring and the sharp separation between iso-degree and iso-parameter polynomial depth—establishing a grounded blueprint for polynomial circuit learning.
233
+
234
+ = References
235
+
236
+ #set text(size: 8.3pt)
237
+ - Batcher, K. E. (1968). Sorting Networks and Their Applications. _AFIPS Spring Joint Computer Conference_, 307–314.
238
+ - Bernstein, S. (1914). Sur la meilleure approximation de $|x|$ par des polynômes de degrés donnés. _Acta Mathematica_, 37(1), 1–57.
239
+ - Blondel, M., Teboul, O., Berthet, Q., & Djolonga, J. (2020). Fast Differentiable Sorting and Ranking. _ICML 2020_, #link("https://arxiv.org/abs/2002.08871")[arXiv:2002.08871].
240
+ - Cheon, J. H., Kim, D., & Kim, D. (2020). Efficient Homomorphic Comparison Methods with Optimal Complexity. _ASIACRYPT 2020_, #link("https://eprint.iacr.org/2019/1234")[IACR ePrint 2019/1234].
241
+ - Chrysos, G. G., Moschoglou, S., Bouritsas, G., Panagakis, Y., Deng, J., & Zafeiriou, S. (2021). Deep Polynomial Neural Networks. _IEEE TPAMI_, #link("https://arxiv.org/abs/2006.13026")[arXiv:2006.13026] (#link("https://github.com/grigorisg9gr/polynomial_nets")[Code]).
242
+ - Cuturi, M., Teboul, O., & Vert, J.-P. (2019). Differentiable Ranks and Sorting using Optimal Transport. _NeurIPS 2019_, #link("https://arxiv.org/abs/1905.11885")[arXiv:1905.11885].
243
+ - Grover, A., Wang, E., Zweig, A., & Ermon, S. (2019). Stochastic Optimization of Sorting Networks via Continuous Relaxations. _ICLR 2019_, #link("https://arxiv.org/abs/1903.08850")[arXiv:1903.08850].
244
+ - Habermann, A. N. (1972). Parallel Neighbor-Sort. _Carnegie-Mellon University Technical Report_.
245
+ - Hong, S., Kim, S., Choi, J., Lee, Y., & Cheon, J. H. (2021). Efficient Sorting of Homomorphic Encrypted Data with $k$-Way Sorting Network. _IEEE TIFS_, 16, 4389–4404.
246
+ - Ivakhnenko, A. G. (1971). Polynomial Theory of Complex Systems. _IEEE Trans. Systems, Man, and Cybernetics_, 1(4), 364–378.
247
+ - Kileel, J., Trager, M., & Bruna, J. (2019). On the Expressive Power of Deep Polynomial Neural Networks. _NeurIPS 2019_, #link("https://arxiv.org/abs/1905.12207")[arXiv:1905.12207].
248
+ - Knuth, D. E. (1998). _The Art of Computer Programming, Vol. 3: Sorting and Searching_ (2nd ed.), Sec. 5.3.4. Addison-Wesley.
249
+ - Lee, E., Lee, J.-W., No, J.-S., & Kim, Y.-S. (2022). Minimax Approximation of Sign Function by Composite Polynomial for Homomorphic Comparison. _IEEE TDSC_, 19(6), 3711–3727, #link("https://eprint.iacr.org/2020/834")[IACR ePrint 2020/834].
250
+ - Lee, J., Lee, Y., Kim, J., Kosiorek, A., Choi, S., & Teh, Y. W. (2019). Set Transformer: A Framework for Attention-based Permutation-Invariant Neural Networks. _ICML 2019_, #link("https://arxiv.org/abs/1810.00825")[arXiv:1810.00825].
251
+ - Lipton, Z. C., & Steinhardt, J. (2018). Troubling Trends in Machine Learning Scholarship. #link("https://arxiv.org/abs/1807.03341")[arXiv:1807.03341].
252
+ - Lones, M. A. (2021/2024). How to Avoid Machine Learning Pitfalls: A Guide for Academic Researchers. #link("https://arxiv.org/abs/2108.02497")[arXiv:2108.02497].
253
+ - Mazzone, F., Everts, M., Hahn, F., & Peter, A. (2025). Efficient Ranking, Order Statistics, and Sorting under CKKS. _USENIX Security 2025_, #link("https://arxiv.org/abs/2412.15126")[arXiv:2412.15126].
254
+ - Nanda, N. (2022–2024). How I Think About My Research Process. #link("https://www.lesswrong.com/s/5GT3yoYM9gRmMEKqL")[LessWrong / Alignment Forum Sequence].
255
+ - Petersen, F., Borgelt, C., Kuehne, H., & Deussen, O. (2021). Differentiable Sorting Networks for Scalable Sorting and Ranking Supervision. _ICML 2021_, #link("https://arxiv.org/abs/2105.04019")[arXiv:2105.04019] (#link("https://github.com/Felix-Petersen/diffsort")[Code]).
256
+ - Petersen, F., Borgelt, C., Kuehne, H., & Deussen, O. (2022). Monotonic Differentiable Sorting Networks. _ICLR 2022_, #link("https://arxiv.org/abs/2203.09630")[arXiv:2203.09630].
257
+ - Prillo, S., & Eisenschlos, J. (2020). SoftSort: A Continuous Relaxation for the argsort Operator. _ICML 2020_, #link("https://arxiv.org/abs/2006.16038")[arXiv:2006.16038].
258
+ - Shin, Y., & Ghosh, J. (1991). The Pi-Sigma Network: An Efficient Higher-Order Neural Network. _IJCNN 1991_, 1, 13–18.
259
+ - Sidharth, S. S., et al. (2024). Chebyshev Polynomial-Based Kolmogorov-Arnold Networks. #link("https://arxiv.org/abs/2405.07200")[arXiv:2405.07200].
260
+ - Varga, R. S., & Carpenter, A. J. (1985). On the Bernstein Conjecture in Approximation Theory. _Numerische Mathematik_, 47, 179–196.
261
+ - Wagstaff, E., Fuchs, F. B., Engelcke, M., Posner, I., & Osborne, M. A. (2019). On the Limitations of Representing Functions on Sets. _ICML 2019_, #link("https://arxiv.org/abs/1901.09006")[arXiv:1901.09006].
262
+ - Zaheer, M., Kottur, S., Ravanbakhsh, S., Poczos, B., Salakhutdinov, R., & Smola, A. (2017). Deep Sets. _NeurIPS 2017_, #link("https://arxiv.org/abs/1703.06114")[arXiv:1703.06114].
263
+
264
+ #pagebreak()
265
+ #set text(size: 9pt)
266
+ #heading(numbering: none)[Appendix A: Exact Learned Pure-Polynomial Coefficients]
267
+
268
+ For complete reproducibility (and direct drop-in replacement inside CKKS encrypted sorting circuits), the exact learned fixed-point odd Chebyshev layer coefficients $h_k (u) = u + u(1 - u^2) sum_(j=0)^(m-1) c_(k,j) T_(2j)(u)$ for our 3-parameter and 6-parameter zero-shot shared networks (`seed=42`, trained on $n=8$) are:
269
+ - *`PolySortNet-Shared (m=1)` (3 scalars, deg 27, zero-shot $n=128$ MAE `0.0581`):*
270
+ $c_1 = [1.4017459]$, $c_2 = [0.8520995]$, $c_3 = [0.7529720]$.
271
+ - *`PolySortNet-Shared (m=2)` (6 scalars, deg 125, zero-shot $n=128$ MAE `0.0200`, $tau = 0.9978$):*
272
+ $c_1 = [0.7872190, -1.5390211]$, $c_2 = [1.1491840, -0.9942412]$, $c_3 = [0.9384390, -0.3469870]$.
273
+
274
+ Notice that both models autonomously learn *decreasing higher-order gain* across composite layers (strong initial amplification followed by gentle terminal contraction). All 8 pure-polynomial browser models execute identically (`0.00e+00` float64 max abs diff vs. PyTorch) live at #link("https://burnycoder.github.io/polynomial-neural-network-sort-list/")[burnycoder.github.io/polynomial-neural-network-sort-list].
275
+
276
+ #heading(numbering: none)[Appendix B: Hyperparameter, Batch-Size, and `float64` Sensitivity Audit (Stage 4E-sens)]
277
+
278
+ #figure(
279
+ table(
280
+ columns: (auto, auto, auto, auto, auto, auto, auto),
281
+ align: (left, left, right, right, right, right, right),
282
+ [Sensitivity Axis], [Configuration ($n=8$, seed 42)], [ID MAE], [RMSE], [Mono %], [Ex\@0.05], [$R_"stab"$],
283
+ [PolySort LR], [`lr=3e-4` / `1e-3` / `3e-3` / `8e-3` / `1e-2`], [0.0570 / 0.0384 / 0.0338 / 0.0333 / *0.0332*], [0.071..0.042], [87–94%], [0.7–16.6%], [0.0 / 1.3],
284
+ [PiNet LR Audit], [`lr=3e-4` / `1e-3` / `3e-3` / `1e-2`], [0.0771 / 0.0745 / 0.0520 / *0.0423*], [0.099..0.056], [91–97%], [0.4–7.7%], [0.0 / 1.1],
285
+ [Weight Decay], [`wd=0.0` vs. `wd=0.01` (`PolySortNet`)], [0.033254 vs. 0.033258], [0.04191], [94.09% / 94.02%], [16.4%], [1.30],
286
+ [Batch Size], [`bs=512` / `2048` / `4096` (40 ep)], [*0.03165* / 0.03321 / 0.03327], [0.0397..0.0419], [94.1–94.3%], [20.8–16.4%], [1.2 / 1.3],
287
+ [Float64 Train], [`L=3` (`float64` vs. `float32`)], [*0.033254* vs. 0.033254 (6-dec match)], [0.041907], [94.09%], [16.38%], [1.30],
288
+ [Float64 Train], [`L=4` deg 81 (`float64` vs. `float32`)], [*0.013222* vs. 0.013222 (6-dec match)], [0.017113], [96.22%], [91.80%], [1.50],
289
+ ),
290
+ caption: [*Stage 4E sensitivity sweep (15 runs).* Confirms zero `float32` numerical drift even at degree 81, weight-decay invariance, slightly conservative `bs=4096` throughput setting, and honest LR tuning of `PiNet-NCP-Skip`.],
291
+ )
292
+
293
+ #heading(numbering: none)[Appendix C: NeurIPS Paper Checklist Verification]
294
+ - *Claims & Limitations:* Every claim is backed by paired statistical tests, 95% CIs, or algebraic proof; both falsified preregistered hypotheses (H3.1, H6.1) and pure-polynomial scale blow-up limitations are prominently disclosed.
295
+ - *Code, Data, Checkpoints & Reproducibility:* Full modular `src/pnn_sort/` package, 62 automated `pytest` tests (including FX purity & Knuth 0-1 verification), all 178 run JSONs, and trained checkpoints are publicly archived on GitHub and Hugging Face with deterministic SHA-256 split seeds.
296
+ - *Statistical Rigor:* 5 independent seeds across all 10 core models $times$ 2 lengths (100 cells), 10,000-resample bootstrap CIs, paired Wilcoxon signed-rank tests with rank-biserial effect sizes, and Holm-Bonferroni correction across all 34 tests.
297
+ - *Compute Accounting:* Single NVIDIA RTX 5070 Laptop GPU (8 GB VRAM), $approx 5$ hours total compute across 178 runs; all training scripts support atomic resume.
reports/plan.md CHANGED
@@ -16,5 +16,5 @@ Train, rigorously evaluate, ablate, visualize, and publish a scientific study of
16
  - [x] **Phase 4B:** Remaining main PNN architectures (`PolyPairwiseRank`, `PolySortNetLearnedWire`, `DeepSetsPoly`, `PiNetSorter`, `PolyMLP`) + scaling study ($n=4..128$), Review #2.
17
  - [x] **Phase 4C:** Trained controls (`ShuffledTargetControl`) & non-polynomial baselines (`DiffSort`, `ReLU-MLP`, `SetTransformer`).
18
  - [x] **Phase 4D:** 6 causal ablation suites (30 runs) + Adversarial NeurIPS Self-Review #3.
19
- - [ ] **Phase 4E:** 5-seed statistical rigor (80 new runs; 100 core cells) + hyperparameter/batch/float64 sensitivity sweep (15 runs) — *IN PROGRESS*.
20
- - [ ] **Phase 5:** Publication visualizations, GitHub Pages live browser polynomial sorter, full scientific paper (`reports/paper.pdf`, `reports/summary.md`), Final Triple-Check & Adversarial Review #4, final GitHub + HF sync.
 
16
  - [x] **Phase 4B:** Remaining main PNN architectures (`PolyPairwiseRank`, `PolySortNetLearnedWire`, `DeepSetsPoly`, `PiNetSorter`, `PolyMLP`) + scaling study ($n=4..128$), Review #2.
17
  - [x] **Phase 4C:** Trained controls (`ShuffledTargetControl`) & non-polynomial baselines (`DiffSort`, `ReLU-MLP`, `SetTransformer`).
18
  - [x] **Phase 4D:** 6 causal ablation suites (30 runs) + Adversarial NeurIPS Self-Review #3.
19
+ - [x] **Phase 4E:** 5-seed statistical rigor (80 new runs; 100 core cells) + hyperparameter/batch/float64 sensitivity sweep (15 runs) — **178/178 runs DONE**.
20
+ - [x] **Phase 5:** Publication visualizations, GitHub Pages live browser polynomial sorter, full scientific paper (`reports/paper.pdf`, `reports/summary.md`), Final Triple-Check & Adversarial Review #4, final GitHub + HF sync — **100% COMPLETE**.
reports/progress.md CHANGED
@@ -1,19 +1,17 @@
1
  # Live Progress Report (`pnn-sort`)
2
 
3
- **Last Updated:** 2026-11-25 19:17 CET
4
 
5
- ## Current Status
6
- - **Overall Plan Completion:** **~78% complete** (**~22% remaining**; **98 / 178** preregistered experiment runs complete).
7
- - **Live Accuracy Monitor:** Active at `http://127.0.0.1:18080`.
8
- - **Done:**
9
- - Phases 0–3 (Lit/SOTA review, Preregistration `H1–H6`, Modular `src/pnn_sort/`, 62/62 pytests, Review #1).
10
- - Stages 4A (26 runs), 4B (17 runs + Review #2), 4C (10 runs), Stage 4D (30 causal ablations + Review #3).
11
- - **Stage 4E Sensitivity Sweeps (`4e_sens`, 15/15 runs DONE):**
12
- - `float64` training matches `float32` to **6 decimal places** on both `L=3` (`0.033254`) and degree-81 `L=4` (`0.013222`), ruling out precision drift.
13
- - Weight-decay invariant (`wd=0`: `0.033254` vs `wd=0.01`: `0.033258`); batch-size audit confirms `bs=4096` (`0.03327`) is slightly conservative vs `bs=512` (`0.03165`).
14
- - Fair LR audit shows `PiNet-NCP-Skip` improves to `0.04232` at `lr=0.01` (still $5.85\times$ behind 36-param `PolySortNet-Adaptive-m2`).
15
- - Phase 5 scaffolding built & verified early: `aggregate.py`, `build_paper_assets.py` (6 polished figures), and interactive browser pure-polynomial sorter `docs/index.html` (verified `0.00e+00` bit-exact float64 parity vs PyTorch across all 8 exported models!).
16
- - **In Progress Now:**
17
- - Pushing `4e_sens` + Phase 5 web/viz scaffolding to GitHub & Hugging Face, then executing **`4e_seeds`** (**80 runs**: 10 core models $\times$ $n \in \{8, 16\}$ $\times$ 4 remaining seeds `123, 456, 789, 1024`, with mid-stage GitHub/HF push after the 40 $n=8$ runs; ~80–100 min total on RTX 5070).
18
- - **Next Up (Final Phase 5, ~35–45 min):**
19
- - Re-run `aggregate.py` & `build_paper_assets.py` on all 178 runs (final 5-seed `mean ± std`, 10k bootstrap 95% CIs, Holm-Bonferroni Wilcoxon tests), write `stage-4e` report, compile full academic paper `reports/paper.pdf` (by Libor "Burny" Burian) + `reports/summary.md`, update comprehensive `README.md`, enable live GitHub Pages (`docs/`), complete **Final Triple-Check & Adversarial Review #4**, final GitHub & HF push.
 
1
  # Live Progress Report (`pnn-sort`)
2
 
3
+ **Last Updated:** 2026-11-25 21:53 CET
4
 
5
+ ## Final Status: 100% COMPLETE
6
+ - **Overall Plan Completion:** **100% complete** (**178 / 178 preregistered experiment runs**, 62/62 passing `pytest` tests, 4/4 Adversarial Self-Reviews).
7
+ - **Live Interactive Browser Pure-Polynomial Sorter:** [https://burnycoder.github.io/polynomial-neural-network-sort-list/](https://burnycoder.github.io/polynomial-neural-network-sort-list/) (bit-exact `0.00e+00` float64 parity vs. PyTorch across all 8 pure-polynomial models).
8
+ - **GitHub Repository:** [https://github.com/BurnyCoder/polynomial-neural-network-sort-list](https://github.com/BurnyCoder/polynomial-neural-network-sort-list)
9
+ - **Hugging Face Checkpoints & Paper:** [https://huggingface.co/BurnyCoder/polynomial-neural-network-sort-list](https://huggingface.co/BurnyCoder/polynomial-neural-network-sort-list)
10
+ - **Deliverables Completed & Audited:**
11
+ - Verified Literature & SOTA Reviews (`reports/literature-review.md`, `reports/state-of-the-art-review.md`).
12
+ - Pre-Results Preregistration (`H1–H6`) & Planned Run Matrix (`reports/preregistration.md`, `reports/planned-runs.md`).
13
+ - Modular `src/pnn_sort/` package + PyTorch FX purity auditor + real-time accuracy dashboard + 62/62 unit tests.
14
+ - All 178 runs across Stages 4A, 4B, 4C, 4D (30 causal ablations), `4e_sens` (15 sensitivity/float64 runs), and `4e_seeds` (80 final multi-seed runs = 100 core 5-seed cells).
15
+ - Final 5-seed aggregation (`results/multiseed_summary.json`, `results/statistical_tests.json`, `results/summary_table.csv`) with 10k bootstrap 95% CIs & Holm-Bonferroni Wilcoxon tests.
16
+ - 6 visually audited publication figures (`reports/paper/figures/` & `docs/figures/`).
17
+ - Full compiled academic paper `reports/paper.pdf` (authored by Libor "Burny" Burian, 2026-11-25), `reports/summary.md`, comprehensive `README.md`, and Adversarial Self-Reviews #1–#4.
 
 
reports/reviews/review-04-final.md ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Adversarial Self-Review #4: Final Pre-Publication Scientific & Reproducibility Audit
2
+
3
+ **Date:** 2026-11-25
4
+ **Reviewer Role:** Skeptical NeurIPS Area Chair & Methodology Auditor
5
+ **Scope:** End-to-end triple-check across all **178 / 178 runs**, 5-seed statistics (100 core cells), 34 Holm-Bonferroni Wilcoxon tests, 62 automated `pytest` tests, all 6 publication figures, live browser pure-polynomial evaluator (`docs/index.html`), `reports/paper.pdf`, `reports/summary.md`, and `README.md`.
6
+
7
+ ---
8
+
9
+ ## 1. Scientific & Statistical Integrity Checklist (NeurIPS Standard)
10
+
11
+ | Audit Criterion | Status | Concrete Ground-Truth Verification |
12
+ | :--- | :---: | :--- |
13
+ | **Zero Data Leakage / Contamination** | **PASS** | SHA-256 keyed disjoint splits verified in `tests/test_data.py`; `ShuffledTarget` leakage control confirmed (`0.210 / 0.282` MAE, `0.0%` Ex@0.05). |
14
+ | **Strict Pure-Polynomial Enforcement** | **PASS** | Automated PyTorch FX tracer (`src/pnn_sort/audit.py`) audited 18/18 pure-PNN models and rejected 5/5 non-poly models (`62/62` pytest tests passing after final `trainer.py` edit). |
15
+ | **No p-Hacking / Pre- vs. Post-Hoc Transparency** | **PASS** | Preregistration (`H1–H6`) pushed to GitHub (`879258c`) *before* any training/eval results existed; all post-hoc adjustments (`analytical_cheon_fg`, HiGHS LP Remez, `bs=4096` WDDM fix, `R_stable` $s \ge 1.0$) explicitly logged in `preregistration.md` Sec. 7. |
16
+ | **Honest Reporting of Negative & Falsified Results** | **PASS** | Both falsified preregistered hypotheses (**H3.1** iso-degree $D=9$ and **H6.1** fixed-point ID MAE), the cubic $m=1$ vs. `DeepSets-Poly` $n=8$ tie (**H1d**), fair LR tuning of `PiNet-NCP-Skip` (`0.0423` at `lr=0.01`), pure-polynomial scale blow-up cliffs, and non-poly upper-bound gaps (`DiffSort`, `SetTransformer`) are prominently featured in Abstract, Tables 1–3, Fig. 4, Summary, and README. |
17
+ | **Multi-Seed Error Bars, CIs & Multiple-Testing Control** | **PASS** | All 10 core models $\times$ $n \in \{8, 16\}$ replicated across **5 independent seeds** (`42, 123, 456, 789, 1024`; 100 cells, 50,000 test lists/model). All 34 planned comparisons verified via two-sided paired Wilcoxon signed-rank tests, 10,000-resample bootstrap 95% CIs, rank-biserial effect sizes, and Holm-Bonferroni correction (`results/statistical_tests.json`). |
18
+ | **Confounder & Numerical Precision Audits** | **PASS** | Stage 4E sensitivity sweep confirmed zero `float32` vs. `float64` optimization drift to 6 decimal places even at degree $3^4 = 81$ (`L=4`), weight-decay invariance (`< 4e-6`), and conservative `bs=4096` setting (`0.03327` vs `bs=512` `0.03165`). |
19
+ | **No Graph Crimes & Visual PDF Audit** | **PASS** | Every PNG figure (`fig1..fig6`) and every page of `reports/paper.pdf` visually inspected directly; caught and fixed overlapping A1 scatter labels in Fig. 6B, `RandomFixed` scale-2x badge in Fig. 4, Table 1 header spacing, Typst math subscripts/fractions, and literal `~` spacing. Colorblind-safe Okabe-Ito palette throughout. |
20
+ | **Numerical Consistency Across Paper, README, & Raw JSONs** | **PASS** | Automated triple-check verified `178/178` run JSONs, `20/20` 5-seed cells, `34` Holm-Bonferroni tests, `6/6` figures in both `reports/paper/figures/` and `docs/figures/`, and `19/19` verbatim numerical cross-checks across `paper.typ` and `README.md`. |
21
+ | **Bit-Exact Browser Deployment & Reproducibility** | **PASS** | All 8 exported pure-polynomial models in `docs/weights.json` verified bit-exact (`0.00e+00` max abs diff vs. PyTorch float64) via Node.js; GitHub Pages live at `https://burnycoder.github.io/polynomial-neural-network-sort-list/`. |
22
+
23
+ ---
24
+
25
+ ## 2. Residual Limitations (Explicitly Retained in Paper Section 7)
26
+ 1. Stage-4D causal ablations and Stage-4E sensitivity runs are single-seed (`seed=42`); mitigated by verifying that `PolySortNet` exhibits seed SD $\le 8 \times 10^{-5}$ across all 5 seeds in Stage 4E.
27
+ 2. Pure polynomials cannot eliminate upper scale divergence ($s > R_{\text{stable}}$) without leaving the polynomial ring; centered non-polynomial scaling `(x - mean)/max(|x - mean|)` is left as clear future work.
28
+ 3. Bitonic/Odd-Even Merge wiring requires power-of-2 lengths natively (arbitrary lengths require $+1$ sentinel padding).
29
+
30
+ ---
31
+
32
+ ## 3. Final Publication Verdict
33
+ **ACCEPT (Camera-Ready).** All methodological, statistical, reproducibility, visualization, and scientific-integrity standards are met without outstanding defects. Approved for final synchronization to GitHub (`main` + GitHub Pages) and Hugging Face Hub.
reports/summary.md ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Executive Scientific Summary: Strictly Pure Polynomial Neural Networks for Sorting
2
+
3
+ **Author:** Libor "Burny" Burian
4
+ **Date:** 2026-11-25
5
+ **Paper:** [reports/paper.pdf](paper.pdf) | **Live Browser Sorter:** [https://burnycoder.github.io/polynomial-neural-network-sort-list/](https://burnycoder.github.io/polynomial-neural-network-sort-list/) | **Checkpoints:** [Hugging Face Hub](https://huggingface.co/BurnyCoder/polynomial-neural-network-sort-list)
6
+
7
+ ---
8
+
9
+ ## 1. Research Question & Core Takeaway
10
+ We asked whether a **strictly pure Polynomial Neural Network (PNN)**—using *exclusively* additions, subtractions, and multiplications at inference (mechanically verified via PyTorch FX with zero `ReLU`, `sigmoid`, `tanh`, `softmax`, `div`, `abs`, `min`/`max`, or normalization)—can learn to sort continuous real-valued lists, how architectural inductive bias governs accuracy and generalization, and whether gradient-trained composite polynomials beat hand-derived CKKS homomorphic-encryption minimax polynomials at identical polynomial degree.
11
+
12
+ Across **178 preregistered experimental runs** (17 architectures, 5 independent seeds on all 10 core models $\times$ $n \in \{8, 16\}$, 10 OOD suites, 6 causal ablations, and `float64`/hyperparameter audits), the answer is a **nuanced, causally verified yes — with sharp algebraic boundaries**:
13
+
14
+ ### Most Significant Positive Findings
15
+ 1. **36–60 parameter pure polynomials crush unstructured PNNs and beat analytical CKKS by $1.6\times\text{--}3.9\times$:**
16
+ - `PolySortNet-Adaptive (m=2)` (deg 125/gate) achieves 5-seed held-out MAE **`0.00724 ± 0.00000`** ($n=8$, `95.9%` Ex@0.05) and **`0.00981 ± 0.00008`** ($n=16$, `81.8%` Ex@0.05) — beating `DeepSets-Poly` (131k params) by **$4.56\times / 4.20\times$**, `PiNet-NCP-Skip` (202k params) by **$7.49\times / 6.35\times$**, `PolyMLP` by **$8.26\times / 6.61\times$**, non-polynomial `ReLU/GELU-MLP` by **$4.90\times / 6.48\times$**, and analytical CKKS Cheon/Hong/Mazzone $f_3\circ g_3$ by **$3.85\times$** (all Holm-Bonferroni paired Wilcoxon $p_{\text{holm}} < 10^{-300}$, 5/5 seeds).
17
+ 2. **Zero-shot $16\times$ length extrapolation & OOD wins over 96.6k-parameter `SetTransformer`:**
18
+ - 6-parameter `PolySortNet-Shared (m=2)` trained only on $n=8$ extrapolates zero-shot to **$n=128$** (28 Bitonic stages) with **MAE `0.02001` ($\tau = 0.9978$)**, beating `SetTransformer` (`0.05311`) by **$2.65\times$**.
19
+ - On 5-seed $n=8$ averages, 36-param `PolySortNet-Adaptive (m=2)` beats 96.6k-param `SetTransformer` on **Near-Ties $10^{-3}$** (`0.00659` vs `0.00665`), **50% Duplicates** (`0.00660` vs `0.00737`), and **Shift $+100$** (`0.00726` vs `99.50`, **$13{,}714\times$**), with exact float64 sum conservation ($2.1 \times 10^{-16}$) and shift equivariance ($6.6 \times 10^{-14}$).
20
+ 3. **Iso-parameter depth separation & autonomous Bitonic stride rediscovery:**
21
+ - Holding parameter count fixed at 4/stage, composite `L=4, d=3` (deg 81) beats flat `L=1, d=9` by **$4.28\times / 4.13\times$** (`0.0132 / 0.0163`, `Ex@0.05 = 91.8% / 61.4%`) while expanding upper scale stability from `0.00` (Runge blow-up) $\to$ **`1.50`**.
22
+ - Stage-adaptive slopes $s'(0)$ autonomously dip at every long-stride Bitonic merge reset (Stage 3 for $n=8$; Stages 1, 3, 6 for $n=16$) and ramp monotonically as stride halves.
23
+ 4. **Orders-of-magnitude lower seed variance & zero `float32` drift:**
24
+ - `PolySortNet-Adaptive (m=2)` exhibits seed SD `5.8e-7` at $n=8$ ($9{,}078\times$ smaller than `PiNet`); full `float64` training matches `float32` to 6 decimal places even at degree 81.
25
+
26
+ ### Most Significant Negative Results & Falsified Preregistered Hypotheses
27
+ 1. **H6 Part 1 FALSIFIED on ID MAE:** Removing the $h(1)=1$ fixed-point constraint (`unconstrained_odd_cheby`, `raw_monomial`, `general_cheby`) **improves** ID MAE by 26–30% (`0.0234 / 0.0273` vs `0.0333 / 0.0369`) by contracting late-stage comparator domains ($s_5(1) = -445 \text{ to } -1038$), trading away scale stability ($R_{\text{stable}}: 1.3 \to 1.1$).
28
+ 2. **H3 Part 1 FALSIFIED at strict iso-degree $D=9$:** 4-param/stage flat `L=1, d=9` (`0.0566 / 0.0674`) beats 2-param/stage composite `L=2, d=3` (`0.0771 / 0.0831`) on ID MAE before suffering Runge blow-up at $1.1\times$ scale.
29
+ 3. **Inevitable pure-polynomial upper scale cliff (H5 causally proven):** Every pure polynomial blows up at $s = 1.5\text{--}2.0$; non-poly `max(|x|)` wrapping (A6) immediately restores $R_{\text{stable}} = 5.0$ while breaking Shift $+100$ equivariance (`0.455 / 0.480`).
30
+ 4. **Non-polynomial upper bounds still lead in-distribution:** Transcendental `DiffSort-Logistic` (`0.00041 / 0.00069`), `DiffSort-Cauchy` (`0.00306 / 0.00424`), and `SetTransformer` (`0.00218 / 0.00377`) remain sharper on bounded ID lists.
31
+ 5. **Unstructured PNNs collapse at $n=16$ & H1 cubic caveat:** `PiNet`, `PolyMLP`, `ReLU-MLP`, and `PolyPairwiseRank` all score `0.0%` Ex@0.05 at $n=16$; cubic $m=1$ `PolySortNet` ties `DeepSets-Poly` at $n=8$ (`0.03327` vs `0.03300`) before dominating at $n=16$ and on OOD shifts/duplicates.