Attention-Patching:通过注意力输出投影实现隐式ICL
Learn the Effects, Not the Examples: Implicit ICL via Attention Patching
研究者提出 Attention-Patching 隐式 ICL 方法,通过对注意力输出投影做任务特定更新来建模自注意力的上下文变化,用有无固定示例集的问答对拟合逐层仿射变换。在 12 个分类基准和四个模型家族上,其平均准确率高于所评估的隐式 ICL 基线,推理成本接近零样本,性能与显式 ICL 相当。
arXiv:2611.30690v1 Announce Type: new Abstract: In-context learning (ICL) enables language models to adapt to new tasks from demonstrations, but repeatedly including multiple examples increases context length and inference cost. Many existing implicit ICL methods encode demonstrations as fixed vectors, limiting adaptation of the intervention to individual queries and token positions. We propose Attention-Patching, an implicit ICL method that models contextual changes in self-attention outputs through task-specific updates to attention output projections. Using query-answer pairs processed with and without a fixed demonstration set, Attention-Patching fits layer-wise affine transformations from non-contextual attention representations to the demonstration-induced output changes. Across 12 classification benchmarks and four model families, Attention-Patching achieves higher average accuracy than the evaluated implicit ICL baselines while maintaining performance comparable to explicit ICL at near zero-shot inference cost. Further experiments on diverse generation tasks demonstrate its applicability to autoregressive multi-token generation.
来源:arXiv (AI + Vision + Imaging) · arxiv.org