[论文解读] LLM In-Context Recall is Prompt Dependent
本文使用针堆法研究大语言模型(LLMs)的上下文回忆性能,表明回忆能力高度依赖于提示工程,并受针的位置、堆栈长度和模型微调等因素影响。关键发现显示,模型架构、训练策略和微调显著影响回忆准确率,微调模型如WizardLM和GPT-3.5 Turbo 0125在参数量相近的情况下优于基础模型。
The proliferation of Large Language Models (LLMs) highlights the critical importance of conducting thorough evaluations to discern their comparative advantages, limitations, and optimal use cases. Particularly important is assessing their capacity to accurately retrieve information included in a given prompt. A model's ability to do this significantly influences how effectively it can utilize contextual details, thus impacting its practical efficacy and dependability in real-world applications. Our research analyzes the in-context recall performance of various LLMs using the needle-in-a-haystack method. In this approach, a factoid (the "needle") is embedded within a block of filler text (the "haystack"), which the model is asked to retrieve. We assess the recall performance of each model across various haystack lengths and with varying needle placements to identify performance patterns. This study demonstrates that an LLM's recall capability is not only contingent upon the prompt's content but also may be compromised by biases in its training data. Conversely, adjustments to model architecture, training strategy, or fine-tuning can improve performance. Our analysis provides insight into LLM behavior, offering direction for the development of more effective applications of LLMs.
研究动机与目标
- 评估LLMs在使用针堆法时,能否可靠地从长上下文窗口中检索出嵌入的特定事实。
- 探究提示结构(如针的位置和堆栈长度)是否影响上下文回忆性能。
- 分析模型架构、训练策略和微调对不同LLMs回忆准确率的影响。
- 识别评估评分中可能扭曲模型真实性能的系统性偏差或异常。
- 为基于其检索能力在实际应用中选择和优化LLMs提供可操作的洞见。
提出的方法
- 使用三种不同的事实-问题对(如PistachioAI、旧金山、Thornfield Hollow)进行针堆测试,以评估上下文回忆能力。
- 在多种堆栈长度和针的位置下,评估九种上下文窗口大小各异的LLMs,包括Llama 2、GPT-3.5 Turbo、Mistral、Mixtral和GPT-4 Turbo。
- 使用GPT-4 Turbo作为裁判,依据预设标准(表4)对模型输出进行评分,降低人工评估的成本和时间。
- 生成热力图以可视化不同堆栈深度和长度下的回忆性能,支持模型行为的对比分析。
- 分析基础模型与其微调变体(如WizardLM与Llama 2 70B)之间的性能差异,以隔离微调的影响。
- 识别并记录由提示伪影引发的评分异常,例如无关上下文改变提示含义,导致即使事实正确回答也被GPT-4 Turbo错误地打低分。

实验结果
研究问题
- RQ1事实(针)在长上下文(堆栈)中的位置如何影响LLM的回忆能力?
- RQ2堆栈长度在多大程度上影响不同LLMs的上下文回忆性能?
- RQ3架构差异、参数量和注意力机制如何影响回忆准确率?
- RQ4微调是否能提升上下文回忆能力?与基础模型相比,提升幅度如何?
- RQ5训练数据偏差和提示伪影在多大程度上扭曲评估结果,特别是在自动化评分中?
主要发现
- 上下文回忆性能对提示设计极为敏感,针的位置和堆栈长度导致显著差异。
- 微调模型如WizardLM 70B在所有测试中均优于其基础模型(Llama 2 70B),表明指令微调带来明确的性能提升。
- GPT-3.5 Turbo 0125相比GPT-3.5 Turbo 1106表现出可测量的改进,归因于更新的微调策略,在全部三项测试中均获得更高的回忆分数。
- Mistral 7B v0.2和Mixtral 8x7B分别实现96.7%和95.8%的高回忆率,表明架构改进和参数量增加可提升检索性能。
- 当无关上下文改变提示含义时,出现评分异常,导致即使事实正确,GPT-4 Turbo也错误地给予低分。
- 研究发现,单次针堆测试不足以代表模型的真实回忆能力,因其存在强烈的提示依赖性。

阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。