解析了提示学习中示范选择与思维链的作用机制。
Demonstrations, CoT, and Prompting: A Theoretical Analysis of ICL
- 基于温和假设建立理论框架,关联示范质量与泛化能力
- 证明性能受示范质量、模型内在能力及分布偏移共同影响
- 揭示思维链通过分解任务提升学习效率,适合复杂推理场景
上下文学习(ICL)使预训练大模型通过少量输入-输出示范实现下游任务适应,无需参数更新。尽管已有诸多理论研究,但多数依赖强架构或数据假设,未能捕捉示范选择、思维链(CoT)提示、示范数量和提示模板等关键实践因素的影响。本文在较弱假设下建立了ICL的理论分析框架,推导出测试损失的上界,表明性能由三方面决定:(i) 示范质量,由连接测试提示与预训练样本路径上的ICL损失利普希茨常数衡量;(ii) 模型固有的ICL能力;(iii) 分布偏移程度。在此框架下,分析了CoT提示作为任务分解机制,其有效性取决于各子步骤示范质量高且子任务更易学习。此外,刻画了模型对提示模板的敏感性随示范数量的变化规律。实验验证了所有理论结论。研究表明,预训练赋予模型超越观测任务的泛化能力,CoT使模型能将简单子任务组合成复杂任务,而示范与指令则支持检索相似或可组合的任务,共同支撑对未见任务的泛化。
原文摘要 · Abstract (English)
In-Context Learning (ICL) enables pretrained LLMs to adapt to downstream tasks by conditioning on a small set of input-output demonstrations, without any parameter updates. Although there have been many theoretical efforts to explain how ICL works, most either rely on strong architectural or data assumptions, or fail to capture the impact of key practical factors such as demonstration selection, Chain-of-Thought (CoT) prompting, the number of demonstrations, and prompt templates. We address this gap by establishing a theoretical analysis of ICL under mild assumptions that links these design choices to generalization behavior. We derive an upper bound on the ICL test loss, showing that performance is governed by (i) the quality of selected demonstrations, quantified by Lipschitz constants of the ICL loss along paths connecting test prompts to pretraining samples, (ii) an intrinsic ICL capability of the pretrained model, and (iii) the degree of distribution shift. Within the same framework, we analyze CoT prompting as inducing a task decomposition and show that it is beneficial when demonstrations are well chosen at each substep and the resulting subtasks are easier to learn. Finally, we characterize how ICL performance sensitivity to prompt templates varies with the number of demonstrations. Together, our study shows that pretraining equips the model with the ability to generalize beyond observed tasks, while CoT enables the model to compose simpler subtasks into more complex ones, and demonstrations and instructions enable it to retrieve similar or complex tasks, including those that can be composed into more complex ones, jointly supporting generalization to unseen tasks. All theoretical insights are corroborated by experiments.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。