无需训练,随机变换器+提示即可逼近任意函数
Training-Free Universal Approximation by Prompting Random Transformers
- 用软提示控制随机权重的单层注意力网络
- 理论证明可逼近任意光滑函数,达最优收敛率
- 适合研究模型泛化与提示机制的学者
提示对Transformer的表达能力有多强?这一问题对厘清提示、架构和预训练各自的作用至关重要。我们从逼近论角度证明:预训练并非必需——仅用单层softmax注意力网络搭配随机未训练权重,在适当软提示引导下,即可在紧致流形上逼近任意Hölder连续函数。基于softmax注意力与核方法的联系,我们构造出显式软提示(每个目标函数对应一个提示,与查询无关),通过求解线性系统使注意力得分匹配高斯核指数,使冻结的Transformer模拟经典的Nadaraya-Watson核估计器。该构造只需满足轻微的秩条件,我们在高斯初始化下证明其几乎必然成立。所提网络继承核回归的理论保证,实现依赖内在维度的最小最大最优逼近率。我们进一步量化了提示代价,揭示软提示范数、提示长度与隐含维度间的权衡关系。数值实验验证了构造有效性及预测的收敛速率。
原文摘要 · Abstract (English)
How expressive is prompting a transformer? Answering this question is important for separating the roles of prompting, architecture, and pretraining in transformer models, and for determining whether task-specific behavior must be stored in model weights or can instead be induced at inference time through the prompt. We show, in an approximation-theoretic sense, that pretraining is optional: a single-layer softmax attention network with random, untrained weights can approximate any Hölder function on a compact manifold when steered by an appropriate soft prompt. Guided by the connection between softmax attention and kernel methods, we construct explicit soft prompts (a prompt per target function, independent of the query) as solutions to linear systems matching attention logits to Gaussian kernel exponents, under which the frozen transformer emulates the classical Nadaraya-Watson kernel estimator. The construction requires only a mild rank condition on the weights, which we show holds almost surely under Gaussian initialization. The prompted network inherits the theoretical guarantees of kernel regression, leading to universal approximation theorems with minimax-optimal rates that depend on the intrinsic dimension. We further quantify the cost of prompting, exposing a tradeoff between the norm of the constructed soft prompt tokens, prompt length, and hidden dimension. Numerical experiments corroborate the constructions and predicted rates.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。