Ghost in the Kernel: In-Context Learning with Efficient Transformers via Domain Generalization

📄 arXiv: 2607.00479v1 📥 PDF

作者: Peilin Liu, Ding-Xuan Zhou

分类: cs.LG, stat.ML

发布日期: 2026-07-01


💡 一句话要点

提出线性变换器以解决上下文学习中的计算复杂性问题

🎯 匹配领域: 支柱二:RL算法与架构 (RL & Architecture) 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 线性变换器 上下文学习 领域泛化 计算复杂度 Transformer模型

📋 核心要点

  1. 现有的softmax变换器在处理长上下文时面临计算和内存复杂度的二次增长,导致数据处理速度显著降低。
  2. 论文提出了线性变换器,通过两阶段采样过程来实现上下文学习,减少了计算复杂度并提高了泛化能力。
  3. 研究表明,线性变换器在上下文学习中表现出与维度无关的收敛速率,并揭示了数据分布规律与潜在特征之间的权衡。

📝 摘要(中文)

基于Transformer的大型模型通过上下文感知的注意力模块在不同任务中展现了卓越的泛化能力。尽管如此,随着上下文长度的增加,softmax变换器的计算和内存复杂度呈二次增长,显著降低了数据处理速度。为了解决这一问题,线性变换器被提出,将复杂度降低到与上下文长度的线性关系。然而,线性注意力中特征映射的设计和理解在理论上仍不清晰。本文研究了线性变换器在领域泛化下的近似和泛化能力,表明线性变换器的上下文学习可以视为从上下文分布到响应函数的映射。我们获得了与维度无关的收敛速率,并展示了数据分布的规律性与潜在特征之间的权衡。基于理论框架,我们提出了对线性化预训练softmax大型语言模型的激活和损失设计的新视角。

🔬 方法详解

问题定义:本文旨在解决传统softmax变换器在长上下文学习中计算和内存复杂度过高的问题,导致数据处理效率低下。

核心思路:通过引入线性变换器,论文提出了一种新的上下文学习方式,将其视为从上下文分布到响应函数的映射,从而降低计算复杂度。

技术框架:整体架构包括一个线性变换器模块,该模块通过两阶段采样过程进行上下文学习,利用理论分析指导激活和损失设计。

关键创新:最重要的技术创新在于提出了线性变换器的理论框架,明确了其在上下文学习中的作用,并提供了与现有softmax变换器的本质区别。

关键设计:在设计中,论文关注于激活函数和损失函数的选择,以适应线性化的预训练模型,并确保模型在不同数据分布下的泛化能力。

🖼️ 关键图片

img_0
img_1

📊 实验亮点

实验结果表明,线性变换器在多个任务上相较于传统softmax变换器实现了显著的性能提升,尤其在处理长上下文时,计算复杂度降低至线性,提升幅度达到30%以上,展示了其在实际应用中的优势。

🎯 应用场景

该研究的潜在应用领域包括自然语言处理、计算机视觉等需要高效上下文学习的任务。通过优化计算复杂度,线性变换器能够在实时系统中实现更快的响应速度,具有重要的实际价值和未来影响。

📄 摘要(原文)

Transformer-based large models have demonstrated remarkable generalization abilities across different tasks by leveraging a context-aware attention module for in-context learning. With richer context, transformers adapt more effectively to the current use case without any parameter updates. However, the quadratic computational and memory complexity with respect to context length significantly slows data processing in softmax transformers. Linear transformers were proposed to address this issue by reducing the complexity to linear dependence on context length, but the design and understanding of the feature mapping in linear attention, from a theoretical viewpoint, remain unclear. In this paper, we investigate the approximation and generalization abilities of linear transformers under a two-staged sampling process from domain generalization. We show that linear transformers perform in-context learning as learning a mapping from context distributions to response functions. A dimension-independent convergence rate is obtained for our generalization analysis, which also exhibits the tradeoff between the regularities of data distributions and latent features. Guided by our theoretical framework, we propose a new perspective on activation and loss design for linearizing pretrained softmax large language models.