Exact Finite Attention Responses From RoPE Derivatives
Organizations: Hassana Labs · Department of Computer Science, Royal Holloway, University of London · University of Oxford
Abstract
We derive exact local responses for attention interventions, allowing candidate edits to be scored from a cached baseline and one backward pass. The starting point is the RoPE derivative : its integral gives the finite positional displacement, which we carry through the softmax without linearising either rotation or normalisation. The resulting predictions achieve 95.36--96.52% sign accuracy across 92,160 executed positional edits on 768 held-out prompt sets, reducing answer-margin MAE by 73.6--82.5% against the positional Jacobian and by 36.2--50.9% against zero. For simultaneous key and value edits, the same divided-difference calculus isolates the interaction term , which is omitted by adding separate attributions. Retaining it reduces downstream margin MAE by more than a factor of nine in every setting of a 5,120-intervention sweep across two Qwen sizes, two tasks, and multiple layers; reductions against a quadratic interaction correction are 75.9--98.5%. Exactness concerns the edited attention write; downstream predictions contract that response with a baseline gradient and are evaluated by native execution. The calculus also yields a KL certificate for local approximation error, an exact query-conditioned gradient-step representation whose curvature identifies attention-preserving query directions, and minimum-norm query control. Sparse evaluation supports candidate ranking and cache decisions under explicit local distortion criteria.
Figures & tables
| Task | Finite | Jacobian | Zero | Reduction vs. zero |
|---|---|---|---|---|
| Corrupt | 0.02808 | 0.16028 | 0.05724 | 50.9% [48.2, 53.7] |
| Ordered | 0.05786 | 0.21897 | 0.09073 | 36.2% [35.0, 37.5] |
| SST-2 | 0.03585 | 0.15426 | 0.06681 | 46.3% [43.1, 49.9] |
| Model | Task | Layer | Separate | Quadratic | Exact |
|---|---|---|---|---|---|
| 0.5B | Retrieval | 18 | 0.001042 | ||
| 0.5B | SST-2 | 18 | 0.003099 | ||
| 1.5B | Retrieval | 14 | 0.003342 | 0.001525 | |
| 1.5B | Retrieval | 21 | 0.107864 | 0.087683 | 0.007844 |
| 1.5B | SST-2 | 14 | 0.003194 | 0.001418 | |
| 1.5B | SST-2 | 21 | 0.109616 | 0.080700 | 0.004510 |
Appendix figures & tables6 assets
Supplementary material from the paper’s appendix.
Appendix
| Branch | Generated expression | Checks passed |
|---|---|---|
| Ordinary | lookup(value) | 0/6 |
| Source emphasis | current(value) | 1/6 |
| Installed no-op | lookup(value) | 0/6 |
| Ranked attention edit | legacy(current(value)) | 6/6 |