arXiv:2410.23123cs.CL2024-10被引 138

研究发现大模型在逻辑题中既会记忆题目又会推理,两者并存。

On Memorization of Large Language Models in Logical Reasoning

  • 用动态生成的骑士与说谎者谜题测试模型记忆与推理能力
  • 微调后模型对训练题几乎全对,但稍作变化就出错
  • 揭示模型在记忆与推理间切换的内在机制,适合关注模型可靠性的人

大型语言模型(LLMs)在复杂推理基准上表现优异,却仍会犯基础错误。这种矛盾行为令人困惑,难以理解其推理机制。一种假设是,模型在常见推理基准上接近饱和的高分表现,可能源于对相似题目的记忆。本文通过基于骑士与说谎者(Knights and Knaves, K&K)谜题的动态生成推理基准,定量评估了模型在推理任务中的记忆现象。结果表明,经过微调后,模型能近乎完美地记忆训练过的谜题,但在面对轻微变化时表现显著下降。然而,微调虽导致严重记忆,却也稳定提升了模型在新问题上的泛化能力。通过扰动测试、跨难度迁移、内部探查及使用错误答案进行微调等深入分析,我们证实模型在解题过程中同时发展出推理技能和记忆能力。最后,基于每样本的记忆评分分析,揭示了模型在解决逻辑谜题时如何在推理与记忆之间切换。代码与数据已公开于 https://memkklogic.github.io。

原文摘要 · Abstract (English)

Large language models (LLMs) achieve good performance on challenging reasoning benchmarks, yet could also make basic reasoning mistakes. This contrasting behavior is puzzling when it comes to understanding the mechanisms behind LLMs' reasoning capabilities. One hypothesis is that the increasingly high and nearly saturated performance on common reasoning benchmarks could be due to the memorization of similar problems. In this paper, we systematically investigate this hypothesis with a quantitative measurement of memorization in reasoning tasks, using a dynamically generated logical reasoning benchmark based on Knights and Knaves (K&K) puzzles. We find that LLMs could interpolate and memorize the training puzzles (achieving near-perfect accuracy) after fine-tuning, yet they struggle with slight variations of these puzzles. On the other hand, we show that while fine-tuning leads to heavy memorization, it also consistently improves generalization performance. Through in-depth analyses with perturbation tests, cross difficulty-level transferability, probing model internals, and fine-tuning with wrong answers, we establish that LLMs develop reasoning skills on K&K puzzles alongside memorization. Finally, our analysis based on a per-sample memorization score sheds light on how LLMs switch between reasoning and memorization when solving logical puzzles. Our code and data are available at https://memkklogic.github.io.

大模型逻辑推理记忆机制微调

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。