mlsanityData to 7 Oct 2026

Transformers as In-Context Samplers: From Closed-Form Diffusion to Estimation-Free Sampling

arXiv 2609.08981 ↗First posted 8 Sep 2026cs.LG cs.AI stat.APcited by 0

Not on the map. Why?

Abstract (arXiv)

A growing body of work establishes that large language models are not mere statistical memorizers, but are capable of in-context learning: performing inference at test time using only examples provided in the prompt, without any parameter updates. Prior theoretical work has shown that this capability extends to supervised learning tasks such as linear regression. We prove that in-context learning extends further to data generation: frozen transformers can simulate iterative generative samplers from in-context samples. We first show that transformers can realize closed-form and smoothed closed-form diffusion samplers. The construction identifies a concrete generative role for softmax attention: it computes responsibility weights and weighted empirical averages, while feedforward layers implement Euler updates. To empirically relate these constructions to pretrained language models, we study semantic-topic sampling: prompts consisting of words drawn from a common semantic category, such as animals, foods, or cities. Across transformer layers, the normalized hidden states exhibit a two-stage geometry: they move toward a uniform spherical reference in intermediate layers and then return to structured, topic-dependent representations near the output. We further measure an interacting-particle energy on these hidden-state clouds and observe the same U-shape pattern. We then prove that transformers can approximate an energy-based sampler, constructing the same U-shape energy across the layers.

Key facts. No citing papers in the map yet (data through 7 Oct 2026). Builds on 35 of its 48 references that are in the map. First posted on arXiv 8 Sep 2026.

Builds on

35 of 48 references.

References · 35

  1. 2017Attention Is All You Needcited by 59,932
  2. 2020Language Models are Few-Shot Learnerscited by 32,199
  3. 2020Denoising Diffusion Probabilistic Modelscited by 20,851
  4. 2021High-Resolution Image Synthesis with Latent Diffusion Modelscited by 18,694
  5. 2023GPT-4 Technical Reportcited by 18,132
  6. 2024The Llama 3 Herd of Modelscited by 14,192
  7. 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
  8. 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
  9. 2020Denoising Diffusion Implicit Modelscited by 9,655
  10. 2020Score-Based Generative Modeling through Stochastic Differential Equationscited by 8,964
  11. 2022PaLM: Scaling Language Modeling with Pathwayscited by 5,304
  12. 2024Qwen2.5 Technical Reportcited by 4,713
23 more
  1. 2022OPT: Open Pre-trained Transformer Language Modelscited by 3,464
  2. 2022BLOOM: A 176B-Parameter Open-Access Multilingual Language Modelcited by 1,968
  3. 2021What Makes Good In-Context Examples for GPT-3?cited by 1,184
  4. 2021Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivitycited by 1,122
  5. 2022In-context Learning and Induction Headscited by 930
  6. 2021An Explanation of In-context Learning as Implicit Bayesian Inferencecited by 915
  7. 2022Transformers learn in-context by gradient descentcited by 714
  8. 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 700
  9. 2022What learning algorithm is in-context learning? Investigations with linear modelscited by 671
  10. 2023The Falcon Series of Open Language Modelscited by 526
  11. 2023Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selectioncited by 291
  12. 2023Transformers learn to implement preconditioned gradient descent for in-context learningcited by 274
  13. 2023Label Words are Anchors: An Information Flow Perspective for Understanding In-Context Learningcited by 235
  14. 2023Transformers as Algorithms: Generalization and Stability in In-context Learningcited by 220
  15. 2023One Step of Gradient Descent is Provably the Optimal In-Context Learner with One Layer of Linear Self-Attentioncited by 168
  16. 2022Self-Adaptive In-Context Learning: An Information Compression Perspective for In-Context Example Selection and Orderingcited by 158
  17. 2023What and How does In-Context Learning Learn? Bayesian Model Averaging, Parameterization, and Generalizationcited by 112
  18. 2015The Goldilocks Principle: Reading Children's Books with Explicit Memory Representationscited by 108
  19. 2023Cerebras-GPT: Open Compute-Optimal Language Models Trained on the Cerebras Wafer-Scale Clustercited by 106
  20. 2023In-Context Learning Unlocked for Diffusion Modelscited by 103
  21. 2023Closed-Form Diffusion Modelscited by 46
  22. 2023Minimizers for an aggregation model with attractive-repulsive interactioncited by 3
  23. 2025Data Generation without Function Estimationcited by 1

Built on by

Not cited yet.

Similar, not cited

Close in wording, no citation either way

  1. 2026DIP: Dynamic In-Context Planner For Diffusion Language Models
  2. 2024Linear Transformers with Learnable Kernel Functions are Better In-Context Models
  3. 2026Time-Annealed Perturbation Sampling: Diverse Generation for Diffusion Language Models
  4. 2026DreamingGoose: Staged Distillation from Autoregressive Transformers to Bidirectional Recurrent Diffusion Language Models
  5. 2025How Transformers Learn In-Context Recall Tasks? Optimality, Training Dynamics and Generalization
  6. 2026Learning to Read the Contextual Tokens in Diffusion Transformers
  7. 2025Context-Aware Initialization for Reducing Generative Path Length in Diffusion Language Models
  8. 2025Efficient Parallel Samplers for Recurrent-Depth Models and Their Connection to Diffusion Language Models