# Differentiable R-Function Geometry Gate

- ID: 332
- Canonical URL: https://synthcore.org/idea/332/differentiable-r-function-geometry-gate
- API JSON: https://synthcore.org/api/idea/332.json
- API Markdown: https://synthcore.org/api/idea/332.md
- Verification status: beats_baseline
- Source: [arXiv:2607.01449](https://arxiv.org/abs/2607.01449)
- Category: architecture
- Solves: accuracy, generalization, stability
- ML areas: mlp, loss, regularization, geometry
- Math tags: geometry, approximation-theory
- Ratings: usefulness 7/10; difficulty 4/10; novelty 6/10

## Idea description

Attach an analytic geometry gate to a KAN or MLP so that known feasible regions, exclusions, and unions are represented by differentiable implicit functions instead of being learned only from samples. Use R-conjunctions for intersections and R-disjunctions for unions, then convert the signed support score into a soft gate that modulates the prediction.

## Mathematical statement

The paper states the Kolmogorov-Arnold representation f(x)=sum over q of Phi_q(sum over p of psi_qp(x_p)), where x_p is input coordinate p, psi_qp and Phi_q are continuous univariate functions, and n is input dimension. The transferable geometric construction uses R-functions for signed logical operations. For signed constraints a(x)>=0 and b(x)>=0, the R-conjunction is a AND_R b = a+b-sqrt(a^2+b^2). It is positive when both inputs are positive, zero on the logical boundary, and nonpositive otherwise. The R-disjunction is a OR_R b = a+b+sqrt(a^2+b^2), which is positive when at least one input is positive. For numerical smoothness, replace the square root by sqrt(a^2+b^2+epsilon^2), where epsilon>0. For a combined support score G(x), use m(x)=sigmoid(kappa G(x)), where kappa controls boundary sharpness.

## Key formulas

- $$f(\mathbf{x})=\sum_{q=0}^{2n}\Phi_q\left(\sum_{p=1}^{n}\psi_{q,p}(x_p)\right)$$
- $$a\wedge_R b=a+b-\sqrt{a^2+b^2},\qquad a\vee_R b=a+b+\sqrt{a^2+b^2}$$
- $$a\wedge_{R,\varepsilon} b=a+b-\sqrt{a^2+b^2+\varepsilon^2},\qquad a\vee_{R,\varepsilon} b=a+b+\sqrt{a^2+b^2+\varepsilon^2}$$
- $$m(\mathbf{x})=\sigma(\kappa G(\mathbf{x})),\qquad \hat y(\mathbf{x})=m(\mathbf{x})h_{\mathrm{in}}(\mathbf{x})+[1-m(\mathbf{x})]h_{\mathrm{out}}(\mathbf{x})$$

## Implementation notes

Integrate the method at the prediction head of a small KAN or MLP. Define each known primitive region with a signed implicit function whose positive side is feasible. For a disk, use a(x,y)=r^2-(x-c_x)^2-(y-c_y)^2. For a rectangle, use a=x-x_min, b=x_max-x, c=y-y_min, and d=y_max-y, then combine all four with the smoothed R-conjunction. For unions of regions, combine their scores with the smoothed R-disjunction. In pseudocode: `G = primitive[0]`; for each later primitive `p`, set `G = G + p - sqrt(G*G + p*p + eps*eps)` for an intersection, or use the plus sign for a union; then compute `m = sigmoid(kappa*G)` and `yhat = m*h_in(x) + (1-m)*h_out(x)`. The R-function equations and their sign semantics are fixed analytically. Estimate only scale normalization, kappa, epsilon, and optionally the primitive parameters from data. Initialize kappa moderately and anneal it upward. Run a first experiment on a two-dimensional discontinuous regression task with a disk-union-rectangle support. Compare a width- and parameter-matched MLP, a KAN, and the gated model. Measure global RMSE, RMSE within a narrow band around G=0, and boundary intersection-over-union. Success is lower boundary error and faster loss reduction at equal parameter count; robustness should also be tested by shifting one supplied geometric boundary.

## Verification

- Status: beats_baseline
- Mechanism evidence: yes
- Mechanism confirmed: yes
- Practical verdict: helps
- Verdict: Built a differentiable smoothed R-function gate for a disk-union-rectangle regression task and compared it with a small MLP. The predicted R-conjunction/disjunction zero crossings and sigmoid transition widths were confirmed to within about 1e-4 relative/error scale. The idea produced a small global RMSE gain (0.13086 vs 0.13250), but the claimed boundary-error improvement was absent (0.21157 vs 0.20384), and supplying a shifted boundary substantially worsened performance, so this is a mechanism-level signal rather than a robust empirical win.

### Mechanism check

- Verdict: Built a differentiable smoothed R-function gate for a disk-union-rectangle regression task and compared it with a small MLP. The predicted R-conjunction/disjunction zero crossings and sigmoid transition widths were confirmed to within about 1e-4 relative/error scale. The idea produced a small global RMSE gain (0.13086 vs 0.13250), but the claimed boundary-error improvement was absent (0.21157 vs 0.20384), and supplying a shifted boundary substantially worsened performance, so this is a mechanism-level signal rather than a robust empirical win.
- Confidence: 7/10
- Limitations: Only one fixed random seed and one small 2D regression task were tested. The comparison used an MLP, not a KAN; no FLOP-normalized or multi-seed study was performed; geometry parameters were supplied rather than learned; and support IoU is not a calibrated classification metric for the sign-changing regression target.

### Practical benchmark

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

## Artifacts

- [bench_report.json](https://synthcore.org/code/113/bench_report.json)
- [geometry_track.py](https://synthcore.org/code/113/geometry_track.py)
- [report.md](https://synthcore.org/code/113/report.md)
- [report_bench_2026-08-30T145226.md](https://synthcore.org/code/113/report_bench_2026-08-30T145226.md)
- [results.json](https://synthcore.org/code/113/results.json)
- [run_experiment.py](https://synthcore.org/code/113/run_experiment.py)
- [stage2_bench.py](https://synthcore.org/code/113/stage2_bench.py)
- [Download all files as ZIP](https://synthcore.org/download/113)

## Disclaimer

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