FactorLLM: Factorizing Knowledge via Mixture of Experts for Large Language Models

Zhongyu Zhao, Menghang Dong, Rongyu Zhang, Wenzhao Zheng, Yunpeng Zhang +4 more
8/15/2024
cs.CLcs.AIcs.LG

Official code: zhenwuweihe/FactorLLM (7 stars, last commit 2024-08-15).

Abstract

Recent research has demonstrated that Feed-Forward Networks (FFNs) in Large Language Models (LLMs) play a pivotal role in storing diverse linguistic and factual knowledge. Conventional methods frequently face challenges due to knowledge confusion stemming from their monolithic and redundant architectures, which calls for more efficient solutions with minimal computational overhead, particularly for LLMs. In this paper, we explore the FFN computation paradigm in LLMs and introduce FactorLLM, a novel approach that decomposes well-trained dense FFNs into sparse sub-networks without requiring any further modifications, while maintaining the same level of performance. Furthermore, we embed a router from the Mixture-of-Experts (MoE), combined with our devised Prior-Approximate (PA) loss term that facilitates the dynamic activation of experts and knowledge adaptation, thereby accelerating computational processes and enhancing performance using minimal training data and fine-tuning steps. FactorLLM thus enables efficient knowledge factorization and activates select groups of experts specifically tailored to designated tasks, emulating the interactive functional segmentation of the human brain. Extensive experiments across various benchmarks demonstrate the effectiveness of our proposed FactorLLM which achieves comparable performance to the source model securing up to 85% model performance while obtaining over a 30% increase in inference speed. Code: https://github.com/zhenwuweihe/FactorLLM.

View on arXivView PDF

Code Implementations(1)

70Shell, PythonMay 22, 20242 years ago

Similar Papers

Cite this paper

@article{zhao2024factorllm,
  title  = {FactorLLM: Factorizing Knowledge via Mixture of Experts for Large Language Models},
  author = {Zhongyu Zhao and Menghang Dong and Rongyu Zhang and Wenzhao Zheng and Yunpeng Zhang and Huanrui Yang and Dalong Du and Kurt Keutzer and Shanghang Zhang},
  year   = {2024},
  eprint = {2408.11855},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2408.11855v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2408.11855.svg)](https://codeofpaper.com/paper/2408.11855)

Discussion