冻结的Transformer可作为上下文采样器,实现无需参数更新的生成模型。
Transformers as In-Context Samplers: From Closed-Form Diffusion to Estimation-Free Sampling

- 利用softmax注意力计算责任权重与加权平均,前馈层模拟欧拉更新。
- 中间层隐藏状态先趋于均匀球面,后回归主题相关结构,呈现U型能量模式。
- 首次证明Transformer能模拟基于能量的生成采样,适合生成任务研究者。
越来越多的研究表明,大语言模型不仅是统计记忆体,还能在不更新参数的情况下,仅通过提示中的示例完成上下文学习。已有理论工作证明该能力可扩展至线性回归等监督学习任务。本文进一步证明,上下文学习可延伸至数据生成:冻结的Transformer能从上下文样本中模拟迭代生成采样器。我们首先证明Transformer可实现闭式扩散采样与平滑闭式扩散采样。其构造揭示了softmax注意力的生成作用:计算责任权重与加权经验均值,前馈层执行欧拉更新。为将此机制与预训练语言模型关联,我们研究语义主题采样——即提示由同一语义类别(如动物、食物、城市)的词构成。在各层中,归一化隐藏状态呈现两阶段几何结构:中间层趋向均匀球面参考,输出层则返回结构化的主题依赖表示。我们进一步测量这些隐藏状态云的能量,发现同样呈U型变化。随后我们证明,Transformer能逼近基于能量的采样器,在各层构建相同的U型能量曲线。
原文摘要 · Abstract (English)
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 \emph{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 \emph{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.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。