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

Peilin Liu, Ding-Xuan Zhou
7/1/2026
cs.LGstat.ML

No confident code implementation found for this paper.

Abstract

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.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{liu2026ghost,
  title  = {Ghost in the Kernel: In-Context Learning with Efficient Transformers via Domain Generalization},
  author = {Peilin Liu and Ding-Xuan Zhou},
  year   = {2026},
  eprint = {2607.00479},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2607.00479v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2607.00479.svg)](https://codeofpaper.com/paper/2607.00479)

Discussion