commit c30215583c1f83c21856e7ec1de4cd9f512f5f05 Author: ModelHub XC Date: Sat Aug 1 17:35:11 2026 +0800 初始化项目,由ModelHub XC社区提供模型 Model: nanbeige/Nanbeige4-3B-Base Source: Original Platform diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..0cefdb3 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,52 @@ +*.7z filter=lfs diff=lfs merge=lfs -text +*.arrow filter=lfs diff=lfs merge=lfs -text + + +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.ftz filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.h5 filter=lfs diff=lfs merge=lfs -text +*.joblib filter=lfs diff=lfs merge=lfs -text +*.lfs.* filter=lfs diff=lfs merge=lfs -text + +*.msgpack filter=lfs diff=lfs merge=lfs -text +*.onnx filter=lfs diff=lfs merge=lfs -text +*.ot filter=lfs diff=lfs merge=lfs -text +*.parquet filter=lfs diff=lfs merge=lfs -text +*.pb filter=lfs diff=lfs merge=lfs -text +*.pt filter=lfs diff=lfs merge=lfs -text +*.pth filter=lfs diff=lfs merge=lfs -text +*.rar filter=lfs diff=lfs merge=lfs -text +saved_model/**/* filter=lfs diff=lfs merge=lfs -text +*.tar.* filter=lfs diff=lfs merge=lfs -text +*.tflite filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zstandard filter=lfs diff=lfs merge=lfs -text +*.tfevents* filter=lfs diff=lfs merge=lfs -text +*.db* filter=lfs diff=lfs merge=lfs -text +*.ark* filter=lfs diff=lfs merge=lfs -text +**/*ckpt*data* filter=lfs diff=lfs merge=lfs -text +**/*ckpt*.meta filter=lfs diff=lfs merge=lfs -text +**/*ckpt*.index filter=lfs diff=lfs merge=lfs -text + +*.ckpt filter=lfs diff=lfs merge=lfs -text +*.gguf* filter=lfs diff=lfs merge=lfs -text +*.ggml filter=lfs diff=lfs merge=lfs -text +*.llamafile* filter=lfs diff=lfs merge=lfs -text +*.pt2 filter=lfs diff=lfs merge=lfs -text +*.mlmodel filter=lfs diff=lfs merge=lfs -text +*.npy filter=lfs diff=lfs merge=lfs -text +*.npz filter=lfs diff=lfs merge=lfs -text +*.pickle filter=lfs diff=lfs merge=lfs -text +*.pkl filter=lfs diff=lfs merge=lfs -text +*.tar filter=lfs diff=lfs merge=lfs -text +*.wasm filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text +*tfevents* filter=lfs diff=lfs merge=lfs -text + +tokenizer.model filter=lfs diff=lfs merge=lfs -text +model.safetensors filter=lfs diff=lfs merge=lfs -text +tokenizer.json filter=lfs diff=lfs merge=lfs -text +pytorch_model.bin filter=lfs diff=lfs merge=lfs -text \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..1168fc2 --- /dev/null +++ b/README.md @@ -0,0 +1,127 @@ +--- +license: apache-2.0 +language: +- en +- zh +library_name: transformers +pipeline_tag: text-generation +tags: +- llm +- nanbeige +--- +
+ +Nanbeige Logo +
+ + +# 1. Introduction + +Nanbeige4-3B-Base is a **3B-parameter base model** within the fourth-generation Nanbeige LLM family. +It showcases that even a compact model can achieve advanced performances through continuous enhancements in data quality and training methodologies. +When performing supervised fine-tuning (SFT) on the same training data, our model significantly outperforms open-source models of the same size, and even surpasses larger models such as Qwen3-8B. + +* Technical Report: https://arxiv.org/pdf/2512.06266 + +
+ + +
+ +# 2. Model Summary + +Training Data
+ + * We constructed a comprehensive **23T-tokens** training corpus from web texts, books, code, and papers, meticulously filtered through a hybrid strategy of tagging-based scoring and retrieval-based recalling. + This foundation was then augmented with **knowledge-dense and reasoning-intensive synthetic data**, including Q&A pairs, textbooks, and Long-COTs, which significantly benefited the downstream task performance. + + +Training Recipe
+ + * We designed an innovative **FG-WSD (Fine-Grained Warmup-Stable-Decay)** training scheduler, meticulously refining the conventional WSD approach. +This scheduler was implemented with a **fine-grained, quality-progressive data curriculum**, dividing the Stable stage into multiple phases with progressively improved data mixtures. Compared to the vanilla WSD, our method achieved notable performance gains. During the Decay stage, we increased the proportion of math, code, synthetic QA, and synthetic Long-COT data to further enhance reasoning capabilities. + | Stage | Training Tokens | Learning Rate | + |-------------------------------|-----------------|-----------------------| + | Warmup Stage | 0.1T | 0 ——> 4.5e-4 | + | Diversity-Enriched Stable Stage| 12.4T | Constant 4.5e-4 | + | High-Quality Stable Stage | 6.5T | Constant 4.5e-4 | + | Decay and Long-Context Stage | 4T | 4.5e-4 ——> 1.5e-6 |

+ + + +# 3. Model Performance + +For model performance comparison, we fine-tuned both our base model and the Qwen series base models using the same fine-tuning data and evaluated their downstream task metrics. We believe that when evaluating base models, this end-to-end validation approach better reflects the model's ultimate performance in downstream tasks compared to the few-shot testing approach. + +To ensure a fair comparison, we conducted experiments with three distinct datasets, including [Nemotron-Dataset-v1](https://huggingface.co/datasets/nvidia/Nemotron-Post-Training-Dataset-v1), [Ring-lite-sft-data](https://huggingface.co/datasets/inclusionAI/Ring-lite-sft-data), and [OpenThoughts3](https://huggingface.co/datasets/open-thoughts/OpenThoughts3-1.2M). For each dataset, we randomly select 500k training samples for SFT experiments. + +* Finetuned with Nemotron-Dataset-v1 +| Model | AIME2024 | AIME2025 | Math-500 | GPQA | +|--------------------|----------|----------|----------|------| +| Qwen3-4B-Base | 24.6 | 25.0 | 90.4 | 44.6 | +| Qwen3-8B-Base | 37.9 | 29.6 | 91.1 | 48.9 | +| **Nanbeige4-3B-Base** | **52.9** | **40.8** | **93.4** | **53.4** | + +* Finetuned with Ring-lite-sft-data +| Model | AIME2024 | AIME2025 | Math-500 | GPQA | +|--------------------|----------|----------|----------|------| +| Qwen3-4B-Base | 40.4 | 31.3 | 93.6 | 51.4 | +| Qwen3-8B-Base | 50.0 | 35.8 | 94.4 | 55.1 | +| **Nanbeige4-3B-Base** | **56.8** | **45.3** | **95.5** | **57.7** | + +* Finetuned with OpenThoughts3 +| Model | AIME2024 | AIME2025 | Math-500 | GPQA | +|--------------------|----------|----------|----------|------| +| Qwen3-4B-Base | 52.9 | 42.1 | 93.2 | 49.6 | +| Qwen3-8B-Base | 60.4 | 47.1 | **95.0** | 55.3 | +| **Nanbeige4-3B-Base** | **62.4** | **49.2** | 94.6 | **56.9** | + +The results demonstrate that **Nanbeige4-3B-Base** significantly outperforms Qwen3-4B-Base, and even surpasses the larger Qwen3-8B-Base, highlighting the greater potential of our base model after fine-tuning. This advantage stems from the optimized training recipe during our Stable stage and the extensive high-quality synthetic data incorporated during the Decay stage. + + +## 4. Quickstart + +``` +from transformers import AutoModelForCausalLM, AutoTokenizer +tokenizer = AutoTokenizer.from_pretrained( + 'Nanbeige/Nanbeige4-3B-Base', + use_fast=False, + trust_remote_code=True +) +model = AutoModelForCausalLM.from_pretrained( + 'Nanbeige/Nanbeige4-3B-Base', + torch_dtype='auto', + device_map='auto', + trust_remote_code=True +) +prompt = "中国的首都是" +input_ids = tokenizer(prompt, return_tensors='pt').input_ids +output_ids = model.generate(input_ids.to('cuda')) +resp = tokenizer.decode(output_ids[0][len(input_ids[0]):], skip_special_tokens=True) +print(resp) +``` + + +# 5. Limitations + +While we place great emphasis on the safety of the model during the training process, striving to ensure that its outputs align with ethical and legal requirements, it may not completely avoid generating unexpected outputs due to the model's size and probabilistic nature. These outputs may include harmful content such as bias or discrimination. Please don't propagate such content. We do not assume any responsibility for the consequences resulting from the dissemination of inappropriate information. +
+ +# 6. Citation +If you find our model useful or want to use it in your projects, please cite as follows: +``` +@misc{yang2025nanbeige43btechnicalreportexploring, + title={Nanbeige4-3B Technical Report: Exploring the Frontier of Small Language Models}, + author={Chen Yang and Guangyue Peng and Jiaying Zhu and Ran Le and Ruixiang Feng and Tao Zhang and Wei Ruan and Xiaoqi Liu and Xiaoxue Cheng and Xiyun Xu and Yang Song and Yanzipeng Gao and Yiming Jia and Yun Xing and Yuntao Wen and Zekai Wang and Zhenwei An and Zhicong Sun and Zongchao Chen}, + year={2025}, + eprint={2512.06266}, + archivePrefix={arXiv}, + primaryClass={cs.CL}, + url={https://arxiv.org/abs/2512.06266}, +} +``` +
+ +# 7. Contact +If you have any questions, please raise an issue or contact us at nanbeige@126.com. +
diff --git a/added_tokens.json b/added_tokens.json new file mode 100644 index 0000000..d7e6f6d --- /dev/null +++ b/added_tokens.json @@ -0,0 +1,7 @@ +{ + "": 166104, + "": 166103, + "<|endoftext|>": 166102, + "<|im_end|>": 166101, + "<|im_start|>": 166100 +} diff --git a/config.json b/config.json new file mode 100644 index 0000000..431d9f7 --- /dev/null +++ b/config.json @@ -0,0 +1,27 @@ +{ + "architectures": [ + "LlamaForCausalLM" + ], + "attention_bias": false, + "attention_dropout": 0.0, + "bos_token_id": 1, + "eos_token_id": 2, + "hidden_act": "silu", + "hidden_size": 2560, + "initializer_range": 0.02, + "intermediate_size": 10496, + "max_position_embeddings": 32768, + "model_type": "llama", + "num_attention_heads": 20, + "num_hidden_layers": 32, + "num_key_value_heads": 4, + "pretraining_tp": 1, + "rms_norm_eps": 1e-05, + "rope_scaling": null, + "rope_theta": 5000000, + "tie_word_embeddings": false, + "torch_dtype": "bfloat16", + "transformers_version": "4.38.2", + "use_cache": true, + "vocab_size": 166144 +} diff --git a/configuration.json b/configuration.json new file mode 100644 index 0000000..bbeeda1 --- /dev/null +++ b/configuration.json @@ -0,0 +1 @@ +{"framework": "pytorch", "task": "text-generation", "allow_remote": true} \ No newline at end of file diff --git a/figures/nbg.png b/figures/nbg.png new file mode 100644 index 0000000..3466c5a Binary files /dev/null and b/figures/nbg.png differ diff --git a/figures/performance_base.png b/figures/performance_base.png new file mode 100644 index 0000000..91c49d0 Binary files /dev/null and b/figures/performance_base.png differ diff --git a/generation_config.json b/generation_config.json new file mode 100644 index 0000000..02fd380 --- /dev/null +++ b/generation_config.json @@ -0,0 +1,6 @@ +{ + "_from_model_config": true, + "bos_token_id": 1, + "eos_token_id": 2, + "transformers_version": "4.38.2" +} diff --git a/model.safetensors b/model.safetensors new file mode 100644 index 0000000..8177e11 --- /dev/null +++ b/model.safetensors @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d7a6ede44a91b758b5da0ece5272c740587f0e483ec5d250c451cc6c33d84ad1 +size 7867308040 diff --git a/pytorch_model.bin b/pytorch_model.bin new file mode 100644 index 0000000..be3045e --- /dev/null +++ b/pytorch_model.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f0df581bc7823d94e4b8cbf7ccc53415bf6aef20e48e0374bfc49d2fd65cc549 +size 7867370154 diff --git a/tokenizer.json b/tokenizer.json new file mode 100644 index 0000000..84eb726 --- /dev/null +++ b/tokenizer.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:34bdaf57c31aef664b6e62c3b4fbdcb49171508c8d38942413a92d4a28707866 +size 9840344 diff --git a/tokenizer.model b/tokenizer.model new file mode 100644 index 0000000..5dc56ce --- /dev/null +++ b/tokenizer.model @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fb41d04798b714520a9b075727b0226538b7330254299062742c50ec8374bc36 +size 2782298 diff --git a/tokenizer_config.json b/tokenizer_config.json new file mode 100644 index 0000000..b832f96 --- /dev/null +++ b/tokenizer_config.json @@ -0,0 +1,61 @@ +{ + "add_bos_token": true, + "add_eos_token": false, + "add_prefix_space": true, + "added_tokens_decoder": { + "0": { + "content": "", + "lstrip": false, + "normalized": false, + "rstrip": false, + "single_word": false, + "special": true + }, + "1": { + "content": "", + "lstrip": false, + "normalized": false, + "rstrip": false, + "single_word": false, + "special": true + }, + "2": { + "content": "", + "lstrip": false, + "normalized": false, + "rstrip": false, + "single_word": false, + "special": true + }, + "166103": { + "content": "", + "lstrip": false, + "normalized": false, + "rstrip": false, + "single_word": false, + "special": true + }, + "166104": { + "content": "", + "lstrip": false, + "normalized": false, + "rstrip": false, + "single_word": false, + "special": true + } + }, + "additional_special_tokens": [ + "" + ], + "bos_token": "", + "clean_up_tokenization_spaces": false, + "eos_token": "", + "legacy": true, + "model_max_length": 1000000000000000019884624838656, + "pad_token": null, + "sp_model_kwargs": {}, + "spaces_between_special_tokens": false, + "tokenizer_class": "LlamaTokenizer", + "unk_token": "", + "use_default_system_prompt": false +}