# Projected Absolute-Residual Compensation for Neural State-Space Models

- ID: 1519
- Canonical URL: https://synthcore.org/idea/1519/projected-absolute-residual-compensation-for-neural-state-sp
- API JSON: https://synthcore.org/api/idea/1519.json
- API Markdown: https://synthcore.org/api/idea/1519.md
- Verification status: beats_baseline
- Source: [arXiv:2607.28142](https://arxiv.org/abs/2607.28142)
- Category: dynamics
- Solves: stability, accuracy
- ML areas: rnn, ssm, world-model
- Math tags: control-theory, dynamical-systems, linear-algebra, optimization
- Ratings: usefulness 7/10; difficulty 5/10; novelty 8/10

## Idea description

Augment a recurrent or state-space neural model with two predictors: an absolute predictor using raw command and output histories, and an incremental predictor using differences. Use the absolute prediction residual, projected onto an offline-learned mismatch subspace, to estimate persistent actuator bias or dead-zone effects and compensate the next command or latent transition. The incremental branch provides a diagnostic because a constant mismatch should vanish there while the absolute residual remains nonzero and proportional to the mismatch.

## Mathematical statement

Let u_k be the commanded input, u_k^eff the unknown effective input after a dead-zone or quantizer, and y_k the observed output. Fit an absolute one-step predictor yhat_k^abs = P_u U_k + P_y Y_k + P_c c_k, where U_k and Y_k are stacked input and output histories and c_k contains current neural features. Fit an incremental predictor Delta-yhat_k^inc = Q_u Delta-U_k + Q_y Delta-Y_k + Q_c Delta-c_k. For a persistent mismatch d_k = u_k^eff - u_k, the absolute residual e_k^abs = y_k - yhat_k^abs is approximately P_d d_k, while the incremental residual tends to zero for constant d_k. Let H_d contain calibration residual directions and define the regularized orthogonal projector Pi_d = H_d (H_d^T H_d + lambda I)^(-1) H_d^T. The estimated mismatch signature is ehat_d,k = Pi_d e_k^abs. If G_d maps a command correction to output residual, apply delta-u_k = -gamma G_d^dagger ehat_d,k, with 0 < gamma <= 1. For a locally linearized compensated closed loop z_{k+1} = A_cl z_k + B_e(e_k^abs - ehat_d,k), practical stability requires spectral radius rho(A_cl) < 1, and the residual bound scales with the unprojected component (I - Pi_d) P_d d_k.

## Key formulas

- $$\hat{y}_k^{\mathrm{abs}}=P_u U_k+P_y Y_k+P_c c_k,\qquad e_k^{\mathrm{abs}}=y_k-\hat{y}_k^{\mathrm{abs}}.$$
- $$\Delta\hat{y}_k^{\mathrm{inc}}=Q_u\Delta U_k+Q_y\Delta Y_k+Q_c\Delta c_k,\qquad e_k^{\mathrm{inc}}=\Delta y_k-\Delta\hat{y}_k^{\mathrm{inc}}.$$
- $$\Pi_d=H_d(H_d^{\mathsf T}H_d+\lambda I)^{-1}H_d^{\mathsf T},\qquad \hat e_{d,k}=\Pi_d e_k^{\mathrm{abs}},\qquad \delta u_k=-\gamma G_d^\dagger \hat e_{d,k}.$$
- $$\|z_k\|\le c\rho(A_{\mathrm{cl}})^k\|z_0\|+\frac{c\|B_e\|}{1-\rho(A_{\mathrm{cl}})}\sup_j\|(I-\Pi_d)P_d d_j\|,\qquad \rho(A_{\mathrm{cl}})<1.$$

## Implementation notes

1. Integration point: wrap a GRU, S4-style state-space layer, or neural state-space controller that emits a nominal command u_k for a simulated actuator or environment. Maintain buffers of the last T commands, observations, and neural features. Add two small linear heads on these features: an absolute head predicting y_k and an incremental head predicting Delta-y_k. Apply the projected residual correction before the command reaches the actuator or simulator. 2. Pseudocode: collect nominal trajectories; fit P_u, P_y, and P_c by ridge regression; fit Q_u, Q_y, and Q_c on differenced data; collect residual vectors while injecting several constant biases and dead-zone widths; form H_d from the leading principal components of those residuals; compute Pi_d; at every step calculate e_abs, calculate ehat_d = Pi_d e_abs, estimate delta-u = -gamma times the pseudoinverse of G_d times ehat_d, clip the corrected command, and execute it. 3. The mechanism taken from the paper is the absolute-versus-incremental decomposition and fixed projection. Predictor matrices, H_d, G_d, and local spectral radius are estimated empirically. 4. First experiment: train a small GRU to control a damped linear plant with a known plus-or-minus 0.18 command dead-zone. Compare the baseline, projected correction, and unprojected correction on constant-reference tracking. The predicted signature is that incremental residual norm decays toward zero under constant mismatch while absolute residual norm remains proportional to bias. After correction, steady-state error should scale with the norm of (I - Pi_d) P_d d. The measured divergence boundary should occur near rho(A_cl) = 1, within 20 percent.

## Verification

- Status: beats_baseline
- Mechanism evidence: yes
- Mechanism confirmed: yes
- Practical verdict: helps
- Verdict: Built and numerically verified a deterministic projected absolute-residual compensation toy in verify.py. Absolute residual scaling, incremental cancellation, projection residual scaling, and the stability boundary all matched their predictions; tracking error improved from 0.272727 to 0.054545 with compensation. Projected and unprojected compensation were identical here because the toy was one-dimensional and fully covered by the learned mismatch subspace.

### Mechanism check

- Verdict: Built and numerically verified a deterministic projected absolute-residual compensation toy in verify.py. Absolute residual scaling, incremental cancellation, projection residual scaling, and the stability boundary all matched their predictions; tracking error improved from 0.272727 to 0.054545 with compensation. Projected and unprojected compensation were identical here because the toy was one-dimensional and fully covered by the learned mismatch subspace.
- Confidence: 8/10
- Limitations: This is an exact linear toy, not a trained GRU or S4 model. It does not test learned ridge heads, finite-sample estimation, measurement noise, nonlinear dead-zone or quantization effects, online adaptation, multidimensional G_d pseudoinverse behavior, or a meaningful projected-versus-unprojected controller distinction.

### 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/591/bench_report.json)
- [bench_stage2.py](https://synthcore.org/code/591/bench_stage2.py)
- [report.md](https://synthcore.org/code/591/report.md)
- [report_bench_2026-08-31T192705.md](https://synthcore.org/code/591/report_bench_2026-08-31T192705.md)
- [results.json](https://synthcore.org/code/591/results.json)
- [verify.py](https://synthcore.org/code/591/verify.py)
- [Download all files as ZIP](https://synthcore.org/download/591)

## Disclaimer

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