Skip to main content
QUICK REVIEW

[论文解读] In-Context Learning with Long-Context Models: An In-Depth Exploration

Amanda Bertsch, Maor Ivgi|arXiv (Cornell University)|Apr 30, 2024
Data Stream Mining TechniquesComputer Science被引用 7
一句话总结

本文在极长的上下文长度下研究上下文学习(ICL),覆盖多个数据集和模型,比较朴素提示、基于检索的演示示例和微调,并分析长上下文 ICL 的特性。

ABSTRACT

As model context lengths continue to increase, the number of demonstrations that can be provided in-context approaches the size of entire training datasets. We study the behavior of in-context learning (ICL) at this extreme scale on multiple datasets and models. We show that, for many datasets with large label spaces, performance continues to increase with hundreds or thousands of demonstrations. We contrast this with example retrieval and finetuning: example retrieval shows excellent performance at low context lengths but has diminished gains with more demonstrations; finetuning is more data hungry than ICL but can sometimes exceed long-context ICL performance with additional data. We use this ICL setting as a testbed to study several properties of both in-context learning and long-context models. We show that long-context ICL is less sensitive to random input shuffling than short-context ICL, that grouping of same-label examples can negatively impact performance, and that the performance boosts we see do not arise from cumulative gain from encoding many examples together. We conclude that although long-context ICL can be surprisingly effective, most of this gain comes from attending back to similar examples rather than task learning.

研究动机与目标

  • 研究当演示示例达到数百到数千、接近完整训练集规模时,ICL 的扩展性。
  • 在长上下文条件下比较朴素的上下文提示、检索得到的演示示例和模型微调。
  • 评估长上下文对模型对演示顺序和标签分组的敏感性的影响。
  • 在不同数据集上,将长上下文 ICL 与基于 LoRA 的微调以及检索并提示的方法进行对比。

提出的方法

  • 评估多种长上下文变体的 Llama-2-7b(nosep),包括 32k-context 和 80k-context 的微调模型,以及 Mistral-7b-Instruct-v0.2。
  • 采用受限解码输出仅有效标签,遵循 Ratner 等人(2022)。
  • 进行三种设定的在-context 学习:随机抽样演示示例、通过 BM25 的基于检索的演示、以及带分类头的微调。
  • 在同一数据集上将 ICL 变体与参数高效微调(LoRA)进行比较。
  • 对每个数据集随机抽样 250 个测试样本,并报告准确率和宏F1(以准确率为主)。
  • 在五个具有不同标签空间的分类数据集上评估长上下文 ICL 行为。

实验结果

研究问题

  • RQ1当上下文长度极大时,增加在-context 演示的数量是否仍然提升性能?
  • RQ2在长上下文 ICL 中,基于检索的选择与随机选择相比如何?
  • RQ3在具有不同标签空间的数据集上,长上下文 ICL 与 LoRA 微调的比较如何?
  • RQ4随着演示示例规模增大,长上下文 ICL 会显现出哪些特性(例如对示例顺序的敏感性、按标签分组等)?
  • RQ5长上下文 ICL 的收益在多大程度上来自于检索到相关示例,而非同时对大量示例进行编码?

主要发现

  • 在数百到数千个演示示例下,性能有所提升,在某些数据集上有时可以达到甚至超过微调模型。
  • 基于检索的演示在短上下文下优于随机抽样,但随着演示数量增加,长上下文 ICL 的优势减弱。
  • 使用 LoRA 的微调在某些数据集上可以超过长上下文 ICL,尤其是在标签空间较大的情况下,但长上下文 ICL 通常仍具竞争力。
  • 随着上下文长度增加,长上下文 ICL 对演示顺序的敏感性减弱,将同标签的示例分组可能显著降低性能。
  • 长上下文 ICL 的主要优势似乎来自检索到更多相关示例,而非通过编码迭代地改进决策边界,表明在长上下文中检索机制占主导。
  • 阻塞注意力实验表明,改进的大部分来自于获取相关演示的能力,而不是在短块内学习任务边界。

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。