Llama SLayer 8B: Shallow Layers Hold the Key to Knowledge Injection

Tianxiang Chen, Zhentao Tan, Tao Gong, Yue Wu, Qi Chu +3 more
10/3/2024
cs.CL

Official code: txchen-USTC/Llama-Slayer (0 stars, last commit 2024-11-15).

Abstract

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

View on arXivView PDF

Code Implementations(1)

[EMNLP Findings 2024] Official code for our paper "Llama SLayer 8B: Shallow Layers Hold the Key to Knowledge Injection"

00PythonOct 2, 20241 years ago

Similar Papers

Cite this paper

@article{chen2024llama,
  title  = {Llama SLayer 8B: Shallow Layers Hold the Key to Knowledge Injection},
  author = {Tianxiang Chen and Zhentao Tan and Tao Gong and Yue Wu and Qi Chu and Bin Liu and Jieping Ye and Nenghai Yu},
  year   = {2024},
  eprint = {2410.02330},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2410.02330v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2410.02330.svg)](https://codeofpaper.com/paper/2410.02330)

Discussion