apple-aiml-research/ml-diffucoder

DiffuCoder: Understanding and Improving Masked Diffusion Models for Code Generation

What it solves

DiffuCoder addresses the limitations of autoregressive (AR) models in code generation, specifically exploring how masked diffusion models (dLLMs) can generate code more flexibly and efficiently. It also tackles the inefficiency and high variance in post-training dLLMs by introducing a new sampling scheme to ensure all tokens receive a learning signal.

How it works

DiffuCoder is a masked diffusion model for code generation. Unlike AR models that generate text left-to-right, it uses a diffusion process to refine tokens. To improve performance, the project introduces Coupled-GRPO, a post-training method that uses a coupled-sampling scheme. This scheme selects pairs of timesteps that together cover all target tokens, ensuring every token's log-probability is computed at least once and providing more accurate probability estimates in a realistic partially-masked context.

Who it’s for

This project is for AI researchers and developers working on non-autoregressive generation, diffusion-based language models, and specialized code generation models.

Highlights

  • Coupled-GRPO: A novel post-training method to reduce variance and improve learning efficiency in diffusion LLMs.
  • Non-Linear Generation: Ability to break the strict left-to-right bias of traditional AR models.
  • Autoregressiveness Score: A new metric to quantify the causal patterns during the generation process.
  • Pre-trained Models: Availability of Base, Instruct, and cpGRPO versions of the 7B model on Hugging Face.

Related

  • Project
  • Project
  • Project
  • Project