Asymptotic Study of In-context Learning with Random Transformers through Equivalent Models

Samet Demir, Zafer Dogan
9/18/2025
stat.MLcs.LG

No confident code implementation found for this paper.

Abstract

We study the in-context learning (ICL) capabilities of pretrained Transformers in the setting of nonlinear regression. Specifically, we focus on a random Transformer with a nonlinear MLP head where the first layer is randomly initialized and fixed while the second layer is trained. Furthermore, we consider an asymptotic regime where the context length, input dimension, hidden dimension, number of training tasks, and number of training samples jointly grow. In this setting, we show that the random Transformer behaves equivalent to a finite-degree Hermite polynomial model in terms of ICL error. This equivalence is validated through simulations across varying activation functions, context lengths, hidden layer widths (revealing a double-descent phenomenon), and regularization settings. Our results offer theoretical and empirical insights into when and how MLP layers enhance ICL, and how nonlinearity and over-parameterization influence model performance.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{demir2025asymptotic,
  title  = {Asymptotic Study of In-context Learning with Random Transformers through Equivalent Models},
  author = {Samet Demir and Zafer Dogan},
  year   = {2025},
  eprint = {2509.15152},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2509.15152v1}
}

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/2509.15152.svg)](https://codeofpaper.com/paper/2509.15152)

Discussion