大模型用两步机制完成上下文学习,不依赖标签词
Inference and Verbalization Functions During In-Context Learning
- 先推理任务再映射答案到标签空间
- 不同标签词下性能几乎不变,证明推理独立于标签
- 该机制在多个主流模型中可定位到特定层,适合研究模型内部机理
大型语言模型(LMs)能通过少量示例(示例-标签对)在推理时实现上下文学习(ICL)以解决新任务。尽管高质量示例至关重要,但先前研究发现,在某些情况下,无关标签对ICL性能影响极小(Min等,2022)。我们假设,模型通过两个连续过程完成ICL:首先是求解任务的推理函数,随后是将推断结果映射到标签空间的表述函数。重要的是,我们假设推理函数对标签空间的重映射(如“true”/“false”改为“cat”/“dog”)具有不变性,使模型可在不同标签词设置下复用同一推理函数。通过受控的逐层替换干预实验,我们验证了该假设。研究结果在多个数据集和任务(自然语言推理、情感分析、主题分类)中得到证实,并进一步表明这两个函数可定位在多种开源模型(包括GEMMA-7B、MISTRAL-7B-V0.3、GEMMA-2-27B和LLAMA-3.1-70B)的特定层中。
原文摘要 · Abstract (English)
Large language models (LMs) are capable of in-context learning from a few demonstrations (example-label pairs) to solve new tasks during inference. Despite the intuitive importance of high-quality demonstrations, previous work has observed that, in some settings, ICL performance is minimally affected by irrelevant labels (Min et al., 2022). We hypothesize that LMs perform ICL with irrelevant labels via two sequential processes: an inference function that solves the task, followed by a verbalization function that maps the inferred answer to the label space. Importantly, we hypothesize that the inference function is invariant to remappings of the label space (e.g., "true"/"false" to "cat"/"dog"), enabling LMs to share the same inference function across settings with different label words. We empirically validate this hypothesis with controlled layer-wise interchange intervention experiments. Our findings confirm the hypotheses on multiple datasets and tasks (natural language inference, sentiment analysis, and topic classification) and further suggest that the two functions can be localized in specific layers across various open-sourced models, including GEMMA-7B, MISTRAL-7B-V0.3, GEMMA-2-27B, and LLAMA-3.1-70B.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。