arXiv:2604.25858cs.LGcs.AI2026-04

揭示Transformer在上下文学习中成功与失败的边界条件。

Investigation into In-Context Learning Capabilities of Transformers

论文配图:Investigation into In-Context Learning Capabilities of Transformers
图 1 · 摘自论文原文
  • 通过合成数据实验,分析维度、样本数和预训练任务数对上下文学习的影响。
  • 发现高维数据下模型易出现良性过拟合,仍能保持良好泛化性能。
  • 为理解上下文学习的有效性提供了可量化的参数范围参考,适合研究者参考。

Transformers 在上下文学习(ICL)中表现出强大能力,可在推理时仅通过输入-输出示例对解决未见过的任务。尽管已有理论工作阐明了Transformer在上下文执行线性分类的条件,但其经验尺度行为尚未充分刻画。本文系统研究了高斯混合二分类任务中的上下文学习,基于Frei和Vardi(2024)的理论框架,分析输入维度、上下文示例数量及预训练任务数三个核心因素对测试准确率的影响。采用受控的合成设置与线性上下文分类器形式,我们分离出模型仅从上下文推断任务结构的几何条件。此外,还探究了良性过拟合现象:模型虽记忆含噪标签,却仍能在干净测试数据上实现强泛化。通过跨维度、序列长度、任务多样性与信噪比的广泛实验,我们识别出该现象出现的参数区域,并刻画其依赖于数据几何与训练暴露程度的关系。结果提供了一幅完整的上下文分类尺度行为图谱,凸显维度、信号强度与上下文信息在决定上下文学习成败中的关键作用。

原文摘要 · Abstract (English)

Transformers have demonstrated a strong ability for in-context learning (ICL), enabling models to solve previously unseen tasks using only example input output pairs provided at inference time. While prior theoretical work has established conditions under which transformers can perform linear classification in-context, the empirical scaling behavior governing when this mechanism succeeds remains insufficiently characterized. In this paper, we conduct a systematic empirical study of in-context learning for Gaussian-mixture binary classification tasks. Building on the theoretical framework of Frei and Vardi (2024), we analyze how in-context test accuracy depends on three fundamental factors: the input dimension, the number of in-context examples, and the number of pre-training tasks. Using a controlled synthetic setup and a linear in-context classifier formulation, we isolate the geometric conditions under which models successfully infer task structure from context alone. We additionally investigate the emergence of benign overfitting, where models memorize noisy in-context labels while still achieving strong generalization performance on clean test data. Through extensive sweeps across dimensionality, sequence length, task diversity, and signal-to-noise regimes, we identify the parameter regions in which this phenomenon arises and characterize how it depends on data geometry and training exposure. Our results provide a comprehensive empirical map of scaling behavior in in-context classification, highlighting the critical role of dimensionality, signal strength, and contextual information in determining when in-context learning succeeds and when it fails.

上下文学习模型泛化高维数据良性过拟合

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。