Weighted Resolvent-Equivariant Attention
Implementation & benchmark of arXiv:2608.15140 — Resolvent intertwining and spectral duality in Markov chains with geometric resetting
Source paper: Resolvent intertwining and spectral duality in Markov chains with geometric resetting arXiv:2608.15140 ⓘ · analyzed Sep 1, 2026
AI-generated research hypothesis, automatically tested. Not peer-reviewed.
Idea description
Add a weighted reflection symmetry to an attention or graph-propagation matrix instead of requiring ordinary permutation equivariance. For paired positions or graph nodes related by an involution, penalize the failure of the propagation operator to commute with the weighted reflection; this makes all geometric multi-step propagations symmetry-compatible. The method is suitable for data with mirror, reversal, paired-agent, or left/right structure where the two sides have unequal importance weights.
Formulas
Mathematical statement
The paper defines the resolvent R(\gamma)=(I-(1-\gamma)P)^{-1}, where P is a Markov transition matrix, \gamma\in(0,1] is a damping parameter, and I is the identity matrix. Let \sigma be an involution on indices, meaning \sigma(\sigma(i))=i, let \mathcal{R} be its reflection operator with (\mathcal{R}f)_i=f_{\sigma(i)}, and let \Delta=\operatorname{diag}(\sqrt{\kappa(i)}) for positive weights \kappa(i). The central result is the intertwining relation [\Delta^2\mathcal{R},R(\gamma)]=0, where [A,B]=AB-BA. Because the resolvent is an invertible matrix function of P, the corresponding symmetry can be imposed directly on the propagation operator as [\Delta^2\mathcal{R},P]=0. This then implies commutation with every power P^t and with every geometric mixture of powers. In the neural adaptation, G=\Delta^2\mathcal{R} is the weighted reflection and the training penalty measures the squared Frobenius norm of [G,P].
Implementation notes
1. Integration point: apply the method to the row-stochastic attention matrix P produced by one transformer attention head, or to the normalized adjacency/message-passing matrix in a graph neural network. Choose a known index involution \sigma, such as reversing sequence positions, swapping two mirrored graph halves, or pairing two sensor types. Store positive pair weights \kappa(i); if no prior weights are known, initialize all \kappa(i)=1 and optionally learn log \kappa(i) with a small L2 penalty. Construct the sparse matrix G=\Delta^2\mathcal{R}, whose only nonzero entry in row i is G[i,\sigma(i)]=\kappa(i). 2. Pseudocode: compute logits L=QK^T/\sqrt{d}; compute P=softmax(L,dim=-1); compute GP by permuting the columns of P according to \sigma and multiplying row i by \kappa(i); compute PG by permuting the rows according to \sigma and multiplying the appropriate columns by \kappa; add lambda_comm * ||GP-PG||_F^2/(||G||_F^2||P||_F^2+1e-8) to the task loss; then compute Y=PV. For a graph layer, replace P with the normalized message matrix. 3. The paper supplies the exact commutator criterion and its consequence for all powers and resolvents. Estimate the empirical penalty directly from the current finite-batch P; do not explicitly invert I-(1-gamma)P during training. For validation, compute R_gamma by solving (I-(1-gamma)P)X=I for several gamma values and measure ||GR_gamma-R_gamma G||_F. 4. Cheap experiment: train a 4-layer, 8-head transformer on a synthetic sequence task whose target is invariant under reversal but whose two mirrored halves have unequal noise scales. Compare baseline attention, reversal augmentation, and the weighted-commutator model at matched parameters and FLOPs. Track validation accuracy, equivariance error ||Gf(x)-f(Gx)||, commutator error, and loss variance across seeds. Success means higher accuracy or lower sample complexity at equal compute, at least a 10x reduction in equivariance error, and no increase in optimization instability. Test a second small graph benchmark with a known automorphism and measure whether the benefit remains when \kappa is learned.
Verification
Stage 1 · Toy mechanism gate: Passed ✓
Stage 2 · Mechanism transferred to benchmark: Confirmed ✓
Stage 2 · Practical benchmark result: No measurable effect
Methodology: 8 paired seeds, permutation test (p<0.05) against a learning-rate-tuned baseline. How verification works
Stage 1 — Mechanism check agent confidence 8/10
Implemented weighted reflection commutator regularization for a toy attention head and verified the core mechanism numerically. Perturbation scaling was exact, commuting operators preserved powers and resolvents to floating-point precision, and resolvent incompatibility vanished at gamma=1 with the predicted near-one damping behavior. The pilot reduced commutator RMS 8.6x and improved mean accuracy from 0.6994 to 0.7351, but did not meet the requested 10x empirical threshold and is not sufficient evidence for a broad ML win.
- Agent confidence
- 8/10
- Baseline
- lambda=0: accuracy 0.6994, validation loss 0.6377, commutator RMS 3.3943
- Idea
- lambda=1: accuracy 0.7351, validation loss 0.5181, commutator RMS 0.3932; math checks: perturbation slope predicted/fitted 1.9490096903/1.9490096903, max power commutator 6.34e-16, resolvent identity relative error <1.2e-13
Limitations: Only a tiny single-head attention task and two seeds were tested. No 4-layer/8-head transformer, graph benchmark, reversal-augmentation baseline, learned kappa, sample-complexity curve, FLOP-matched analysis, or direct function-level equivariance evaluation was performed; the toy resolvent matrix was also not constrained to be a well-conditioned Markov transition matrix.
How to run: python3 experiment.py
Stage 2 — Benchmark vs. tuned baseline (arXiv:2608.15140)
No significant difference vs. the tuned baseline (+0.1%, p=0.7309, wins 3 / 8 paired seeds).
- Benchmark
- Sequence modeling
- Model
- transformer_tiny
- Paired seeds
- 8
- Baseline mean
- 0.1958
- Idea mean
- 0.196
- Effect (Δ)
- 0.0002 (+0.1%; negative = idea better)
- Wins
- 3 / 8 paired seeds
- p-value
- 0.7309 (permutation test, 20 000 shuffles)
- Smallest detectable effect
- ±1.0%
- Mechanism
- Confirmed ✓
- Practical effect
- No effect
- Baseline tuning
- swept over 3 configs
No fresh run was possible: bench import failed outside the mandatory injected command, and /home/maxwelhelp/all/math2nn/bench/README.md plus the package directory were absent. The available artifact is therefore not independently verifiable in this session; additionally, its baseline tuning and mechanism signature used four-seed subsets and its idea sweep varied learning rate but not nearby lambda settings.
How to run: python3 bench_weighted_attention.py
Verdict computed by deterministic test code from paired-seed statistics — not by the language model.
Stage 2 — Benchmark latest Failed ✗
Agent confidence: 10/10
The required registered benchmark could not be rerun in this environment because the bench package and README are unavailable, so this is not new valid bench evidence. The existing local artifact reports a correct sequence-track comparison with no task-metric win: baseline MSE 0.195805 versus idea MSE 0.195998, paired permutation p=0.7309. Its mechanism signal was directional but small (1.58x commutator reduction), therefore the idea is not demonstrated as a benchmark win.
- Baseline
- Existing artifact only: sequence/transformer_tiny, tuned lr=0.001, 8 epochs; 8-seed MSE mean 0.1958046276.
- Environment check
- The mandatory injected TRACKS command returned ('tabular','vision','sequence','dynamics'), but subsequent import bench failed and the specified bench README/path was absent.
- Idea
- Existing artifact only: lambda=0.3, lr=0.001, 8 epochs; 8-seed MSE mean 0.1959976610; paired delta +0.0001930334; p=0.7309.
Benchmark result
No significant difference vs. the tuned baseline (+0.1%, p=0.7309, wins 3 / 8 paired seeds).
- Benchmark
- Sequence modeling
- Model
- transformer_tiny
- Paired seeds
- 8
- Baseline mean
- 0.1958
- Idea mean
- 0.196
- Effect (Δ)
- 0.0002 (+0.1%; negative = idea better)
- Wins
- 3 / 8 paired seeds
- p-value
- 0.7309 (permutation test, 20 000 shuffles)
- Smallest detectable effect
- ±1.0%
- Mechanism
- Confirmed ✓
- Practical effect
- No effect
- Baseline tuning
- swept over 3 configs
No fresh run was possible: bench import failed outside the mandatory injected command, and /home/maxwelhelp/all/math2nn/bench/README.md plus the package directory were absent. The available artifact is therefore not independently verifiable in this session; additionally, its baseline tuning and mechanism signature used four-seed subsets and its idea sweep varied learning rate but not nearby lambda settings.
How to run: python3 bench_weighted_attention.py
Artifacts
- REPORT.md 2.9 KB View
- bench_report.json 4.9 KB View Raw
- bench_weighted_attention.py 7.1 KB View Raw
- experiment.py 7.7 KB View Raw
- report.md 1.5 KB View
- report_bench_2026-09-02T232715.md 4.8 KB View
- results.json 3.8 KB View Raw