思维的炼金术:通过监督分类理解上下文学习
The Alchemy of Thought: Understanding In-Context Learning Through Supervised Classification
AI总结:
本文通过比较LLM与监督分类器的行为,发现ICL在高相关性时更接近kNN,而在低相关性时LLM表现更优,揭示了注意力机制与GD的区别。
摘要:
上下文学习(ICL)已成为一种重要的范式,用于快速定制LLM以适应新任务而无需微调。然而,尽管有实证证据证明其有用性,我们仍然没有真正理解ICL是如何工作的。在本文中,我们比较了上下文学习与在ICL演示上训练的监督分类器的行为,以探讨三个研究问题:(1)具有ICL的LLM是否与在相同示例上训练的分类器行为相似?(2)如果是,哪种分类器更接近,基于梯度下降(GD)的还是基于k最近邻(kNN)的?(3)当它们行为不相似时,什么条件与行为差异有关?通过文本分类作为用例,使用六个数据集和三个LLM,我们观察到当演示的相关性较高时,LLM的行为与这些分类器行为相似。平均而言,ICL更接近kNN而不是逻辑回归,这提供了实证证据,表明注意力机制的行为更类似于kNN而不是GD。然而,当演示相关性较低时,LLM的表现优于这些分类器,可能是因为LLM可以退回到其参数记忆,而这些分类器没有这种优势。
英文摘要:
In-context learning (ICL) has become a prominent paradigm to rapidly customize LLMs to new tasks without fine-tuning. However, despite the empirical evidence of its usefulness, we still do not truly understand how ICL works. In this paper, we compare the behavior of in-context learning with supervised classifiers trained on ICL demonstrations to investigate three research questions: (1) Do LLMs with ICL behave similarly to classifiers trained on the same examples? (2) If so, which classifiers are closer, those based on gradient descent (GD) or those based on k-nearest neighbors (kNN)? (3) When they do not behave similarly, what conditions are associated with differences in behavior? Using text classification as a use case, with six datasets and three LLMs, we observe that LLMs behave similarly to these classifiers when the relevance of demonstrations is high. On average, ICL is closer to kNN than logistic regression, giving empirical evidence that the attention mechanism behaves more similarly to kNN than GD. However, when demonstration relevance is low, LLMs perform better than these classifiers, likely because LLMs can back off to their parametric memory, a luxury these classifiers do not have.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。