中文 | English
openPangu-R-7B-Diffusion is a context-causal block diffusion language model with a block length of 32 and 7 billion parameters (excluding vocabulary embedding). It is built upon the pre-trained model of openPangu-Embedded-7B, which was further pre-trained on 700 billion tokens with an 8k length. After that, it was fine-tuned on 100 billion tokens of 32k-long annealing data, and finally trained for 10 epochs using 10 billion tokens of slow-thinking SFT data. The entire model training and inference process is based on the Ascend NPU.

openPangu-R-7B-Diffusion employs causal block diffusion decoding, performing diffusion decoding block by block. During the decoding process, full attention is applied within each block, while causal attention is used for the preceding context. When all tokens within a block are decoded, the entire block of tokens is stored in the context KV cache, which uses a causal attention mask. Simultaneously, the first token of the next block is decoded.

During the training of openPangu-R-7B-Diffusion, masked corpus blocks are concatenated with unmasked context. The model predicts the masked tokens for the masked corpus blocks and performs autoregressive training on the unmasked context.

| openPangu-7B-Diffusion-Base | |
|---|---|
| Architecture | Dense |
| Parameters (Non-Embedding) | 7B |
| Number of Layers | 34 |
| Hidden Dimension | 12800 |
| Attention Mechanism | GQA |
| Number of Attention Heads | 32 for Q,8 for KV |
| Vocabulary Size | 153k |
| Context Length (Natively) | 8k |
| Continued training Tokens | 700B |
| Benchmark | Metric | LLaDA-8B-Base | LLaDA-MoE-7B-A1B-Base | Dream-v0-Base-7B | openPangu-7B-Diffusion-Base |
|---|---|---|---|---|---|
| General | |||||
| MMLU | Acc | 65.90 | 64.59 | 69.50 | 70.09 |
| MMLU-Pro | Exact Match | 41.80 | 39.16 | 48.15 | 59.05 |
| CEVAL | Acc | 70.50 | 65.56 | 59.18 | 73.03 |
| CMMLU | Acc | 69.90 | 65.65 | 60.87 | 77.27 |
| BBH | Exact Match | 49.80 | 52.71 | 57.90 | 77.30 |
| Math | |||||
| GSM8K | Exact Match | 70.70 | 66.41 | 77.79 | 78.77 |
| MATH | Exact Match | 27.30 | 36.10 | 39.60 | 46.02 |
| Coding | |||||
| MBPP | Pass@1 | 38.20 | 52.40 | 56.20 | 55.80 |
| HumanEval | Pass@1 | 33.50 | 45.73 | 57.90 | 50.00 |
| Avg | 51.96 | 54.26 | 60.05 | 65.26 |
Note: The evaluation results represent the optimal values obtained after traversing the sampling settings. Typically, using alg="entropy", num_small_blocks=8 can achieve the desired results. Although openPangu-7B-Diffusion-Base has a maximum length of 8192 tokens, 512 tokens are usually sufficient for benchmarking.
Atlas 800T A2 (64GB), please refer to [Atlas 800T A2] for obtaining the driver and firmware installation packages.
The above software environment has been verified, and theoretically supports newer versions. For any questions, please submit an issue.
The following provides a simple inference example of Pangu-Diffusion-7B based on the transformers framework:
Please modify generate.py and add the model path before running.
cd inference
python generate.pyUnlike benchmarking, to achieve optimal throughput, the sampling parameters should be set to alg="confidence_threshold", threshold=0.9, num_small_blocks=1, and an appropriate batch size should be selected based on the device.
Unless otherwise noted, openPangu-7B-Diffusion-Base model is licensed under the terms and conditions of OPENPANGU MODEL LICENSE AGREEMENT VERSION 1.0, which is intended to be used permissively and enable the further development of artificial intelligence technologies. Please refer to the LICENSE file located in the root directory of the model repository for details.
Due to the technical limitations inherent in the technology on which the openPangu-7B-Diffusion-Base (“Model”) relies and the fact that the artificial intelligence generated content is automatically produced by Model, Huawei cannot make any guarantees regarding the following matters:
If you have any comments or suggestions, please submit an issue or contact openPangu@huawei.com.