betaFeedback

WorksComputer Science

Universal interpolation for deep residual self-attention networks

Abstract

Universal approximation is a necessary qualitative property of learning architectures to benefit from scaling laws. While it is generically verified on a variety of neural architectures and random feature models, it typically involves infinite width limits. In this work, we focus on deep self-attention models and consider instead the `dual' regime, where approximation power is enabled entirely by depth, and featuring strong parameter sharing across layers, motivated by recent models such as the Looped Transformers. More specifically, we ask whether one can find a predefined finite set of parameters, each defining an attention block, such that the resulting finite set of transformations can map any collection of NN sequences of nn tokens to any other collection of NN sequences of nn tokens. Crucially, these transformations are fixed independently of the input and output collections: only the order in which the blocks are applied, their signs, and their durations depend on the particular interpolation task. Our main result establishes it for residual softmax attention using only two frozen single-head blocks with Gaussian-initialized projection matrices. The result holds at both continuous and finite depth. We also characterize the restrictions imposed by causal masking and establish corresponding universal interpolation guarantees.

Introduction

Introduced by Vaswani et al. (2017), transformers have driven major advances in natural language processing (Devlin et al., [15]), computer vision (Dosovitskiy et al., [16]) and reasoning (Wei et al., 2022). This widespread success motivates several key questions regarding their architecture, including their expressive power, their ‘inductive bias’ or feature-learning abilities, and ultimately their ability to generalize in the current pretrain/post-train paradigm.

Towards this long-term goal, the first stepping stone is to characterize a flexible class of transformer architectures with enough expressive power to interpolate any given dataset, as a basis for studying scaling laws. A standard approach to studying expressivity in neural architectures is to consider infinitely wide limits, starting with the classic universal approximation theory of Cybenko [13], Hornik et al. [23] and others in the single-hidden layer setting. In this context, the design of simple hypothesis spaces (e.g. random feature models) with universal approximation has enabled the subsequent study of non-linear feature learning. Given the prevalent role of depth in the success of recent deep learning models, it is natural to ask whether other mechanisms for universal approximation exist where depth is the instrumental variable; in other words, to consider the deep analogs of random feature models.

In this work we focus on transformer models, and specifically their self-attention modules. Motivated by recent interest on looped transformers, we make an additional distinction: while traditional memo-rization asks whether, for any given task, it is possible to adjust the parameters of the architecture to produce prescribed outputs, we are interested in capturing the notion of parameter reuse. Specifically, we ask whether it is possible to predefine a finite family of attention blocks a priori, without looking at the data, and then achieve exact interpolation only by choosing which block, and with which scalar gain, to use at each layer. Following the fixed-generator formulations in Cuchiero et al. [12]; Agrachov & Letrouit (2026), we call this property universal interpolation.

These questions are particularly relevant to recent Transformer architectures that reuse a small number of blocks across depth. Such recurrent-depth or looped architectures have recently been explored at scale in language models, including recurrent-depth models [19], Mixture-of-Recursions [6], Nanbeige4.2-3B [29], and Hyperloop Transformers (Zeitoun et al., 2026). Rather than introducing independent parameters at every layer, these models obtain additional effective depth by repeatedly applying the same transformations. This makes it natural to ask how much expressive power can arise from depth and composition alone when the available transformations are fixed.

Exact interpolation. A large body of work studies expressivity of neural networks by asking whether, for each finite dataset, network parameters can be chosen to match the prescribed outputs exactly. Such results characterize the fitting capacity of an architecture, while allowing all of its parameters to depend on the dataset. Ruiz-Balet & Zuazua [30] establish exact interpolation of finite datasets of distinct points by ReLU neural ODEs in dimension at least two, using data-dependent controls and biases; one active hidden unit suffices. For transformers, Kajitsuka & Sato [25] construct contextual representations with one attention head and rank-one projections, followed by a feed-forward decoder whose size grows with the data. Dana et al. [14] prove next-token memorization for attention-only models with constructed embeddings and a readout, with capacity controlled by the number and dimension of heads. Alcalde et al. [3] obtain exact interpolation of output token sets, without prescribed token correspondences, using attention and ReLU feed-forward blocks with explicit depth bounds. Geshkovski et al. [20] instead study interpolation of token distributions on the sphere using attention, perceptrons, and spherical layer normalization. In all of these settings, the transformations used by the network may be adapted to the particular interpolation problem.

Universal approximation. A related notion of expressivity is universal approximation, which asks whether a network class can approximate every mapping in a prescribed function class to arbitrary accuracy, under an appropriate topology. Here too, the network parameters may depend on the target function; universality concerns the network class rather than a fixed collection of transformations. Classical results establish universal approximation for sufficiently wide networks with a single hidden layer and a continuous sigmoidal activation [e.g. 13, 23]. Lin & Jegelka [26] establish L1L^1 universal approximation for deep ReLU residual networks with one-neuron hidden layers and target-dependent weights and biases. From a control-theoretic perspective, Tabuada & Gharesifard [35] derive approximation guarantees through ensemble controllability and monotonicity. For transformers, Yun et al. (2020) establish LpL^p approximation of continuous permutation-equivariant mappings with compact support at fixed sequence length, using two attention heads of width one and feed-forward blocks of width four. Furuya et al. [18] obtain uniform approximation of continuous in-context mappings on compact token domains, with token dimension and head count bounded independently of context length and accuracy while retaining tokenwise MLPs. Hu et al. [24] establish approximation using two attention layers supplemented with linear transformations. These results address approximation of function classes rather than exact interpolation under a fixed set of reusable transformations.

Universal interpolation with fixed generators. Beyond classical exact interpolation, one can ask whether the transformations available to the network can be fixed in advance and reused across datasets. Cuchiero et al. [12] construct five fixed vector fields that interpolate every finite dataset of distinct points in a bounded connected domain of dimension at least two, with only the scalar controls depending on the data. Related fixed-family interpolation results have been obtained for general neural ODEs [21] and for smooth-activation residual networks [36]. For ReLU dynamics, Cai & Duan [9] establish exact interpolation using arbitrary affine vector fields together with a fixed ReLU field. Combining their result with an exact factorization of affine flow maps into elementary linear flows and translations yields a finite family of fixed generators, independent of the dataset and its size, with biases allowed. Closest to our work, Agrachev & Letrouit [1] prove that two generic equivariant vector fields suffice for simultaneous interpolation of arbitrarily many compatible point clouds. Their genericity is formulated over an infinite-dimensional space of vector fields, and they explicitly leave extensions to standard softmax attention as an open direction. Establishing such a result is one focus of our work.

Our contributions. We formalize exact and universal interpolation (Definitions 2.3 and 2.4), two related notions used in the literature, and give simple criteria that follow directly from classical theorems in control theory (§ 2.2.1). We also provide a PyTorch implementation to investigate these criteria numerically (§ 2.2.2). Our main contributions are:

  • to transfer exact (resp. universal) interpolation from continuous to finite depth under the corresponding Lie-rank conditions (Proposition 2.9, resp. Proposition 2.10);

  • to establish universal interpolation with frozen random noncausal attention blocks for any prescribed number of heads, using a number of blocks that grows linearly with the batch size (Theorem 3.3);

  • to show that only two frozen random single-head noncausal attention blocks suffice for universal interpolation on a connected domain of full measure (Theorem 3.5);

  • to rule out exact and universal interpolation on the full configuration space for causal attention when the batch size exceeds the token dimension, by characterizing the exact dimension of the associated Lie-algebra trace (Proposition 3.8);

  • to recover universal interpolation for causal attention on each connected component of a class of batches sharing the same linear relations among their first tokens (Corollary 3.10).

Exact interpolation and universal interpolation

In this section, we formulate exact and universal interpolation in continuous depth and show how the resulting criteria transfer to finite-depth residual networks. We begin by recalling the standard continuous-depth formulation of residual architectures.

From residual layers to continuous-depth networks

Given a partition 0=s0<⋯<sL=:S0=s_0<\cdots<s_L=:S, a residual layer takes the form

xk+1=xk+hkfθk(xk),hk=sk+1−sk.x_{k+1}=x_k+h_kf_{\theta_k}(x_k),\qquad h_k=s_{k+1}-s_k.

Taking θ(s)=θk\theta(s)=\theta_k on [sk,sk+1)[s_k,s_{k+1}), this update is a forward Euler discretization of the continuous-depth dynamics [27, 22, 10]

dx(s)ds=fθ(s)(x(s)),x(0)=x0.(1)\frac{\mathrm{d}x(s)}{\mathrm{d}s}=f_{\theta(s)}(x(s)),\qquad x(0)=x_0. \tag*{(1)}

where s∈[0,S]s\in[0,S] represents continuous depth and the parameters θ(s)\theta(s) may vary with depth but are shared across inputs.

For self-attention, we represent each sequence by its ordered token coordinates x=vec⁡(x1,…,xn)∈Rndx=\operatorname{vec}(x_1,\ldots,x_n)\in\mathbb{R}^{nd} and use the finite-dimensional ODE formulation (1). This representation retains the prescribed tokenwise input–output correspondences, which are not encoded by an empirical-measure description [31].

We consider two classes of vector fields, corresponding to residual ReLU networks and residual self-attention networks.

Example 2.1 (Continuous-depth ResNets). A bias-free residual block with one ReLU hidden layer has update

fU,V:x∈Rd↦Uσ(VTx)∈Rd,(2)f_{U,V}:x\in\mathbb{R}^{d}\mapsto U\sigma(V^{\mathsf{T}}x)\in\mathbb{R}^{d}, \tag*{(2)}

where σ(t):=max⁡{t,0}\sigma(t):=\max\{t,0\} is applied componentwise and U,V∈Rd×rU,V\in\mathbb{R}^{d\times r}, with rr the hidden width.

Example 2.2 (Continuous-depth self-attention). For x=vec⁡(x1,…,xn)∈Rndx=\operatorname{vec}(x_1,\ldots,x_n)\in\mathbb{R}^{nd}, let J=(Ji)i=1n\mathcal{J}=(\mathcal{J}_i)_{i=1}^{n} specify the visible key positions. An HH-head block updates token ii by

[fW,V(x)]i:=∑h=1H∑j∈Jie⟨Whxi,xj⟩Vhxj∑q∈Jie⟨Whxi,xq⟩,i=1,…,n.(3)[f_{\mathbf{W},\mathbf{V}}(x)]_i:=\sum_{h=1}^{H}\frac{\sum_{j\in\mathcal{J}_i}\mathrm{e}^{\langle W_hx_i,x_j\rangle}V_hx_j}{\sum_{q\in\mathcal{J}_i}\mathrm{e}^{\langle W_hx_i,x_q\rangle}},\qquad i=1,\ldots,n. \tag*{(3)}

Here W=(Wh)h=1H\mathbf{W}=(W_h)_{h=1}^{H} and V=(Vh)h=1H\mathbf{V}=(V_h)_{h=1}^{H}, with the standard parametrization (Vaswani et al., 2017)

Wh=(WhK)TWhQrh,Vh=WhOWhV,W_h=\frac{(W_h^{K})^{\mathsf{T}}W_h^{Q}}{\sqrt{r_h}},\qquad V_h=W_h^{O}W_h^{V},

where WhQ,WhK,WhV∈Rrh×dW_h^{Q},W_h^{K},W_h^{V}\in\mathbb{R}^{r_h\times d} and WhO∈Rd×rhW_h^{O}\in\mathbb{R}^{d\times r_h}. The head widths rhr_h are arbitrary positive integers, including the standard choice rh=d/Hr_h=d/H when HH divides dd. We write fW,Vf_{\mathbf{W},\mathbf{V}} for noncausal attention (Ji={1,…,n}\mathcal{J}_i=\{1,\ldots,n\}) and fW,Vcf_{\mathbf{W},\mathbf{V}}^{\mathrm{c}} for causal attention (Ji={1,…,i}\mathcal{J}_i=\{1,\ldots,i\}).

Exact and universal interpolation

Let F={fθ:Rp→Rp:θ∈Θ}\mathcal{F} = \{f_\theta: \mathbb{R}^{p} \to\mathbb{R}^{p} : \theta\in\Theta\} be the family of available updates, with each fθf_\theta locally Lipschitz. We represent a dataset of NN samples by its vectorisation X=vec⁡(x1,…,xN)∈RpNX = \operatorname{vec}(x^1,\ldots,x^N) \in\mathbb{R}^{pN}, where (x1,…,xN)(x^1,\ldots,x^N) is an ordered batch. For residual ReLU networks, each sample is a vector in Rd\mathbb{R}^{d}, so p=dp=d. For self-attention, each sample is a sequence of nn tokens vectorized in Rnd\mathbb{R}^{nd}, so p=ndp=nd and NN counts sequences rather than tokens. Applying the same weights to the whole batch gives the lifted update

fθ(N)(X):=(fθ(x1),…,fθ(xN)).f_\theta^{(N)}(X) := \left(f_\theta(x^1),\ldots,f_\theta(x^N)\right).

A depth-dependent choice of parameters θ(⋅)\theta(\cdot) is called a control; throughout, controls are piecewise constant with finitely many depth intervals.

Architectural symmetries and preserved relations constrain which input–output pairs can be interpolated. We study interpolation on a chosen configuration domain MN⊆RpN\mathcal{M}_N \subseteq\mathbb{R}^{pN}, specified for each architecture below. Both input and target configurations must lie in this domain, with targets represented in the same space as the inputs.

Definition 2.3 (Exact interpolation). Fix N≥1N \ge1 and a nonempty, open, connected set MN⊆RpN\mathcal{M}_N \subseteq\mathbb{R}^{pN}. For S>0S > 0, a piecewise-constant control θ:[0,S]→Θ\theta: [0,S] \to\Theta with finitely many depth intervals exactly interpolates a pair X,Y∈MNX,Y \in\mathcal{M}_N if the solution of

Z˙(s)=fθ(s)(N)(Z(s)),Z(0)=X,\dot{Z}(s) = f_{\theta(s)}^{(N)}(Z(s)), \qquad Z(0) = X,

remains in MN\mathcal{M}_N and satisfies Z(S)=YZ(S)=Y. We say that F\mathcal{F} has the exact interpolation property on MN\mathcal{M}_N if every pair X,Y∈MNX,Y \in\mathcal{M}_N admits such a terminal depth S>0S>0 and a control.

Universal interpolation additionally requires a finite dictionary of updates to be fixed before the input–target dataset is given. For the next definition, the architecture must allow the negative of each selected update. Both architectures above have this property by negating the output matrices.

References

  1. [1]Andrei Agrachev and Cyril Letrouit. Generic controllability of equivariant systems and applications to particle systems and neural networks. Annales de l’Institut Henri Poincaré C, Analyse non linéaire, 43(3):639–668, 2026. URL https://ems.press/journals/aihpc/articles/14298488.arxiv.org/abs/2404.08289
  2. [2]Andrei A. Agrachev and Yuri L. Sachkov. Control Theory from the Geometric Viewpoint, volume 87 of Encyclopaedia of Mathematical Sciences. Springer, Berlin, Heidelberg, 2004. doi: 10.1007/978-3-662-06404-7. URL https://doi.org/10.1007/978-3-662-06404-7.
  3. [3]Albert Alcalde, Giovanni Fantuzzi, and Enrique Zuazua. Exact sequence interpolation with transformers. Mathematical Foundations of Machine Learning, 2(1):2, 2026.DOI
  4. [4]Tal Amir, Steven Gortler, Ilai Avni, Ravina Ravina, and Nadav Dym. Neural injective functions for multisets, measures and graphs via a finite witness theorem. Advances in Neural Information Processing Systems, 36:42516–42551, 2023.arxiv.org/abs/2306.06529
  5. [5]James Ax. On schanuel’s conjectures. Annals of mathematics, 93(2):252–268, 1971.DOI
  6. [6]Sangmin Bae, Yujin Kim, Reza Bayat, Sungnyun Kim, Jiyoun Ha, Tal Schuster, Adam Fisch, Hayr Harutyunyan, Ziwei Ji, Aaron C. Courville, and Se-Young Yun. Mixture-of-Recursions: Learning dynamic recursive depths for adaptive token-level computation. In Advances in Neural Information Processing Systems, volume 38, 2025. doi: 10.52202/085713-3229. URL https://papers.nips.cc/paper_files/paper/2025/hash/8b08bbf8b420faa6eeb4020720582ec7-Abstract-Conference.html.DOI
  7. [7]Edward Bierstone and Pierre D Milman. Semianalytic and subanalytic sets. Publications Mathématiques de l’I.H.É.S, 67:5–42, 1988.DOI
  8. [8]Yongqiang Cai. Vocabulary for universal approximation: A linguistic perspective of mapping compositions. In Proceedings of the 41st International Conference on Machine Learning, volume 235 of Proceedings of Machine Learning Research, pp. 5189–5208. PMLR, 2024. URL https://proceedings.mlr.press/v235/cai24a.html.arxiv.org/abs/2305.12205
  9. [9]Yongqiang Cai and Yifei Duan. Achieving universal approximation and universal interpolation via nonlinearity of control families. arXiv preprint arXiv:2510.03676, 2025.arxiv.org/abs/2510.03676
  10. [10]Ricky TQ Chen, Yulia Rubanova, Jesse Bettencourt, and David K Duvenaud. Neural ordinary differential equations. Advances in neural information processing systems, 31, 2018.arxiv.org/abs/1806.07366
  11. [11]Jingpu Cheng, Qianxiao Li, Ting Lin, and Zuowei Shen. Interpolation, approximation, and controllability of deep neural networks. SIAM Journal on Control and Optimization, 63(1):625–649, 2025.arxiv.org/abs/2309.06015
  12. [12]Christa Cuchiero, Martin Larsson, and Josef Teichmann. Deep neural networks, generic universal interpolation, and controlled odes. SIAM Journal on Mathematics of Data Science, 2(3):901–919, 2020.arxiv.org/abs/1908.07838
  13. [13]George Cybenko. Approximation by superpositions of a sigmoidal function. Mathematics of control, signals and systems, 2(4):303–314, 1989.
  14. [14]Léo Dana, Muni Sreenivas Pydi, and Yann Chevaleyre. Memorization in attention-only transformers. In Proceedings of The 28th International Conference on Artificial Intelligence and Statistics, volume 258 of Proceedings of Machine Learning Research, pp. 3133–3141. PMLR, 2025. URL https://proceedings.mlr.press/v258/dana25a.html.
  15. [15]Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pp. 4171–4186. Association for Computational Linguistics, 2019. doi: 10.18653/v1/N19-1423. URL https://aclanthology.org/N19-1423/.DOI
  16. [16]Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, and Neil Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id=YicbFdNTTy.
  17. [17]Yifei Duan and Yongqiang Cai. A minimal control family of dynamical systems for universal approximation. IEEE Transactions on Automatic Control, 70(11):7233–7244, 2025.arxiv.org/abs/2312.12903
  18. [18]Takashi Furuya, Maarten V. de Hoop, and Gabriel Peyré. Transformers are universal in-context learners. In International Conference on Learning Representations, 2025. URL https://proceedings.iclr.cc/paper_files/paper/2025/file/c9028f7874df04843e7bf435ee4cd3c3-Paper-Conference.pdf.arxiv.org/abs/2408.01367
  19. [19]Jonas Geiping, Sean McLeish, Neel Jain, John Kirchenbauer, Siddharth Singh, Brian R. Bartoldson, Bhavya Kailkhura, Abhinav Bhatele, and Tom Goldstein. Scaling up test-time compute with latent reasoning: A recurrent depth approach. In Advances in Neural Information Processing Systems, volume 38, 2025. URL https://arxiv.org/abs/2502.05171.
  20. [20]Borjan Geshkovski, Philippe Rigollet, and Domènec Ruiz-Balet. Measure-to-measure interpolation using transformers. Foundations of Computational Mathematics, pp. 1–50, 2026.DOI
  21. [21]Erlend Grong and Sylvie Vega-Molino. Controllability on landmark manifolds for shapes and neural ODEs. Mathematics of Control, Signals, and Systems, 38(2):275–289, 2026. doi: 10.1007/s00498-026-00435-1.DOI
  22. [22]Eldad Haber and Lars Ruthotto. Stable architectures for deep neural networks. Inverse problems, 34 (1):014004, 2018.DOI
  23. [23]Kurt Hornik, Maxwell Stinchcombe, and Halbert White. Multilayer feedforward networks are universal approximators. Neural networks, 2(5):359–366, 1989.DOI
  24. [24]Jerry Yao-Chieh Hu, Hude Liu, Hong-Yu Chen, Weimin Wu, and Han Liu. Universal approximation with softmax attention. In Proceedings of the 43rd International Conference on Machine Learning, volume 306. PMLR, 2026. URL https://openreview.net/forum?id=GoW78qJ3qM.arxiv.org/abs/2504.15956
  25. [25]Tokio Kajitsuka and Issei Sato. Are transformers with one layer self-attention using low-rank weight matrices universal approximators? In International Conference on Learning Representations, volume 2024, pp. 35177–35205, 2024.
  26. [26]Hongzhou Lin and Stefanie Jegelka. Resnet with one-neuron hidden layers is a universal approximator. Advances in neural information processing systems, 31, 2018.
  27. [27]Yiping Lu, Aoxiao Zhong, Quanzheng Li, and Bin Dong. Beyond finite layer neural networks: Bridging deep architectures and numerical differential equations. In International conference on machine learning, pp. 3276–3285. PMLR, 2018.
  28. [28]Sibylle Marcotte, Rémi Gribonval, and Gabriel Peyré. Abide by the law and follow the flow: Conservation laws for gradient flows. Advances in neural information processing systems, 36: 63210–63221, 2023.
  29. [29]Nanbeige Lab, Chen Yang, Chengrui Huang, Fufeng Lan, Hanhui Chen, Hao Zhou, Huatong Song, Jiaqi Cao, Jiaying Zhu, Jinlin Niu, Kai Wang, Lisheng Huang, Qiliang Liang, Ran Le, Ruixiang Feng, Shuang Sun, Tao Gu, Tao Zhang, Tianyu Luo, Yang Song, Yun Xing, Yuntao Wen, Ziyao Xu, Zongchao Chen, and Zongqiang Li. Nanbeige-4.2-3B: Unlocking agentic capabilities in a compact model. arXiv preprint arXiv:2607.22083, 2026. URL https://arxiv.org/abs/2607.22083.
  30. [30]Domenec Ruiz-Balet and Enrique Zuazua. Neural ode control for classification, approximation, and transport. SIAM Review, 65(3):735–773, 2023.
  31. [31]Michael E Sander, Pierre Ablin, Mathieu Blondel, and Gabriel Peyré. Sinkformers: Transformers with doubly stochastic attention. In International Conference on Artificial Intelligence and Statistics, pp. 3515–3530. PMLR, 2022.
  32. [33]Héctor Sussmann. Some optimal control applications of real-analytic stratifications and desingularization. Banach Center Publications, 44(1):211–232, 1998.
  33. [34]Héctor J Sussmann. Orbits of families of vector fields and integrability of distributions. Transactions of the American Mathematical Society, 180:171–188, 1973.
  34. [35]Paulo Tabuada and Bahman Gharesifard. Universal approximation power of deep residual neural networks via nonlinear control theory. In International Conference on Learning Representations, 2021. URL https://iclr.cc/virtual/2021/poster/3010.
  35. [36]Paulo Tabuada and Bahman Gharesifard. Universal approximation power of deep residual neural networks through the lens of control. IEEE Transactions on Automatic Control, 68(5):2715–2728, 2023. doi: 10.1109/TAC.2022.3190051. URL https://arxiv.org/abs/2007.06007v4. Corrected version; corrigendum doi: 10.1109/TAC.2024.3390099.

Paper details

vlnc:W_nj392naz
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 3

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Computer Science

GPT-6 Astra (bare)

View statement
Looking for related papers…
Contents