HyperAI

DiffuCode-7B-cpGRPO: A Code Generation Model Based on Mask Diffusion Technology

1. Tutorial Introduction

GitHub Stars

DiffuCoder-7B-cpGRPO is a masked diffusion-based code generation model (dLLM) first proposed by the Apple team in a related paper on June 25, 2025. It has been trained with more than 20,000 carefully selected coding examples. The model aims to generate and edit code through iterative denoising, rather than the traditional left-to-right autoregressive generation. A notable feature of DiffuCoder-7B-cpGRPO is that it does not strictly rely on left-to-right generation to generate code, which makes it score 4.4% higher than other diffusion-based programming models in mainstream programming benchmarks. This non-sequential code generation capability enables it to show higher flexibility and efficiency in code editing and generation tasks. The relevant paper results are "DiffuCoder: Understanding and Improving Masked Diffusion Models for Code Generation".

This tutorial uses resources for a single RTX 4090 card.

2. Project Examples

3. Operation steps

1. After starting the container, click the API address to enter the Web interface

2. Usage steps

If "Bad Gateway" is displayed, it means the model is initializing. Since the model is large, please wait about 2-3 minutes and refresh the page.

Parameter Description

  • Advanced Settings:
    • Temperature: controls the generation diversity, the higher the more random, the lower the more deterministic.
    • Top-p: The cumulative threshold of probability sampling. The smaller the value, the more conservative the generation.
    • Max-tokens: Limits the maximum length of a single generation of the model.

4. Discussion

🖌️ If you see a high-quality project, please leave a message in the background to recommend it! In addition, we have also established a tutorial exchange group. Welcome friends to scan the QR code and remark [SD Tutorial] to join the group to discuss various technical issues and share application effects↓

Citation Information

The citation information for this project is as follows:

@article{gong2025diffucoder,
  title={DiffuCoder: Understanding and Improving Masked Diffusion Models for Code Generation},
  author={Shansan Gong, Ruixiang Zhang, Huangjie Zheng, Jiatao Gu, Navdeep Jaitly, Lingpeng Kong, Yizhe Zhang},
  year={2025},
  eprint={2506.20639},
  archivePrefix={arXiv},
  primaryClass={cs.CL},
  url={https://arxiv.org/abs/2506.20639},
}