2024-11-02 · 专家 · 机器学习 · 自然语言处理

What Happened in LLMs Layers when Trained for Fast vs. Slow Thinking: A Gradient Perspective

本文通过分析LLM训练过程中的梯度变化,揭示了快思考与慢思考对模型训练稳定性和效率的影响,并提出了基于梯度模式的正确性判断方法。

更新于 2024-11-09。作者:Ming Li、Yanhong Li、Tianyi Zhou。

中文摘要

什么是大型语言模型(LLMs)后训练中的差异化因素?我们通过梯度这一视角,研究了不同响应和初始模型训练时,LLMs中不同层的训练模式。我们特别关注了快速思维与慢速思维如何影响层间梯度,鉴于近年来LLMs在推理路径,如思维链(CoT)和过程奖励上的训练越来越受欢迎。在我们的研究中,没有CoT的快速思维导致了更大的梯度以及层间梯度差异,这表明慢速思维(详细CoT)带来的学习稳定性。此外,预训练的LLMs相比指令微调的LLMs,受快速思维不稳定性的影响较小。此外,我们还研究了梯度模式是否可以反映在训练不同LLMs时,使用慢速思维与快速思维路径的响应正确性。结果显示,慢速思维的梯度可以区分正确和不相关的推理路径。作为比较,我们对非推理知识学习任务也进行了类似的梯度分析,然而,在这些任务上,仅仅增加响应长度并不能导致类似慢速思维的行为。我们的研究加深了对LLMs训练的基本理解,并对其效率和稳定性提供了新的见解,为构建可泛化的系统2智能体铺平了道路。我们的代码、数据和梯度统计可以在以下链接找到:https://github.com/MingLiiii/Layer_Gradient。

英文摘要

What makes a difference in the post-training of LLMs? We investigate the training patterns of different layers in large language models (LLMs), through the lens of gradient, when training with different responses and initial models. We are specifically interested in how fast vs. slow thinking affects the layer-wise gradients, given the recent popularity of training LLMs on reasoning paths such as chain-of-thoughts (CoT) and process rewards. In our study, fast thinking without CoT leads to larger gradients and larger differences of gradients across layers than slow thinking (Detailed CoT), indicating the learning stability brought by the latter. Moreover, pre-trained LLMs are less affected by the instability of fast thinking than instruction-tuned LLMs. Additionally, we study whether the gradient patterns can reflect the correctness of responses when training different LLMs using slow vs. fast thinking paths. The results show that the gradients of slow thinking can distinguish correct and irrelevant reasoning paths. As a comparison, we conduct similar gradient analyses on non-reasoning knowledge learning tasks, on which, however, trivially increasing the response length does not lead to similar behaviors of slow thinking. Our study strengthens fundamental understandings of LLM training and sheds novel insights on its efficiency and stability, which pave the way towards building a generalizable System-2 agent. Our code, data, and gradient statistics can be found in: https://github.com/MingLiiii/Layer_Gradient.

解读

一句话总结

本文通过分析LLM训练过程中的梯度变化,揭示了快思考与慢思考对模型训练稳定性和效率的影响,并提出了基于梯度模式的正确性判断方法。

问题1:这篇论文想要解决什么具体问题?

• 问题背景:大型语言模型(LLM)的训练机制和训练行为仍然是一个黑盒,难以理解。 • 现有方案不足:现有研究主要关注静态模型的可解释性,对LLM动态训练模式中的梯度研究不足。 • 研究目标:通过分析LLM训练过程中的梯度变化,揭示快思考与慢思考对模型训练稳定性和效率的影响,并提出基于梯度模式的正确性判断方法。

问题2:论文的核心创新点是什么?

• 技术创新:利用SVD技术对LLM训练过程中的梯度进行谱分析,揭示了快思考与慢思考对梯度的影响。 • 方法改进:提出基于梯度模式的正确性判断方法,通过比较不同类型响应的梯度模式,判断响应的正确性。 • 优势:与现有方法相比,该方法能够更直观地反映LLM的训练过程,并提高模型训练的稳定性和效率。

问题3:实验结果如何验证了方法的有效性?

• 关键实验:在数学、常识推理和知识学习任务上,对快思考与慢思考的梯度模式进行了比较。 • 性能提升:慢思考的梯度模式在不同层之间更加稳定,且能够区分正确与无关的推理路径。 • 对比结果:与基线方法相比,慢思考的模型在性能上有所提升。

问题4:这个研究的实际应用价值是什么?

• 应用场景:该方法可以应用于LLM的训练和评估,提高模型训练的稳定性和效率。 • 实施建议:在实际应用中,可以根据任务类型和训练数据选择合适的思考模式。 • 局限与展望:该方法在知识学习任务上的效果不如推理任务,未来可以进一步研究不同类型任务的最佳思考模式。

来源