通过查询学习注意力模型,用少量样本就能还原其参数。
Provably Learning Attention with Queries
- 用自适应查询法,单头注意力仅需O(d²)次查询即可学习。
- 在头维度远小于总维度时,压缩感知使查询量降至O(rd)。
- 即使输出有噪声,也能在多项式查询内达到高精度估计。
我们研究在黑盒访问输出的情况下学习基于Transformer的序列模型。学习者可自适应地输入任意向量序列并观测输出。首先,针对单头注意力回归器,证明了宽度为d的模型可通过简单算法在O(d²)次查询内学习参数。若存在学习ReLU前馈网络的算法,则该方法可扩展至单层Transformer。进一步,在头维数r远小于总维数d的常见情形下,利用压缩感知理论,单头注意力模型仅需O(rd)次查询即可学习。同时分析了噪声环境下鲁棒性:在满足范数和间隔条件时,即使输出含加性误差,仍可用多项式数量查询实现ε精度估计。最后,证明多头注意力不可识别,因此无额外假设下无法学习;但可在特定结构假设下探索可行路径。
原文摘要 · Abstract (English)
We study the problem of learning Transformer-based sequence models with black-box access to their outputs. In this setting, a learner may adaptively query the oracle with any sequence of vectors and observe the output of the target function. We begin with studying the learnability of the simplest formulation, that is, learning a single-head attention-based regressor with queries. We show that for a model with width $d$, there is an elementary algorithm to learn the parameters of single-head attention with $O(d^2)$ queries. Further, we show that if there exists an algorithm to learn ReLU feedforward networks (FFNs), then the single-head algorithm can be easily adapted to learn one-layer Transformers with single-head attention. Next, we show that, in the common regime where the head dimension $r \ll d$, single-head attention-based models can be learned with $O(rd)$ queries via compressed sensing arguments. We also study robustness to noisy oracle access, proving that under mild norm and margin conditions, the parameters can be estimated to $\varepsilon$ accuracy with a polynomial number of queries even when outputs are only provided up to additive tolerance. Finally, we consider the learnability of multi-head attention and show that they are not identifiable from queries, and hence, learnability in the same sense is not feasible without additional assumptions. We discuss potential approaches to learn multi-head attention-based models under certain structural assumptions.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。