BurnyCoder commited on
Commit
5c813d9
·
verified ·
1 Parent(s): 63007c9

Upload folder using huggingface_hub

Browse files
reports/experiments/experiments.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Master Experiments Log (`pnn-sort`)
2
+
3
+ **Author:** Libor "Burny" Burian
4
+ **Last Updated:** 2026-11-25
5
+
6
+ ## Plain-Language Glossary of Key Terms
7
+ - **Pure Polynomial Neural Network (PNN):** A neural network whose forward calculation uses *only* additions, subtractions, and multiplications — no `ReLU`, `sigmoid`, `softmax`, `if/else`, divisions, or built-in `sort`.
8
+ - **Composite Polynomial Depth ($L$):** Instead of fitting one giant flat polynomial (which needs huge degree to approximate sharp corners like $|a-b|$), we feed a simple cubic or quintic polynomial into itself $L$ times. Three nested cubics produce a degree-$3^3 = 27$ polynomial with just 3 learnable numbers!
9
+ - **Sorting Network Wiring (Bitonic / Odd-Even):** A fixed blueprint of which pairs of slots to compare at each parallel step. Replacing each discrete compare-and-swap switch with a pure polynomial yields a **Polynomial Sorting Network (`PolySortNet`)**.
10
+ - **Value MAE ($\downarrow$):** Average absolute difference between the network's output list and the true sorted list. Closer to `0.0000` is better.
11
+ - **Monotonicity Rate ($\uparrow$):** Percentage of test lists where every output value is in valid sorted order ($\hat{y}_1 \le \hat{y}_2 \le \dots \le \hat{y}_n$).
12
+ - **Pairwise Order Accuracy / Kendall's $\tau$ ($\uparrow$):** Percentage of all element pairs in the output list that are in the correct relative order ($\tau = 1.0$ means zero inversions).
13
+ - **Scale Stability Radius ($R_{\text{stable}}$):** How much larger than $[-1, 1]$ input values can grow before a pure polynomial's higher-order terms inevitably explode.
14
+
15
+ ---
16
+
17
+ ## Summary Table of Completed Experiments
18
+
19
+ *(Populated incrementally as Stages 4A → 4E execute.)*
20
+
21
+ | Experiment Folder | Stage | Models Covered | Status | Key Highlight |
22
+ | :--- | :---: | :--- | :---: | :--- |
23
+ | `stage-4a-controls-and-main` | 4A | Analytical CKKS, Trivial/Linear Controls, `PolySortNet` (Shared & Stage-Adaptive) | Pending | — |
24
+ | `stage-4b-pnn-ladder-and-scaling` | 4B | `PolyPairwiseRank`, `LearnedWire`, `DeepSetsPoly`, `PiNet`, `PolyMLP`, $n=4..128$ | Pending | — |
25
+ | `stage-4c-baselines-and-controls` | 4C | `ShuffledTarget`, `DiffSort` (Logistic/Cauchy), `ReLU-MLP`, `SetTransformer` | Pending | — |
26
+ | `stage-4d-ablations` | 4D | 6 Causal Ablation Families (A1–A6) | Pending | — |
27
+ | `stage-4e-multiseed-and-sensitivity` | 4E | 5-Seed Statistical Rigor (100 runs) + Hyperparam & Float64 Sweeps | Pending | — |
reports/experiments/learnings.md ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Cumulative Scientific & Engineering Learnings (`pnn-sort`)
2
+
3
+ **Author:** Libor "Burny" Burian
4
+ **Last Updated:** 2026-11-25
5
+
6
+ This living log documents every key insight gained from the literature review, mathematical derivations, engineering/debugging mistakes, and empirical experiments.
7
+
8
+ ---
9
+
10
+ ## Learnings from Literature & State-of-the-Art Review (Phase 1)
11
+
12
+ 1. **Unifying Three Siloed Fields Reveals the Core Opportunity:**
13
+ - **Deep PNNs ($\Pi$-Nets; Chrysos et al., TPAMI 2021)** study expressive multivariate polynomial approximations (CCP, NCP, NCP-Skip, ProdPoly) but almost always insert BatchNorm/InstanceNorm or `tanh` to prevent high-order gradient blow-up, and have not been studied on non-smooth algorithmic sorting.
14
+ - **Differentiable Sorting Networks (`diffsort`; Petersen et al., ICML 2021 / ICLR 2022)** prove exact algebraic properties of odd-symmetric conditional swaps (sum conservation, shift invariance, idempotency, boundedness) and an $\epsilon \cdot \ell$ depth error bound (Theorem 9), plus monotonicity conditions ($f'(x) \in \Theta(1/x^2)$, Theorems 5 & 8) — but rely strictly on non-polynomial transcendental functions ($\exp$, $\arctan$, division).
15
+ - **Homomorphic CKKS Polynomial Sorting (Cheon et al., 2020; Hong et al., 2021; Lee et al., 2022; Mazzone et al., USENIX Security 2025)** solves sorting with **strictly pure polynomials**, introducing composite sign polynomials $f_m(u)$, Remez minimax composite sequences, and Mazzone's constant-depth all-to-all ranking with exact quadratic tie-correction $E = 4C(1-C)$ — but uses fixed, hand-engineered coefficients minimizing **unweighted sign error** $|1 - s(u)|$ instead of data-trained **value-weighted sorting error** $|\Delta|\,|1 - s(|\Delta|)|$.
16
+
17
+ 2. **Key Mathematical Derivation — Fixed-Point Odd Chebyshev Parameterization:**
18
+ - Parameterizing each composite layer as $h_k(u) = u + u(1 - u^2)\sum_{j=0}^{m-1} c_{k,j} T_{2j}(u)$ strictly guarantees $h_k(0)=0, h_k(\pm 1)=\pm 1$, odd symmetry, and exact subsumption of both the identity map ($c=0$) and Cheon et al.'s analytical $f_m(u)$ polynomials (verified symbolically to $< 10^{-13}$ in SymPy).
19
+ - Computing even Chebyshev terms via $T_{2j}(u) = T_j(2u^2 - 1)$ halves the multiplicative steps while remaining 100% pure polynomial.
20
+ - Because $\Delta = (b - a)/2 \in [-1, 1]$ for $a, b \in [-1, 1]$, any comparator satisfying $|s(\Delta)| \le 1$ keeps every wire bounded inside $[\min(x), \max(x)] \subseteq [-1, 1]$ across arbitrary sorting depth (preventing activation blow-up without any non-polynomial normalization!).
21
+
22
+ 3. **Rolle's Theorem Trade-Off Between Exact Boundary Fidelity and Monotonicity:**
23
+ - Checking Petersen et al. (2022) Theorem 5 against Cheon's $f_1(u) = \frac{3}{2}u - \frac{1}{2}u^3$ revealed a subtle mathematical fact: any smooth comparator with $s(0)=0, s(1)=1$, and $s(u)<1$ on $(0,1)$ has $\hat{\min}_s(2, 0) = 0$ and $\hat{\min}_s(x, 0) > 0$ on $(0, 2)$, so by Rolle's theorem its derivative $\frac{d}{dx}\hat{\min}_s(x, 0)$ MUST become negative somewhere on $(0, 2)$. Thus exact boundary accuracy at $u=1$ precludes strict global monotonicity on $[0, 1]$, while Petersen's Theorem 9 ($\epsilon \cdot \ell$ error bound) still holds directly!
24
+
25
+ ---
26
+
27
+ ## Learnings from Pre-Training Engineering & Verification (Phase 3)
28
+
29
+ 4. **Bug Caught by Resume Determinism Test — Cosine LR Horizon Must Remain Fixed:**
30
+ - *Issue:* Our initial `test_checkpoint_resume_determinism` failed (`0.5277` vs `0.5203`) because passing `epochs=2` then `epochs=4` created two different cosine schedule horizons (`total_steps`), causing epochs 1–2 to use different learning rates than an uninterrupted 4-epoch run.
31
+ - *Fix:* Added `stop_after_epoch` to `train_run` so the target horizon `cfg.epochs` stays invariant across interruptions and resumes bit-for-bit.
32
+
33
+ 5. **Mathematical Insight Caught by Analytical Unit Test — Why Repeated Cheon $f_1^{(3)}$ Has High MAE ($\approx 0.114$) and Why Mixed/Learned Compositions Win:**
34
+ - *Discovery:* Our initial unit test expected Cheon $f_1^{(3)}$ to achieve MAE $< 0.02$ on $n=8$ Uniform $[-1, 1]$, but its actual exact MAE was `0.1137`!
35
+ - *Root Cause:* Because $f_1(u) = \frac{3}{2}u - \frac{1}{2}u^3$ has origin slope $f_1'(0) = 1.5$, composing it 3 times only yields origin slope $1.5^3 = 3.375$. For $n=8$ lists in $[-1, 1]$, typical adjacent half-differences are $\Delta \approx 0.11$, where $f_1^{(3)}(0.11) \approx 0.36$ — far from $1.0$!
36
+ - *Scientific Upgrade:* To avoid comparing against a weak analytical strawman, we added **Cheon/Hong/Mazzone's exact mixed $f_3 \circ g_3$** polynomial (origin slope $4.48 \times 2.19 \approx 9.8$, degree 49, MAE $< 0.03$) AND **Remez minimax composite polynomials** at BOTH $m=1$ (deg 27) and $m=2$ (deg 125). This also explains *mechanistically* why gradient-trained composite polynomials (`c_1 > c_2 > c_3`) can crush uniform $f_1^{(3)}$ at the exact same degree 27: early layers can amplify small gaps aggressively (controlled intermediate overshoot, just like Cheon's $g_3$), while the final layer contracts values cleanly back to $\pm 1$!
37
+
38
+ 6. **Lee et al. (2022) Exact Convex-LP Composite Remez & Stability Threshold Discovery:**
39
+ - *Issue:* Our initial Nelder-Mead fixed-point minimax approximation at $\delta = 0.02$ produced poor MAE (`0.312`), and even Lee et al.'s exact closed-form odd cubic minimax at $\delta = 0.02$ ($\tau_L = 0.526$) diverged to `NaN` inside a 6-stage Bitonic network!
40
+ - *Root Cause:* When $\delta$ is set too aggressively for composition depth $L = 3$, the minimax equioscillation amplitude $\tau_L$ pushes $|s(\Delta)|$ up to $1 + \tau_L \approx 1.53$, allowing wire values to escape $[-1, 1]$ and cascade exponentially across sorting stages! Conversely, scaling the final stage by $1/(1+\tau_L)$ keeps wires bounded but shrinks every swap by $(1+\tau_L)^{-1}$ per stage, compounding to $(1+\tau_L)^{-\ell}$ attenuation.
41
+ - *Fix:* Implemented **Lee et al. (2022) Algorithm 2** via exact **HiGHS convex linear programming** (`scipy.optimize.linprog`), rescaling intermediate stages $1 \dots L-1$ by $1/\text{peak}$ into $[\alpha_k, 1]$ while centering stage $L$ at $1.0$ with depth-matched $\delta$ ($\delta=0.10$ for $L=3, m=1 \Rightarrow \text{MAE} \approx 0.044$, $2.6\times$ better than Cheon $f_1^{(3)}$; $\delta=0.03$ for $L=3, m=2$).
42
+
reports/literature-review.md ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Literature Review: Polynomial Neural Networks and Neural List Sorting
2
+
3
+ **Author:** Libor "Burny" Burian
4
+ **Date:** 2026-11-25
5
+ **Scope:** Strictly pure Polynomial Neural Networks (PNNs), polynomial approximation of piecewise-linear order statistics, symmetric set representations, differentiable sorting networks, and composite polynomial sorting under approximate Homomorphic Encryption (CKKS).
6
+
7
+ > **Verification Note:** All arXiv metadata and full-text primary sources cited below were retrieved and audited via the arXiv API (`https://info.arxiv.org/help/api/index.html`) and official public GitHub repositories (`grigorisg9gr/polynomial_nets`, `Felix-Petersen/diffsort`). Individual paper licenses (e.g., CC BY 4.0 for arXiv:2412.15126) apply to their respective source works.
8
+
9
+ ---
10
+
11
+ ## 1. Mathematical Nature of the Sorting Map
12
+
13
+ Let $x = (x_1, \dots, x_n) \in [-1, 1]^n$. The value-sorting map
14
+ $$S(x) = \big(x_{(1)}, x_{(2)}, \dots, x_{(n)}\big), \qquad x_{(1)} \le x_{(2)} \le \dots \le x_{(n)}$$
15
+ has five structural properties that directly constrain any polynomial approximator:
16
+
17
+ 1. **Permutation Invariance (Symmetry):** For every permutation $\pi \in \mathfrak{S}_n$, $S(\pi x) = S(x)$. Each coordinate $x_{(k)}$ is a symmetric function of $(x_1, \dots, x_n)$.
18
+ 2. **Continuous, Piecewise-Linear, and Non-Smooth:** $S$ is globally $1$-Lipschitz in $\|\cdot\|_\infty$ and $\|\cdot\|_2$, yet non-differentiable along all $\binom{n}{2}$ hyperplanes $x_i = x_j$. For $n = 2$,
19
+ $$\min(a, b) = \frac{a + b - |a - b|}{2}, \qquad \max(a, b) = \frac{a + b + |a - b|}{2}.$$
20
+ Because every finite-degree polynomial is $C^\infty$ analytic, **no finite-degree polynomial can represent $S(x)$ identically** on any open set intersecting $x_i = x_j$.
21
+ 3. **Shift Equivariance & Sum Conservation:** $S(x + c\mathbf{1}) = S(x) + c\mathbf{1}$ for all $c \in \mathbb{R}$, and $\sum_{k=1}^n x_{(k)} = \sum_{i=1}^n x_i$.
22
+ 4. **Positive Homogeneity (Scale Equivariance):** $S(\lambda x) = \lambda S(x)$ for $\lambda \ge 0$, and negation anti-symmetry $S(-x) = -\mathrm{rev}(S(x))$.
23
+ 5. **Fundamental Polynomial Limitation on Scale Extrapolation:** Any non-affine polynomial $p : \mathbb{R}^n \to \mathbb{R}^n$ of degree $D \ge 2$ grows asymptotically as $O(\|x\|^D)$ along non-vanishing leading directions. Therefore, **strictly pure polynomials cannot maintain bounded error on unbounded domains** — they necessarily possess a finite stability radius $R$ beyond which $|x_i| > R$ diverges polynomially.
24
+
25
+ ### 1.1 Approximation Theory of $|x|$: Flat vs. Composite Polynomials
26
+ By the Stone-Weierstrass theorem (Stone, 1948), continuous functions on compact sets $[-1, 1]^n$ can be uniformly approximated arbitrarily closely by polynomials. However, the **degree cost** differs exponentially between flat and deep (composite) polynomials:
27
+
28
+ - **Bernstein's Theorem (1914) and Varga & Carpenter (1985, 1987):** Let $E_D(|u|) = \inf_{\deg(p) \le D} \sup_{u \in [-1,1]} \big||u| - p(u)\big|$. Bernstein (1914) proved that $\beta = \lim_{m \to \infty} 2m\, E_{2m}(|u|)$ exists. Using high-precision Remez exchange computations, Varga & Carpenter (1985, *Numerische Mathematik* 47, 179–196; 1987, *Constructive Approximation* 3, 193–223) disproved Bernstein's conjecture ($\beta = \frac{1}{2\sqrt{\pi}}$) and established:
29
+ $$\beta \approx 0.2801694990, \qquad E_D(|u|) \sim \frac{\beta}{D}.$$
30
+ Consequently, a **flat polynomial** requires degree $D = \Theta(1/\varepsilon)$ to approximate a single two-element comparator to error $\varepsilon$.
31
+ - **Exponential Degree Compression via Composition:** Nesting $L$ low-degree odd polynomials $s(u) = (h_L \circ \dots \circ h_1)(u)$ of degree $d$ attains total polynomial degree $D = d^L$ with only $O(L)$ parameters and $O(L)$ multiplications, driving error down super-exponentially on $[-1, -\delta] \cup [\delta, 1]$ (Cheon et al., 2020; Lee et al., 2022).
32
+
33
+ ---
34
+
35
+ ## 2. Polynomial Neural Networks (PNNs)
36
+
37
+ ### 2.1 Classical Polynomial Networks
38
+ - **GMDH (Ivakhnenko, 1971):** *Polynomial Theory of Complex Systems*, IEEE Trans. Systems, Man, and Cybernetics, no. 4, pp. 364–378. Introduced hierarchical quadratic partial descriptors on predefined variable pairs (often cited as the first deep polynomial network; cf. Chrysos et al., 2021, Sec. 2).
39
+ - **Pi-Sigma Networks (Shin & Ghosh, 1991):** *The Pi-Sigma Network: An Efficient Higher-Order Neural Network for Pattern Classification and Function Approximation*, IJCNN 1991, vol. 1, pp. 13–18. Sums linear projections then multiplies them via a product unit; extended to Sigma-Pi-Sigma networks (SPSNN; Li, 2003, *Neural Processing Letters*). Struggles to scale to high-dimensional or high-degree settings without factorization.
40
+
41
+ ### 2.2 Expressive Power of Deep Polynomial Neural Networks
42
+ - **Kileel, Trager & Bruna (NeurIPS 2019):** *On the Expressive Power of Deep Polynomial Neural Networks* ([arXiv:1905.12207](https://arxiv.org/abs/1905.12207)). Analyzes feedforward networks with pure polynomial activations $x \mapsto x^r$ through algebraic geometry, defining the **functional variety** (Zariski closure of representable polynomials). Key findings:
43
+ - Networks with narrow intermediate widths suffer a **bottleneck property** preventing them from filling the ambient polynomial space regardless of depth/other widths.
44
+ - Architectures whose widths increase monotonically then decrease monotonically optimize variety dimension.
45
+
46
+ ### 2.3 $\Pi$-Nets: Tensor-Factorized Deep Polynomial Neural Networks
47
+ - **Chrysos, Moschoglou, Bouritsas, Panagakis, Deng & Zafeiriou (CVPR 2020; IEEE TPAMI 2021):**
48
+ - Conference version: *$\Pi$-nets: Deep Polynomial Neural Networks* ([arXiv:2003.03828](https://arxiv.org/abs/2003.03828)).
49
+ - Journal version: *Deep Polynomial Neural Networks* ([arXiv:2006.13026](https://arxiv.org/abs/2006.13026), IEEE TPAMI; official code: [github.com/grigorisg9gr/polynomial_nets](https://github.com/grigorisg9gr/polynomial_nets)).
50
+ - Follow-up: *Augmenting Deep Classifiers with Polynomial Neural Networks* (ECCV 2022, [arXiv:2104.07916](https://arxiv.org/abs/2104.07916)).
51
+ - **Exact Formulations (Chrysos et al., arXiv:2006.13026, Sec. 3.1–3.2, Eqs. 6, 9, 10):** To avoid the $O(d^N)$ tensor explosion of an $N$-th order multivariate polynomial $G(\mathbf{z}) = \sum_{n=1}^N \mathcal{W}^{[n]} \prod_{j=2}^{n+1} \times_j \mathbf{z} + \boldsymbol{\beta}$, Chrysos et al. introduce three coupled tensor factorizations implemented via Hadamard products ($*$):
52
+ 1. **CCP (Eq. 6):** $\mathbf{x}_n = (\mathbf{U}_{[n]}^T \mathbf{z}) * \mathbf{x}_{n-1} + \mathbf{x}_{n-1}$, with $\mathbf{x}_1 = \mathbf{U}_{[1]}^T \mathbf{z}$ and $\mathbf{x} = \mathbf{C}\mathbf{x}_N + \boldsymbol{\beta}$.
53
+ 2. **NCP (Eq. 9):** $\mathbf{x}_n = (\mathbf{A}_{[n]}^T \mathbf{z}) * (\mathbf{S}_{[n]}^T \mathbf{x}_{n-1} + \mathbf{B}_{[n]}^T \mathbf{b}_{[n]})$, with $\mathbf{x}_1 = (\mathbf{A}_{[1]}^T \mathbf{z}) * (\mathbf{B}_{[1]}^T \mathbf{b}_{[1]})$ and $\mathbf{x} = \mathbf{C}\mathbf{x}_N + \boldsymbol{\beta}$.
54
+ 3. **NCP-Skip (Eq. 10):** $\mathbf{x}_n = (\mathbf{A}_{[n]}^T \mathbf{z}) * (\mathbf{S}_{[n]}^T \mathbf{x}_{n-1} + \mathbf{B}_{[n]}^T \mathbf{b}_{[n]}) + \mathbf{V}_{[n]} \mathbf{x}_{n-1}$.
55
+ 4. **ProdPoly (Sec. 3.2):** Composing $M$ polynomial blocks of order $B$ produces polynomial degree $B^M$ with linear parameter count.
56
+ - **Crucial Caveat from Chrysos et al. (arXiv:2006.13026, Sec. 4–5):** In practice, Chrysos et al. frequently insert normalization (BatchNorm/InstanceNorm) or a final `tanh` to bound gradients, explicitly noting in Section 5 (*Future Directions*) that pure high-order polynomials without normalization can produce unbounded gradients and overfit. In our work, we test **strictly pure** $\Pi$-Nets (zero normalization/activation) as our unstructured PNN baseline.
57
+
58
+ ### 2.4 Orthogonal Polynomial Networks & Arithmetic Neural Units
59
+ - **ChebyKAN (Sidharth et al., 2024):** *Chebyshev Polynomial-Based Kolmogorov-Arnold Networks: An Efficient Architecture for Nonlinear Function Approximation* ([arXiv:2405.07200](https://arxiv.org/abs/2405.07200)). Replaces B-splines in KANs (Liu et al., 2024, [arXiv:2404.19756](https://arxiv.org/abs/2404.19756)) with Chebyshev polynomials $T_k(u)$ for orthogonal conditioning — note that standard ChebyKAN applies `tanh` before evaluating $T_k$ to clamp inputs to $[-1, 1]$, which breaks strict polynomiality! Our Chebyshev parameterization eliminates `tanh` by exploiting the algebraic range-boundedness of odd CAS gates on $[-1, 1]$.
60
+ - **NALU / NAU / NMU:** Trask et al. (NeurIPS 2018, *Neural Arithmetic Logic Units*, [arXiv:1808.00508](https://arxiv.org/abs/1808.00508)) and Madsen & Johansen (ICLR 2020, *Neural Arithmetic Units*, [arXiv:2001.05016](https://arxiv.org/abs/2001.05016)) highlight how carefully constrained parameterizations and initialization are essential for stable gradient learning of multiplicative/arithmetic circuits.
61
+
62
+ ---
63
+
64
+ ## 3. Symmetric Functions on Sets & Order Statistics
65
+
66
+ - **DeepSets (Zaheer et al., NeurIPS 2017):** *Deep Sets* ([arXiv:1703.06114](https://arxiv.org/abs/1703.06114)). Establishes that permutation-invariant set functions take the form $f(X) = \rho\big(\sum_{x \in X} \phi(x)\big)$. For polynomial $\phi(x) = (x, x^2, \dots, x^K)$ (or Chebyshev basis $T_k(x)$), $\sum_i \phi(x_i)$ computes the **Newton power sums**, which by the Fundamental Theorem of Symmetric Polynomials algebraically generate all symmetric polynomials in $(x_1, \dots, x_n)$.
67
+ - **Latent Dimension Bottleneck (Wagstaff et al., ICML 2019; JMLR 2022):** *On the Limitations of Representing Functions on Sets* ([arXiv:1901.09006](https://arxiv.org/abs/1901.09006)) and *Universal Approximation of Functions on Sets* (JMLR 23(151):1–56, 2022). Proves that for *continuous* encoder/decoder maps $\phi, \rho$, universal representation of set functions (explicitly including **order statistics / sorting**!) requires latent dimension $L_{\text{lat}} \ge n$. Consequently, our `DeepSetsPoly` baseline sets latent width $\ge 2n$.
68
+ - **Set Transformer (Lee et al., ICML 2019):** *Set Transformer: A Framework for Attention-based Permutation-Invariant Neural Networks* ([arXiv:1810.00825](https://arxiv.org/abs/1810.00825)). Uses multi-head self-attention (softmax, non-polynomial) to capture pairwise interactions directly across arbitrary set sizes; serves as a strong non-polynomial neural baseline.
69
+ - **Pointer Networks (Vinyals et al., NeurIPS 2015):** *Pointer Networks* ([arXiv:1506.03134](https://arxiv.org/abs/1506.03134)). Early autoregressive attention baseline for combinatorial/sorting tasks (non-polynomial).
70
+
71
+ ---
72
+
73
+ ## 4. Differentiable Sorting & Sorting Networks
74
+
75
+ ### 4.1 Classical Data-Oblivious Sorting Networks
76
+ - **Batcher (1968):** *Sorting Networks and Their Applications*, AFIPS Spring Joint Computer Conference, pp. 307–314. Introduced the **Bitonic** and **Odd-Even Mergesort** networks with parallel depth $\ell = \frac{1}{2}\log_2 n (\log_2 n + 1)$ and $O(n \log^2 n)$ compare-and-swap (CAS) gates.
77
+ - **Habermann (1972):** *Parallel Neighbor-Sort*, CMU Technical Report (odd-even transposition sorting network, depth $n$, $\approx n(n-1)/2$ CAS gates).
78
+ - **Knuth (1998):** *The Art of Computer Programming, Vol. 3: Sorting and Searching* (2nd ed.), Sec. 5.3.4 (zero-one principle and optimal-depth sorting networks).
79
+
80
+ ### 4.2 Continuous Relaxations of Sorting (Non-Polynomial)
81
+ - **NeuralSort (Grover et al., ICLR 2019):** *Stochastic Optimization of Sorting Networks via Continuous Relaxations* ([arXiv:1903.08850](https://arxiv.org/abs/1903.08850)). Relaxes permutation matrices to unimodal row-stochastic matrices via temperature-controlled softmax over pairwise $|x_i - x_j|$ terms.
82
+ - **Optimal Transport / Sinkhorn Sorting (Cuturi et al., NeurIPS 2019):** *Differentiable Ranks and Sorting using Optimal Transport* ([arXiv:1905.11885](https://arxiv.org/abs/1905.11885)). Frames sorting as entropically regularized 1D optimal transport solved via iterative Sinkhorn projections.
83
+ - **Fast Differentiable Sorting and Ranking (Blondel et al., ICML 2020):** *Fast Differentiable Sorting and Ranking* ([arXiv:2002.08871](https://arxiv.org/abs/2002.08871)). Casts sorting as projection onto the permutahedron with $O(n \log n)$ isotonic regression; monotonic, but unbounded relaxation error (Petersen et al., 2022, Table 2).
84
+ - **SoftSort (Prillo & Eisenschlos, ICML 2020):** *SoftSort: A Continuous Relaxation for the argsort Operator* ([arXiv:2006.16038](https://arxiv.org/abs/2006.16038)). Streamlined $O(n^2)$ unimodal row-stochastic relaxation using row-wise softmax over $-|x_i - s_j|/\tau$.
85
+ - **Differentiable Sorting Networks (`diffsort`, Petersen et al., ICML 2021 & ICLR 2022):**
86
+ - ICML 2021: *Differentiable Sorting Networks for Scalable Sorting and Ranking Supervision* ([arXiv:2105.04019](https://arxiv.org/abs/2105.04019), PMLR 139:8546–8555; code: [github.com/Felix-Petersen/diffsort](https://github.com/Felix-Petersen/diffsort)).
87
+ - ICLR 2022: *Monotonic Differentiable Sorting Networks* ([arXiv:2203.09630](https://arxiv.org/abs/2203.09630)).
88
+ - **Key Exact Results (verified from full PDF & `diffsort/functional.py`):**
89
+ - Continuous CAS relaxation: $\min_f(a,b) = a f(b-a) + b f(a-b)$, $\max_f(a,b) = a f(a-b) + b f(b-a)$ with odd-symmetric $f(x) = 1 - f(-x)$ (guarantees symmetry, idempotency, shift invariance, sum conservation, and boundedness by hard $\min/\max$; Appendix B).
90
+ - **Theorem 5 & 8 (ICLR 2022):** Global monotonicity requires $f'(x) \in \Omega(1/x^2)$, and bounded error requires $f'(x) \in O(1/x^2)$. Thus logistic $\sigma(\beta x)$ is error-bounded ($\approx 0.0696/\beta$) but non-monotonic; Cauchy CDF $f_{\mathcal{C}}(x) = \frac{1}{\pi}\arctan(\beta x) + \frac{1}{2}$ is $C^\infty$ analytic, monotonic, and error-bounded ($1/(\pi^2 \beta)$); optimal 1-Lipschitz monotonic $f_{\mathcal{O}}$ achieves error bound $1/(16\beta)$.
91
+ - **Theorem 9 (ICLR 2022):** If each CAS layer has error $\le \epsilon$ and the sorting network has $\ell$ layers, total $L_\infty$ sorting error is bounded by $\epsilon \cdot \ell$. **Crucially, this induction proof holds verbatim for our pure-polynomial CAS gates whenever $|s_\theta(\Delta)| \le 1$ on $[-1, 1]$!**
92
+
93
+ ---
94
+
95
+ ## 5. Pure-Polynomial Sorting in Homomorphic Encryption (CKKS)
96
+
97
+ In approximate Fully Homomorphic Encryption (specifically CKKS), ciphertexts support **only additions and multiplications** — the exact same computational model as strictly pure Polynomial Neural Networks!
98
+
99
+ - **Cheon, Kim & Kim (ASIACRYPT 2020; IACR ePrint 2019/1234):** *Efficient Homomorphic Comparison Methods with Optimal Complexity* ([ePrint 2019/1234](https://eprint.iacr.org/2019/1234)). Introduced composite odd polynomials achieving optimal asymptotic multiplicative depth for approximating $\mathrm{sign}(x)$ on $[-1, 1]$:
100
+ $$f_m(x) = \sum_{i=0}^{m} \frac{1}{4^i} \binom{2i}{i} x(1 - x^2)^i.$$
101
+ Explicitly:
102
+ - $f_1(x) = \frac{3}{2}x - \frac{1}{2}x^3$,
103
+ - $f_2(x) = \frac{15}{8}x - \frac{10}{8}x^3 + \frac{3}{8}x^5$,
104
+ - $f_3(x) = \frac{35}{16}x - \frac{35}{16}x^3 + \frac{21}{16}x^5 - \frac{5}{16}x^7$,
105
+ and mixed compositions with faster small-$x$ amplification polynomial $g_3(x) = (4589x - 16577x^3 + 25614x^5 - 12860x^7)/1024$ (verified in Mazzone et al., 2025, Sec. 2.2).
106
+ - **Hong, Kim, Choi, Lee & Cheon (IEEE TIFS 2021):** *Efficient Sorting of Homomorphic Encrypted Data with $k$-Way Sorting Network*, IEEE TIFS 16:4389–4404. Combines Cheon et al.'s composite sign polynomials with $k$-way sorting networks, reducing comparison depth from $O(\log_2^2 n)$ to $O(k \log_k^2 n)$.
107
+ - **Lee, Lee, No & Kim (IACR ePrint 2020/834; IEEE TDSC 2022):** *Minimax Approximation of Sign Function by Composite Polynomial for Homomorphic Comparison* ([ePrint 2020/834](https://eprint.iacr.org/2020/834); IEEE TDSC 19(6):3711–3727). Replaces fixed binomial $f_m$ with **Remez-optimal minimax composite polynomials** chosen by dynamic programming, minimizing worst-case $L_\infty$ error on $[-1, -\delta] \cup [\delta, 1]$ and cutting depth by ~41% and runtime by ~45%.
108
+ - **Mazzone, Everts, Hahn & Peter (USENIX Security 2025; arXiv:2412.15126):** *Efficient Ranking, Order Statistics, and Sorting under CKKS* ([arXiv:2412.15126](https://arxiv.org/abs/2412.15126)). Breaks the $\Omega(\log^2 n)$ swap-network comparison depth barrier by shifting to an **all-to-all $O(1)$-comparison-depth** polynomial architecture:
109
+ 1. Simultaneous pairwise comparisons $C_{ij} = \mathrm{cmp}(x_j, x_i) = \frac{1 + s((x_j - x_i)/2)}{2}$.
110
+ 2. Fractional rank $r_j = \sum_{i=1}^n C_{ij} + 0.5$.
111
+ 3. **Exact Polynomial Tie-Correction Offset (Sec. 4, Alg. 6):** Computes equality matrix $E = 4 C (1 - C)$ (pure quadratic!), upper-triangular sum $U_j = \sum_{i \le j} E_{ij}$, total tie count $T_j = \sum_i E_{ij}$, and tie-resolved rank $r_j^{\text{fixed}} = \sum_i C_{ij} + U_j - 0.5 T_j$.
112
+ 4. Parallel polynomial indicator $W_{jk} = \mathrm{ind}_{[k-0.5, k+0.5]}(r_j^{\text{fixed}})$ and extraction $\hat{y}_k = \sum_{j=1}^n W_{jk} x_j$.
113
+
114
+ ---
115
+
116
+ ## 6. Methodological Standards Grounding This Study
117
+
118
+ To ensure strong predictive and explanatory power without common ML pitfalls, our experimental protocol directly adopts:
119
+ - **Lones (2021/2024):** *How to Avoid Machine Learning Pitfalls: A Guide for Academic Researchers* ([arXiv:2108.02497](https://arxiv.org/abs/2108.02497)) — strict split isolation, appropriate baselines, multiple seeds, and transparent reporting of negative results.
120
+ - **Lipton & Steinhardt (2018):** *Troubling Trends in Machine Learning Scholarship* ([arXiv:1807.03341](https://arxiv.org/abs/1807.03341)) — separating speculation from mathematical proof/empirical evidence, avoiding conflating architectural tweaks with fundamental gains.
121
+ - **Nanda (2022–2024):** *How I Think About My Research Process* ([LessWrong Sequence](https://www.lesswrong.com/s/5GT3yoYM9gRmMEKqL)) — falsifiable hypotheses, discriminating experiments, truth-seeking skepticism, and mechanistic inspection of what networks actually learn.
122
+ - **Schulman (2017):** *An Opinionated Guide to ML Research* ([joschu.net](http://joschu.net/blog/opinionated-guide-ml-research.html)) — clean baselines, controlled ablations, and fast diagnostic loops.
123
+ - **NeurIPS Paper Checklist Guidelines** ([neurips.cc](https://neurips.cc/public/guides/PaperChecklist)) — error bars, statistical significance, reproducibility, limitations, and compute accounting.
124
+
125
+ ---
126
+
127
+ ## 7. Synthesis: Key Research Gap Identified
128
+
129
+ Despite deep progress in **three parallel communities**:
130
+ 1. **Deep PNNs** ($\Pi$-Nets, PolyMLPs, ChebyKANs) have been applied to vision, meshes, and smooth regression — never systematically benchmarked on non-smooth algorithmic list sorting or compared against sorting-structured polynomials.
131
+ 2. **Differentiable Sorting Networks** (`diffsort`, NeuralSort, SoftSort) rely on *non-polynomial* transcendental relaxations ($\exp$, $\arctan$, division) and focus on ordering-supervision of image encoders rather than pure-polynomial value sorting.
132
+ 3. **Homomorphic Polynomial Sorting** (Cheon, Hong, Lee, Mazzone) uses *hand-crafted / Remez-fixed* polynomials optimized for **unweighted worst-case $\mathrm{sign}(u)$ error** $|1 - s(u)|$ on $[\delta, 1]$ — never **end-to-end gradient-trained** on data distributions to minimize **value-weighted sorting error** $u|1 - s(u)|$ or allowed to adapt polynomial coefficients per sorting stage!
133
+
134
+ **Our central scientific opportunity:** Unify these three fields by formulating, auditing, training, and rigorously dissecting a complete ladder of **strictly pure Polynomial Neural Networks** for list sorting — directly testing whether gradient-trained composite PNNs can surpass analytical minimax CKKS polynomials at iso-depth/iso-degree, how architectural inductive bias governs scaling, and where pure polynomials fundamentally succeed or break down.
reports/plan.md ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Master Project Plan (`pnn-sort`)
2
+
3
+ **Author:** Libor "Burny" Burian
4
+ **Created:** 2026-11-25
5
+ **Last Updated:** 2026-11-25
6
+
7
+ ## Objective
8
+ Train, rigorously evaluate, ablate, visualize, and publish a scientific study of **strictly pure Polynomial Neural Networks (PNNs)** for sorting continuous lists of real numbers, comparing unstructured PNNs ($\Pi$-Nets, PolyMLP), symmetric set PNNs (DeepSets-Poly), constant-depth all-to-all polynomial rankers (`PolyPairwiseRank`), and learned composite polynomial sorting networks (`PolySortNet`) against zero-training analytical CKKS minimax polynomials (Cheon et al., 2020; Lee et al., 2022), trivial/random controls, and non-polynomial neural baselines (`diffsort`, ReLU-MLP, Set Transformer).
9
+
10
+ ## Phase Checklist
11
+ - [x] **Phase 0:** Workspace & hardware audit (NVIDIA RTX 5070 Laptop GPU, CUDA 13.4, `torch 2.11.0+cu128`, `uv`, `gh`, `hf`, `pdflatex`, `typst`).
12
+ - [x] **Phase 1:** Full primary-source literature review (`reports/literature-review.md`) and SOTA review (`reports/state-of-the-art-review.md`).
13
+ - [x] **Phase 2:** Preregistration (`reports/preregistration.md`), Run Matrix (`reports/planned-runs.md`), Docs (`docs/`), Pre-Results `README.md`, GitHub + Hugging Face repo creation & pre-results push.
14
+ - [x] **Phase 3:** Modular `src/pnn_sort/` package, automated FX purity audit, real-time accuracy web dashboard, full `pytest` suite (62/62 passed), pre-training push & Adversarial Self-Review #1.
15
+ - [ ] **Phase 4A:** Zero-training analytical/controls + primary `PolySortNet` (Shared & Stage-Adaptive), incremental GitHub & HF pushes.
16
+ - [ ] **Phase 4B:** Remaining main PNN architectures (`PolyPairwiseRank`, `PolySortNetLearnedWire`, `DeepSetsPoly`, `PiNetSorter`, `PolyMLP`) + scaling study ($n=4..128$), Review #2.
17
+ - [ ] **Phase 4C:** Trained controls (`ShuffledTargetControl`) & non-polynomial baselines (`DiffSort`, `ReLU-MLP`, `SetTransformer`).
18
+ - [ ] **Phase 4D:** 6 causal ablation suites + Adversarial NeurIPS Self-Review #3.
19
+ - [ ] **Phase 4E:** 5-seed statistical rigor + hyperparameter sensitivity sweep + float64 precision audit.
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.
reports/planned-runs.md ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Planned Experimental Run Matrix
2
+
3
+ **Author:** Libor "Burny" Burian
4
+ **Date:** 2026-11-25
5
+ **Companion Document:** [preregistration.md](preregistration.md)
6
+
7
+ This document enumerates every planned training, control, baseline, ablation, and sensitivity run, explicitly specifying how each run differs in architecture, polynomial degree, multiplicative depth, wiring, loss, optimizer, data, and seed.
8
+
9
+ ---
10
+
11
+ ## 1. Shared Default Training Protocol
12
+
13
+ - **Training Set:** $200{,}000$ lists from $\mathrm{Uniform}[-1, 1]^n$ (seed-isolated `train` stream).
14
+ - **Validation / Test Sets:** $10{,}000$ / $10{,}000$ lists (seed-isolated `val`, `test` streams).
15
+ - **Default Optimization:** `AdamW`, batch size `512`, `60` epochs (`~23,400` optimizer steps), cosine annealing LR schedule with 5% linear warmup, gradient norm clipping `1.0`.
16
+ - Default LR: `3e-3` for compact structured polynomial networks (`polysort_*`, `poly_pairwise_rank`), `1e-3` for deep dense networks (`pinet_ncp_skip`, `poly_mlp`, `deepsets_poly`, `relu_mlp`, `set_transformer`), `1e-2` for `diffsort` learnable steepness / linear control. (Verified in Stage 4E LR sensitivity sweep.)
17
+ - **Default Loss:** Value MSE $\mathcal{L}_{\text{MSE}}(\hat{y}, y) = \frac{1}{n}\|\hat{y} - y\|_2^2$ (loss ablations tested in Stage 4D).
18
+ - **Precision:** Trained in `float32` (with `float64` training check on deep $L=4$ composite ablation and `float64` verification at evaluation time).
19
+ - **Checkpointing:** Atomic checkpoint after every epoch (saving model, optimizer, scheduler, RNG states, best validation checkpoint) for full restart resumability.
20
+
21
+ ---
22
+
23
+ ## 2. Stage 4A — Zero-Training Controls, Analytical Baselines & Primary Main Models (Single Seed = 42)
24
+
25
+ | Run ID | Model Family | Pure Poly? | Exact Architecture & Diff | Comp. Deg ($D_s$) | Seq. Mult. Depth | $n$ | Training? |
26
+ | :--- | :--- | :---: | :--- | :---: | :---: | :---: | :---: |
27
+ | `ctrl_identity_n8/n16` | `IdentityControl` | Yes | $\hat{y} = x$ (no-op lower bound) | 1 | 0 | 8, 16 | None |
28
+ | `ctrl_linear_n8/n16` | `LinearControl` | Yes | Exact closed-form Ridge/OLS $\hat{y} = Wx + b$ fit on `train` | 1 | 0 | 8, 16 | Closed-form |
29
+ | `ctrl_rand_polysort_n8/n16` | `RandomInitControl` | Yes | Untrained random-init `PolySortNet-Shared` ($L=3, d=3$) | 27 | $6\times 3$ / $10\times 3$ | 8, 16 | None |
30
+ | `ctrl_rand_pinet_n8/n16` | `RandomInitControl` | Yes | Untrained random-init `PiNet-NCPSkip` | 6 | 5 | 8, 16 | None |
31
+ | `ana_cheon_f1_L3_n8/n16` | `AnalyticalCheonSort` | Yes | Bitonic wiring + Cheon $f_1^{(3)}$ ($L=3, d=3$) | 27 | $3\ell$ | 8, 16 | None |
32
+ | `ana_cheon_f2_L2_n8/n16` | `AnalyticalCheonSort` | Yes | Bitonic wiring + Cheon $f_2^{(2)}$ ($L=2, d=5$) | 25 | $2\ell$ | 8, 16 | None |
33
+ | `ana_cheon_fg_n8/n16` | `AnalyticalCheonFGSort` | Yes | Bitonic wiring + Cheon/Hong/Mazzone mixed $f_3 \circ g_3$ ($L=2, d=7$) | 49 | $2\ell$ | 8, 16 | None |
34
+ | `ana_remez_L3_n8/n16` | `AnalyticalRemezSort` | Yes | Bitonic wiring + Lee et al. (2022) HiGHS LP minimax odd cubic ($L=3, d=3, \delta=0.10$) | 27 | $3\ell$ | 8, 16 | None (LP fit) |
35
+ | `ana_remez_L3_m2_n8/n16` | `AnalyticalRemezSort` | Yes | Bitonic wiring + Lee et al. (2022) HiGHS LP minimax odd quintic ($L=3, d=5, \delta=0.03$) | 125 | $3\ell$ | 8, 16 | None (LP fit) |
36
+ | **`main_polysort_shared_n8/n16`** | `PolySortNet` (Shared) | Yes | Bitonic wiring + **shared** fixed-point odd Chebyshev CAS ($L=3, m=1 \Rightarrow d=3, D_s=27$, 3 params) | 27 | $3\ell$ | 8, 16 | AdamW, 60 ep |
37
+ | **`main_polysort_shared_m2_n8/n16`** | `PolySortNet` (Shared-Deg5) | Yes | Bitonic wiring + **shared** fixed-point odd Chebyshev CAS ($L=3, m=2 \Rightarrow d=5, D_s=125$, 6 params) | 125 | $3\ell$ | 8, 16 | AdamW, 60 ep |
38
+ | **`main_polysort_adaptive_n8/n16`** | `PolySortNet` (Stage-Adaptive) | Yes | Bitonic wiring + **per-layer** fixed-point odd Chebyshev CAS ($L=3, m=1 \Rightarrow d=3$, $3\ell$ params: 18 for $n=8$, 30 for $n=16$) | 27 | $3\ell$ | 8, 16 | AdamW, 60 ep |
39
+ | **`main_polysort_adaptive_m2_n8/n16`** | `PolySortNet` (Stage-Adaptive-Deg5) | Yes | Bitonic wiring + **per-layer** fixed-point odd Chebyshev CAS ($L=3, m=2 \Rightarrow d=5$, $6\ell$ params) | 125 | $3\ell$ | 8, 16 | AdamW, 60 ep |
40
+
41
+ *(Note: $\ell = 6$ for Bitonic $n=8$; $\ell = 10$ for Bitonic $n=16$; $\ell = 15$ for $n=32$; $\ell = 21$ for $n=64$; $\ell = 28$ for $n=128$.)*
42
+
43
+ ---
44
+
45
+ ## 3. Stage 4B — Remaining Main Pure-PNN Architectures & Scaling Study (Single Seed = 42)
46
+
47
+ | Run ID | Model Family | Pure Poly? | Exact Architecture & Diff | Params ($n=8/16$) | $n$ |
48
+ | :--- | :--- | :---: | :--- | :---: | :---: |
49
+ | `main_poly_pairwise_n8/n16` | `PolyPairwiseRank` | Yes | Mazzone-inspired all-to-all $O(1)$ comp depth: learned odd Chebyshev $s_{\text{cmp}}$ ($L=3, m=2$) + exact tie-correction $E=4C(1-C)$ + learned indicator $s_{\text{ind}}$ ($L=3, m=2$) | 12 / 12 | 8, 16 |
50
+ | `main_polysort_learnedwire_n8/n16` | `PolySortNetLearnedWire` | Yes | $\ell$ stages of learned residual linear routing matrices $R_t \in \mathbb{R}^{n\times n}$ interleaved with fixed-point Chebyshev CAS gates ($L=3, m=1$) | ~402 / ~2,590 | 8, 16 |
51
+ | `main_deepsets_poly_n8/n16` | `DeepSetsPoly` | Yes | Permutation-invariant $\rho_{\text{poly}}(\frac{1}{n}\sum_i \phi_{\text{poly}}(x_i))$, $\phi$: deg-6 Chebyshev features + linear ($H=64 \ge 2n$), $\rho$: 3-block ProdPoly NCP-Skip | ~35k / ~36k | 8, 16 |
52
+ | `main_pinet_ncpskip_n8/n16` | `PiNetSorter` | Yes | Chrysos et al. (2021) ProdPoly NCP-Skip (2 stacked deg-3 NCP-Skip blocks, hidden width 128, zero BN/tanh, exact Eq. 10) | ~52k / ~56k | 8, 16 |
53
+ | `main_poly_mlp_n8/n16` | `PolyMLP` | Yes | 3-hidden-layer dense MLP (width 128) with per-neuron learnable deg-3 Chebyshev polynomial activations (Kileel et al., 2019) | ~36k / ~38k | 8, 16 |
54
+ | `scale_polysort_n4/n32` | `PolySortNet` (Shared & Adaptive) | Yes | Scaling study across $n=4$ ($\ell=3$) and $n=32$ ($\ell=15$) + zero-shot eval of `n8`-trained `polysort_shared` on $n \in \{4, 8, 16, 32, 64, 128\}$ | 3–90 | 4, 32 (+ zero-shot 64, 128) |
55
+ | `scale_unstruct_n4` | `PiNetSorter`, `PolyMLP`, `DeepSetsPoly` | Yes | Small-$n$ regime ($n=4$) to verify whether unstructured PNNs succeed on short lists and quantify how rapidly they degrade with $n$ | ~34k–50k | 4 |
56
+
57
+ ---
58
+
59
+ ## 4. Stage 4C — Trained Control & Non-Polynomial Baselines (Single Seed = 42)
60
+
61
+ | Run ID | Model Family | Pure Poly? | Exact Architecture & Diff | $n$ |
62
+ | :--- | :--- | :---: | :--- | :---: |
63
+ | `ctrl_shuffled_n8/n16` | `ShuffledTargetControl` | Yes | `PolySortNet-Adaptive` trained on randomly permuted targets (leakage check) | 8, 16 |
64
+ | `base_diffsort_logistic_n8/n16` | `DiffSortBaseline` (Logistic) | **No** | Petersen et al. (2021) Bitonic + logistic sigmoid $\sigma(\beta(b-a))$, learned log-steepness $\beta$ | 8, 16 |
65
+ | `base_diffsort_cauchy_n8/n16` | `DiffSortBaseline` (Cauchy) | **No** | Petersen et al. (2022) Bitonic + monotonic Cauchy CDF $\frac{1}{\pi}\arctan(\beta(b-a)) + \frac{1}{2}$, learned $\beta$ | 8, 16 |
66
+ | `base_relu_mlp_n8/n16` | `ReLUMLPBaseline` | **No** | 3-layer GELU/ReLU MLP (width 128, parameter-matched to `PolyMLP` / `PiNet`) | 8, 16 |
67
+ | `base_set_transformer_n8/n16` | `SetTransformerBaseline` | **No** | 2-layer multi-head SAB + PMA-style slot queries (Lee et al., 2019; width 64, 4 heads, ~40k params) | 8, 16 |
68
+
69
+ ---
70
+
71
+ ## 5. Stage 4D — Causal Ablation Suite ($n = 8$ & $n = 16$, Seed = 42)
72
+
73
+ | Ablation Family | Run IDs | Controlled Variable Changed (All Else Fixed to `PolySortNet-Adaptive` Bitonic) |
74
+ | :--- | :--- | :--- |
75
+ | **A1. Parameterization** | `abl_param_fp_cheby` (ref), `abl_param_unconst_odd`, `abl_param_general_cheby`, `abl_param_raw_monomial` | Fixed-point odd Chebyshev vs. unconstrained odd Chebyshev vs. general (even+odd) Chebyshev vs. raw monomials |
76
+ | **A2. Iso-Degree Depth** | `abl_depth_L1_d9` (flat deg 9), `abl_depth_L2_d3` (comp deg 9), `abl_depth_L3_d3` (deg 27), `abl_depth_L4_d3` (deg 81) | Tests Bernstein vs. Cheon depth separation at exact iso-degree $D=9$ and depth scaling $L \in \{1, 2, 3, 4\}$ |
77
+ | **A3. Initialization** | `abl_init_identity` ($c=0$), `abl_init_random` ($\mathcal{N}(0, 0.1^2)$), `abl_init_cheon` (Cheon $f_1$ warm-start) | Tests optimization landscape sensitivity and convergence speed |
78
+ | **A4. Wiring Topology** | `abl_wire_bitonic` ($\ell=6/10$), `abl_wire_oddeven_merge` (Batcher odd-even merge), `abl_wire_oddeven_trans` ($\ell=8/16$), `abl_wire_random_fixed` (**negative control**) | Isolates causal contribution of valid sorting-network wiring vs. random pairwise swaps |
79
+ | **A5. Objective Loss** | `abl_loss_mse` (ref), `abl_loss_huber`, `abl_loss_mse_mono` (MSE + $0.1 \cdot \mathrm{ReLU}(\hat{y}_k - \hat{y}_{k+1})$), `abl_loss_mse_mono_w1` | Tests H2b trade-off between Value MAE and Adversarial Near-Tie Ordering |
80
+ | **A6. Scale Boundary (Non-Poly)** | `abl_scale_pure` (ref) vs. `abl_scale_norm_maxabs` (divides by $\max_i |x_i| + 10^{-8}$ before/after — **explicitly non-polynomial**) | Quantifies exact scale-extrapolation trade-off of strict polynomial purity |
81
+
82
+ ---
83
+
84
+ ## 6. Stage 4E — Multi-Seed Statistical Rigor & Hyperparameter Sensitivity
85
+
86
+ - **Multi-Seed Suite (5 Seeds: `42, 123, 456, 789, 1024`) on $n = 8$ and $n = 16$:**
87
+ - `polysort_shared`, `polysort_adaptive`, `polysort_adaptive_m2`, `poly_pairwise_rank`, `deepsets_poly`, `pinet_ncp_skip`, `poly_mlp`, `diffsort_cauchy`, `relu_mlp`, `set_transformer` (10 models $\times$ 2 lengths $\times$ 5 seeds = 100 runs; ~45–75 min total on RTX 5070).
88
+ - **Hyperparameter Sensitivity Sweep ($n = 8$, `polysort_adaptive` & `pinet_ncp_skip`):**
89
+ - Learning rate $\in \{3\times 10^{-4}, 10^{-3}, 3\times 10^{-3}, 10^{-2}\}$.
90
+ - Weight decay $\in \{0, 10^{-4}, 10^{-2}\}$.
91
+ - Batch size $\in \{128, 512, 2048\}$.
92
+ - Precision check: `float32` vs. `float64` training on `polysort_adaptive` ($L=3$ and $L=4$).
reports/preregistration.md ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Scientific Preregistration: Strictly Pure Polynomial Neural Networks for List Sorting
2
+
3
+ **Author:** Libor "Burny" Burian
4
+ **Preregistration Date (Pre-Results):** 2026-11-25
5
+ **Status:** LOCKED BEFORE ANY TRAINING OR EVALUATION RESULTS EXIST
6
+ **Repository:** `BurnyCoder/polynomial-neural-network-sort-list`
7
+
8
+ > **Scientific Integrity Commitment:** This document records all hypotheses, primary metrics, experimental controls, statistical tests, and explicit falsification criteria **prior to executing any model training or evaluation** (following Lones, [arXiv:2108.02497](https://arxiv.org/abs/2108.02497); Lipton & Steinhardt, [arXiv:1807.03341](https://arxiv.org/abs/1807.03341); and NeurIPS Paper Checklist standards). Any subsequent exploratory analyses will be explicitly tagged as **Post-Hoc** in Section 7.
9
+
10
+ ---
11
+
12
+ ## 1. Domain, Task, and Strict Pure-Polynomial Definition
13
+
14
+ - **Task:** Given $x = (x_1, \dots, x_n) \in [-1, 1]^n$, predict the non-decreasing sorted vector $y = \mathrm{sort}(x) = (x_{(1)}, \dots, x_{(n)})$ with $x_{(1)} \le \dots \le x_{(n)}$.
15
+ - **Strict Pure-Polynomial Invariant:** Every model classified as a **Pure PNN** must compute $f_\theta(x)$ using **exclusively** additions, subtractions, constant/learned affine maps, and multiplications during inference (no ReLU, GELU, sigmoid, tanh, softmax, division, square root, `abs`, `min`/`max`, `argsort`, or runtime normalization). Purity is audited mechanically via PyTorch FX graph tracing (`tests/test_purity.py`).
16
+
17
+ ---
18
+
19
+ ## 2. Pre-Specified Hypotheses & Explicit Falsification Criteria
20
+
21
+ ### H1 — Architectural Inductive Bias Ladder (Primary Hypothesis)
22
+ - **Claim:** On in-distribution Uniform $[-1, 1]^n$ list sorting ($n \in \{8, 16\}$), strictly pure polynomial sorting networks (`polysort_shared`, `polysort_adaptive`) achieve at least **$5\times$ lower Value MAE** and significantly higher **Exact Monotonicity Rate** and **Kendall's $\tau$** than unstructured pure PNNs (`pinet_ncp_skip`, `poly_mlp`) and permutation-invariant power-sum PNNs (`deepsets_poly`), while using $\ge 10\times$ fewer learnable parameters.
23
+ - **Falsification Criterion:** H1 is **falsified** if `polysort_shared` or `polysort_adaptive` fails to beat all three (`pinet_ncp_skip`, `poly_mlp`, `deepsets_poly`) on $n=8$ and $n=16$ Value MAE by at least $2\times$ with Holm-Bonferroni corrected $p < 0.01$ (paired Wilcoxon signed-rank test on $N_{\text{test}}=10{,}000$ lists, averaged across 5 seeds).
24
+
25
+ ### H2 — Learned Composite PNNs vs. Zero-Training Analytical CKKS Minimax at Iso-Depth
26
+ - **Claim:** At the **exact same sorting-network wiring, composition depth $L$, and polynomial degree $d$** (Bitonic network, $L=3$ cubic layers, comparator degree $3^3 = 27$), gradient-trained `polysort_adaptive` (and `polysort_shared`) will achieve **strictly lower Value MAE** on Uniform $[-1, 1]^n$ ($n=8, 16$) than zero-training analytical Cheon et al. (2020) $f_1^{(3)}$ (`analytical_cheon`) and Remez minimax composite (`analytical_remez`) networks, because value-sorting error weights sign error by $|\Delta|$ ($e_{\text{val}} = |\Delta||1 - s(|\Delta|)|$) and stage-adaptive polynomials exploit shrinking gap distributions in later Bitonic layers.
27
+ - **Discriminating Trade-Off Prediction (H2b):** When trained purely on Value MSE without an ordering penalty, `polysort_*` may trade off small-gap slope against medium-gap value accuracy, so on **adversarial near-ties** ($\delta = 10^{-3}$), analytical Remez minimax may tie or outperform MSE-only `polysort_shared` in pairwise ordering unless a monotonicity/ordering loss term is added.
28
+ - **Falsification Criterion:** H2 is **falsified** if `polysort_adaptive` fails to reduce Uniform $[-1, 1]^n$ Value MAE by at least **15% relative** vs. `analytical_cheon` AND beat `analytical_remez` with corrected $p < 0.01$ at iso-depth ($L=3, d=3$).
29
+
30
+ ### H3 — Empirical Depth Separation at Iso-Degree (Bernstein vs. Cheon)
31
+ - **Claim:** At identical comparator degree $D = 9$ inside the exact same Bitonic sorting network ($n = 8, 16$), a **composite depth-2 cubic** comparator ($L=2, d=3 \Rightarrow D=9$) achieves lower Value MAE and lower seed variance than a **flat depth-1 degree-9** polynomial ($L=1, d=9 \Rightarrow D=9$), and increasing composition depth $L \in \{1, 2, 3, 4\}$ with cubic blocks reduces Value MAE monotonically.
32
+ - **Falsification Criterion:** H3 is **falsified** if flat $(L=1, d=9)$ achieves equal or lower Value MAE than composite $(L=2, d=3)$ across 3+ seeds, OR if $(L=3, d=3)$ fails to improve over $(L=2, d=3)$ by $\ge 20\%$ relative MAE.
33
+
34
+ ### H4 — Constant-Depth All-to-All Ranking (`PolyPairwiseRank`) vs. Swap Networks (`PolySortNet`)
35
+ - **Claim:** On $n = 8$, the Mazzone-inspired constant-depth `poly_pairwise_rank` (comparison depth 2, with exact polynomial tie-correction $E = 4C(1-C)$) will significantly outperform unstructured PNNs (`pinet_ncp_skip`, `poly_mlp`, `deepsets_poly`), **but** as $n$ increases ($n=16, 32$) at fixed polynomial budget, `polysort_shared` will outperform `poly_pairwise_rank` on Value MAE and exact monotonicity because `poly_pairwise_rank`'s rank indicator must resolve spacing $1/n$ without exact sum-conservation guarantees.
36
+ - **Falsification Criterion:** H4 is **falsified** if `poly_pairwise_rank` achieves equal or lower Value MAE than `polysort_shared` at $n = 16$ under matched comparator degree.
37
+
38
+ ### H5 — Zero-Shot Length & Shift Generalization vs. Theoretical Scale-Boundary Blow-Up
39
+ - **Claim (Positive Invariants):** `polysort_shared` trained exclusively on $n = 8$ over $[-1, 1]^8$ will:
40
+ 1. Exhibit **exact shift equivariance** ($\|f_\theta(x + c\mathbf{1}) - (f_\theta(x) + c\mathbf{1})\|_\infty < 10^{-5}$ in float32 and $< 10^{-12}$ in float64) for $c \in \{1, 10, 100\}$.
41
+ 2. Exhibit **exact sum conservation** ($|\sum \hat{y}_i - \sum x_i| < 10^{-5}$ in float32, $< 10^{-12}$ in float64).
42
+ 3. **Generalize zero-shot** to unseen list lengths $n \in \{4, 16, 32, 64, 128\}$ with Value MAE remaining $< 0.03$ and Kendall's $\tau > 0.98$ even at $n = 128$ (16$\times$ training length).
43
+ - **Claim (Predicted Negative Boundary):** On scaled inputs $s \cdot x$ with $s > 1$, strictly pure `polysort_shared` MUST exhibit a sharp **polynomial blow-up cliff** (MAE $> 1.0$ or numerical overflow by $s = 2.0$–$5.0$), whereas the non-polynomial scale-normalized ablation (`ablation_scale_norm`) eliminates this cliff completely (MAE scales linearly with $s$, constant relative MAE).
44
+ - **Falsification Criterion:** H5 is **falsified** if shift or sum error exceeds numerical tolerance ($10^{-4}$ float32), if zero-shot $n=64$ Kendall's $\tau < 0.95$, OR if strictly pure `polysort_shared` does not diverge (MAE $< 0.1$) at $s = 5.0$.
45
+
46
+ ### H6 — Parameterization & Structural Topology Causality (Ablations)
47
+ - **Claim:**
48
+ 1. Fixed-point odd Chebyshev parameterization ($h_k(u) = u + u(1-u^2)\sum c_{k,j} T_{2j}(u)$) achieves better training stability (0% NaN divergence rate) and lower Value MAE than raw monomial basis and unconstrained general (even+odd) polynomials.
49
+ 2. Replacing Bitonic/Odd-Even wiring with a **Random Fixed Wiring** negative control causes catastrophic failure (MAE $> 10\times$ worse, Kendall's $\tau < 0.70$), proving causally that the sorting-network topology carries essential algorithmic structure, while **Learned Wiring** (`polysort_learned_wire`) improves substantially over Random Wiring yet lags fixed Bitonic wiring at $n \ge 8$.
50
+ - **Falsification Criterion:** H6 is **falsified** if random fixed wiring achieves Kendall's $\tau > 0.85$ at $n=8$, or if raw monomial basis matches or beats fixed-point Chebyshev across all depths $L \in \{2, 3, 4\}$ with 0% divergence.
51
+
52
+ ---
53
+
54
+ ## 3. Pre-Specified Metrics
55
+
56
+ ### Primary Metrics (Used for Hypothesis Testing)
57
+ 1. **Value MAE ($\downarrow$):** $\mathrm{MAE}(\hat{y}, y) = \frac{1}{n}\sum_{k=1}^n |\hat{y}_k - x_{(k)}|$.
58
+ 2. **Kendall's $\tau$ ($\uparrow$):** Rank correlation between $\hat{y}$ and the indices $(1, \dots, n)$ — wait: let's define ordering metrics with **100% mathematical precision** so there is ZERO ambiguity!
59
+ - **Monotonicity Rate ($\uparrow$):** Fraction of test lists strictly/weakly sorted: $\frac{1}{N}\sum_{m=1}^N \mathbf{1}\big[\hat{y}^{(m)}_1 \le \hat{y}^{(m)}_2 \le \dots \le \hat{y}^{(m)}_n\big]$ (using strict tolerance $\hat{y}_k \le \hat{y}_{k+1} + 10^{-7}$ for float32 ties, and exact $\le$ reported alongside).
60
+ - **Pairwise Order Accuracy ($\uparrow$):** Fraction of all $\binom{n}{2}$ pairs $(i < j)$ satisfying $\hat{y}_i \le \hat{y}_j$ (equivalently $\frac{1 + \tau_{\text{mono}}}{2}$, where $\tau_{\text{mono}} = 1 - \frac{2 \cdot \mathrm{inversions}(\hat{y})}{\binom{n}{2}}$ is the Kendall's $\tau$ of $\hat{y}$ against ascending order $(1, \dots, n)$!).
61
+ - **Value-Matched Exact Sort Rate ($\uparrow$):** Fraction of test lists that are BOTH monotonic ($\hat{y}_1 \le \dots \le \hat{y}_n$) AND have max elementwise value error $\|\hat{y} - y\|_\infty < \varepsilon_{\text{tol}}$ (reported at $\varepsilon_{\text{tol}} \in \{0.05, 0.01, 0.001\}$). Why this dual metric? Because a trivial constant output $[0, 0, \dots, 0]$ is vacuously monotonic! Combining Monotonicity Rate with Value MAE and $\varepsilon$-Exact Sort Rate prevents metric gaming!
62
+
63
+ ### Secondary & Diagnostic Metrics
64
+ - **RMSE ($\downarrow$):** $\sqrt{\frac{1}{n}\sum_{k=1}^n (\hat{y}_k - y_k)^2}$.
65
+ - **Max Elementwise Error $L_\infty$ ($\downarrow$):** $\max_{1 \le k \le n} |\hat{y}_k - y_k|$ (mean and 99th percentile across $N_{\text{test}}$).
66
+ - **Multiset Wasserstein-1 Distance $W_1(\hat{y}, y)$ ($\downarrow$):** $\frac{1}{n}\sum_{k=1}^n |\mathrm{sort}(\hat{y})_k - y_k|$ — cleanly disentangles **value distortion** (how faithful the multiset of output values is to the input values) from **ordering error**!
67
+ - **Sum Conservation Error ($\downarrow$):** $\big|\sum_{k=1}^n \hat{y}_k - \sum_{i=1}^n x_i\big|$.
68
+ - **Structural Complexity:** Learnable parameter count, effective polynomial degree $D_{\text{eff}}$, sequential multiplicative depth $d_{\text{mult}}$, forward latency (ms per 1,000 lists on GPU & CPU).
69
+ - **Empirical Scale Stability Radius $R_{\text{stable}}$ ($\uparrow$):** Largest scale factor $s \in \{0.1, 0.5, 1.0, 1.05, 1.1, 1.2, 1.3, 1.5, 2.0, 5.0\}$ with relative MAE ($\mathrm{MAE}/s$) $< 0.05$.
70
+
71
+ ---
72
+
73
+ ## 4. Data Generation, Splits & Zero-Leakage Protocol
74
+
75
+ - **Deterministic Seed-Keyed Streams:** Every split uses an independent `numpy.random.Generator` seeded via `SHA256(f"{split_name}:{n}:{seed}")`, ensuring mathematically independent datasets across `train`, `val`, `test`, and every OOD suite.
76
+ - **Sizes:**
77
+ - `train`: $200{,}000$ i.i.d. lists from $\mathrm{Uniform}[-1, 1]^n$ (or online infinite stream? **Decision: Fixed pre-generated $200{,}000$-list training set** so ALL models — tiny 6-parameter `PolySortNet` and 100k-parameter `PiNet`/`ReLUMLP` — are trained on the **EXACT SAME finite sample budget**, enabling honest generalization & overfitting measurement, plus verifiable zero overlap with `val`/`test`!).
78
+ - `val`: $10{,}000$ i.i.d. lists (used strictly for checkpoint selection & hyperparameter sweep).
79
+ - `test`: $10{,}000$ i.i.d. lists (touched ONLY at final evaluation).
80
+ - **Held-Out OOD & Stress Test Suites ($N = 2{,}000$ lists each):**
81
+ 1. `ood_gaussian`: $\mathcal{N}(0, 0.35^2)$ clipped to $[-1, 1]$.
82
+ 2. `ood_bimodal`: 50/50 mixture of $\mathcal{N}(-0.7, 0.1^2)$ and $\mathcal{N}(+0.7, 0.1^2)$ clipped to $[-1, 1]$.
83
+ 3. `ood_skewed`: $2 \cdot \mathrm{Beta}(0.5, 5.0) - 1$ (heavily clustered near $-1$).
84
+ 4. `ood_integers`: Uniform discrete grid $\{-10, -9, \dots, 10\} / 10$ (frequent exact ties).
85
+ 5. `ood_duplicates_50`: 50% of entries duplicated from remaining elements.
86
+ 6. `ood_nearties_1e-2`, `ood_nearties_1e-3`, `ood_nearties_1e-4`: Lists containing planted adjacent gaps of exact size $\delta \in \{10^{-2}, 10^{-3}, 10^{-4}\}$.
87
+ 7. `ood_edge_sorted` & `ood_edge_reversed`: Already-sorted and strictly reverse-sorted lists.
88
+ 8. `ood_shift_1`, `ood_shift_10`, `ood_shift_100`: $x + c\mathbf{1}$ for $c \in \{1, 10, 100\}$.
89
+ 9. `ood_scale_s`: $s \cdot x$ for $s \in \{0.1, 0.5, 1.0, 1.05, 1.1, 1.2, 1.3, 1.5, 2.0, 5.0\}$.
90
+ 10. `ood_length_n`: Zero-shot list lengths $n \in \{4, 8, 16, 32, 64, 128\}$.
91
+
92
+ ---
93
+
94
+ ## 5. Statistical Analysis Plan
95
+
96
+ - **Multi-Seed Protocol:** All 9 core comparison models evaluated over **5 independent random seeds** (`42, 123, 456, 789, 1024`) on $n = 8$ and $n = 16$. Summary tables report `mean ± std` across seeds AND pooled test-set **95% percentile bootstrap confidence intervals** ($B = 10{,}000$ resamples).
97
+ - **Paired Hypothesis Testing:** For every preregistered comparison (H1–H6), compute per-list paired metric differences $d_m = M_A(x^{(m)}) - M_B(x^{(m)})$ on the exact same $N_{\text{test}} = 10{,}000$ test lists; run two-sided **Wilcoxon signed-rank tests** and report exact $p$-values and rank-biserial effect sizes, applying **Holm-Bonferroni** familywise error rate control at $\alpha = 0.05$ across all planned hypothesis comparisons.
98
+ - **Float64 Verification:** All primary models are evaluated in BOTH `float32` and `float64` on `test` and `ood_shift_*` to separate genuine mathematical error from `float32` roundoff noise.
99
+ - **Leakage Sanity Control:** `shuffled_target_ctrl` trains `polysort_adaptive` on randomly permuted targets; its test MAE MUST match a naive mean predictor (confirming zero target leakage).
100
+
101
+ ---
102
+
103
+ ## 6. Confounder Checklist
104
+
105
+ | Potential Confounder | Mitigation in This Study |
106
+ | :--- | :--- |
107
+ | **Parameter count mismatch** | Parameter-matched capacity among unstructured baselines (`pinet_ncp_skip`, `poly_mlp`, `relu_mlp`, `deepsets_poly`, `set_transformer` ~25k–65k params), while explicitly reporting parameter counts alongside accuracy so tiny structured PNNs (`polysort_shared`: 3–9 params!) are never conflated with overparameterized models. |
108
+ | **Degree / depth mismatch vs. analytical CKKS** | `polysort_shared` and `polysort_adaptive` compared against `analytical_cheon` and `analytical_remez` at **strictly identical** sorting wiring, layer count $\ell$, composition depth $L=3$, and block degree $d=3$ (total comparator degree $27$). |
109
+ | **Optimizer / LR bias** | Standard AdamW + cosine schedule + gradient clipping across all models, PLUS explicit hyperparameter sensitivity sweep in Stage 4E verifying conclusions do not depend on cherry-picked LR/weight decay. |
110
+ | **Vacuous monotonicity (constant output)** | Always co-report Value MAE, Wasserstein-1 $W_1$, Monotonicity Rate, and $\varepsilon$-Exact Sort Rate together. |
111
+ | **Hidden non-polynomial ops** | Automated PyTorch FX tracer test (`tests/test_purity.py`) rejects any non-polynomial op in any model tagged `is_pure_polynomial=True`. |
112
+
113
+ ---
114
+
115
+ ## 7. Pre-Hoc vs. Post-Hoc Analysis Log
116
+
117
+ - **Pre-Hoc Analyses (Locked 2026-11-25):** Hypotheses H1–H6, all 17 models/controls, all 6 ablation families, and all 10 OOD suites documented in `reports/planned-runs.md`.
118
+ - **Post-Hoc Exploratory Analyses:** *(None yet — any exploratory follow-up triggered by unexpected empirical findings will be logged here with date and rationale.)*
reports/progress.md ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Live Progress Report (`pnn-sort`)
2
+
3
+ **Last Updated:** 2026-11-25 16:40 CET
4
+
5
+ ## Current Status
6
+ - **Overall Progress:** ~38% complete (Phases 0–3 complete; starting Phase 4A training).
7
+ - **Done:**
8
+ - Phase 0–1: CUDA GPU environment (`torch 2.11.0+cu128`, RTX 5070 Laptop GPU), full primary-source literature & SOTA reviews.
9
+ - Phase 2: Preregistration (`reports/preregistration.md`), Run Matrix (`reports/planned-runs.md`), docs, GitHub + Hugging Face repos created, pre-results commit `879258c` pushed.
10
+ - Phase 3: Modular `src/pnn_sort/` codebase implemented (17+ models/controls/baselines, PyTorch FX purity auditor, exact HiGHS convex-LP Lee et al. 2022 Remez composite solver, resumable trainer, real-time web accuracy dashboard, bootstrap/Wilcoxon/Holm stats, plotting engine). **62/62 pytest tests pass**. Adversarial Self-Review #1 written (`reports/reviews/review-01-pre-training.md`).
11
+ - **In Progress:**
12
+ - Pushing verified Phase 3 codebase to GitHub & Hugging Face, then launching Stage 4A (zero-training analytical/controls + primary `PolySortNet` models on $n=8, 16$) with live dashboard monitoring.
13
+ - **Next Up:** Stages 4B (full PNN ladder + scaling $n=4..128$), 4C (non-poly baselines + shuffled-target control), 4D (6 causal ablations), 4E (5-seed statistical rigor + sensitivity sweeps), and Phase 5 (visualizations, GitHub Pages live browser sorter, `reports/paper.pdf`).
14
+ - **Estimated Remaining Time:** ~1.5–3 hours wall-clock on RTX 5070.
reports/reviews/review-01-pre-training.md ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Adversarial Self-Review #1: Pre-Training Audit (NeurIPS-Style Red Team)
2
+
3
+ **Date:** 2026-11-25
4
+ **Reviewer Role:** Skeptical NeurIPS Area Chair & Methodology Auditor
5
+ **Scope:** Codebase (`src/pnn_sort/`), test suite (`tests/` — 62/62 passed), preregistration (`reports/preregistration.md`), and run matrix (`reports/planned-runs.md`) prior to any model training.
6
+
7
+ ---
8
+
9
+ ## 1. Summary of Pre-Training Verification
10
+ - **PyTorch FX Pure-Polynomial Audit:** 18/18 pure-PNN models (and zero-shot length views `n=4, 16, 32`) passed mechanical FX graph verification confirming zero non-polynomial ops; 5/5 non-polynomial baselines (`diffsort_*`, `relu_mlp`, `polysort_scale_norm`) were verified to fail the pure-polynomial gate as required.
11
+ - **Symbolic & Exact Invariant Audit:** Cheon $f_1\text{--}f_4$ Chebyshev expansions match SymPy exact algebra ($< 10^{-13}$); Bitonic, Odd-Even Merge, and Odd-Even Transposition wirings pass Knuth Zero-One exact verification across $n \in \{2..32\}$; `PolySortNet` satisfies float64 sum conservation ($< 10^{-13}$), shift equivariance up to $c=100$ ($< 10^{-11}$), negation anti-symmetry ($< 10^{-13}$), and constant idempotency ($< 10^{-14}$).
12
+ - **Anti-Leakage & Reproducibility:** SHA-256 keyed disjoint split hashes pass; interrupted-and-resumed training matches uninterrupted training bit-for-bit (`atol=1e-6`).
13
+
14
+ ---
15
+
16
+ ## 2. Adversarial Critiques Raised & Mitigations Applied
17
+
18
+ ### Critique 1: "Is Cheon $f_1^{(3)}$ a strawman analytical baseline?"
19
+ - **Assessment:** **VALID — FIXED BEFORE TRAINING.** Initial unit tests showed repeated Cheon $f_1^{(3)}$ has origin slope $1.5^3 = 3.375$, yielding MAE $\approx 0.114$ on $n=8$ Uniform $[-1,1]^8$. Comparing trained networks solely against $f_1^{(3)}$ would exaggerate gains.
20
+ - **Mitigation:** Added three far stronger zero-training analytical CKKS baselines:
21
+ 1. `analytical_cheon_fg`: exact Cheon/Hong/Mazzone mixed $f_3 \circ g_3$ (degree 49, MAE $< 0.03$).
22
+ 2. `analytical_remez` ($L=3, m=1$, $\delta=0.10$, degree 27): exact HiGHS convex-LP Lee et al. (2022) minimax composite (MAE $\approx 0.044$).
23
+ 3. `analytical_remez` ($L=3, m=2$, $\delta=0.03$, degree 125): iso-degree analytical rival for `polysort_shared_m2` and `polysort_adaptive_m2`.
24
+
25
+ ### Critique 2: "Could `DiffSortBaseline` be crippled by a small temperature?"
26
+ - **Assessment:** **MITIGATED.** `DiffSortBaseline` learns `log_steepness` up to $\exp(8.0) \approx 2980$ with `lr=2e-2`, allowing it to sharpen arbitrarily close to a hard comparator (non-polynomial upper bound). Note that `DiffSortBaseline` is initialized at `steepness=10.0` (standard `diffsort` default).
27
+
28
+ ### Critique 3: "Are unstructured PNNs (`pinet_ncp_skip`, `deepsets_poly`, `poly_mlp`) starved for parameters?"
29
+ - **Assessment:** **MITIGATED.** Parameter counts verified:
30
+ - `polysort_shared`: **3** params; `polysort_adaptive`: **18–30** params; `poly_pairwise_rank`: **12** params.
31
+ - `poly_mlp`: **36.7k–38.8k** (matched to `relu_mlp`: **35.2k–37.3k**).
32
+ - `deepsets_poly`: **130.9k–131.7k**; `pinet_ncp_skip`: **201.6k–205.7k**; `set_transformer`: **96.6k**.
33
+ Unstructured models receive $1{,}000\times$–$60{,}000\times$ *more* parameters than `PolySortNet`, making any `PolySortNet` victory overwhelmingly attributable to architectural inductive bias rather than capacity advantage.
34
+
35
+ ### Critique 4: "Can `test` split differ across models and invalidate paired Wilcoxon tests?"
36
+ - **Assessment:** **MITIGATED.** `evaluate_model_full` fixes `seed=9999` for `test` ($N=10{,}000$) and all OOD suites ($N=2{,}000$) across EVERY model and training seed, saving exact per-list metric arrays (`test_per_list.npz`) so paired Wilcoxon signed-rank tests operate on the exact same held-out lists.
37
+
38
+ ### Critique 5: "Risk of vacuous monotonicity or hidden float32 roundoff."
39
+ - **Assessment:** **MITIGATED.** Every report co-logs Value MAE, RMSE, $L_\infty$, Multiset $W_1$, Sum Conservation Error, exact & tolerance Monotonicity Rate, Pairwise Order Accuracy / Kendall's $\tau$, and $\varepsilon$-Exact Sort Rates ($\varepsilon \in \{0.05, 0.01, 0.001\}$), plus a separate `float64` verification pass on `test` and `ood_shift_100`.
40
+
41
+ ### Critique 6: "Is `SetTransformerBaseline` truly permutation-invariant and strong?"
42
+ - **Assessment:** **VERIFIED.** Uses 2 Pre-LN Self-Attention Blocks without positional encodings on inputs (strictly permutation-equivariant), followed by quantile-query cross-attention (strictly permutation-invariant output order statistics, length-generalizable).
43
+
44
+ ---
45
+
46
+ ## 3. Verdict
47
+ **APPROVED FOR STAGE 4 EXECUTION.** No methodological flaws or leakage vectors remain. Proceed to Stage 4A (zero-training controls/analytical baselines + primary `PolySortNet` models) with live dashboard telemetry and incremental GitHub/Hugging Face syncs.
reports/state-of-the-art-review.md ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # State-of-the-Art Review: Polynomial & Neural Methods for Sorting Lists
2
+
3
+ **Author:** Libor "Burny" Burian
4
+ **Date:** 2026-11-25
5
+
6
+ ---
7
+
8
+ ## 1. Taxonomy of State-of-the-Art Approaches
9
+
10
+ No prior published work systematically trains and compares **strictly pure Polynomial Neural Networks (PNNs)** across architectural inductive biases for continuous numerical list sorting. Instead, the state of the art spans **four distinct paradigms**, summarized below.
11
+
12
+ | Paradigm | Representative Methods | Pure Polynomial? | Comparison / Layer Depth | Zero-Shot Length Generalization? | Handles Exact Ties? | Primary Strength | Key Limitation for Pure-PNN List Sorting |
13
+ | :--- | :--- | :---: | :---: | :---: | :---: | :--- | :--- |
14
+ | **1. Unstructured Deep PNNs** | $\Pi$-Nets (CCP / NCP / NCP-Skip / ProdPoly; Chrysos et al., CVPR '20 / TPAMI '21), PolyMLP (Kileel et al., NeurIPS '19) | Yes *(when BN/tanh removed)* | $O(L)$ | No (fixed $n$) | Approximate | General multivariate polynomial approximator; tensor-factorized parameters | Lacks permutation symmetry & pairwise comparison bias; severe gradient instability & Bernstein $O(1/D)$ bottleneck |
15
+ | **2. Symmetric Set Networks** | DeepSets (Zaheer et al., NeurIPS '17), Power-Sum PNN, Set Transformer (Lee et al., ICML '19) | DeepSets-Poly: Yes; SetTransf: No | $O(L)$ | SetTransf: Yes; DeepSets: latent $\ge n$ req. | Approximate | Enforces exact permutation invariance $f(\pi x)=f(x)$ | Wagstaff et al. (2019/2022) prove latent width $\ge n$ is mandatory; decoding order statistics from power sums is ill-conditioned |
16
+ | **3. Differentiable Sorting Networks (Non-Poly)** | `diffsort` Logistic / ART / Cauchy / Optimal (Petersen et al., ICML '21 & ICLR '22); NeuralSort (ICLR '19); SoftSort (ICML '20); FastSort (ICML '20) | **No** ($\exp$, $\arctan$, division, `abs`) | Bitonic: $\frac{1}{2}\log_2 n(\log_2 n + 1)$; Odd-Even: $n$ | Yes | Yes (exact on CAS wires) | Proven monotonicity + $\epsilon \ell$ error bound (Petersen Thm. 5, 8, 9); scales to $n=1024$ | Uses non-polynomial transcendental activations; temperature $\beta$ tuned via grid search rather than learned per-stage polynomials |
17
+ | **4. Analytical Polynomial Sorting (CKKS FHE)** | Cheon et al. (ASIACRYPT '20), Hong et al. (IEEE TIFS '21), Lee et al. (IEEE TDSC '22), Mazzone et al. (USENIX Sec '25) | **Yes** (additions & multiplications only) | Bitonic: $O(\log^2 n)$; $k$-way: $O(k\log_k^2 n)$; Mazzone: **$O(1)$ (depth 2)** | Yes | Swap nets: Yes; Mazzone: Yes w/ $E=4C(1-C)$ | Optimal asymptotic depth for worst-case $L_\infty$ sign error on $[\delta, 1]$ | **Zero data adaptation:** fixed coefficients optimize unweighted $\|1 - s(u)\|_\infty$ rather than value-sorting error $u|1-s(u)|$ or stage-varying gap distributions |
18
+
19
+ ---
20
+
21
+ ## 2. Deep Technical Analysis of SOTA Building Blocks
22
+
23
+ ### 2.1 Why Analytical Sign-Minimax Polynomials Are Suboptimal for Value Sorting
24
+ In a polynomial compare-and-swap (CAS) gate with scaled difference $\Delta = \frac{b - a}{2} \in [-1, 1]$ and odd polynomial $s(\Delta) \approx \mathrm{sign}(\Delta)$:
25
+ $$\hat{\min}_s(a, b) = \frac{a+b}{2} - \Delta \cdot s(\Delta), \qquad \hat{\max}_s(a, b) = \frac{a+b}{2} + \Delta \cdot s(\Delta).$$
26
+ The exact single-gate **value error** is:
27
+ $$e_{\text{val}}(\Delta) = \big|\hat{\min}_s(a,b) - \min(a,b)\big| = \big|\hat{\max}_s(a,b) - \max(a,b)\big| = |\Delta| \cdot \big|1 - s(|\Delta|)\big|.$$
28
+
29
+ Compare the two optimization objectives on $[0, 1]$:
30
+ 1. **Analytical CKKS Objective (Cheon et al., 2020; Lee et al., 2022):** Minimizes unweighted sign error $\sup_{u \in [\delta, 1]} |1 - s(u)|$ for a chosen precision threshold $\delta > 0$. Because $s(0) = 0$ is fixed, forcing small error at tiny $\delta$ forces high slope near $0$, causing Gibbs-like oscillations or requiring high multiplicative depth $L$.
31
+ 2. **Value-Sorting Objective (This Study):** Minimizes expected value error $\mathbb{E}\big[\|\hat{y} - \mathrm{sort}(x)\|_p^p\big]$ over the actual input and intermediate-layer gap distributions! Crucially:
32
+ - The factor $|\Delta|$ naturally **down-weights** tiny gaps ($|\Delta| \to 0$) in value error, allowing a low-depth polynomial to achieve far lower MAE/RMSE than an unweighted sign-minimax polynomial of the *exact same degree and multiplicative depth*.
33
+ - **Stage-Dependent Gap Distribution:** In an $\ell$-layer Bitonic sorting network (e.g., $\ell = 6$ for $n=8$, $\ell = 10$ for $n=16$), early layers compare nearly random pairs with wide gaps ($|\Delta| \sim O(1)$), whereas final merge layers compare adjacent sorted sub-lists with much smaller gaps ($|\Delta| \sim O(1/n)$). Analytical CKKS networks apply the **identical** polynomial $s$ at every stage, wasting depth early or under-resolving late; **stage-adaptive learned `PolySortNet`** can allocate distinct composite polynomial coefficients $\{c^{(t)}_{k,j}\}$ to each sorting layer $t = 1, \dots, \ell$!
34
+
35
+ ### 2.2 Fixed-Point-Preserving Chebyshev Residual Parameterization
36
+ Training deep compositions of raw monomials $s(u) = \sum c_j u^j$ is notoriously ill-conditioned (Vandermonde condition numbers grow exponentially in degree, and small parameter steps cause activations to blow up beyond $[-1, 1]$).
37
+
38
+ To solve this cleanly while remaining **100% strictly polynomial**, we introduce the **Fixed-Point Odd Chebyshev Composition Block**:
39
+ $$h_k(u) = u + u(1 - u^2) \sum_{j=0}^{m-1} c_{k,j}\, T_{2j}(u), \qquad s_\theta(u) = (h_L \circ h_{L-1} \circ \dots \circ h_1)(u),$$
40
+ where $T_0(u) = 1$, $T_2(u) = 2u^2 - 1$, $T_4(u) = 8u^4 - 8u^2 + 1$, etc., computed strictly via polynomial recurrence $T_{r+1}(u) = 2u T_r(u) - T_{r-1}(u)$.
41
+
42
+ **Exact Mathematical Properties:**
43
+ 1. **Strictly Pure Polynomial:** Degree of each block is $2m + 1$; total degree of $s_\theta$ is $(2m+1)^L$; total degree of the CAS gate $\Delta s_\theta(\Delta)$ is $(2m+1)^L + 1$.
44
+ 2. **Exact Odd Symmetry:** $h_k(-u) = -h_k(u) \implies s_\theta(-u) = -s_\theta(u)$ identically for all $\theta$.
45
+ 3. **Exact Fixed Points:** $h_k(0) = 0$ and $h_k(\pm 1) = \pm 1$ identically for all $\theta$.
46
+ 4. **Exact Subsumption of Analytical SOTA:**
47
+ - $c_{k,j} = 0 \implies h_k(u) = u$ (exact identity — ideal residual initialization).
48
+ - $m = 1, c_{k,0} = \frac{1}{2} \implies h_k(u) = \frac{3}{2}u - \frac{1}{2}u^3 = f_1(u)$ (Cheon et al., 2020).
49
+ - $m = 2, c_{k,0} = \frac{11}{16}, c_{k,1} = -\frac{3}{16} \implies$ wait, let's verify exact Chebyshev expansion of $f_2(u) = u + u(1-u^2)(\frac{1}{2} + \frac{3}{8}(1-u^2)) = u + u(1-u^2)(\frac{7}{8} - \frac{3}{8}u^2)$! Since $u^2 = \frac{1 + T_2(u)}{2}$, we have $\frac{7}{8} - \frac{3}{8}\cdot\frac{1+T_2(u)}{2} = \frac{11}{16} - \frac{3}{16}T_2(u)$! Exact algebraic identity!!
50
+ 5. **Bounded Propagation Guarantee:** Whenever $|s_\theta(\Delta)| \le 1$ on $[-1, 1]$, every wire at every depth remains strictly inside $[\min(x), \max(x)] \subseteq [-1, 1]$, and Petersen et al. (2022) Theorem 9 gives the exact $L_\infty$ upper bound:
51
+ $$\|\hat{y} - \mathrm{sort}(x)\|_\infty \le \ell \cdot \sup_{u \in [0, 1]} u\, |1 - s_\theta(u)|.$$
52
+
53
+ ### 2.3 Constant-Depth All-to-All Learned Polynomial Sorting (`PolyPairwiseRank`)
54
+ Inspired directly by **Mazzone et al. (USENIX Security 2025, arXiv:2412.15126)**, we also design a **learned constant-comparison-depth** pure polynomial sorter that avoids the $O(\log^2 n)$ sequential CAS depth of Bitonic networks:
55
+ 1. Compute all $n \times n$ pairwise scaled differences $\Delta_{ij} = (x_j - x_i)/2$ and learned odd composite polynomial comparison matrix $C_{ij} = \frac{1 + s_\theta^{\text{cmp}}(\Delta_{ij})}{2}$.
56
+ 2. Apply Mazzone's exact polynomial tie-correction offset (Sec. 4, Alg. 6):
57
+ $$E_{ij} = 4 C_{ij}(1 - C_{ij}), \qquad r_j = \sum_{i=1}^n C_{ij} + \sum_{i \le j} E_{ij} - \frac{1}{2}\sum_{i=1}^n E_{ij} \in [1, n].$$
58
+ 3. For each target rank $k \in \{1, \dots, n\}$, apply a learned polynomial indicator kernel centered at $k$ using normalized rank difference $z_{jk} = \frac{r_j - k}{n} \in [-1, 1]$:
59
+ $$W_{jk} = \frac{1 + s_\theta^{\text{ind}}\big(z_{jk} + \frac{1}{2n}\big)}{2} \cdot \frac{1 - s_\theta^{\text{ind}}\big(z_{jk} - \frac{1}{2n}\big)}{2},$$
60
+ and output $\hat{y}_k = \sum_{j=1}^n W_{jk} x_j$.
61
+ - **Trade-off to test empirically:** `PolyPairwiseRank` has **constant comparison depth** (depth 2 instead of $\frac{1}{2}\log_2 n(\log_2 n + 1)$), is 100% pure polynomial, and generalizes zero-shot to arbitrary $n$ — **but** its indicator step must resolve rank spacing $1/n$ (shrinking as $n$ grows) AND lacks exact sum-conservation unless $\sum_k W_{jk} = 1$. Comparing `PolySortNet` vs. `PolyPairwiseRank` directly tests the **swap-network vs. rank-indicator** paradigm divide in trainable PNNs!
62
+
63
+ ---
64
+
65
+ ## 3. Summary of Key Trade-offs & Open Questions Resolved by Our Experiments
66
+
67
+ | Scientific Question | Analytical / Theoretical Expectation | Empirical Test Designed in This Study |
68
+ | :--- | :--- | :--- |
69
+ | **Can unstructured PNNs ($\Pi$-Net, PolyMLP) sort lists?** | Expressible via Stone-Weierstrass, but suffers Bernstein $O(1/D)$ bottleneck & combinatorial lack of permutation bias; should degrade rapidly as $n$ grows from $4 \to 16$. | Compare `pinet_ncp_skip`, `poly_mlp`, `deepsets_poly` vs `polysort_*` across $n \in \{4, 8, 16\}$. |
70
+ | **Can learned PNNs beat analytical CKKS minimax at iso-depth?** | **Yes for Value MAE/RMSE** (value error weights sign error by $|\Delta|$, and stage-adaptive polynomials exploit narrowing layer gaps); **trade-off on adversarial near-ties** unless ordering margin loss is included. | Iso-depth head-to-head: `polysort_shared` & `polysort_adaptive` vs `analytical_cheon` & `analytical_remez` on Uniform ID + Adversarial Near-Ties. |
71
+ | **Is flat-vs-composite depth separation empirically large?** | Huge separation predicted: degree-9 composite ($L=2, d=3$) should vastly outperform flat degree-9 ($L=1, d=9$) in optimization stability and accuracy, and $L=3$ ($d=3$, deg 27) should improve further. | Iso-degree ablation: $(L=1, d=9)$ vs $(L=2, d=3)$ vs $(L=3, d=3)$ vs $(L=4, d=3)$. |
72
+ | **Can sorting wiring be learned end-to-end vs fixed Bitonic?** | Unconstrained linear mixing breaks exact sum conservation & swap structure; likely worse than Bitonic/Odd-Even, while still beating random fixed wiring. | `polysort_learned_wire` vs `polysort_shared` (Bitonic/Odd-Even) vs `random_wire` negative control. |
73
+ | **Where do pure polynomials fundamentally fail?** | Exact polynomial divergence beyond stability radius $R$ on scaled OOD inputs ($s > 1$). | Scale extrapolation sweep $s \in [0.1, 5.0]$ + non-poly scale-wrapper ablation. |
74
+
75
+ ---
76
+
77
+ ## References (Verified Primary Sources)
78
+
79
+ 1. Batcher, K. E. (1968). *Sorting networks and their applications*. AFIPS Spring Joint Computer Conference, pp. 307–314.
80
+ 2. Bernstein, S. N. (1914). *Sur la meilleure approximation de $|x|$ par des polynômes de degrés donnés*. Acta Mathematica, 37, 1–57.
81
+ 3. Blondel, M., Teboul, O., Berthet, Q., & Djolonga, J. (2020). *Fast Differentiable Sorting and Ranking*. ICML 2020. [arXiv:2002.08871](https://arxiv.org/abs/2002.08871).
82
+ 4. Cheon, J. H., Kim, D., & Kim, D. (2020). *Efficient Homomorphic Comparison Methods with Optimal Complexity*. ASIACRYPT 2020. [IACR ePrint 2019/1234](https://eprint.iacr.org/2019/1234).
83
+ 5. Chrysos, G. G., Moschoglou, S., Bouritsas, G., Panagakis, Y., Deng, J., & Zafeiriou, S. (2020). *$\Pi$-nets: Deep Polynomial Neural Networks*. CVPR 2020. [arXiv:2003.03828](https://arxiv.org/abs/2003.03828).
84
+ 6. Chrysos, G. G., Moschoglou, S., Bouritsas, G., Deng, J., Panagakis, Y., & Zafeiriou, S. (2021). *Deep Polynomial Neural Networks*. IEEE TPAMI. [arXiv:2006.13026](https://arxiv.org/abs/2006.13026) | [GitHub](https://github.com/grigorisg9gr/polynomial_nets).
85
+ 7. Cuturi, M., Teboul, O., & Vert, J.-P. (2019). *Differentiable Ranks and Sorting using Optimal Transport*. NeurIPS 2019. [arXiv:1905.11885](https://arxiv.org/abs/1905.11885).
86
+ 8. Grover, A., Wang, E., Zweig, A., & Ermon, S. (2019). *Stochastic Optimization of Sorting Networks via Continuous Relaxations (NeuralSort)*. ICLR 2019. [arXiv:1903.08850](https://arxiv.org/abs/1903.08850).
87
+ 9. 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.
88
+ 10. Ivakhnenko, A. G. (1971). *Polynomial Theory of Complex Systems*. IEEE Trans. Systems, Man, and Cybernetics, (4), 364–378.
89
+ 11. Kileel, J., Trager, M., & Bruna, J. (2019). *On the Expressive Power of Deep Polynomial Neural Networks*. NeurIPS 2019. [arXiv:1905.12207](https://arxiv.org/abs/1905.12207).
90
+ 12. 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. [IACR ePrint 2020/834](https://eprint.iacr.org/2020/834).
91
+ 13. 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. [arXiv:1810.00825](https://arxiv.org/abs/1810.00825).
92
+ 14. Lipton, Z. C., & Steinhardt, J. (2018). *Troubling Trends in Machine Learning Scholarship*. [arXiv:1807.03341](https://arxiv.org/abs/1807.03341).
93
+ 15. Lones, M. A. (2021). *How to Avoid Machine Learning Pitfalls: A Guide for Academic Researchers*. [arXiv:2108.02497](https://arxiv.org/abs/2108.02497).
94
+ 16. Madsen, A., & Johansen, A. R. (2020). *Neural Arithmetic Units*. ICLR 2020. [arXiv:2001.05016](https://arxiv.org/abs/2001.05016).
95
+ 17. Mazzone, F., Everts, M., Hahn, F., & Peter, A. (2025). *Efficient Ranking, Order Statistics, and Sorting under CKKS*. USENIX Security '25. [arXiv:2412.15126](https://arxiv.org/abs/2412.15126).
96
+ 18. Petersen, F., Borgelt, C., Kuehne, H., & Deussen, O. (2021). *Differentiable Sorting Networks for Scalable Sorting and Ranking Supervision*. ICML 2021, PMLR 139:8546–8555. [arXiv:2105.04019](https://arxiv.org/abs/2105.04019) | [GitHub](https://github.com/Felix-Petersen/diffsort).
97
+ 19. Petersen, F., Borgelt, C., Kuehne, H., & Deussen, O. (2022). *Monotonic Differentiable Sorting Networks*. ICLR 2022. [arXiv:2203.09630](https://arxiv.org/abs/2203.09630).
98
+ 20. Prillo, S., & Eisenschlos, J. M. (2020). *SoftSort: A Continuous Relaxation for the argsort Operator*. ICML 2020. [arXiv:2006.16038](https://arxiv.org/abs/2006.16038).
99
+ 21. Shin, Y., & Ghosh, J. (1991). *The Pi-Sigma Network: An Efficient Higher-Order Neural Network for Pattern Classification and Function Approximation*. IJCNN 1991, vol. 1, pp. 13–18.
100
+ 22. Sidharth, S. S., Keerthana, A. R., Gokul, R., & Anas, K. P. (2024). *Chebyshev Polynomial-Based Kolmogorov-Arnold Networks (ChebyKAN)*. [arXiv:2405.07200](https://arxiv.org/abs/2405.07200).
101
+ 23. Trask, A., Hill, F., Reed, S. E., Rae, J., Dyer, C., & Blunsom, P. (2018). *Neural Arithmetic Logic Units*. NeurIPS 2018. [arXiv:1808.00508](https://arxiv.org/abs/1808.00508).
102
+ 24. Varga, R. S., & Carpenter, A. J. (1985/1987). *On the Bernstein Conjecture in Approximation Theory*. Numerische Mathematik 47, 179–196; Constructive Approximation 3, 193–223.
103
+ 25. Vinyals, O., Fortunato, M., & Jaitly, N. (2015). *Pointer Networks*. NeurIPS 2015. [arXiv:1506.03134](https://arxiv.org/abs/1506.03134).
104
+ 26. Wagstaff, E., Fuchs, F. B., Engelcke, M., Posner, I., & Osborne, M. A. (2019/2022). *On the Limitations of Representing Functions on Sets* (ICML 2019, [arXiv:1901.09006](https://arxiv.org/abs/1901.09006)) & *Universal Approximation of Functions on Sets* (JMLR 23(151):1–56, 2022).
105
+ 27. Zaheer, M., Kottur, S., Ravanbakhsh, S., Poczos, B., Salakhutdinov, R., & Smola, A. (2017). *Deep Sets*. NeurIPS 2017. [arXiv:1703.06114](https://arxiv.org/abs/1703.06114).