arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2602.08294cs.CL
收藏

何时上下文有助于?大型语言模型中上下文信息的误差动态

When Does Context Help? Error Dynamics of Contextual Information in Large Language Models

Harbin Institute of Technology(哈尔滨工业大学);Singapore Management University(新加坡管理大学)

Dingzirui Wang, Xuanliang Zhang, Keyan Xu, Qingfu Zhu, Wanxiang Che, Yang Deng

AI总结:

本文提出统一理论框架,分析上下文信息对Transformer模型误差动态的影响,通过几何条件和范数约束揭示上下文校正的必要条件,并通过实验验证提升模型性能。

摘要:

推理时的上下文信息,如演示、检索知识或交互历史,可以显著提高大型语言模型(LLMs)而无需参数更新,但其理论作用在特定设置之外如上下文学习(ICL)仍不甚清楚。我们提出一个统一的理论框架,用于分析Transformer基于LLM中任意上下文信息的影响。我们的分析通过输出误差动态来表征上下文影响。在单层Transformer中,我们证明了上下文条件误差向量分解成基线误差向量和上下文校正向量。这导致了误差减少的必要几何条件:上下文校正必须与基线误差的负向量对齐并满足范数约束。我们进一步表明,上下文校正范数允许一个显式的上界,由上下文-查询相关性和互补性决定。这些结果扩展到多上下文和多层Transformer。在ICL、检索增强生成和记忆演变中的实验验证了我们的理论,并激发了一种原则性的上下文选择策略,该策略通过0.6%提高了性能。

英文摘要:

Contextual information at inference time, such as demonstrations, retrieved knowledge, or interaction history, can substantially improve large language models (LLMs) without parameter updates, yet its theoretical role remains poorly understood beyond specific settings such as in-context learning (ICL). We present a unified theoretical framework for analyzing the effect of arbitrary contextual information in Transformer-based LLMs. Our analysis characterizes contextual influence through output error dynamics. In a single-layer Transformer, we prove that the context-conditioned error vector decomposes additively into the baseline error vector and a contextual correction vector. This yields necessary geometric conditions for error reduction: the contextual correction must align with the negative baseline error and satisfy a norm constraint. We further show that the contextual correction norm admits an explicit upper bound determined by context-query relevance and complementarity. These results extend to multi-context and multi-layer Transformers. Experiments across ICL, retrieval-augmented generation, and memory evolution validate our theory and motivate a principled context selection strategy that improves performance by $0.6\%$.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑