Introduction
InnoMegrez2-Preview is a device native large language model. Megrez2 takes advantages of both the accuracy of Mixture-of-Experts (MoE) architecture and the compact size of Dense models. This preview model was trained on 5T Tokens of data. The official release, with larger training data and better reasoning and agent capabilities, will come later this year.
Model Card
Architecture | Mixture-of-Experts (MoE) |
Total Parameters | 3x7B |
Activated Parameters | 3B |
Experts Shared Frequency | 3 |
Number of Layers (Dense layer included) | 31 |
Number of Dense Layers | 1 |
Attention Hidden Dimension | 2048 |
MoE Hidden Dimension (per Expert) | 1408 |
Number of Attention Heads | 16 |
Number of Experts | 64 |
Selected Experts per Token | 6 |
Number of Shared Experts | 4 |
Vocabulary Size | 128,880 |
Context Length | 32K |
Base Frequency of RoPE | 5,000,000 |
Attention Mechanism | GQA |
Activation Function | SwiGLU |
Performance
We evaluated InnoMegrez2-Preview using the open-source evaluation tool OpenCompass on several important benchmarks. Some of the evaluation results are shown in the table below.
Benchmark | Metric | InnoMegrez2-Preview | Qwen2.5-3B | Qwen2.5-7B | Qwen3-4B | Qwen3-8B | Phi-4-mini | Gemma-3-4B | GPT-4o-mini 2024-07-18 |
---|---|---|---|---|---|---|---|---|---|
Activate Params (B) | 3.0 | 3.1 | 7.6 | 4.0 | 8.2 | 3.8 | 4.3 | - | |
Stored Params (B) | 7.5 | 3.1 | 7.6 | 4.0 | 8.2 | 3.8 | 4.3 | - | |
General Tasks | |||||||||
C-EVAL | EM | 91.7 | 68.2 | 76.2 | 72.2 | 77.9 | 40.0 | - | 66.3 |
MMLU-Pro | EM | 67.6 | 43.7 | 56.3 | - | - | 52.8 | 43.6 | - |
Instruction Tasks | |||||||||
IF-Eval | Prompt Strict | 80.2 | 58.2 | 71.2 | 81.2 | 83.0 | 68.6 | 90.2 | 80.4 |
Math & STEM Tasks | |||||||||
MATH-500 | EM | 81.6 | 65.9 | 75.5 | 84.8 | 87.4 | 64.0 | 75.6 | 78.2 |
GSM8K | EM | 83.6 | 86.7 | 91.6 | - | 93.2 | 88.6 | 89.2 | - |
Coding Tasks | |||||||||
HumanEval | Pass@1 | 74.4 | 74.4 | 84.8 | - | 85.9 | 74.4 | 71.3 | 87.2 |
MBPP | Pass@1 | 88.0 | 72.7 | 79.2 | - | 77.0 | 65.3 | 63.2 | - |
How to Run
Transformers
The latest version of transformers
is recommended or transformers>=4.52.4
is required.
The following contains a code snippet illustrating how to use the model generate content based on given inputs.
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
path = "sii-research/InnoMegrez2-Preview"
device = "cuda"
tokenizer = AutoTokenizer.from_pretrained(path, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(path, torch_dtype=torch.bfloat16, device_map=device, trust_remote_code=True)
messages = [
{"role": "user", "content": "世界上最高的山峰是哪座?"},
]
model_inputs = tokenizer.apply_chat_template(messages, return_tensors="pt", add_generation_prompt=True).to(device)
model_outputs = model.generate(
model_inputs,
do_sample=True,
max_new_tokens=1024
)
output_token_ids = [
model_outputs[i][len(model_inputs[i]):] for i in range(len(model_inputs))
]
responses = tokenizer.batch_decode(output_token_ids, skip_special_tokens=True)[0]
print(responses)
# 世界上最高的山峰是珠穆朗玛峰(Mount Everest),位于喜马拉雅山脉的中尼边境。珠穆朗玛峰的海拔高度为8,848.86米(29,031.7英尺),这一数据是由中国和尼泊尔在2020年共同宣布的最新测量结果。珠穆朗玛峰不仅是登山爱好者的圣地,也是地理和科学研究的重要对象。
How to Deploy
InnoMegrez2-Preview support using vLLM
and SGLang
as inference backends. For more information, please visit the gitHub repository.
Best Practice
To achieve optimal performance, we recommend the following settings:
Sampling Parameters: we suggest using Temperature=0.7 and TopP=0.9 .
Standardize Output Format: We recommend using prompts to standardize model outputs when benchmarking.
- Math Problems: Include "Please reason step by step, and put your final answer within \boxed{}." in the prompt.
- Multiple-Choice Questions: Add the following JSON structure to the prompt to standardize responses: "Please show your choice in the answer field with only the choice letter, e.g., "answer": "C"."
License Agreement
All our open-weight models are licensed under Apache 2.0.
Citation
If you find our work helpful, feel free to give us a cite.
Contact
If you have any questions, please feel free to submit a GitHub issue or contact WeChat groups.
- Downloads last month
- 2