Orion-MoE8x7B / README.md
renillhuang's picture
readme: Update inference code
94f9d42
|
raw
history blame
15.2 kB
metadata
language:
  - en
  - zh
  - ja
  - ko
metrics:
  - accuracy
pipeline_tag: text-generation
tags:
  - code
  - model
  - llm
logo

Orion-MOE8x7B

🌐English | 🇨🇳中文

Table of Contents


1. Model Introduction

  • Orion-MOE8x7B-Base Large Language Model(LLM) is a pretrained generative Sparse Mixture of Experts, trained from scratch by OrionStarAI. The base model is trained on multilingual corpus, including Chinese, English, Japanese, Korean, etc, and it exhibits superior performance in these languages.

  • The Orion-MOE8x7B series models exhibit the following features

    • The model demonstrates excellent performance in comprehensive evaluations compared to other base models of the same parameter scale.
    • It has strong multilingual capabilities, significantly leading in Japanese and Korean test sets, and also performing comprehensively better in Arabic, German, French, and Spanish test sets.
  • Model Hyper-Parameters

    • The architecture of the OrionMOE 8x7B models closely resembles that of Mixtral 8x7B, with specific details shown in the table below.

      Configuration OrionMOE 8x7B
      Hidden Size 4096
      # Layers 32
      # Query Heads 32
      # KV Heads 8
      Intermediate Size 14592
      # Experts 8
      # Activated Experts 2
      Embedding Tying False
      Position embedding RoPE
      seq_len 8192
      Vocabulary Size 1136664
  • Model pretrain hyper-parameters

    • We use the AdamW optimizer with hyperparameters set to 𝛽1 = 0.9, 𝛽2 = 0.95, and a weight decay of 0.1.
    • Training begins with a learning rate warm-up phase over 2000 iterations, where the learning rate is linearly increased to a peak of 3e-4. Afterward, a cosine schedule is applied to gradually reduce the learning rate to 3e-5 over the course of training.
    • The model is trained using BF16/FP32 mixed precision, with a batch size of 2600, processing approximately 22 million tokens per step.
  • Model pretrain data distribution

    • The training dataset is primarily composed of English, Chinese, and other languages, accounting for 50%, 25%, and 12% of the data, respectively. Additionally, code makes up 9%, while mathematical text accounts for 4%. The distribution by topics is detailed in the table below.
      logo


2. Model Download

Model release and download links are provided in the table below:

Model Name HuggingFace Download Links ModelScope Download Links
⚾Orion-MOE8x7B-Base Orion-MOE8x7B-Base Orion-MOE8x7B-Base


3. Model Benchmarks

3.1. Base Model Orion-MOE8x7B-Base Benchmarks

3.1.1. LLM evaluation results on examination and professional knowledge

TestSet Mixtral 8x7B Qwen1.5-32b Qwen2.5-32b Orion 14B Orion 8x7B
CEval 54.09 83.50 87.74 72.80 89.74
CMMLU 53.21 82.30 89.01 70.57 89.16
MMLU 70.40 73.40 82.90 69.94 85.90
MMLU Pro 38.50 45.25 58.01 33.95 58.31
ARC_c 85.08 90.17 94.24 79.66 91.86
HellaSwag 81.95 81.98 82.51 78.53 89.19
LAMBADA 76.79 73.74 75.37 78.83 79.74
BBH 50.87 57.28 67.69 50.35 55.82
MuSR 43.21 42.65 49.78 43.61 49.93
PIQA 83.41 82.15 80.05 79.54 87.32
CommonSenseQA 69.62 74.69 72.97 66.91 73.05
IFEval 24.15 32.97 41.59 29.08 30.06
GPQA 30.90 33.49 49.50 28.53 52.17
HumanEval 33.54 35.98 46.95 20.12 44.51
MBPP 60.70 49.40 71.00 30.00 43.40
MATH Lv5 9.00 25.00 31.72 2.54 5.07
GSM8K 47.50 77.40 80.36 52.01 59.82
MATH 28.40 36.10 48.88 7.84 23.68

3.1.2. Comparison of LLM performances on Japanese testsets

Model JSQuAD JCommonSenseQA JNLI MARC-ja JAQKET v2 PAWS-ja avg
Mixtral-8x7B 89.00 78.73 32.13 95.44 78.86 44.50 69.78
Qwen1.5-32B 89.86 84.54 50.99 97.08 82.14 43.80 74.74
Qwen2.5-32B 89.09 93.83 72.14 97.86 89.27 42.15 80.73
Orion-14B-Base 74.22 88.20 72.85 94.06 66.20 49.90 74.24
Orion 8x7B 91.77 90.43 90.46 96.40 81.19 47.35 82.93

3.1.3. Comparison of LLM performances on Korean testsets

Model HAE-RAE KoBEST BoolQ KoBEST COPA KoBEST HellaSwag KoBEST SentiNeg KoBEST WiC PAWS-ko avg
Mixtral-8x7B 53.16 78.56 66.20 56.60 77.08 49.37 44.05 60.72
Qwen1.5-32B 46.38 76.28 60.40 53.00 78.34 52.14 43.40 58.56
Qwen2.5-32B 70.67 80.27 76.70 61.20 96.47 77.22 37.05 71.37
Orion-14B-Base 69.66 80.63 77.10 58.20 92.44 51.19 44.55 67.68
Orion 8x7B 65.17 85.40 80.40 56.00 96.98 73.57 46.35 71.98

3.1.4. Comparison of LLM performances on Arabic, German, French, and Spanish testsets

Lang ar de fr es
Model HellaSwag ARC HellaSwag ARC HellaSwag ARC HellaSwag ARC
Mixtral-8x7B 53.16 78.56 66.20 56.60 77.08 49.37 44.05 60.72
Qwen1.5-32B 46.38 76.28 60.40 53.00 78.34 52.14 43.40 58.56
Qwen2.5-32B 70.67 80.27 76.70 61.20 96.47 77.22 37.05 71.37
Orion-14B-Base 69.66 80.63 77.10 58.20 92.44 51.19 44.55 67.68
Orion 8x7B 65.17 85.40 80.40 56.00 96.98 73.57 46.35 71.98

3.1.5. Leakage Detection Benchmark

When the pre-training data of a large language model contains content from a specific dataset, the model’s performance on that dataset may be artificially enhanced, leading to inaccurate performance evaluations. To address this issue, researchers from the Shenzhen Institute of Advanced Technology, Chinese Academy of Sciences, and other institutions have proposed a simple and effective method for detecting data leakage. This method leverages the interchangeable nature of multiple-choice options by shuffling the options in the original dataset to generate derived data. The log-probability distribution of the derived dataset is then computed using the model to detect whether the original dataset has been leaked.

We conducted data leakage detection experiments on three benchmark datasets: MMLU, CMMLU, and C-Eval.
More details can be found in the paper: https://web3.arxiv.org/pdf/2409.01790.
Test code: https://github.com/nishiwen1214/Benchmark-leakage-detection.

Threshold 0.2 Qwen2.5 32B Qwen1.5 32B Orion 8x7B Orion 14B Mixtral 8x7B
MMLU 0.30 0.27 0.22 0.28 0.25
CEval 0.39 0.38 0.27 0.26 0.26
CMMLU 0.38 0.39 0.23 0.27 0.22

3.1.6. Inference speed

Setup inference server on 8x Nvidia RTX3090, and get results from client in unit of tokens per second.

OrionLLM_V2.4.6.1 1para_out62 1para_out85 1para_out125 1para_out210
OrionMOE 33.04 33.43 33.53 33.59
Qwen32 26.46 26.73 26.80 27.03
OrionLLM_V2.4.6.1 4para_out62 4para_out90 4para_out125 4para_out220
OrionMOE 29.45 30.45 31.04 31.46
Qwen32 23.61 24.30 24.86 25.17
OrionLLM_V2.4.6.1 8para_out62 8para_out85 8para_out125 8para_out220
OrionMOE 25.71 27.13 28.89 29.70
Qwen32 21.16 21.92 23.14 23.56

We found that the inference speed results vary based on the number of concurrent requests and the length of output. To facilitate horizontal comparisons, we conducted multiple sets of tests. Each set of test data has a specific format: <n>para_out<m>. For example, "4para_out220" indicates the inference speed when there are 4 concurrent requests from the client and the average output token length is 220.

inf_speed


4. Model Inference

Model weights, source code, and configuration needed for inference are published on Hugging Face, and the download link is available in the table at the beginning of this document. We demonstrate various inference methods here, and the program will automatically download the necessary resources from Hugging Face.

4.1. Python Code

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from transformers.generation.utils import GenerationConfig

tokenizer = AutoTokenizer.from_pretrained("OrionStarAI/Orion-MOE8x7B-Base",
                                          use_fast=False,
                                          trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained("OrionStarAI/Orion-MOE8x7B-Base",
                                             device_map="auto",
                                             torch_dtype=torch.bfloat16,
                                             trust_remote_code=True)

model.generation_config = GenerationConfig.from_pretrained("OrionStarAI/Orion-MOE8x7B-Base")
messages = [{"role": "user", "content": "Hello, what is your name? "}]
response = model.chat(tokenizer, messages, streaming=False)
print(response)

In the above Python code, the model is loaded with device_map='auto' to utilize all available GPUs. To specify the device, you can use something like export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 (using GPUs 0,1,2,3,4,5,6,7).

4.2. Direct Script Inference


# base model
CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python demo/text_generation_base.py --model OrionStarAI/Orion-MOE8x7B-Base --tokenizer OrionStarAI/Orion-MOE8x7B-Base --prompt hello

4.3. vLLM Inference Service

Download project(https://github.com/OrionStarAI/vllm_server), follow the instructions to build up the vLLM service docker image.

git clone [email protected]:OrionStarAI/vllm_server.git
cd vllm_server
docker build -t vllm_server:0.0.0.0 -f Dockerfile .

Start docker service

docker run --gpus all -it -p 9999:9999 -v $(pwd)/logs:/workspace/logs:rw -v $HOME/Downloads:/workspace/models -e CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 -e MODEL_DIR=Orion-MOE8x7B-Base -e MODEL_NAME=orion-moe vllm_server:0.0.0.0

Run inference

curl http://0.0.0.0:9999/v1/chat/completions -H "Content-Type: application/json" -d '{"model": "orion-moe","temperature": 0.2,"stream": false, "messages": [{"role": "user", "content":"Which company developed you as an AI agent?"}]}'


5. Declarations, License

5.1. Declarations

We strongly urge all users not to use the Orion-MOE8x7B model for any activities that may harm national or social security or violate the law. Additionally, we request users not to use the Orion-MOE8x7B model for internet services without proper security review and filing. We hope all users abide by this principle to ensure that technological development takes place in a regulated and legal environment. We have done our best to ensure the compliance of the data used in the model training process. However, despite our significant efforts, unforeseen issues may still arise due to the complexity of the model and data. Therefore, if any problems arise due to the use of the Orion-MOE8x7B open-source model, including but not limited to data security issues, public opinion risks, or any risks and issues arising from the model being misled, abused, disseminated, or improperly utilized, we will not assume any responsibility.

5.2. License

Community use of the Orion-MOE8x7B series models


6. Company Introduction

OrionStar is a leading global service robot solutions company, founded in September 2016. OrionStar is dedicated to using artificial intelligence technology to create the next generation of revolutionary robots, allowing people to break free from repetitive physical labor and making human work and life more intelligent and enjoyable. Through technology, OrionStar aims to make society and the world a better place.

OrionStar possesses fully self-developed end-to-end artificial intelligence technologies, such as voice interaction and visual navigation. It integrates product development capabilities and technological application capabilities. Based on the Orion robotic arm platform, it has launched products such as OrionStar AI Robot Greeting, AI Robot Greeting Mini, Lucki, Coffee Master, and established the open platform OrionOS for Orion robots. Following the philosophy of "Born for Truly Useful Robots", OrionStar empowers more people through AI technology.

The core strengths of OrionStar lies in possessing end-to-end AI application capabilities, including big data preprocessing, large model pretraining, fine-tuning, prompt engineering, agent, etc. With comprehensive end-to-end model training capabilities, including systematic data processing workflows and the parallel model training capability of hundreds of GPUs, it has been successfully applied in various industry scenarios such as government affairs, cloud services, international e-commerce, and fast-moving consumer goods.

Companies with demands for deploying large-scale model applications are welcome to contact us.
Enquiry Hotline: 400-898-7779
E-mail: [email protected]
Discord Link: https://discord.gg/zumjDWgdAs

wechat