CoolFace
Modelpublic

llama-moe/LLaMA-MoE-v1-3_0B-2_16

sourceHugging Faceapache-2.0updated 2y agoView on Hugging Face
11likes11kdownloads
Model Card

LLaMA-MoE-v1-3.0B (2/16)

[[๐Ÿ’ป Code]](https://github.com/pjlab-sys4nlp/llama-moe) | [[๐Ÿ“œ Technical Report]](https://github.com/pjlab-sys4nlp/llama-moe/blob/main/docs/LLaMA_MoE.pdf)

๐Ÿ‘‹ Very nice to meet you here~

โค๏ธ This repo contains the model LLaMA-MoE-v1-3.0B (2/16), which activates 2 out of 16 experts (3.0B parameters). This model is NOT fine-tuned by instruction pairs, so it may not be good enough to act like a chatbot.

๐Ÿ“ข LLaMA-MoE is a series of Mixture-of-Expert (MoE) models based on LLaMA-2. You can find the code for training this model at this repo.

๐Ÿ’Ž This series of models are obtained by partitioning original LLaMA FFNs into experts and further continual pre-training. The total model size is only 6.7B parameters, which is very convenient for deployment and research usage. More details could be found at our technical report.

๐Ÿš€ QuickStart

python
# python>=3.10

import torch
from transformers import AutoTokenizer, AutoModelForCausalLM

model_dir = "llama-moe/LLaMA-MoE-v1-3_0B-2_16"
tokenizer = AutoTokenizer.from_pretrained(model_dir, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(model_dir, torch_dtype=torch.bfloat16, trust_remote_code=True)
model.eval()
model.to("cuda:0")

input_text = "Suzhou is famous of"
inputs = tokenizer(input_text, return_tensors="pt")
inputs = inputs.to("cuda:0")

pred = model.generate(**inputs, max_length=50, temperature=0.0)
print(tokenizer.decode(pred.cpu()[0], skip_special_tokens=True))
# Suzhou is famous of its beautiful gardens. The most famous one is the Humble Administrator's Garden. It is a classical Chinese garden with a history of more than 600 years. The garden is divided into three

๐Ÿ“Š Performance

Model\#Activated Experts\#Experts\#Activated ParamsLinks
LLaMA-MoE-3.0B2163.0B[[๐Ÿค— HF Weights]](https://huggingface.co/llama-moe/LLaMA-MoE-v1-30B-216)
LLaMA-MoE-3.5B (4/16)4163.5B[[๐Ÿค— HF Weights]](https://huggingface.co/llama-moe/LLaMA-MoE-v1-35B-416)
LLaMA-MoE-3.5B (2/8)283.5B[[๐Ÿค— HF Weights]](https://huggingface.co/llama-moe/LLaMA-MoE-v1-35B-28)
ModelSciQPIQAWinoGrandeARC-eARC-c (25)HellaSwag (10)LogiQABoolQ (32)LAMBADANQ (32)MMLU (5)Average
OPT-2.7B78.974.860.854.434.061.425.863.363.610.725.850.3
Pythia-2.8B83.273.659.658.836.760.728.165.964.68.726.851.5
INCITE-BASE-3B85.673.963.561.740.364.727.565.865.415.227.253.7
Open-LLaMA-3B-v288.077.963.163.340.171.428.169.267.416.026.855.6
Sheared-LLaMA-2.7B87.576.965.063.341.671.028.373.668.317.627.356.4
LLaMA-MoE-3.0B84.277.563.660.240.970.830.671.966.617.026.855.5
LLaMA-MoE-3.5B (4/16)87.677.965.565.644.273.329.775.069.520.326.857.7
LLaMA-MoE-3.5B (2/8)88.477.666.765.343.173.329.673.969.419.827.057.6

๐Ÿ“– Details

Training Data: 200B tokens from SlimPajama with the same data sampling weights as Sheared LLaMA.

๐Ÿ“ƒ Citation

bibtex
@article{llama-moe,
  title={LLaMA-MoE: Building Mixture-of-Experts from LLaMA with Continual Pre-training},
  author={Tong Zhu and Xiaoye Qu and Daize Dong and Jiacheng Ruan and Jingqi Tong and Conghui He and Yu Cheng},
  journal={arXiv preprint arXiv:2406.16554},
  year={2024},
  url={https://arxiv.org/abs/2406.16554},
}