Adaptive inference and function vectors in deep transformers

Ravin Raj, Gautam Reddy
6/15/2026
cs.LGcs.AIphysics.app-ph

No official code found. Best implementation: reddylab-princeton/icl-function-vectors (0 stars, last commit 2026-06-12).

Abstract

Transformers are widely used as a general-purpose substrate for learning complex correlations between a large collection of coupled variables, but their internal mechanisms have remained mysterious. We introduce a theory of a deep transformer as a mean-field interacting system that implements distributed inference, subject to constraints on communication, locality and depth. We show that such a system can exploit internal state representations ('function vectors') to infer a latent context variable at increasingly finer scales over its layers. In an in-context regression task, the theory predicts a non-trivial relationship between non-Gaussian, hierarchical structure in the latent context variable, and transformer depth. Predictions are tested using constrained linear attention transformers and demonstrate adaptive inference in deep architectures. Feedforward blocks and depth enable transformers to implement a much richer class of in-context learning algorithms than previously described.

View on arXivView PDF

Code Implementations(1)

Code for reproducing the figures in Raj and Reddy, Adaptive inference and Function Vectors in Deep Transformers. .

00Jun 12, 20264 months ago

Similar Papers

Cite this paper

@article{raj2026adaptive,
  title  = {Adaptive inference and function vectors in deep transformers},
  author = {Ravin Raj and Gautam Reddy},
  year   = {2026},
  eprint = {2606.16694},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2606.16694v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2606.16694.svg)](https://codeofpaper.com/paper/2606.16694)

Discussion