arXiv:2502.11812cs.CLcs.AI2025-02ICML被引 23

通过电路分析揭示大模型微调机制,提出更高效适配方法。

Towards Understanding Fine-Tuning Mechanisms of LLMs via Circuit Analysis

  • 用电路分析追踪微调中网络结构变化,发现边权重变动显著。
  • 基于电路变化设计新LoRA方法,性能提升2.46%且参数量相当。
  • 适用于研究模型内部机制或优化微调策略的研究者。

微调能显著提升大语言模型性能,但其内在机制仍不清晰。本文通过电路分析这一机制可解释性工具,深入探究微调过程。与以往聚焦预训练模型已表现良好的任务不同,我们设计了一系列数学任务,其中微调带来显著性能提升,更贴近实际应用。实验中,我们在微调不同阶段识别出电路,并分析电路、微调方法与任务复杂度之间的关系。结果发现,尽管节点相似性保持较高,但边结构发生显著变化,与此前认为仅增加少量组件的结论不同。基于此,我们提出一种电路感知的低秩适应(LoRA)方法,根据电路边的变化为各层分配秩。实验表明,该方法在参数量相近时,平均性能比标准LoRA提升2.46%。此外,我们还探索了子任务电路组合对复合任务微调的增强作用,为任务设计和理解电路动态提供了新视角。

原文摘要 · Abstract (English)

Fine-tuning significantly improves the performance of Large Language Models (LLMs), yet its underlying mechanisms remain poorly understood. This paper aims to provide an in-depth interpretation of the fine-tuning process through circuit analysis, a popular tool in Mechanistic Interpretability (MI). Unlike previous studies (Prakash et al. 2024; Chhabra et al. 2024) that focus on tasks where pre-trained models already perform well, we develop a set of mathematical tasks where fine-tuning yields substantial performance gains, which are closer to the practical setting. In our experiments, we identify circuits at various checkpoints during fine-tuning and examine the interplay between circuit analysis, fine-tuning methods, and task complexities. First, we find that while circuits maintain high node similarity before and after fine-tuning, their edges undergo significant changes, in contrast to prior work that shows circuits only add some additional components after fine-tuning. Based on these observations, we develop a circuit-aware Low-Rank Adaptation (LoRA) method, which assigns ranks to layers based on edge changes in the circuits. Experimental results demonstrate that our circuit-based LoRA algorithm achieves an average performance improvement of 2.46% over standard LoRA with similar parameter sizes. Furthermore, we explore how combining circuits from subtasks can enhance fine-tuning in compositional tasks, providing new insights into the design of such tasks and deepening the understanding of circuit dynamics and fine-tuning mechanisms.

大模型微调机制电路分析LoRA

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