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

在大型语言模型中微调与上下文学习:从形式语言学习的角度

Fine-tuning vs. In-context Learning in Large Language Models: A Formal Language Learning Perspective

Max Planck Institute for Software Systems(马克斯·普朗克软件系统研究所);Boston University(波士顿大学)

Bishwamittra Ghosh, Soumi Das, Till Speicher, Qinyuan Wu, Mohammad Aflah Khan, Deepak Garg, Krishna P. Gummadi, Evimaria Terzi

AI总结:

本文从形式语言学习的角度比较了大型语言模型中的微调与上下文学习,通过设计精确的语言边界、受控字符串采样和无数据污染的任务,发现微调在分布内泛化上优于上下文学习,而两者在分布外泛化上表现相当,且两者在不同熟练度水平上的归纳偏置也有所不同。

摘要:

大型语言模型(LLMs)在两种基本的学习模式中运作——微调(FT)和上下文学习(ICL),这引发了关于哪种模式产生更大的语言能力以及它们是否在归纳偏置上有所不同的关键问题。先前比较FT和ICL的研究由于实验设置不一致而得出混杂和不明确的结果。为了实现严格比较,我们提出了一项形式语言学习任务——提供精确的语言边界、受控字符串采样和无数据污染,并引入一种判别测试来评估语言能力,其中LLM成功当且仅当它将更高生成概率分配给语言字符串而不是非语言字符串。经验上,我们发现:(a)FT在分布内泛化上比ICL更具语言能力,但两者在分布外泛化上表现相当。(b)它们的归纳偏置,通过字符串生成概率的相关性来衡量,当两种模式部分学习语言时相似,但在更高熟练度水平上分化。(c)与FT不同,ICL的表现在不同大小和家族的模型之间差异显著,并且对语言的token词汇表敏感。因此,我们的工作展示了形式语言作为评估LLM的受控测试床的潜力,这些行为在自然语言数据集中难以隔离。我们的源代码可在https://github.com/bishwamittra/formallm上获得。

英文摘要:

Large language models (LLMs) operate in two fundamental learning modes - fine-tuning (FT) and in-context learning (ICL) - raising key questions about which mode yields greater language proficiency and whether they differ in their inductive biases. Prior studies comparing FT and ICL have yielded mixed and inconclusive results due to inconsistent experimental setups. To enable a rigorous comparison, we propose a formal language learning task - offering precise language boundaries, controlled string sampling, and no data contamination - and introduce a discriminative test for language proficiency, where an LLM succeeds if it assigns higher generation probability to in-language strings than to out-of-language strings. Empirically, we find that: (a) FT has greater language proficiency than ICL on in-distribution generalization, but both perform equally well on out-of-distribution generalization. (b) Their inductive biases, measured by the correlation in string generation probabilities, are similar when both modes partially learn the language but diverge at higher proficiency levels. (c) Unlike FT, ICL performance differs substantially across models of varying sizes and families and is sensitive to the token vocabulary of the language. Thus, our work demonstrates the promise of formal languages as a controlled testbed for evaluating LLMs, behaviors that are difficult to isolate in natural language datasets. Our source code is available at https://github.com/bishwamittra/formallm.

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

↑