ml-diffucoder  by apple

Diffusion models for code generation

created 1 month ago
664 stars

Top 51.6% on sourcepulse

GitHubView on GitHub
Project Summary

This repository provides DiffuCoder, a diffusion-based large language model for code generation, addressing limitations in existing diffusion LLMs' generation patterns and post-training strategies. It targets researchers and developers in AI code generation, offering potentially faster generation than autoregressive models and improved performance through novel techniques.

How It Works

DiffuCoder builds upon Masked Denoising Models (MDMs) and diffusion LLMs (dLLMs), investigating how their generation patterns differ from autoregressive models. It introduces a new metric, the "autoregressiveness score," to quantify causal patterns during generation. A key innovation is Coupled-GRPO, a post-training method that addresses inefficiencies in per-timestep loss computation by using a coupled-sampling scheme. This scheme ensures all tokens receive a learning signal and improves probability estimates by evaluating tokens in partially-masked contexts, offering better accuracy with modest computational overhead.

Quick Start & Requirements

  • Installation: Clone huggingface/open-r1, merge provided files, and set up the environment using conda and pip (e.g., pip install vllm==0.8.4, flash-attn==2.8.0.post1, setuptools, .[code]).
  • Prerequisites: Python 3.11, CUDA, E2B API token (for code sandbox), wandb account.
  • Data Preparation: Requires TIGER-Lab/AceCode-89K dataset for GRPO training.
  • Resources: Training requires a code sandbox and wandb for logging. Inference requires a CUDA-enabled GPU.
  • Links: Open-R1, Huggingface Models, Paper

Highlighted Details

  • Models are available on Huggingface (Base, Instruct, cpGRPO).
  • Supports inference with configurable TOKEN_PER_STEP for performance/speed trade-offs.
  • Implements Coupled-GRPO for improved diffusion LLM training.
  • Code evaluation leverages Qwen2.5-Coder.

Maintenance & Community

  • Project is associated with Apple and research contributions from multiple authors.
  • Updates mention ongoing MLX support for Apple Silicon.
  • Code is based on huggingface/open-r1 and LLaMA-Factory.

Licensing & Compatibility

  • The README does not explicitly state a license. The underlying open-r1 project is Apache 2.0 licensed. Compatibility for commercial use or closed-source linking requires clarification.

Limitations & Caveats

MLX support for Apple Silicon is listed as "in progress" as of June 2025, indicating potential limitations for users on that platform. The specific license for this repository is not clearly stated, which could impact commercial adoption.

Health Check
Last commit

3 weeks ago

Responsiveness

Inactive

Pull Requests (30d)
1
Issues (30d)
5
Star History
672 stars in the last 90 days

Explore Similar Projects

Starred by Stas Bekman Stas Bekman(Author of Machine Learning Engineering Open Book; Research Engineer at Snowflake).

HALOs by ContextualAI

0.2%
873
Library for aligning LLMs using human-aware loss functions
created 1 year ago
updated 2 weeks ago
Starred by Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems), Alex Cheema Alex Cheema(Cofounder of EXO Labs), and
1 more.

recurrent-pretraining by seal-rg

0.1%
806
Pretraining code for depth-recurrent language model research
created 5 months ago
updated 2 weeks ago
Starred by Omar Sanseviero Omar Sanseviero(DevRel at Google DeepMind), Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems), and
3 more.

Medusa by FasterDecoding

0.2%
3k
Framework for accelerating LLM generation using multiple decoding heads
created 1 year ago
updated 1 year ago
Starred by Ross Taylor Ross Taylor(Cofounder of General Reasoning; Creator of Papers with Code), Daniel Han Daniel Han(Cofounder of Unsloth), and
4 more.

open-instruct by allenai

0.2%
3k
Training codebase for instruction-following language models
created 2 years ago
updated 14 hours ago
Starred by Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems), Jeff Hammerbacher Jeff Hammerbacher(Cofounder of Cloudera), and
10 more.

open-r1 by huggingface

0.2%
25k
SDK for reproducing DeepSeek-R1
created 6 months ago
updated 3 days ago
Feedback? Help us improve.