MoE(Mixture-of-Experts, ICLR 2017)

2024. 7. 8. 14:10·DL·ML
목차
  1. Methods
  2. Experiments
  3. References
  4. Footnotes

Methods

Figure 1: A Mixture of Experts layer embedded within a recurrent language model.

 

conditional computation이라는 방법은 각 example에 따라 subnetwork가 active되어 model capacity를 늘리는 방법이다. model의 크기를 키우는 것에 비해서 더 많은 capacity를 늘릴 수 있다는 장점이 있는데, 여기에는 기술적인 문제가 몇 개 있다:

 

1) GPU는 branching보다 arithmetic에 유리하다.

2) dataset과 batch size가 아주 커져야 한다. 

3) network bandwidth가 bottleneck이 된다. 

 

여기서는 이를 해결하기 위한 방법인 Sparsely-Gated Mixture-of-Experts Layer(MoE)를 제안한다. 

 

Fig. 1에서 보이듯 각 layer는 n개의 expert network E1,⋯En와 gating network G로 구성된다. 이때 gating network의 output은 sparse n-dimensional vector이다.

 

이를 이용한 MoE module의 output은 다음과 같이 계산된다:

 

y=∑i=1nG(x)iEi(x)

 

G(x)i=0이면 계산을 생략한다. 그 결과 실제 experiment에서는 수천 개의 expert 중 몇 개만 activate된다. 

 

 

Gating Network

가장 simple한 형태의 gating은 softmax를 사용하는 것이다: 

 

Gσ(x)=Softmax(x⋅Wg)

 

그러나 이 방법은 sparse하지 않으므로 computationally efficient하지 않다. 따라서 Noisy Top-K gating을 사용해서 sparsity를 달성한다. tunable Gaussian noise를 더한 뒤 top k value를 제외한 모든 값을 -∞로 설정해서 sparse하도록 만든다. 이는 다음과 같이 표현된다:

 

G(x)=Softmax(KeepTopK(H(x),k))

H(x)i=(x⋅Wg)i+StandardNormal()⋅Softplus((x⋅Wnoise)i)

KeepTopK(v,k)i={viif vi is in the top k elements of v,−∞otherwise.

 

이 gating network는 다른 network와 함께 train된다.

 

 

Balancing Expert Utilization

그러나 이렇게 할 경우 실제로는 일부 expert에 large weight가 부과되어 빠르게 local minima로 converge하는 문제가 보고된 바 있다. 따라서 constraint를 부과한다. 

 

Importance(X)=∑x∈XG(x)

Limportance(X)=wimportance⋅CV(Importance(X))2

 

즉 위와 같이 importance term의 coefficient of variation을 loss term에 더해준다. 이때 importance는 batchwise로 더해지므로, cv square를 loss term으로 추가하는 것은, 특정 expert가 너무 많은 importance를 갖지 않도록 regularize한다.  

 

 

Experiments

Figure 2: Model comparison on 1-Billion-Word Language-Modeling Benchmark.

Fig. 2의 왼쪽을 보면 model의 크기를 키울 수 있고, 이 경우 perplexity가 감소한다. 우측에서는 같은 computational budget에서의 perplexity를 LSTM과 비교한다. 

 


References

 

Footnotes

'DL·ML' 카테고리의 다른 글

FGSM (Fast Gradient Sign Method)  (0) 2024.07.15
Adversarial Attack  (1) 2024.07.15
VAE Loss Derivation (in progress)  (1) 2024.04.07
[ODAI] DOTA benchmark  (2) 2024.03.06
Grounding DINO architecture  (0) 2024.02.27
  1. Methods
  2. Experiments
  3. References
  4. Footnotes
'DL·ML' Other articles in this category
  • FGSM (Fast Gradient Sign Method)
  • Adversarial Attack
  • VAE Loss Derivation (in progress)
  • [ODAI] DOTA benchmark
Jordano
Jordano
  • Jordano
    Jordano
    Jordano
  • Total
    Today
    Yesterday
    • All categories
      • Introduction
      • Theatre⋅Play
      • Thinking
        • iDeAs
        • Philosophy
      • History
        • Cuba
        • China
      • CS
        • HTML·CSS·JavaScript
        • Dart·Flutter
        • C, C++
        • Python
        • PS
        • Algorithm
        • Network
        • OS
        • etc
      • DL·ML
        • Paper
        • Study
        • Project
      • Mathematics
        • Information Theory
        • Linear Algebra
        • Statistics
        • etc
      • etc
        • Paper
      • Private
      • Travel
  • Blog Menu

    • 홈
    • 태그
    • 방명록
  • Link

  • hELLO· Designed By정상우.v4.10.3
Jordano
MoE(Mixture-of-Experts, ICLR 2017)
상단으로

티스토리툴바

단축키

내 블로그

내 블로그 - 관리자 홈 전환
Q
Q
새 글 쓰기
W
W

블로그 게시글

글 수정 (권한 있는 경우)
E
E
댓글 영역으로 이동
C
C

모든 영역

이 페이지의 URL 복사
S
S
맨 위로 이동
T
T
티스토리 홈 이동
H
H
단축키 안내
Shift + /
⇧ + /

* 단축키는 한글/영문 대소문자로 이용 가능하며, 티스토리 기본 도메인에서만 동작합니다.