Giter Club home page Giter Club logo

loramoe's Introduction

LoRAMoE: Revolutionizing Mixture of Experts for Maintaining World Knowledge in Language Model Alignment

This is the repository for LoRAMoE: Revolutionizing Mixture of Experts for Maintaining World Knowledge in Language Model Alignment.

Overview of LoRAMoE

Implementation

You can quickly export the environment by using the follow command:

conda env create -f environment.yml

or

conda create -n loramoe python=3.10 -y

pip install -r requirements.txt

We do not install the peft to avoid the conflicts with the local peft package.

Usage

Data Format

We construct a tiny dataset to demonstrate the data format during the training and inference phase and evaluate the correct of code.

data/
|--tiny_data/
  |--train/train.json
  |--test.json

Train LoRAMoE on Single Node

bash run_loramoe.sh

Explanations of Hyper-parameters

blc weight blc alpha LoRA rank LoRA alpha LoRA trainable LoRA dropout LoRA num
the strength of localized balance constraints degree of imbalance rank of LoRA experts LoRA scale where the LoRA layers are added dropout rate in LoRA number of experts

Note: Our main changes to transformers and peft

In transformers, we mainly change modeling_llama.py to introduce new para task_types.

In peft, we replace the original LoRA class with the mixtures of experts architecture.

Citation

If you find this useful in your research, please consider citing

@misc{dou2024loramoe,
      title={LoRAMoE: Revolutionizing Mixture of Experts for Maintaining World Knowledge in Language Model Alignment}, 
      author={Shihan Dou and Enyu Zhou and Yan Liu and Songyang Gao and Jun Zhao and Wei Shen and Yuhao Zhou and Zhiheng Xi and Xiao Wang and Xiaoran Fan and Shiliang Pu and Jiang Zhu and Rui Zheng and Tao Gui and Qi Zhang and Xuanjing Huang},
      year={2023},
      eprint={2312.09979},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}

loramoe's People

Contributors

ablustrund avatar mok0102 avatar zhou-zoey avatar

Stargazers

xxs avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.