q-Fractional Memory State-Space Layer
Implementation & benchmark of arXiv:2607.15833 — Maps of q-deformed fractional order: From circle to cardioid via crescent
Source paper: Maps of q-deformed fractional order: From circle to cardioid via crescent arXiv:2607.15833 ⓘ · analyzed Aug 30, 2026
AI-generated research hypothesis, automatically tested. Not peer-reviewed.
Idea description
Replace the uniform or power-law convolution in a recurrent or state-space layer by a Gaussian q-binomial fractional kernel with learnable order alpha and deformation q. The parameter q controls a concrete memory-localization transition: q close to 1 gives classical fractional power-law memory, whereas q<1 produces exponentially localized memory and should reduce long-horizon gradient interference and truncation cost.
Formulas
Mathematical statement
Let q in (0,1], alpha>0, and define the q-number [n]_q=(1-q^n)/(1-q), q-factorial [n]_q!=product from j=1 to n of [j]_q, and q-Pochhammer symbol (a;q)_k=product from j=0 to k-1 of (1-aq^j). A practical q-fractional kernel is w_k(q,alpha)=(-1)^k q^{k(k-1)/2} (q^{-alpha};q)_k/(q;q)_k. For a linearized recurrent channel h_{t+1}=A h_t+B x_t+C sum from k=0 to t of w_k h_{t-k}, define W_q(z)=sum from k=0 to infinity of w_k z^{-k}. The characteristic equation is det[zI-A-CW_q(z)]=0. Stability requires every characteristic root z to satisfy |z|<1. At q=1 the kernel approaches the classical fractional power-law kernel; for q<1 its tail is exponentially localized, enabling finite truncation with geometrically decreasing error.
Implementation notes
Integrate this as a residual recurrent or diagonal state-space block. For each channel, keep a rolling buffer of the last K hidden states and compute the q-kernel once per parameter update; constrain alpha with softplus(alpha_raw) and q with q=q_min+(1-2q_min)sigmoid(q_raw), where q_min prevents numerical degeneracy. Pseudocode is: initialize alpha,q,A,C; precompute w[0:K] using stable log-q-Pochhammer products; at time t compute memory=sum(k=0,min(t,K)) w[k]*h[t-k]; compute h_candidate=tanh(A*h[t]+C*memory+B*x[t]); then set h[t+1]=h[t]+gamma*(h_candidate-h[t]). Estimate W_q(exp(i theta)) on a frequency grid theta_j=2*pi*j/M, and estimate the dominant characteristic root either by augmenting the state with K delayed copies and applying an eigensolver or by power iteration on the linearized Jacobian. The paper supplies the q-binomial kernel, its q-to-1 fractional limit, and the exponential-versus-power-law localization mechanism; finite K, nonlinear saturation, and the root approximation are engineering choices. The first cheap experiment should use a one-layer recurrent model on Copy-Memory, Adding, and sequential MNIST, comparing vanilla RNN, an S4-style diagonal state-space model, and this q-fractional layer at matched parameter count. Sweep q in {0.5,0.7,0.85,0.95,0.99,1.0}, alpha in {0.25,0.5,0.75}, and K in {32,64,128}. The quantitative prediction is that the kernel tail is approximately linear on a log-log plot at q=1 but linear on a semilog plot for q<1. Increasing K should produce geometrically shrinking validation changes for q<1 and only algebraically shrinking changes near q=1. Training should become unstable when the estimated maximum characteristic-root modulus crosses 1, with the measured boundary within approximately 20% of the predicted boundary.
Verification
Stage 1 · Toy mechanism gate: Passed ✓
Stage 2 · Mechanism transferred to benchmark: Confirmed ✓
Stage 2 · Practical benchmark result: Inconclusive
Methodology: 8 paired seeds, permutation test (p<0.05) against a learning-rate-tuned baseline. How verification works
Stage 1 — Mechanism check agent confidence 9/10
Built a differentiable q-fractional recurrent layer with learnable alpha and bounded q, plus stable kernel generation and CUDA-compatible forward/backward execution. The mechanism manifested: at q=1 and alpha=0.5, the measured log-log tail slope was -1.5055 versus predicted -1.5; for q<1, measured log-ratio slopes matched log(q) within 2.5%, and truncation tails decayed quadratically in log K with observed coefficients matching 0.5 log(q). This is stronger than merely geometric decay, although no task-level baseline win was established.
- Agent confidence
- 9/10
- Baseline
- q=1: power-law slope observed -1.5055 vs predicted -1.5; relative L1 tails at K=16,32,64,128 were 0.0616, 0.0411, 0.0265, 0.0161.
- Idea
- q=0.7: log-ratio slope -0.3566746 vs log(q) -0.3566749 and quadratic tail coefficient -0.17941 vs -0.17834; q=0.95: -0.0511691 vs -0.0512933 and -0.0258261 vs -0.0256466. Literal q-Pochhammer and recurrence implementations differed by at most 1.4e-17; CUDA smoke test passed with finite backward gradients.
Limitations: No Copy-Memory, Adding, sequential-MNIST, matched-parameter baseline, speed benchmark, or characteristic-root stability sweep was run. The truncation result verifies the supplied kernel mechanism only; it does not demonstrate improved end-to-end training or wall-clock efficiency.
How to run: python3 q_fractional_experiment.py && /home/maxwelhelp/main/bin/python3 smoke_test.py
Stage 2 — Benchmark vs. tuned baseline (arXiv:2607.15833)
Ahead of the baseline (−33.1%) but not statistically significant (p=0.0921, wins 6 / 8 paired seeds).
- Benchmark
- Dynamics forecasting
- Model
- rnn_small
- Paired seeds
- 8
- Baseline mean
- 0.0075
- Idea mean
- 0.005
- Effect (Δ)
- -0.0025 (−33.1%; negative = idea better)
- Wins
- 6 / 8 paired seeds
- p-value
- 0.0921 (permutation test, 20 000 shuffles)
- Smallest detectable effect
- ±40.0%
- Mechanism
- Confirmed ✓
- Practical effect
- Inconclusive
- Baseline tuning
- swept over 3 configs
Only the built-in dynamics track was evaluated; Copy-Memory, Adding, sequential MNIST, vision, tabular, and sequence tracks were not tested. The baseline sweep covered learning rate only, with the recurrent architecture otherwise matched; q and alpha were not learned in this Stage-2 implementation, and no wall-clock or truncation-cost comparison was measured.
How to run: python3 stage2_q_bench.py
Verdict computed by deterministic test code from paired-seed statistics — not by the language model.
Stage 2 — Benchmark latest Failed ✗
Agent confidence: 9/10
Built and evaluated a matched q-fractional recurrent system on the structurally appropriate actuated-pendulum dynamics track using the benchmark harness. The idea reduced mean test MSE from 0.007459 to 0.004987, but the paired permutation p-value was 0.09205, so it did not achieve a significant win under the required criterion. The trained impulse-response signature matched the predicted log(q) slope within 0.017 and was confirmed, but mechanism confirmation does not override the task-level significance requirement.
- Baseline
- Tuned lr=0.006; mean test MSE 0.007458905573002994; std 0.0032465297417158586
- Delta mean
- -0.0024718851782381535
- Idea
- q=0.95, alpha=0.5, lr=0.006; mean test MSE 0.004987020394764841; std 0.0014836907266684164
- Idea wins
- 6/8
- Mechanism signature
- observed impulse-response log slope -0.0682463 versus predicted log(q) -0.0512933; confirmed=true
- P value
- 0.09205
Benchmark result
Ahead of the baseline (−33.1%) but not statistically significant (p=0.0921, wins 6 / 8 paired seeds).
- Benchmark
- Dynamics forecasting
- Model
- rnn_small
- Paired seeds
- 8
- Baseline mean
- 0.0075
- Idea mean
- 0.005
- Effect (Δ)
- -0.0025 (−33.1%; negative = idea better)
- Wins
- 6 / 8 paired seeds
- p-value
- 0.0921 (permutation test, 20 000 shuffles)
- Smallest detectable effect
- ±40.0%
- Mechanism
- Confirmed ✓
- Practical effect
- Inconclusive
- Baseline tuning
- swept over 3 configs
Only the built-in dynamics track was evaluated; Copy-Memory, Adding, sequential MNIST, vision, tabular, and sequence tracks were not tested. The baseline sweep covered learning rate only, with the recurrent architecture otherwise matched; q and alpha were not learned in this Stage-2 implementation, and no wall-clock or truncation-cost comparison was measured.
How to run: python3 stage2_q_bench.py
Artifacts
- bench_report.json 4.2 KB View Raw
- q_fractional_experiment.py 4.4 KB View Raw
- q_fractional_layer.py 2.6 KB View Raw
- report.md 1.7 KB View
- report_bench_2026-08-30T193303.md 6.3 KB View
- results.json 3.8 KB View Raw
- smoke_test.py 1.0 KB View Raw
- stage2_q_bench.py 5.8 KB View Raw