Llama Slayer 8B:浅层是知识注入的关键
Llama SLayer 8B: Shallow Layers Hold the Key to Knowledge Injection
AI总结:
本文发现浅层对LLM知识注入更关键,提出选择性增强浅层并剪枝深层的S策略,并基于此构建Llama Slayer-8B系列模型,在代码、数学和法律语料上验证了有效性。
摘要:
作为一种增强预训练大语言模型(LLM)的方式,知识注入对于开发垂直领域大模型至关重要,并已被广泛研究。尽管当前大多数方法,包括参数高效微调(PEFT)和块扩展方法,在所有LLM层上均匀地应用知识,但这引出了一个问题:所有层对知识注入是否同等关键?我们首先评估每一层的重要性,以找到知识注入的最优层范围。直观上,更重要的层应在知识注入中发挥更关键的作用,并应获得更密集的注入。我们观察到,在移除或扩展浅层后,问答基准上的性能出现下降,且随着层越深,退化程度越小,这表明浅层是知识注入的关键。这一见解促使我们提出S策略,即一种后预训练策略,选择性增强浅层,同时剪枝效果较差的深层。基于该策略,我们引入了Llama Slayer-8B和Llama Slayer-8B-Instruct。我们在代码与数学语料库上进行了实验,并证明了该策略的有效性。在不同LLM、Mistral-7B和法律语料库上的进一步实验证实了该方法的普遍适用性,突显了其广泛的效力。我们的代码可在以下地址获取:https://github.com/txchen-USTC/Llama-Slayer
英文摘要:
As a manner to augment pre-trained large language models (LLM), knowledge injection is critical to develop vertical domain large models and has been widely studied. Although most current approaches, including parameter-efficient fine-tuning (PEFT) and block expansion methods, uniformly apply knowledge across all LLM layers, it raises the question: are all layers equally crucial for knowledge injection? We begin by evaluating the importance of each layer in finding the optimal layer range for knowledge injection. Intuitively, the more important layers should play a more critical role in knowledge injection and deserve a denser injection. We observe performance dips in question-answering benchmarks after the removal or expansion of the shallow layers, and the degradation shrinks as the layer gets deeper, indicating that the shallow layers hold the key to knowledge injection. This insight leads us to propose the S strategy, a post-pretraining strategy of selectively enhancing shallow layers while pruning the less effective deep ones. Based on this strategy, we introduce Llama Slayer-8B and Llama Slayer-8B-Instruct. We experimented on the corpus of code $\&$ math and demonstrated the effectiveness of our strategy. Further experiments across different LLM, Mistral-7B, and a legal corpus confirmed the general applicability of the approach, underscoring its wide-ranging efficacy. Our code is available at: \https://github.com/txchen-USTC/Llama-Slayer
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。