00:00:00

Share Your Feedback 🏝️

Unreasonable Ineffectiveness LLM Deeper layers

Unreasonable Ineffectiveness LLM Deeper layers

MinWoo(Daniel) Park | Tech Blog

Read more
Previous: Latent Diffusion Models | Bigger is not always better* Next: DPO | stepwise-DPO

Unreasonable Ineffectiveness LLM Deeper layers

  • Related Project: Private
  • Category: Paper Review
  • Date: 2024-04-06

The Unreasonable Ineffectiveness of the Deeper Layers

  • url: https://arxiv.org/abs/2403.17887
  • pdf: https://arxiv.org/pdf/2403.17887
  • html: https://arxiv.org/html/2403.17887v1
  • abstract: We empirically study a simple layer-pruning strategy for popular families of open-weight pretrained LLMs, finding minimal degradation of performance on different question-answering benchmarks until after a large fraction (up to half) of the layers are removed. To prune these models, we identify the optimal block of layers to prune by considering similarity across layers; then, to “heal” the damage, we perform a small amount of fine-tuning. In particular, we use parameter-efficient fine-tuning (PEFT) methods, specifically quantization and Low Rank Adapters (QLoRA), such that each of our experiments can be performed on a single A100 GPU. From a practical perspective, these results suggest that layer pruning methods can complement other PEFT strategies to further reduce computational resources of fine-tuning on the one hand, and can improve the memory and latency of inference on the other hand. From a scientific perspective, the robustness of these LLMs to the deletion of layers implies either that current pretraining methods are not properly leveraging the parameters in the deeper layers of the network or that the shallow layers play a critical role in storing knowledge.

TL;DR


  • 대상: 대규모 언어모델의 효율적 훈련과 인퍼런스
  • 문제: 훈련 후 인퍼런스 비용과 시간 절감 필요
  • 방법: 층(레이어) 제거, 양자화, Low Rank Adapters(LoRA) 결합

[문제 정의 및 선행 연구]

대규모 언어모델(LLM)은 막대한 훈련 자원을 요구하며, 이 모델들은 생애주기 동안 대부분의 연산을 인퍼런스에서 사용합니다. 효율적인 훈련을 위해 모델의 크기 증가와 자원 사용의 최적화가 연구되어 왔습니다. 훈련 후에는, 모델을 더 경제적으로 만들기 위해 다양한 기법들이 제시되었습니다.

  • Quantization: 모델 가중치의 Precision를 줄여 메모리 사용량을 감소시킵니다.
  • Low Rank Adapters (LoRA): 모델 파라미터의 소수만을 업데이트하여 튜닝 비용을 절감합니다.
  • Pruning: 필요 없는 파라미터나 연결을 제거하여 메모리 사용량과 인퍼런스 시간을 줄입니다.

이들 기법은 자원 제한 환경에서 병합하여 사용할 경우 이상적인 효과를 발휘할 수 있습니다.


[방법: 층 제거 및 치유]

층 제거 전략

이 연구에서는 LLM의 레이어 사이의 유사성을 분석하여 제거할 최적의 레이어를 식별하는 방법을 개발했습니다. 이는 레이어 간의 각도 거리를 최소화하는 레이어를 선택하여 제거하는 알고리즘을 포함합니다. 수학적으로, 이 과정은 다음과 같이 정의됩니다.

  • 각도 거리 측정: 두 레이어 간의 출력의 각도 거리 \(d\)를 계산하여 가장 작은 거리를 가지는 레이어 블록을 식별합니다. \(d(\ell, \ell+n) = \min_{\ell} \left\{ \text{angular distance between layers } \ell \text{ and } \ell+n \right\}\)
  • 레이어 제거: 식별된 레이어 블록을 제거하고, 필요시 파라미터 효율적인 튜닝을 통해 모델을 “치유”합니다.

치유 과정

제거된 레이어의 영향을 최소화하기 위해 QLoRA를 사용하여 파라미터 효율적인 튜닝을 수행합니다. 이는 모델의 성능을 복원하는 데 도움을 주며, 다음과 같은 수식으로 설명할 수 있습니다.

\[\text{Healing via PEFT} = \text{Fine-tuning using QLoRA to minimize the performance loss due to pruning}\]


[데이터셋과 벤치마크]

이 연구에서 사용된 데이터셋은 BoolQ와 MMLU 등의 질문 응답 벤치마크입니다. 이들은 모델의 질의응답 능력을 평가하기 위해 사용되었습니다.

[실험 결과 및 분석]

실험을 통해 Llama-2-70B 모델에서 최대 50%의 레이어를 제거할 수 있음을 보여주었습니다. 제거된 레이어의 비율이 증가함에 따라 BoolQ와 MMLU 벤치마크에서의 성능 변화를 분석했으며, 특히 40%-50% 제거 구간에서 성능의 급격한 변화를 관찰했습니다. 이는 다음과 같은 그래프로 표현됩니다.

  • 성능 지표: 인퍼런스 정확도 및 손실
  • 레이어 제거 비율: 제거된 레이어의 비율에 따른 성능 변화


[결론 및 향후 연구 방향]

이 연구는 LLM에서 레이어를 효율적으로 제거하고 치유하는 방법을 통해 모델의 인퍼런스 비용을 줄일 수 있는 방법을 제시합니다. 향후 연구에서는 다양한 LLM과 추가적인 벤치마크를 사용하여 이 방법의 범용성을 더 폭넓게 검증할 예정이라고 합니다.

Previous: Latent Diffusion Models | Bigger is not always better* Next: DPO | stepwise-DPO

post contain ""

    No matching posts found containing ""