基于内优化与动量优化的上下文学习状态向量
In-Context Learning State Vector with Inner and Momentum Optimization
AI总结:
本文提出状态向量概念以表示上下文学习所学函数,并借鉴模型融合与动量梯度下降思想设计内优化和动量优化方法,在测试时逐步精化状态向量,同时提出分治聚合策略处理长演示,在Llama-2和GPT-J上取得最先进性能。
摘要:
大型语言模型(LLMs)展现出仅从少量示例中执行上下文学习(In-Context Learning, ICL)的出色能力。近期研究表明,ICL学习到的函数可以通过从transformer中导出的压缩向量来表示。然而,这些向量的工作机制与优化方法尚未得到深入探索。本文针对这一空白,对这些压缩向量进行了全面分析,将其与通过梯度下降训练的参数进行类比,并引入了状态向量(state vector)的概念。受模型融合(model soup)和基于动量的梯度下降相关工作的启发,我们提出了内优化(inner optimization)和动量优化(momentum optimization)方法,以测试时自适应(test-time adaptation)的方式逐步精化状态向量。此外,我们模拟了多示例场景下的状态向量聚合,其中包含大量示例的演示通常因过长而无法用于常规ICL,并进一步提出了一种分治聚合方法以应对这一挑战。我们使用Llama-2和GPT-J在零样本(zero-shot)和少样本(few-shot)两种设置下进行了大量实验。实验结果表明,我们的优化方法有效增强了状态向量,并在多种任务上取得了最先进的性能。代码可在 https://github.com/HITsz-TMG/ICL-State-Vector 获取。
英文摘要:
Large Language Models (LLMs) have exhibited an impressive ability to perform In-Context Learning (ICL) from only a few examples. Recent works have indicated that the functions learned by ICL can be represented through compressed vectors derived from the transformer. However, the working mechanisms and optimization of these vectors are yet to be thoroughly explored. In this paper, we address this gap by presenting a comprehensive analysis of these compressed vectors, drawing parallels to the parameters trained with gradient descent, and introduce the concept of state vector. Inspired by the works on model soup and momentum-based gradient descent, we propose inner and momentum optimization methods that are applied to refine the state vector progressively as test-time adaptation. Moreover, we simulate state vector aggregation in the multiple example setting, where demonstrations comprising numerous examples are usually too lengthy for regular ICL, and further propose a divide-and-conquer aggregation method to address this challenge. We conduct extensive experiments using Llama-2 and GPT-J in both zero-shot setting and few-shot setting. The experimental results show that our optimization method effectively enhances the state vector and achieves the state-of-the-art performance on diverse tasks. Code is available at https://github.com/HITsz-TMG/ICL-State-Vector
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。