Model reference · open weights
Baichuan is an open-weight language model from baichuan-inc. Baichuan-7B (BF16) weighs 14.0 GB; the smallest configuration that runs it is 2× RTX 3060 12 GB.
Summary of the baichuan-inc/Baichuan-7B model card, 2026-10-01
What it is
| Released by | baichuan-inc |
|---|---|
| Released | 2023-06-13 |
| VRAM | 14.0 GB for the weights |
What it runs on
| Card | Requests at once | Context max | Memory |
|---|---|---|---|
| 4K each | |||
| RTX 3060 12 GB | — | — | 11.6 GB |
| RTX 4060 Ti 16 GB | — | 1K | 15.4 GB |
| RTX 3090 24 GB | 4 | all 4K | 23.4 GB |
| RTX 4090 24 GB | 4 | all 4K | 23.4 GB |
| RTX 5090 32 GB | 7 | all 4K | 31.0 GB |
| L40S 48 GB | 13 | all 4K | 44.0 GB |
| A100 80 GB | 29 | all 4K | 78.2 GB |
| H100 80 GB | 28 | all 4K | 78.1 GB |
| RTX PRO 6000 Blackwell 96 GB | 35 | all 4K | 93.8 GB |
| DGX Spark (GB10) 128 GB unified | 41 | all 4K | 107 GB |
| H200 141 GB | 55 | all 4K | 138 GB |
| B200 180 GB | 73 | all 4K | 176 GB |
| 2× RTX 3060 12 GB tensor parallel | 3 | all 4K | 11.6 GB a card |
| 2× RTX 4060 Ti 16 GB tensor parallel | 7 | all 4K | 15.4 GB a card |
| 2× RTX 4090 24 GB tensor parallel | 14 | all 4K | 23.4 GB a card |
| 2× RTX 3090 24 GB tensor parallel | 14 | all 4K | 23.4 GB a card |
| 2× RTX 5090 32 GB tensor parallel | 21 | all 4K | 31.0 GB a card |
| Requests at once | 4K tokens each |
|---|---|
| 1 | 16.8 GB |
| 5 | 25.4 GB |
| 8 | 31.8 GB |
| 16 | 49.0 GB |
| 32 | 83.4 GB |
| 64 | 152 GB |
One card, with vLLM's small-card settings.
From the model card
Baichuan-7B是由百川智能开发的一个开源的大规模预训练模型。基于Transformer结构,在大约1.2万亿tokens上训练的70亿参数模型,支持中英双语,上下文窗口长度为4096。在标准的中文和英文权威benchmark(C-EVAL/MMLU)上均取得同尺寸最好的效果。
如果希望使用Baichuan-7B(如进行推理、Finetune等),我们推荐使用配套代码库Baichuan-7B。
Baichuan-7B is an open-source large-scale pre-trained model developed by Baichuan Intelligent Technology. Based on the Transformer architecture, it is a model with 7 billion parameters trained on approximately 1.2 trillion tokens. It supports both Chinese and English, with a context window length of 4096. It achieves the best performance of its size on standard Chinese and English authoritative benchmarks (C-EVAL/MMLU).
If you wish to use Baichuan-7B (for inference, finetuning, etc.), we recommend using the accompanying code library Baichuan-7B.
在同尺寸模型中Baichuan-7B达到了目前SOTA的水平,参考下面MMLU指标
Baichuan-7B使用自有的中英文双语语料进行训练,在中文上进行优化,在C-Eval达到SOTA水平
不同于LLaMA完全禁止商业使用,Baichuan-7B使用更宽松的开源协议,允许用于商业目的
Among models of the same size, Baichuan-7B has achieved the current state-of-the-art (SOTA) level, as evidenced by the following MMLU metrics.
Baichuan-7B is trained on proprietary bilingual Chinese-English corpora, optimized for Chinese, and achieves SOTA performance on C-Eval.
Unlike LLaMA, which completely prohibits commercial use, Baichuan-7B employs a more lenient open-source license, allowing for commercial purposes.
如下是一个使用Baichuan-7B进行1-shot推理的任务,根据作品给出作者名,正确输出为"夜雨寄北->李商隐"
from transformers import AutoModelForCausalLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("baichuan-inc/Baichuan-7B", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained("baichuan-inc/Baichuan-7B", device_map="auto", trust_remote_code=True)
inputs = tokenizer('登鹳雀楼->王之涣\n夜雨寄北->', return_tensors='pt')
inputs = inputs.to('cuda:0')
pred = model.generate(**inputs, max_new_tokens=64,repetition_penalty=1.1)
print(tokenizer.decode(pred.cpu()[0], skip_special_tokens=True))
The following is a task of performing 1-shot inference using Baichuan-7B, where the author's name is given based on the work, with the correct output being "One Hundred Years of Solitude->Gabriel Garcia Marquez"
from transformers import AutoModelForCausalLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("baichuan-inc/Baichuan-7B", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained("baichuan-inc/Baichuan-7B", device_map="auto", trust_remote_code=True)
inputs = tokenizer('Hamlet->Shakespeare\nOne Hundred Years of Solitude->', return_tensors='pt')
inputs = inputs.to('cuda:0')
pred = model.generate(**inputs, max_new_tokens=64,repetition_penalty=1.1)
print(tokenizer.decode(pred.cpu()[0], skip_special_tokens=True))
整体模型基于标准的Transformer结构,我们采用了和LLaMA一样的模型设计
具体参数和见下表
| Hyperparameter | Value |
|---|---|
| n_parameters | 7000559616 |
| n_layers | 32 |
| n_heads | 32 |
| d_model | 4096 |
| vocab size | 64000 |
| sequence length | 4096 |
The overall model is based on the standard Transformer structure, and we have adopted the same model design as LLaMA:
The specific parameters are as follows:
| Hyperparameter | Value |
|---|---|
| n_parameters | 7000559616 |
| n_layers | 32 |
| n_heads | 32 |
| d_model | 4096 |
| vocab size | 64000 |
| sequence length | 4096 |
我们同时开源出了和本模型配套的训练代码,允许进行高效的Finetune用于下游任务,具体参见Baichuan-7B。
We have also open-sourced the training code that accompanies this model, allowing for efficient finetuning for downstream tasks. For more details, please refer to Baichuan-7B.
在没有充分评估风险和采取缓解措施的情况下投入生产使用;任何可能被视为不负责任或有害的使用案例。
Production use without adequate assessment of risks and mitigation; any use cases which may be considered irresponsible or harmful.
Baichuan-7B可能会产生事实上不正确的输出,不应依赖它产生事实上准确的信息。Baichuan-7B是在各种公共数据集上进行训练的。尽管我们已经做出了巨大的努力来清洗预训练数据,但这个模型可能会生成淫秽、偏见或其他冒犯性的输出。
Baichuan-7B can produce factually incorrect output, and should not be relied on to produce factually accurate information. Baichuan-7B was trained on various public datasets. While great efforts have been taken to clean the pretraining data, it is possible that this model could generate lewd, biased or otherwise offensive outputs.
训练具体设置参见Baichuan-7B。
For specific training settings, please refer to Baichuan-7B.
CEval数据集是一个全面的中文基础模型评测数据集,涵盖了52个学科和四个难度的级别。我们使用该数据集的dev集作为few-shot的来源,在test集上进行了5-shot测试。
| Model 5-shot | Average | Avg(Hard) | STEM | Social Sciences | Humanities | Others | |-----------------------------|---------|-----------|------|--------
Quoted from the model card on Hugging Face. The full card is behind the Hugging Face link above.