Skip to main content
QUICK REVIEW

[논문 리뷰] Compact Language Models via Pruning and Knowledge Distillation

Saurav Muralidharan, Sharath Turuvekere Sreenivas|arXiv (Cornell University)|2024. 07. 19.
Natural Language Processing TechniquesComputer Science인용 수 10
한 줄 요약

이 논문은 큰 LLM을 너비(width)와 깊이(depth) 축의 구조적 가지치기로 압축한 뒤 지식 증류 기반 재학습을 통해, 같은 규모의 모델과 경쟁하거나 그보다 우수한 Minitron 모델(8B 및 4B)을 훨씬 적은 학습 토큰으로 얻을 수 있음을 보여준다.

ABSTRACT

Large language models (LLMs) targeting different deployment scales and sizes are currently produced by training each variant from scratch; this is extremely compute-intensive. In this paper, we investigate if pruning an existing LLM and then re-training it with a fraction (<3%) of the original training data can be a suitable alternative to repeated, full retraining. To this end, we develop a set of practical and effective compression best practices for LLMs that combine depth, width, attention and MLP pruning with knowledge distillation-based retraining; we arrive at these best practices through a detailed empirical exploration of pruning strategies for each axis, methods to combine axes, distillation strategies, and search techniques for arriving at optimal compressed architectures. We use this guide to compress the Nemotron-4 family of LLMs by a factor of 2-4x, and compare their performance to similarly-sized models on a variety of language modeling tasks. Deriving 8B and 4B models from an already pretrained 15B model using our approach requires up to 40x fewer training tokens per model compared to training from scratch; this results in compute cost savings of 1.8x for training the full model family (15B, 8B, and 4B). Minitron models exhibit up to a 16% improvement in MMLU scores compared to training from scratch, perform comparably to other community models such as Mistral 7B, Gemma 7B and Llama-3 8B, and outperform state-of-the-art compression techniques from the literature. We have open-sourced Minitron model weights on Huggingface, with corresponding supplementary material including example code available on GitHub.

연구 동기 및 목표

  • 기존 LLM의 가지치기와 소량 데이터 부분으로 재학습이 더 작은 변종의 전체 재학습을 대체할 수 있는지 평가한다.
  • 깊이(depth), 너비(width), 어텐션, 그리고 MLP 가지치기와 지식 증류를 결합한 실용적 압축 모범 사례를 개발한다.
  • Nemotron-4 15B에서 Minitron 모델(8B 및 4B)을 도출하여 이 접근법을 시연하고, 언어 과제에서 커뮤니티 모델과 비교한다.

제안 방법

  • 활성화 기반 중요도 점수를 사용하여 깊이(레이어), 너비(어텐션 헤드, MLP 은닉 채널), 임베딩 채널 축에서 구조적 가지치기를 수행한다.
  • 조금 가벼운 재학습 단계(~1.8B 토큰)를 사용하고, 가지치지 않은 교사 모델로부터의 지식 증류로 정확도를 회복한다.
  • 제약된 후보 공간에서 경량 신경망 아키텍처 검색을 수행하여 매개변수 예산 내에서 가지치기된 아키텍처를 선택한다.
  • 로짓과 중간 상태를 결합한 증류 기반 손실을 훈련하고, 로짓 손실과 중간 상태 손실 간의 가변 가중치를 적용한다.
  • 최종 성능을 개선하고 기능을 유지하기 위해 두 단계의 반복 방식으로 가지치기를 수행한다.
  • 가지치기 후 재학습된 모델과 무에서 시작한 기준 모델, 그리고 다른 압축 모델들을 다운스트림 작업 모음에서 비교한다.
Figure 1: Results for Minitron . Compression results in significant reduction of training costs for additional models ( $40\times$ ) while producing better results.
Figure 1: Results for Minitron . Compression results in significant reduction of training costs for additional models ( $40\times$ ) while producing better results.

실험 결과

연구 질문

  • RQ1하나의 큰 LLM을 가지치기하고 소량의 데이터로 재학습하여 더 작고 고성능인 변종을 만들 수 있는가?
  • RQ2처음에 가지치기할 가장 효과적인 축(depth, width, embedding)은 무엇이며 어떻게 조합해야 하는가?
  • RQ3가지치기 후 일반 재학습과 비교하여 지식 증류가 정확도 회복에 얼마나 효과적인가?
  • RQ4성과를 보존하거나 향상시키면서 압축 효율을 극대화하는 실용적인 최적 실천 방법은 무엇인가?

주요 결과

  • 너비 관련 구성요소(헤드, MLP 채널, 임베딩)의 가지치기가 일반적으로 심층 가지치기만 하는 것보다 재학습 후 성능을 더 높게 만들어 주며, 재학습이 결과를 향상시킨다.
  • 가벼운 재학습 후에 특히 15B 파라미터 이하의 모델에서 너비 가지치기가 일반적으로 깊이 가지치기보다 더 우수하다.
  • 재학습 중 가지치지 않은 교사로부터의 지식 증류는 일반 훈련에 비해 다운스트림 작업 성능을 크게 향상시킨다.
  • Nemotron-4 15B에서 Minitron 8B 및 4B를 도출하는 데 최대 40배 적은 학습 토큰이 필요하고, 전체 패밀리에 대해 약 1.8배의 학습 비용 절감을 달성한다.
  • Minitron 8B는 Nemotron-3 8B 및 LLaMa-2 7B를 능가하고, 여러 벤치마크에서 Mistral-7B, Gemma-7B, Llama-3-8B와도 경쟁력이 있으며, 토큰 수는 훨씬 적게 사용한다( Nemotron-3 8B의 40배).
  • Minitron-4B는 Gemma2를 능가하고 다양한 깊이/너비 가지치기 기준선과 비교 시 우호적으로 평가되며, 지시-조정된 변형은 지시 준수와 RAG 능력이 강하게 나타난다.
Figure 2: High-level overview of our proposed iterative pruning and distillation approach to train a family of smaller LLMs.
Figure 2: High-level overview of our proposed iterative pruning and distillation approach to train a family of smaller LLMs.

이 논문 읽기

누빈트 뷰어에서 원문을 열고, 읽으면서 궁금한 곳을 바로 물어보세요.

누빈트에서 이 논문 읽기

이 리뷰는 AI가 논문 원문을 바탕으로 만들었습니다. 인용하기 전에 원문을 확인해 주세요.