Manuscript Offprint
arXiv:2610.24026Dynamical Kernel Attention: Estimating the Present from a Record of the Past
Abstract
Standard self-attention compares tokens by similarity but does not account for how much of a past state survives to the present. We introduce Dynamical Kernel Attention (DKA), which derives attention from robust estimation of a latent state evolving under stochastic dynamics. As a past state decays toward equilibrium under the dynamics, the information it carries about the present vanishes, bounding the total evidence a head can draw. Unlike recency biases, DKA can abstain when relevant evidence is weak and guarantees a bounded error when old tokens are discarded. DKA preserves the parallel structure and computational cost of standard attention. We present the model and its theory; empirical evaluation is deferred to a subsequent version.
1 Introduction
Unlike recurrent networks [Elman, 1990] and state space models [Gu et al., 2022], self-attention does not propagate a latent state through shared dynamics: each token is compared with every other directly, and temporal structure enters only through positional encodings. These encode where a token is, but not how much it can still be trusted about the present. We obtain both from one model, treating the sequence as noisy observations of a latent state evolving under a linear stochastic differential equation (SDE). The dynamics transport a past token to the current position, acting as a positional encoding, while the accumulated random forcing determines its reliability. Attention then becomes batch state estimation.
Robust Filter Attention (RFA) [Racioppo, 2026a] pools the transported tokens through a composite likelihood [Lindsay, 1988], treating them as independent given the current state. Each token's weight then depends only on its own agreement with the query, consistent evidence is averaged rather than superseded, and the computation remains that of standard attention. RFA paired this with a flat prior on past states, making each transported token a direct measurement of the current state. Distant tokens then share nearly all of their error yet count as separate votes, and since their predictions have decayed to the equilibrium, they pull the estimate toward it, increasingly so as the context grows.
We introduce Dynamical Kernel Attention (DKA), which draws past states from the stationary distribution of the dynamics. As a token's prediction decays toward equilibrium, it contributes less evidence because the equilibrium is already known (Figure 1). Conditioning on the current state also accounts for the forcing accumulated since the token, so correlated errors are no longer counted once per token. Together, these effects bound overcounting regardless of context length. Unlike a recency bias, which lowers distant tokens' logits but lets softmax shift weight back to them when recent tokens are irrelevant, DKA bounds the total evidence a head can draw, allowing it to abstain. Moreover, the query's prediction of the past decays toward equilibrium, so even a strong match contributes less at longer lags. DKA recovers RFA in the flat-prior limit.
Our contributions are:
Preprint.
(i) A stationary measurement model for attention in which a past token’s evidence fades with lag and the overcounting of correlated tokens is bounded in context length, which gives each head a memory window set by its decay rate (Section 3.5).
(ii) An attention update derived from this model, in which each layer refines the current estimate. Under isotropic noise and decay, it has the same computational complexity as standard attention.
(iii) A null term in the normalization, contributed by the current estimate, which lets a head make no update when the evidence is weak and recovers “softmax plus one” [Miller, 2023] as a special case.
Attention and state estimation. Transformers can represent and learn Kalman filtering [Goel and Bartlett, 2024, Akram and Vikalo, 2026], and Kalman Linear Attention parallelizes Bayesian filtering in information form [Shaj et al., 2026]; DKA instead retains explicit pairwise interactions with past tokens. RFA [Racioppo, 2026a] derives attention from a learned linear dynamical model, transporting past observations and weighting them by dynamical uncertainty, and Racioppo [2026b] extends this approach to the pre-norm Transformer block. DKA differs by conditioning transported observations on the current state under a stationary process, which makes information decay with lag, and by treating each layer as a proximal robust estimation step.
Position, forgetting, and abstention. Relative position is encoded by rotating queries and keys [Su et al., 2024] or by lag-dependent logit biases [Press et al., 2022], and other methods learn decays, through temporal kernels [Kim and Lee, 2024], damped moving averages [Ma et al., 2023], or content-dependent forget gates used to prune the context [Lin et al., 2025a,b, Leviathan et al., 2025, Wertheimer et al., 2026]. Heads are allowed to abstain through sinks, gated or stick-breaking normalizations, and learned priors [Xiao et al., 2024, Bondarenko et al., 2023, Tan et al., 2025, Litman and Guo, 2026]. In DKA, rotation and decay arise from the imaginary and real parts of the eigenvalues of A, and forgetting and abstention follow from uncertainty: a token's information fades as forcing accumulates over the lag, which bounds the effect of evicting it (Proposition 3), and the prior on the current state supplies a null slot.

Token position
Figure 1: A distant token restates the prior. A latent state (black) evolves under stable linear dynamics around an equilibrium at zero; the star marks the current state . Each past token predicts the present by carrying its value forward under the dynamics (blue curves), and the error bars on the right show the uncertainty of each prediction at the present. A nearby token (dark) predicts the current state closely. A distant token (light) has decayed to the equilibrium, and its uncertainty has grown to the stationary spread .
3 Method
DKA treats each attention layer as one step of a robust iterative estimator of a latent state. Past tokens, carried forward to the current position by the dynamics, become measurements of the current state whose information fades with lag; the layer reweights these measurements at the current estimate and takes a damped step toward the estimate they support. Under isotropic noise and decay, each step has the cost of standard attention. Full derivations are in Appendix B.
3.1 Dynamical Model
We model each token embedding as a noisy observation of a latent state evolving under a linear SDE:
where is a Wiener process, , , is Hurwitz, and is invertible. We take , , and to be diagonal, with the eigenvalues of in conjugate pairs so that is real. This loses no generality when the system matrices share an eigenbasis, which can be absorbed into . A constant equilibrium can be absorbed into the projection biases, so we set it to zero.
Writing with and ,
where the accumulated forcing is independent of and solves the Differential Lyapunov Equation (DLE)
We take the process to be stationary, so every state is distributed as , where solves the algebraic Lyapunov equation
Since is independent of , taking the variance of Eq. 2 gives , and stationarity requires , so
By Equation 2, the current state is the sum of two independent parts: the transported past state , which a token at can predict, and the forcing accumulated since, which it cannot. Equation 5 gives the variance of each: of the stationary variance , a share comes from the past state and a share from the forcing. As the lag grows, , so the past state's share vanishes and a distant token can predict almost nothing about the present.
3.2 Measurement Model
Each token’s representation is the current estimate of its own latent state. At the first layer, it is obtained from the embedding, ; at deeper layers, it is the output of the preceding layers, which we treat as a measurement with noise , learned per layer. Transported to position , it becomes
This prediction omits the forcing , which is part of , so its error is correlated with the state being estimated. The only term and share is the transported past state, so by Eq. 5 , while . Gaussian conditioning on then gives the mean , and each past token is a noisy linear measurement of the current state (Appendix B.1),
where and is independent of . This is the measurement model of a Kalman update, with observation matrix and noise covariance . At zero lag, and . As the lag grows, and , so a distant token carries no information about the current state. The stationary prior does not assume that language is stationary. A distant token's prediction has decayed to the equilibrium under any stable dynamics, so it only restates what the prior already says; the stationary prior discounts this restatement, which a composite likelihood would otherwise count once per token.
3.3 Robust Estimation Step
Robust weights. The forcing realized over an interval need not match its budget, and either endpoint may be an atypical observation. We give each pair a latent scale, with , which makes each measurement Student-t with degrees of freedom. We combine the measurements by a composite likelihood [Lindsay, 1988], the product of their individual factors. This requires only each factor's marginal to be correctly specified [Varin et al., 2011], and it makes each token's weight depend only on its own agreement with the query, whereas under the exact likelihood each newer retained token supersedes the older evidence it overlaps with (Appendix B.2). With precision , residual at the current estimate, and distance , the iteratively reweighted least squares (IRLS) weight is the posterior mean inverse scale [Lange et al., 1989]. We temper it so that the logits are normalized by the feature dimension, as in standard attention:
which recovers the exponential kernel as . These are the IRLS weights of an M-estimator [Huber, 1964] with a bounded penalty, so a sufficiently inconsistent measurement is rejected rather than merely downweighted.
Update. The current estimate enters as a proximal prior, , with diagonal. Holding the weights fixed, and tempering the composite likelihood by an exponent to account for measurements that share forcing, each layer minimizes
whose minimizer is the new estimate (Appendix B.3),
This is a Kalman measurement update in information form, with no time update: each position updates directly from all transported measurements, and the posterior precision is the prior precision plus their information . With the measurements held fixed, repeating the update is proximal IRLS. Each layer takes one such step, using measurements the previous layer has updated.
3.4 Isotropic Implementation
The model has a single observation operator . We relax this and learn separate projections , each absorbing its own , while absorbs . The current estimate is read through the query projection, , and past estimates through the key projection, , when the weights are computed; both are read through the value projection, , when the estimates are aggregated. Under a single observation model, the three projections coincide.
Isotropic decay and noise. To retain the memory cost of standard attention, we impose per head , with , and take the forcing, observation-noise, and prior covariances to be , , and . Writing for the decay over a lag, the Lyapunov equation gives with , and the measurement model of Eq. 6 reduces to scalars:
The observation coefficient depends only on the decay rate: the fraction of stationary variance retained over a lag is independent of the noise level. Zero-decay heads are the limit with fixed, in which and .
Rotated residual. With , the transport of mode factors as . Rotating the queries, keys, and values, , , , the residual becomes with .
The term is the backward conditional mean in the rotated frame. Since the rotations have unit magnitude, the factor cancels from the distance, leaving
The only operation is the cross term, a single matrix multiplication; every lag-dependent quantity is elementwise on matrices.
Logits and value update. Setting the degrees of freedom proportional to the state dimension, , so that , the combined weight is with logits
where is the causal mask, including the diagonal. In Eq. 9, and enter only through their product, so we absorb into . In the value basis, the residual is , and since does not depend on , it factors out of the weighted sum. The update is therefore the innovation
Values are rotated into a common frame, aggregated, and counter-rotated, so that aggregation fuses estimates at a common time. Writing for the estimate the context supports,
a step whose size approaches one when the evidence is large and zero when it is small. The posterior variance is available at no cost.
Relation to softmax. Eq. 13 differs from softmax attention in two ways. The normalizer weights each token by its observation coefficient , so it measures accumulated information rather than total weight. Secondly, the prior contributes to the denominator, equivalent to a null slot with logit and zero innovation. For zero-decay heads ( ), the update is a softmax over innovations with one extra null logit, which for is the “softmax plus one” proposed to let heads abstain [Miller, 2023]. The logits then retain , a logarithmic distance penalty derived from the forcing accumulated over the lag. Appendix E shows how RoPE and ALiBi attention arise as limits.
Residual connection. The innovation is the layer’s correction to the current estimate, so the new estimate is , and mapping it back through the output projection gives . Since absorbs and absorbs , the model implies , per head the projector onto the head’s subspace. We impose this directly,
so the residual stream passes through unchanged rather than through a learned product that is only approximately the identity.
Implementation. The update is stabilized by subtracting the row maximum of the logits, as a softmax does internally, and all complex operations reduce to real ones, with the rotations exactly RoPE's. These details, the pseudocode (Algorithm 1), and a block diagram (Figure 2) are in Appendix A.
3.5 Evidence, Bias, and Memory
We state three properties of a single isotropic head with decay ; proofs are in Appendices C and D. The first two concern how much evidence the head draws from its context. For these, we assume that the measurements are drawn from the stationary model, tokens have unit spacing, and robust weights are set to one, since they can only reduce each token's contribution.
We measure evidence by Fisher information about . Let be the exact information in the most recent tokens, which accounts for their correlations, and the information DKA assigns them, the sum of their contributions to . Write for the decay of the variance over one step, for the forcing over one step, and for the head's memory length.
Proposition 1 (Evidence from the context). For every , and , with for . RFA instead assigns each token between and , tending to with lag, so its total grows linearly in .
A distant token’s prediction has decayed to the equilibrium, so it only restates the prior. RFA counts this restatement once per token; DKA’s observation coefficient removes it, so DKA overcounts by at most a factor independent of the context length, and never undercounts.
Proposition 2 (Pull toward the equilibrium). The exact maximum-likelihood estimate and DKA's estimate satisfy for every . RFA's estimate satisfies , where as , with .
Only about K of RFA's N tokens still carry the current state; the rest vote for the equilibrium, so RFA retains a vanishing fraction K/N of the current state, while DKA retains all of it.
The third property holds for any data. Suppose for all , write for the update of Eq. 13 computed from only the tokens at lag at most , and let .
Proposition 3 (Memory window). For every query i, every context length, every choice of robust weights, and every ,
A head therefore needs to keep only its most recent tokens to stay within of its full-context output, so its cache can be sized in advance from its decay rate; zero-decay heads must keep the whole context. The null slot makes this possible, by keeping the denominator of Eq. 13 at least . RFA has no such window, because a distant token's weight in its normalizer is not decayed.
4 Conclusion
We reformulate self-attention as robust iterative estimation of a latent state evolving under stochastic dynamics. By conditioning transported observations on the current state, the resulting attention mechanism accounts for dynamical uncertainty and naturally limits the information contributed by distant tokens, while retaining the parallel structure of standard attention. The formulation also connects attention weights, normalization, robustness, and abstention to a common estimation problem.
References
Usman Akram and Haris Vikalo. Transformers as implicit state estimators: In-context learning in dynamical systems. Transactions on Machine Learning Research, 2026. ISSN 2835-8856. URL https://openreview.net/forum?id=hIMK5MvGkP.
Craig F. Ansley and Robert Kohn. Filtering and smoothing in state space models with partially diffuse initial conditions. Journal of Time Series Analysis, 11(4):275–293, 1990. doi: https://doi.org/10.1111/j.1467-9892.1990.tb00058.x. URL https://onlinelibrary.wiley.com/doi/abs/10.1111/j.1467-9892.1990.tb00058.x.
Arthur S. Bianchessi, Yasmin C. Aguirre, Rodrigo C. Barros, and Lucas S. Kupssinskü. Bayesian Attention Mechanism: A probabilistic framework for positional encoding and context length extrapolation. In The Fourteenth International Conference on Learning Representations, 2026. URL https://openreview.net/forum?id=dXJB908fLd.
Yelysei Bondarenko, Markus Nagel, and Tijmen Blankevoort. Quantizable Transformers: Removing outliers by helping attention heads do nothing. In Thirty-seventh Conference on Neural Information Processing Systems, 2023. URL https://openreview.net/forum?id=sbusw6LD41.
Long Minh Bui, Tho Tran Huu, Duy Dinh, Tan Minh Nguyen, and Trong Nghia Hoang. Revisiting kernel attention with correlated Gaussian process representation. In Proceedings of the Fortieth Conference on Uncertainty in Artificial Intelligence, UAI '24. JMLR.org, 2024.
Ta-Chung Chi, Ting-Han Fan, Peter J Ramadge, and Alexander Rudnicky. KERPLE: Kernelized relative positional embedding for length extrapolation. In S. Koyejo, S. Mohamed, A. Agarwal, D. Belgrave, K. Cho, and A. Oh, editors, Advances in Neural Information Processing Systems, volume 35, pages 8386–8399. Curran Associates, Inc., 2022. doi:10.52202/068431-0610. URL https://proceedings.neurips.cc/paper_files/paper/2022/file/37a413841a614b5414b333585e7613b8-Paper-Conference.pdf.
Piet de Jong. The diffuse Kalman filter. Annals of Statistics, 19:1073–1083, 1991. URL https://api.semanticscholar.org/CorpusID:121007427.
J. Durbin and S.J. Koopman. Time Series analysis by state space methods. Oxford University press, 2 edition, 2012.
Jeffrey L. Elman. Finding structure in time. Cognitive Science, 14(2):179–211, 1990. doi: https://doi.org/10.1207/s15516709cog1402\_1. URL https://onlinelibrary.wiley.com/doi/abs/10.1207/s15516709cog1402\_1.
Prasad Gabbur, Manjot Bilkhu, and Javier Movellan. Probabilistic attention for interactive segmentation. In A. Beygelzimer, Y. Dauphin, P. Liang, and J. Wortman Vaughan, editors, Advances in Neural Information Processing Systems, 2021. URL https://openreview.net/forum?id=JpD1WGTBHB.
Gautam Goel and Peter Bartlett. Can a Transformer represent a Kalman filter? In Alessandro Abate, Mark Cannon, Kostas Margellos, and Antonis Papachristodoulou, editors, Proceedings of the 6th Annual Learning for Dynamics &; Control Conference, volume 242 of Proceedings of Machine Learning Research, pages 1502–1512. PMLR, 15–17 Jul 2024. URL https://proceedings.mlr.press/v242/goel24a.html.
Albert Gu, Karan Goel, and Christopher Re. Efficiently modeling long sequences with structured state spaces. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum?id=uYLFoz1vlAC.
Georges Harik and Varuna Jayasiri. Rotary positional embeddings with relative distances, 2022. URL http://research.labml.ai/RoPER.html.
Peter J. Huber. Robust estimation of a location parameter. The Annals of Mathematical Statistics, 35(1):73–101, March 1964. doi: 10.1214/aoms/1177703732.
Kyung Geun Kim and Byeong Tak Lee. Self-attention with temporal prior: can we learn more from the arrow of time? Frontiers in Artificial Intelligence, Volume 7 - 2024, 2024. ISSN 2624-8212. doi: 10.3389/frai.2024.1397298. URL https://www.frontiersin.org/journals/artificial-intelligence/articles/10.3389/frai.2024.1397298.
Kenneth Lange, Roderick J. Little, and Jeremy M. G. Taylor. Robust statistical modeling using the t distribution. Journal of the American Statistical Association, 84:881–896, 1989. URL https://api.semanticscholar.org/CorpusID:122769764.
Yaniv Leviathan, Matan Kalman, and Yossi Matias. Selective attention improves Transformer. In The Thirteenth International Conference on Learning Representations, 2025. URL https://openreview.net/forum?id=v0FzmPCd1e.
Zhixuan Lin, Evgenii Nikishin, Xu He, and Aaron Courville. Forgetting Transformer: Softmax attention with a forget gate. In The Thirteenth International Conference on Learning Representations, 2025a. URL https://openreview.net/forum?id=q2Lnyegkr8.
Zhixuan Lin, Johan Obando-Ceron, Xu Owen He, and Aaron Courville. Adaptive computation pruning for the Forgetting Transformer. In Second Conference on Language Modeling, 2025b. URL https://openreview.net/forum?id=xNj14CY5S1.
Bruce G. Lindsay. Composite likelihood methods. In N. U. Prabhu, editor, Statistical Inference from Stochastic Processes, volume 80 of Contemporary Mathematics, pages 221–239. American Mathematical Society, 1988.
Elon Litman and Gabe Guo. You need better attention priors. In Forty-third International Conference on Machine Learning, 2026. URL https://openreview.net/forum?id=Q7MkgK17GU.
Xuezhe Ma, Chunting Zhou, Xiang Kong, Junxian He, Liangke Gui, Graham Neubig, Jonathan May, and Luke Zettlemoyer. Mega: Moving average equipped gated attention. In The Eleventh International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id=qNLe3iq2E1.
Evan Miller. Attention is off by one. https://www.evanmiller.org/attention-is-off-by-one.html, 2023. Accessed: 2026-09-14.
Tam Minh Nguyen, Tan Minh Nguyen, Dung D. D. Le, Duy Khuong Nguyen, Viet-Anh Tran, Richard G. Baraniuk, Nhat Ho, and Stanley J. Osher. Improving Transformers with probabilistic attention keys. In ICML, pages 16595–16621, 2022. URL https://proceedings.mlr.press/v162/nguyen22c.html.
Ofir Press, Noah Smith, and Mike Lewis. Train short, test long: Attention with linear biases enables input length extrapolation. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum?id=R8sQPpGCv0.
Peter Racioppo. Robust Filter Attention: Self-attention as precision-weighted state estimation. In Forty-third International Conference on Machine Learning, 2026a. URL https://openreview.net/forum?id=GhI6lw5QKe.
Peter Racioppo. The Transformer as a polar state estimator, 2026b. URL https://arxiv.org/abs/2605.11007.
Hubert Ramsauer, Bernhard Schäfl, Johannes Lehner, Philipp Seidl, Michael Widrich, Thomas Adler, Lukas Gruber, Markus Holzleitner, Milena Pavlović, Geir Kjetil Sandve, Victor Greiff, David Kreil, Michael Kopp, Günter Klambauer, Johannes Brandstetter, and Sepp Hochreiter. Hopfield Networks is all you need, 2021. URL https://arxiv.org/abs/2008.02217.
Vaisakh Shaj, Cameron Barker, Aidan Scannell, Andras Szecsenyi, Elliot J. Crowley, and Amos Storkey. Kalman Linear Attention: Parallel Bayesian filtering for efficient language modeling and state tracking. In Forty-third International Conference on Machine Learning, 2026. URL https://openreview.net/forum?id=9h7sSJe4jN.
Jianlin Su, Murtadha Ahmed, Yu Lu, Shengfeng Pan, Wen Bo, and Yunfeng Liu. RoFormer: Enhanced Transformer with rotary position embedding. Neurocomputing, 568:127063, 2024. ISSN 0925-2312. doi: https://doi.org/10.1016/j.neucom.2023.127063. URL https://www.sciencedirect.com/science/article/pii/S0925231223011864.
Yutao Sun, Li Dong, Barun Patra, Shuming Ma, Shaohan Huang, Alon Benhaim, Vishrav Chaudhary, Xia Song, and Furu Wei. A length-extrapolatable Transformer. In Anna Rogers, Jordan Boyd-Graber, and Naoaki Okazaki, editors, Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 14590–14604, Toronto, Canada, July 2023. Association for Computational Linguistics. doi: 10.18653/v1/2023.acl-long.816. URL https://aclanthology.org/2023.acl-long.816/.
Shawn Tan, Songlin Yang, Aaron Courville, Rameswar Panda, and Yikang Shen. Scaling stick-breaking attention: An efficient implementation and in-depth study. In The Thirteenth International Conference on Learning Representations, 2025. URL https://openreview.net/forum?id=r8J3DSD5kF.
Yao-Hung Hubert Tsai, Shaojie Bai, Makoto Yamada, Louis-Philippe Morency, and Ruslan Salakhutdinov. Transformer dissection: A unified understanding for Transformer's attention via the lens of kernel. In Kentaro Inui, Jing Jiang, Vincent Ng, and Xiaojun Wan, editors, Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 4344–4353, Hong Kong,
China, November 2019. Association for Computational Linguistics. doi: 10.18653/v1/D19-1443. URL https://aclanthology.org/D19-1443/.
Cristiano Varin, Nancy Reid, and David Firth. An overview of composite likelihood methods. Statistica Sinica, 21(1):5–42, 2011.
Davis Wertheimer, Haochen Shen, Ahan Gupta, Derrick Liu, Yu Chin Fabian Lim, Mudhakar Srivatsa, Raghu K. Ganti, Minjia Zhang, and Naigang Wang. A self-pruning Transformer: Extreme KV-cache compression with Universal Attention. In Third Conference on Language Modeling, 2026. URL https://openreview.net/forum?id=7p4duCnIJy.
Guangxuan Xiao, Yuandong Tian, Beidi Chen, Song Han, and Mike Lewis. Efficient streaming language models with attention sinks. In The Twelfth International Conference on Learning Representations, 2024. URL https://openreview.net/forum?id=NG7sS51zVF.
Appendix Table of Contents
- Appendix A: Implementation of the DKA Layer 11
- Real-valued implementation and numerical stability; pseudocode and block diagram for a single isotropic DKA head.
- Appendix B: Derivations 13
- Derives the conditioned measurement model, the robust penalty, and the update, and gives the general diagonal form of the update.
- Appendix C: Counting Evidence from Distant Tokens 15
- Proves Propositions 1 and 2, comparing how much evidence DKA and RFA draw from the context with the exact amount.
- Appendix D: Memory Window 18
- Proves Proposition 3: each head can discard tokens older than a fixed window set by its decay rate.
- Appendix E: Recovery of Standard Positional Encodings 21
- Shows that RoPE and ALiBi attention arise as limits of a DKA head, and how decaying heads depart from them.
- Appendix F: Variance Inflation 22
- Inflates the prior on the past state to connect DKA and RFA, shows that the resulting family keeps a stable parallel form, and bounds the cost of inflation.
- Appendix G: Discussion 23
- Discusses calibrating abstention across heads, spectral coupling, depth, and limitations.
A Implementation of the DKA Layer
As in RFA [Racioppo, 2026a], DKA is formulated in a complex latent space, , and implemented with real operations. The realization follows RFA's, except for the residual, the information , and the proximal update.
Projections. A complex linear map with bias acts on paired real and imaginary channels. Since the inputs and outputs of the head are real, only part of it is needed:
both standard real linear layers. The projections are split into real and imaginary halves, . We do not constrain paired coordinates to be conjugate; the real output projection plays the role of taking the real part.
Rotation. With and , multiplication by is
and likewise for and , which is RoPE's rotation. The frequencies come in conjugate pairs, , so that the dynamics are real, and only of them are learned.
Residual and logits. Each term of the key-frame residual (line 7 of Algorithm 1) is real. The squared norms and are taken in and are unchanged by rotation, so they are computed from the unrotated projections, and is the ordinary inner product of the stacked rotated vectors. With , a single real matrix product,
The covariance , the logits and the weights are then elementwise functions of real matrices. As in RFA, we write for the decayed weights.
Stabilized weights. We subtract the row maximum , as a softmax does internally. Multiplying numerator and denominator of Eq. 13 by and writing ,
which requires one matrix multiplication and two row reductions.
Aggregation and update. Since is real, it acts identically on the real and imaginary halves of the rotated values, as one matrix product on the stacked values, . The inverse rotation by gives
The information is a real row sum, , and the proximal update divides each query's column by a real scalar, , acting identically on both halves; is the estimate . Finally, .
Cost. Each head performs the two matrix products of standard attention with head dimension 2d, for and ; everything else is elementwise on matrices or a reduction over rows. The computation therefore fits a tiled kernel in the style of FlashAttention, which keeps two running sums per query, and , in place of softmax's one, rescaled as the running maximum changes; the null slot is added once the final maximum is known.
A.1 Algorithm
This section gives the full pseudocode for a single isotropic DKA head (Algorithm 1) and a block diagram of it (Figure 2).
Algorithm 1 Dynamical Kernel Attention (isotropic, single head)
Input: Sequence at positions
Input: Linear layers () and ()
Input: Learned scalars ; decay rate ; frequencies
Output: Updated sequence
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14: return
For zero-decay heads (), is replaced by , with learned in place of .

as in RoPE attention
modified by DKA
dynamical model (depends on lag only)
Figure 2: A single Isotropic DKA head. The dynamical model (blue) depends only on the lag and a few per-head scalars, and supplies the decay kernel , the observation coefficient , and the conditioned covariance . The query is compared in the key's frame against the backward conditional mean . Weights are not softmax-normalized: is the row maximum of , and the proximal prior on the current estimate contributes a null slot to the denominator, so a head abstains when the accumulated information is small. The robust weight may be the Student- or exponential kernel, and the mask is causal (including the diagonal).
B Derivations
This section gives the derivations summarized in Section 3.
B.1 Conditioned Measurements
From Eq. 2, the transported estimate is
where , , and are mutually independent. In the stationary regime, the past state is itself accumulated forcing, , and both states are distributed as . Eq. 5 follows from taking the variance of Eq. 2: , with both variances equal to .
Writing and , the only term they share is , so by independence and Eq. 5,
Gaussian conditioning on gives the mean
and the covariance
Factoring on the left, the first two terms are
which is Hermitian and positive semidefinite, since and . This gives Eq. 6, with .
B.2 Robust Objective
Why a composite likelihood. The forcing is specified only through its covariance budget, and the joint dependence it implies across overlapping intervals is the part of the model least supported by the data. A composite likelihood requires only each factor's marginal to be correctly specified [Varin et al., 2011]. It also suits attention: under the exact likelihood, each newer measurement supersedes older ones, as in a Kalman filter, whether or not it is relevant to the query. Treating measurements as independent given lets attention skip irrelevant tokens without discounting older relevant ones, at the cost of an overcount that is bounded in context length (Proposition 1).
Penalty and weights. Marginalizing the scales, the negative log composite likelihood is
with . Its IRLS weight is , which by conjugacy equals the posterior mean inverse scale [Lange et al., 1989]. Because accumulates independent contributions, we temper the weight to Eq. 7, which is generated by the penalty
As , , the penalty of Eq. 14 up to a constant factor. Each layer therefore computes an M-estimator [Huber, 1964], minimizing
and IRLS with weights is the standard algorithm for computing it. Since , the penalty is bounded, so a sufficiently inconsistent measurement adds almost nothing to the objective.
B.3 Update
Recall the residual at the current estimate, , and the information contributed by the measurements, . The gradient of Eq. 8 is
The minimizer sets the gradient to zero. Collecting the terms in ,
To express the solution as a correction to the current estimate, write and expand :
Multiplying by gives Eq. 9. At a fixed point , the proximal term vanishes and , the stationary condition of Eq. 15.
B.4 General Diagonal Form
Since , , , and are diagonal, every matrix above is diagonal, and Eq. 9 can be evaluated for all pairs in parallel. The DLE decouples into scalar equations, one per mode. Writing for the decay over the lag,
The residual is , the distance decomposes over modes as , and, using and , the update is elementwise,
In the isotropic case (Section 3.4), , with , with , and with . The update is then a scalar update per mode,
and dividing numerator and denominator by shows that and enter only through their product. The transport of mode factors as , with , and the rotated queries, keys, and values are , , and . In the value basis, the residual is , and since does not depend on , with ,
which gives Eq. 13. For the key-frame residual of Section 3.4, the transported key and the predicted key are and , so their difference is , with . Since and ,
The term is the backward conditional mean in the rotated frame: for a stationary process, prediction of the past is also contractive, since the current state only partly determines it.
C Counting Evidence from Distant Tokens
The composite likelihood treats measurements as independent given , although they share forcing. This section compares how much evidence DKA and RFA assign to the context with the exact amount (Proposition 1), and how this affects their estimates (Proposition 2).
Setting. The data are generated by the stationary model of Section 3.1 with . We work with a single isotropic mode at the first layer, with unit token spacing, so that , and consider the most recent tokens, . We set the robust weights to one; since they are at most one, they can only reduce each token's contribution. We write
for the decay of the variance over one step, the head's memory length, the variance of the forcing accumulated over a lag, and its value over one step. By Section B.4, token j is a measurement of the current state (Eq. 6),
The rotation in the transport cancels and does not enter.
Information. We measure evidence by Fisher information: a measurement with noise variance carries information about , which in a Gaussian model is exactly what it adds to the posterior precision. The exact information accounts for the correlations among the tokens; a composite likelihood ignores them and adds each token's individual information. DKA's factors are the exact individual likelihoods, so it assigns a token at lag the information
its term in (Section 3.4), with total . RFA treats each token as a direct measurement, , and assigns it , where
moves from at zero lag to at long lag. We omit RFA's floor , which accounts for the query standing in for the latent state; including it adds to and without changing the conclusions.
C.1 Evidence from the Context
Proposition 1 (Evidence from the context). For every N:
(i) Exact.
(ii) DKA. , with equality on the left for .
(iii) RFA. Each token is assigned between and , tending to with lag, so the total lies between and .
Interpretation. A distant token’s prediction has decayed to the equilibrium, so it reports only that is a draw from the stationary distribution, which the prior already says. RFA counts this restatement once per token, so its total grows without bound while the exact total stays bounded. DKA’s coefficient falls with lag, so its total stays within a factor L of the exact total, which the step size absorbs (Section 3.3).
DKA still overcounts, because nearby tokens share forcing. All older tokens reach the current state through the same last step of forcing, which none of them observes, so together they give at most , however many there are. DKA applies this limit to each token separately rather than to their total, which always leaves at least as much, so DKA can overcount but never undercount.
Figure 3 shows both effects: per token, DKA's information falls exponentially with lag while RFA's levels off at ; in total, the exact and DKA counts saturate while RFA's grows linearly.
Proof of (i). The current token has noise independent of the older tokens, so its information adds to theirs: , where is the older tokens' information about , and .
The older tokens are the most recent tokens at position , so by stationarity they give posterior precision . Since , with and independent of the older tokens, the posterior variance of given them is, writing and using ,
Its inverse, the posterior precision, is
since . Information is what the tokens add to the prior precision , so the older tokens' information about is the second term:
The bounds follow from for all .
Proof of (ii). Upper bound. Since , the denominator of is at least , so , and the geometric series gives
Lower bound. The forcing over steps is the forcing over steps plus one new step, decayed over the other :
Evaluating at , whose inverse is , and multiplying the numerator and denominator by ,
carrying a token’s information forward one step gives the information of the token one lag older. Separating the current token, with , and applying this identity to the older tokens,
The second line uses , which holds because is concave with ; the last step is the definition of .
We now show by induction. For , both totals contain only the current token, so . Suppose . Since is increasing (a larger makes smaller),
where the equality is the recursion from the proof of (i). For , the sum over older tokens has a single term, so the first inequality is an equality, and .
Proof of (iii). is a weighted average of and , with the weight on rising to one. Each token's information therefore lies between and and tends to ; summing of them gives the bounds on the total.
C.2 Pull toward the Equilibrium
Each method’s attention output is an estimate of the current state, toward which the residual connection in RFA and the proximal step in DKA move part of the way. We compare the estimates themselves, through the fraction of the current state they retain on average.
Scope. This comparison depends on how the data are generated. Under RFA's flat prior on the past state, each transported token would satisfy , and RFA's estimate would keep all of the current state. The flat prior places the past state farther from the equilibrium than the stationary model does, running the stable dynamics backward. The stationary model is the one consistent with the dynamics both methods assume: a stable process forgets its initial state within about steps, and no stable process produces a flat distribution. The two models nearly agree at lags short compared with , where , and differ only beyond , where the flat prior contradicts the dynamics.
Proposition 2 (Pull toward the equilibrium). The exact maximum-likelihood estimate and DKA's estimate satisfy for every . RFA's estimate satisfies , where as , with
Interpretation. The overcount sets how far each estimate is pulled toward the equilibrium. RFA's estimate is a normalized average over all N tokens, but only about K of them still carry the current state; the rest vote for the equilibrium, so RFA keeps only a fraction K/N of the current state. DKA's normalizer weights each token by , so distant tokens drop out of both numerator and denominator, and its estimate keeps all of the current state.
Figure 4a shows the consequence for accuracy: as the context grows, RFA's error rises toward that of guessing the equilibrium, while DKA's levels off above the exact error.
Proof. Each token has mean .
Exact. Stack the tokens as , where , so that . Setting the derivative of the negative log-likelihood, , to zero gives the maximum-likelihood estimate
DKA. With unit weights and a full step (Eq. 13), DKA's estimate weights each token by its information, . Each has mean , and the weights sum to one, so .
RFA. With unit weights, RFA's estimate is a normalized average of the transported tokens themselves,
The weights do not depend on the data, so , and the bracket is . Substituting the weights and ,
The numerator counts the weight on tokens that still carry the current state. Its terms are times RFA's per-token information, which lies between and (Proposition 1(iii)). So converges, to by the definition of , and summing the geometric series places between and . The denominator counts the weight on all tokens. Its terms tend to , so . Hence
17
☐
D Memory Window
Because past tokens remain available, forgetting in DKA is a property of a token's evidence rather than of its storage. This gives a rule for when storage can be released: each head can discard tokens older than a fixed window, with a guaranteed bound on the change to its output that holds for every query.
Setting. We consider a single isotropic head with decay , tokens at integer positions, and the update of Eq. 13,
where and . Two facts hold for every query and every token. First, and , so . Second, the rotations have unit magnitude, so . Write for the update computed from only the tokens at lag at most , and
Proposition 3 (Memory window). Suppose for all . Then, for every query and every ,
The constant C does not depend on the query, the context length, or the content of the tokens. Hence keeping only the
most recent tokens changes every output of the head by at most .
Proof. Write , and let and be the truncated sums, over tokens at lag at most . The discarded tokens are those at lag , and each lag is occupied by at most one token.
What the discarded tokens contribute. Subtracting the truncated sums from the full ones leaves only the discarded tokens:
Each term of the first sum is nonnegative and at most . Each term of the second has norm at most
using , and . Since each lag holds at most one token, both sums are bounded by sums over , and the tail of the geometric series is . Hence
How the update changes. Since the update is a ratio, its change has two parts, from the numerator and from the denominator:
Both denominators are at least . For the second part we also need . The two parts of have norms at most and , so we bound each part divided by :
In the first term we used ; in the second, . Since and each lag holds at most one token, the full geometric series gives , so the first term is at most , and
Combining,
Finally, exactly when .
Remarks. The bound uses only , so it holds whatever the robust weights are. Robust weighting can suppress a particular token sooner, but whether it does depends on the query, so it does not justify discarding the token. The window depends only on lag.
The proximal prior is what makes the guarantee possible. Its null slot keeps the denominator at least ; with a full step , the denominator is alone, which can be small when the robust weights are small, and grows without bound. The same term that lets a head abstain therefore also bounds how much a discarded token can matter.
Figure 4b shows the effect: the change in DKA's output from discarding old tokens falls exponentially with the window, at a rate set by . Each head has its own window, set by its decay rate. Zero-decay heads have no window, and must keep their whole context.
The argument does not carry over to RFA. There, a distant token's value is decayed by E, but its weight in the normalizer is not, so the normalizer does not converge as the context grows, and discarding distant tokens changes the output even at long lags, as the same figure shows.

(a) Information per token, by lag
(b) Total information, by context length
Figure 3: Counting evidence from distant tokens. One mode of the linear Gaussian model, with data drawn from its stationary distribution and nominal attention weights ( , , ). (a) Information about the current state assigned to a single token. DKA's falls exponentially with lag; RFA's levels off at , since each distant token restates the prior. The exact curve is the information a token adds given all newer tokens. (b) Total information in the N most recent tokens. The exact and DKA totals both saturate, DKA's above the exact by a bounded factor; RFA's grows linearly.

(a) Error of the estimate, by context length
(b) Change in output from evicting old tokens
Figure 4: Accuracy and memory (setting as in Figure 3). We compare the estimates before the residual or proximal step. (a) MSE of each estimate of the current state, ; a value of one is what always guessing the equilibrium, , achieves. With a few tokens, all three agree (RFA dips slightly below exact, trading a little bias for lower variance). Each further token adds a vote for the equilibrium in RFA's average, so its error rises toward one. DKA's levels off above the exact error, reflecting its bounded overcount. (b) Change in the estimate when only the most recent tokens of a 2048-token context are kept (RMS over the stationary data, relative to ). DKA's change falls exponentially at a rate set by , so tokens beyond a fixed window can be evicted for every query. RFA's falls slowly, since a distant token's weight in the normalizer is not decayed. The exact change falls fastest: once recent states are pinned down, older tokens add almost nothing.
E Recovery of Standard Positional Encodings
RoPE and ALiBi attention arise as limits of a single isotropic DKA head. Three limits reduce the head to softmax attention. First, the full step ( ) removes the null slot, so ; the term passes through as a fixed linear map of the residual stream, and the attention output is . Second, zero decay ( , so ) makes the information , so is a normalized average of the values. The values are transported by the relative rotation, as in RoPER [Harik and Jayasiri, 2022], whereas standard RoPE leaves them unrotated. Third, a large Student-t parameter ( ) gives the logits
where, at zero decay, comparing in the key’s frame or the query’s frame gives the same residual. For zero-decay heads, (Algorithm 1).
RoPE. With , is constant. The term is then the same for every key and cancels in the normalization, leaving
This is RoPE attention with inverse temperature and a bias on the key’s norm, which vanishes for normalized keys.
ALiBi. With , grows linearly with lag. For unit-norm queries and keys, , and
The first term is a lag bias. The second is a content penalty, which is zero for a key that matches the query and has an inverse temperature that falls with lag. For , the bias is , the linear recency bias of ALiBi [Press et al., 2022], with slope . At longer lags, it grows logarithmically rather than linearly, as in the logarithmic variant of KERPLE [Chi et al., 2022].
Decaying heads. With , the limits above no longer give softmax attention, and the head departs from both encodings in three ways. First, the lag prior is linear near zero lag, with slope , as in ALiBi, but saturates at beyond about tokens. Since increases with lag, the bias always decreases, so there is no counterpart to RFA's integrative regime. Second, for unit-norm queries and keys, the residual is : the content penalty carries the weight , which decays exponentially with lag, as in xPos [Sun et al., 2023], and even a matching key pays , because the backward mean shrinks toward the equilibrium. Third, the information weights each token by , so the output averages the values with weights proportional to , after undoing their decay, rather than the values themselves with weights proportional to . This is the change that bounds the evidence from distant tokens (Appendix C) and gives each head its memory window (Appendix D).
F Variance Inflation: Interpolating between DKA and RFA
RFA [Racioppo, 2026a] uses the same dynamical model but a flat prior on the past state [Ansley and Kohn, 1990, de Jong, 1991, Durbin and Koopman, 2012], under which each transported token is a direct measurement of the current state, , with a floor. The two models can be connected by inflating DKA's prior on the past state to : a stationary covariance plus an added variance , the form used to initialize state-space models with a partly diffuse initial state, whose limit gives the diffuse prior [Durbin and Koopman, 2012]. At , this is DKA, and as it recovers RFA. Inflation allows the past state to lie farther from the equilibrium than the stationary model predicts.
Measurement model. For a single isotropic mode, with and , conditioning as in Section 3.2 with the inflated prior variance gives
Write , so that . Dividing the numerator and denominator of by gives
To put the variance in DKA's form , substitute in its second term:
Every formula of Section 3.4 then carries over with replaced by . At , , which is DKA. At , , so and , RFA's covariance.
The algorithm. Three steps of Algorithm 1 change. The squared distance becomes
which is DKA's residual at and RFA's, , at . The logits use in place of , and the information is ; the aggregation is unchanged.
Stability. At long lags and near one, is a ratio of two vanishing quantities. With , it is computed instead as
both stable for every . Since , also , so no step divides by a small number. The form of shows what does: tokens younger than about count fully, as in RFA, and older ones fade as , as in DKA.
The cost of inflation. Inflation lets each token attribute more of its deviation from the equilibrium to the current state, so tokens count for more. Since , the results of Appendices C and D still hold for every , with replaced by : the total evidence stays bounded, the estimate keeps at least a fraction of the current state, and the memory window lengthens by at most . All three fail only at , which is RFA.
G Discussion
Calibrating abstention across heads. A head abstains when its evidence is small relative to , for instance when no past token agrees with the current estimate, so that the self-pair dominates and contributes no innovation. With unit weights, each token contributes its information , so a head's steady-state evidence is DKA's total information over an unbounded context (Appendix C),
We approximate the sum by an integral over lag. The trapezoid rule counts every lag fully except the endpoint , which it counts at half weight, so , with . Substituting , so that ,
with . Hence
With a shared , slow heads, which pool more tokens, would rarely abstain, and fast heads would abstain readily. We therefore set and learn from a common initialization, so that every head starts with the same threshold: when all tokens agree, the null slot carries a fraction of the weight. This also absorbs each head's composite overcount, which varies with , into its step size. We hold fixed across heads, so that each head's lag profile is a time-rescaled copy of the others.
Spectral coupling. As in SC-RFA [Racioppo, 2026a], the frequency bank can be partitioned monotonically across heads, with each head's decay rate tied to its highest frequency, ; we call this variant SC-DKA. Each head's signal then decays by a factor over one period of its highest frequency, so high-frequency components fade before they can produce spurious phase matches at long lags. Since DKA's lag profile decreases strictly with lag, the coupled heads form an ordered bank of recency filters at different timescales.
Depth. For a single query with its measurements held fixed, repeating the update is a proximal IRLS iteration, whose proximal term sets the step size but not the limit (Section 3.3). A stack of layers is analogous to this iteration but not identical to it. Each layer's measurements are the previous layer's outputs, which already pool overlapping context, and the raw observations enter only at the first layer. A deep stack therefore need not converge to the Kalman estimate: later layers treat earlier estimates as new measurements, and the composite likelihood counts their overlapping evidence again. Characterizing what a stack of DKA layers computes is left to future work.
Limitations. DKA retains the composite likelihood of RFA, so nearby tokens that share forcing are still overcounted. The overcount is bounded by a factor independent of context length (Proposition 1) and is absorbed by the step size. We keep the composite likelihood deliberately. Under the exact likelihood, a token counts only for what it adds beyond the retained tokens that follow it, so newer consistent tokens supersede older ones, as in a Kalman filter. The composite likelihood instead compares each token with the current estimate on its own, so an older relevant token keeps its weight however many consistent tokens follow it. Each DKA head models a single exponential timescale, so correlations over several timescales rely on the bank of heads, and its decay, and hence its memory window, depends only on lag; content-dependent dynamics are a natural extension. Zero-decay heads have no memory window and must keep their whole context. Finally, the counting results of Appendix C assume data generated by the model, whereas the memory-window bound holds for any data.