arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2502.05390cs.CLcs.LG
收藏

从上下文学习中学习任务表示

Learning Task Representations from In-Context Learning

Yale University(耶鲁大学)

Baturay Saglam, Xinyang Hu, Zhuoran Yang, Dionysis Kalogerias, Amin Karbasi

AI总结:

本文提出一种基于注意力头加权和的自动化任务向量提取方法,并构建跨模态基准,验证其在文本与回归任务中均能有效保持任务保真度。

摘要:

大型语言模型(LLMs)在上下文学习(ICL)中展现出卓越的能力,模型通过基于示例的提示适应新任务,而无需更新参数。然而,理解任务如何在内部被编码和泛化仍然是一个挑战。为了解决文献中的一些实证和技术空白,我们引入了一种自动化公式,将ICL提示中的任务信息编码为Transformer架构内注意力头的函数。该方法计算一个单一的任务向量,作为注意力头的加权和,权重通过梯度下降以因果方式进行优化。我们的研究结果表明,现有方法无法有效泛化到文本以外的模态。为此,我们还设计了一个基准,用于评估任务向量能否在函数回归任务中保持任务保真度。所提出的方法成功地从上下文演示中提取了任务特定信息,并在文本和回归任务中均表现出色,证明了其跨模态的泛化能力。

英文摘要:

Large language models (LLMs) have demonstrated remarkable proficiency in in-context learning (ICL), where models adapt to new tasks through example-based prompts without requiring parameter updates. However, understanding how tasks are internally encoded and generalized remains a challenge. To address some of the empirical and technical gaps in the literature, we introduce an automated formulation for encoding task information in ICL prompts as a function of attention heads within the transformer architecture. This approach computes a single task vector as a weighted sum of attention heads, with the weights optimized causally via gradient descent. Our findings show that existing methods fail to generalize effectively to modalities beyond text. In response, we also design a benchmark to evaluate whether a task vector can preserve task fidelity in functional regression tasks. The proposed method successfully extracts task-specific information from in-context demonstrations and excels in both text and regression tasks, demonstrating its generalizability across modalities.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑