00:00:00

Share Your Feedback 🏝️

ESFT(Expert-Specialized Fine-Tuning)

ESFT(Expert-Specialized Fine-Tuning)

MinWoo(Daniel) Park | Tech Blog

Read more
Previous: Scaling Synthetic Data Personas Next: Best RAG

ESFT(Expert-Specialized Fine-Tuning)

  • Related Project: Private
  • Category: Paper Review
  • Date: 2024-07-03

Let the Expert Stick to His Last: Expert-Specialized Fine-Tuning for Sparse Architectural Large Language Models

  • url: https://arxiv.org/abs/2407.01906
  • pdf: https://arxiv.org/pdf/2407.01906
  • html: https://arxiv.org/html/2407.01906v2
  • github: https://github.com/deepseek-ai/ESFT
  • abstract: Parameter-efficient fine-tuning (PEFT) is crucial for customizing Large Language Models (LLMs) with constrained resources. Although there have been various PEFT methods for dense-architecture LLMs, PEFT for sparse-architecture LLMs is still underexplored. In this work, we study the PEFT method for LLMs with the Mixture-of-Experts (MoE) architecture and the contents of this work are mainly threefold: (1) We investigate the dispersion degree of the activated experts in customized tasks, and found that the routing distribution for a specific task tends to be highly concentrated, while the distribution of activated experts varies significantly across different tasks. (2) We propose Expert-Specialized Fine-Tuning, or ESFT, which tunes the experts most relevant to downstream tasks while freezing the other experts and modules; experimental results demonstrate that our method not only improves the tuning efficiency, but also matches or even surpasses the performance of full-parameter fine-tuning. (3) We further analyze the impact of the MoE architecture on expert-specialized fine-tuning. We find that MoE models with finer-grained experts are more advantageous in selecting the combination of experts that are most relevant to downstream tasks, thereby enhancing both the training efficiency and effectiveness. Our code is available at this https URL.

Contents

TL;DR


  1. 대규모 언어모델의 파라미터 효율적 튜닝 방법 연구
  2. Mixture-of-Experts 아키텍처를 이용한 Experts 특화 파인튜닝 방법 제안
  3. Experts 선택 메커니즘과 세분화된 아키텍처를 통한 계산 효율성 및 작업 전문성 유지

1. 서론

본 논문에서는 대규모 언어모델의 파라미터 규모가 증가함에 따라 (Meta, 2024; Mistral, 2024a; DeepSeek, 2024; Qwen, 2024), 파라미터 효율적인 파인튜닝(PEFT) 방법 (Han et al., 2024)의 중요성이 높아지고 있습니다. 기존의 PEFT 연구는 주로 밀집형 아키텍처의 LLMs에 초점을 맞추었으나, 희소형 아키텍처에서는 상대적으로 연구가 부족합니다. 본 연구는 Mixture-of-Experts (MoE) LLMs 아키텍처 내에서의 PEFT 기법을 탐구하며, MoE 아키텍처에서는 서로 다른 작업이 활성화된 Experts에 의해 처리됨을 도입합니다 (Mistral, 2024b; Databricks, 2024). 이는 특정 작업에 대해 높은 친화도를 보이는 Experts만을 파인튜닝하는 Expert-Specialized Fine-Tuning (ESFT) 방법을 제안하게 된 배경입니다.


2. 관련 작업

2.1 밀집 아키텍처 LLMs를 위한 파라미터 효율적 파인튜닝

PEFT는 downstream 작업에 대한 LLMs의 맞춤화를 효율적으로 수행하기 위해 새로운 파라미터를 추가하거나 기존 파라미터의 일부만을 파인튜닝하는 방법을 포함합니다. Adapter와 Soft Prompt 방법이 이런 방법에 속하며, LoRA는 가중치 행렬을 Low-Rank 구성요소로 분해하여 훈련 비용을 줄이는 방법으로 널리 사용됩니다 (Hu et al., 2021). 그러나, MoE 아키텍처에 적합한 PEFT 연구는 미비한 실정입니다.

2.2 MoE LLMs의 거친 및 세밀한 Experts 시스템

MoE 아키텍처는 Experts의 세분화를 통해 특화된 지식을 효율적으로 학습할 수 있도록 합니다. DeepSeek MoE는 각 Experts를 더 작은 단위로 세분화하여, 동일한 계산 비용으로 다양한 지식 유형에 특화될 수 있도록 했습니다. 이런 세분화는 특정 작업에 가장 관련 있는 Experts를 선택하여 파인튜닝하는 것을 가능하게 합니다.


3. 방법

3.1 Experts의 혼합: 트랜스포머를 위한 MoE

MoE는 트랜스포머의 Feed-Forward Networks (FFNs)를 여러 Experts로 구성된 MoE 계층으로 대체합니다. 각 토큰은 관련성 점수에 기반하여 가장 관련 있는 Experts 집합에 할당되며, 이는 계산 효율성을 보장합니다. 출력된 히든 상태는 다음과 같이 계산됩니다.

\[h_{tl} = \sum_{i=1}^{N} (g_{it} \cdot \text{FFN}_i(u_{tl})) + u_{tl},\] \[g_{it} = \begin{cases} s_{it}, & \text{if } s_{it} \in \text{TopK}(\{s_{jt} | 1 \leq j \leq N\}, K), \\ 0, & \text{otherwise}, \end{cases}\] \[s_{it} = \text{Softmax}_i(u_{tl}^\top e_{il}),\]

\(N\)은 Experts의 총 수, \(\text{FFN}_i(\cdot)\)는 \(i\)번째 Experts의 FFN, \(g_{it}\)는 \(i\)번째 Experts에 대한 게이트 값, \(s_{it}\)는 토큰과 Experts 간의 친화도, \(\text{TopK}(\cdot, K)\)는 \(t\)번째 토큰과 모든 \(N\) Experts에 대해 계산된 affinity score($ s_{it} $) 중 상위 \(K\)개를 나타냄.

3.2 MoE 모델에서의 작업 특화 Experts 조사

MoE 모델의 Experts 특화는 두 가지 측면에서 조사됩니다. 첫째, 동일 작업 데이터에 의해 활성화된 Experts는 집중적으로 할당됩니다. 둘째, 서로 다른 작업에 사용되는 Experts의 분포는 상당히 다르게 나타납니다. 이는 특정 작업에 최적화된 Experts 집합이 일관적으로 사용됨을 보여줍니다.

3.3 Experts 특화 파인튜닝 (ESFT)

ESFT는 특정 작업에 가장 관련 있는 Experts만을 선별적으로 파인튜닝하여 계산 효율성을 향상시키고 Experts의 특화를 유지합니다. 데이터 샘플링을 통해 특정 작업과 가장 관련 있는 Experts를 선택하고, 이들 Experts만을 파인튜닝함으로써, 모델의 일반적인 성능을 유지하면서도 특정 작업에서의 성능을 극대화할 수 있습니다.

Previous: Scaling Synthetic Data Personas Next: Best RAG

post contain ""

    No matching posts found containing ""