Summary

소규모 모델(experts) 여러 개를 묶어서, 실제 동작 시에 activate되는 파라미터 수는 적고, 넓은 domain coverage를 할 수 있는 모델 구현 방법론

Key Features


구조적 특징 (Specialized Subnetworks):


  • 하나의 레이어나 연산(Linear layers, MLPs 등)을 여러 개의 독립적인 하위 네트워크인 **‘Expert(전문가)’ **로 나눔.
  • 각 전문가는 학습 과정에서 데이터의 특정 패턴이나 도메인에 특화되도록 훈련됨.

라우팅 메커니즘 (Gating/Routing Network):


  • 모든 전문가를 동시에 사용하는 것이 아니라, Gating Network라는 중개자가 입력 데이터(토큰)를 보고 가장 적합한 expert에게 전달.
  • “수학” 관련 질문이 들어오면 수학에 특화된 expert node만 활성화하여 계산을 수행.

효율성 및 확장성 (Efficiency & Scalability):


  • Sparse Activation(희소 활성화): 모델 전체의 parameter는 매우 많지만, 실제 추론 시에는 선택된 몇 개의 전문가만 작동하므로 계산 비용(FLOPs)은 훨씬 적음.
  • 이를 통해 하드웨어 자원의 제약 내에서 모델의 지식 용량을 획기적으로 늘릴 수 있음.

Example : Mixtral 8 x 7B


Figure 6.9: Diagram of the Mixtral 8x7B Mixture of Experts (MoE) model architecture. The model is composed of a router network that dynamically selects the most relevant experts from a pool of eight transformer-based experts, each with 7 billion parameters. The experts are organised into transformer blocks, where the router directs data to the appropriate expert based on the input, optimising computational efficiency and model performance. This architecture allows for scalability and specialised processing within large language models.

Question

Q. mistral 8 x 7B은 47B정도의 규모인데, 어떻게 56B보다 작나?

  • 그림이 엄밀하진 않은데, 실제 MoE 모델들은 attention은 sharing함.
    • 뒤의 FFN만 8개로 구성.
  • 따라서, 실제론 MoE의 Routing은 한 번만 일어나는 것이 아니라 매 attention 마다 routing을 넣을수는 있음.
    • 따라서 여기서 볼 수 있는 건, attention은 상대적으로 공유하는 게 괜찮고, mlp부분만 따로 해두어도 performance를 올릴 수 있다는 접근