Skip to main content
QUICK REVIEW

[论文解读] Dr.ICL: Demonstration-Retrieved In-context Learning

Man Luo, Xin Xu|arXiv (Cornell University)|May 23, 2023
Topic Modeling被引用 7
一句话总结

本文提出 Dr.ICL,一种通过使用现成检索器(BM25、GTR)或特定任务的演示检索器,从演示池中检索语义相似演示的上下文学习框架。实验表明,基于检索的 ICL 在单样本设置下显著优于随机演示,且在指令微调模型和思维链(CoT)提示设置下也能提升性能。

ABSTRACT

In-context learning (ICL), teaching a large language model (LLM) to perform a task with few-shot demonstrations rather than adjusting the model parameters, has emerged as a strong paradigm for using LLMs. While early studies primarily used a fixed or random set of demonstrations for all test queries, recent research suggests that retrieving semantically similar demonstrations to the input from a pool of available demonstrations results in better performance. This work expands the applicability of retrieval-based ICL approaches by demonstrating that even simple word-overlap similarity measures such as BM25 outperform randomly selected demonstrations. Furthermore, we extend the success of retrieval-based ICL to instruction-finetuned LLMs as well as Chain-of-Thought (CoT) prompting. For instruction-finetuned LLMs, we find that although a model has already seen the training data at training time, retrieving demonstrations from the training data at test time yields better results compared to using no demonstrations or random demonstrations. Last but not least, we train a task-specific demonstration retriever that outperforms off-the-shelf retrievers.

研究动机与目标

  • 通过从演示池中检索语义相似的演示,替代随机或固定的演示,以提升上下文学习(ICL)的性能。
  • 探究是否可通过检索重用训练数据来提升推理阶段性能,即使对于已接受指令微调的大语言模型也适用。
  • 评估 Dr.ICL 与先进提示技术(如思维链 CoT)之间的协同效应。
  • 开发并训练一种特定任务的演示检索器,使其性能优于现成检索方法。
  • 评估检索带来的性能提升是否源于标签重叠,还是真正的语义相关性,从而排除仅靠标签识别导致性能提升的可能性。

提出的方法

  • 使用现成的稀疏检索(BM25)和稠密检索(GTR)方法,检索与输入查询语义相似的演示。
  • 通过语言模型对现成检索器返回的候选演示进行重排序,构建演示检索训练集。
  • 从重排序结果中选取排名靠前和靠后的演示作为正样本与难负样本,用于训练特定任务的演示检索器。
  • 在推理阶段应用训练好的检索器,选择最优演示并将其整合到提示中,实现上下文学习。
  • 将 Dr.ICL 与思维链(CoT)提示结合,评估其在推理任务中的性能提升。
  • 在少样本设置中采用多数投票机制,并分析预测结果与真实答案的重叠程度,以排除标签偏差作为性能提升原因的可能性。
Figure 1: The average performance of PaLM and Flan-PaLM on five datasets, with one and few-shot ICL. Retrieved demonstrations given by either BM25 or GTR yield better performance than random demonstrations.
Figure 1: The average performance of PaLM and Flan-PaLM on five datasets, with one and few-shot ICL. Retrieved demonstrations given by either BM25 or GTR yield better performance than random demonstrations.

实验结果

研究问题

  • RQ1基于现成检索器(BM25、GTR)的检索式 ICL 是否在上下文学习中优于随机或固定演示?
  • RQ2从训练数据中检索演示是否能提升指令微调大语言模型的性能,即使模型在训练阶段已见过这些数据?
  • RQ3Dr.ICL 是否能进一步提升先进提示技术(如思维链 CoT)的性能?
  • RQ4基于模型生成的重排序信号训练的特定任务演示检索器是否优于现成检索器?
  • RQ5检索带来的性能提升是源于标签重叠,还是查询与演示之间真正的语义相似性?

主要发现

  • 现成检索器(BM25 和 GTR)在单样本和少样本 ICL 中均持续优于随机演示,且 GTR 通常能检索到更具代表性的示例。
  • 对于指令微调的大语言模型(如 Flan-PaLM),在推理阶段从训练数据中检索演示,性能优于不使用演示或使用随机演示的情况,即使模型在训练阶段已见过这些数据。
  • Dr.ICL 与思维链(CoT)提示结合后,在 GSM8k、StrategyQA 和 AQuA 数据集上,无论在单样本还是少样本设置下,性能均得到提升,表明其与先进提示技术存在协同效应。
  • 基于重排序候选样本训练的特定任务演示检索器优于现成检索器,在单样本 ICL 中,NQ 数据集上提升 1.4 个百分点,GSM8k 上提升 1.6 个百分点。
  • 检索带来的性能提升并非源于标签重叠,因为在大多数数据集中预测答案的重叠率较低,表明性能提升源于真正的语义相关性。
  • 由训练好的检索器带来的最大性能提升出现在单样本 ICL 中,该场景对延迟和内存使用要求较高,因此该方法在实际部署中极具适用性。
Figure 2: Pipeline for training demonstration retriever and inference (R for a neural retriever). Figure on the left shows the procedure of obtaining data to train a demonstration retriever: an off-the-shelf retriever takes an input query $x_{q}$ and retrieves top- $k$ (e.g., 100) demonstrations can
Figure 2: Pipeline for training demonstration retriever and inference (R for a neural retriever). Figure on the left shows the procedure of obtaining data to train a demonstration retriever: an off-the-shelf retriever takes an input query $x_{q}$ and retrieves top- $k$ (e.g., 100) demonstrations can

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。