Residual Context Diffusion (ours)

June 28, 2026 · View on GitHub

Residual Context Diffusion (RCD)

Unleashing the Potential of Diffusion LLMs via Residual Denoising

Project Page | arXiv | OpenReview | Models

train_infer_0126

example

Example generation on AIME24. RCD increases parallelism by 4x while maintaining the baseline's peak accuracy.

Introduction

This repository contains the code to replicate our study in "Residual Context Diffusion Language Models". In this study, we point out that diffusion Large Language Models (dLLMs) enable parallel decoding but often trail autoregressive models in accuracy. A key culprit is the inference-time remasking strategy that commits only high-confidence tokens and discards the rest, wasting intermediate computation.

RCD introduces a residual denoising mechanism that turns discarded token distributions into contextual residuals and injects them into the next denoising step. With a two-stage training pipeline, RCD avoids backprop-through-time memory costs while preserving the benefits of residual feedback.

News

  • [2026/06] RCD inference is now reference-free: cold-start initialization removes the need for a draft/reference model during generation.
  • [2026/06] JetEngine for RCD released: a dedicated CUDA/Triton inference engine for block-diffusion LLMs, optimized for RCD's residual denoising with continuous batching and fused kernels. Supports both RCD and SeqD. See jetengine/.
  • [2026/05] RCD is accepted at ICML 2026.
  • [2026/02] Project page, arXiv and models are published.

Performance

TL;DR: RCD consistently improves diffusion reasoning accuracy over Sequential Denoising (SeqD) across both SDAR and LLaDA, with the biggest gains on harder competition-style benchmarks (AIME24/25) and MinervaMath.

SDAR

  • Models: SDAR 4B / 8B, block size b=32 / 64 (KV cache reuse)
  • Eval: SeqD/RCD use 16,384 sequence length; Chat uses 512 tokens (and 1,024 for AIME); confidence threshold = 0.85
ModelVariantGSM8K1MATH500AIME24AIME25
SDAR-4B-b32Chat286.1350.205.832.50
SDAR-4B-b32SeqD81.7361.206.0411.88
SDAR-4B-b32RCD84.9165.409.1717.08
SDAR-4B-b64Chat285.9049.806.251.67
SDAR-4B-b64SeqD78.8556.804.177.29
SDAR-4B-b64RCD87.0468.4011.0414.79
SDAR-8B-b32Chat288.4050.006.464.17
SDAR-8B-b32SeqD86.5065.8011.6714.79
SDAR-8B-b32RCD90.4576.2018.9620.00
SDAR-8B-b64Chat288.3251.605.202.50
SDAR-8B-b64SeqD82.8764.207.089.79
SDAR-8B-b64RCD86.0574.4018.7516.04

LLaDA

  • Eval: sequence length 512, single-token-per-step decoding
ModelVariantGSM8KMinervaMath
LLaDABase370.3031.40
LLaDASeqD75.7431.10
LLaDARCD78.0937.00

Model Zoo

All checkpoints are available on HuggingFace.

SeqD Models (Sequential Denoising — Baseline)

NameURL
SeqD-SDAR-4B-b32-Thinkingmodel
SeqD-SDAR-4B-b64-Thinkingmodel
SeqD-SDAR-8B-b32-Thinkingmodel
SeqD-SDAR-8B-b64-Thinkingmodel
SeqD-LLaDA-8B-Instructmodel

RCD Models (Residual Context Diffusion — Ours)

Since June 2026, RCD inference uses cold-start initialization and no longer requires a separate draft/reference model at generation time.

NameURL
RCD-SDAR-4B-b32-Thinkingmodel
RCD-SDAR-4B-b64-Thinkingmodel
RCD-SDAR-8B-b32-Thinkingmodel
RCD-SDAR-8B-b64-Thinkingmodel
RCD-LLaDA-8B-Instructmodel

Quick Start

The standalone generation scripts require only transformers:

pip install transformers==4.52.3

# Sequential Denoising (baseline)
CUDA_VISIBLE_DEVICES=0 python seqd-sdar/generate.py \
  --model_dir yuezhouhu/SeqD-SDAR-4B-b64-Thinking \
  --trust_remote_code \
  --block_length 64 \
  --denoising_steps 64 \
  --temperature 0 \
  --dtype bfloat16 \
  --confidence_threshold 0.85

# Residual Context Diffusion (ours)
CUDA_VISIBLE_DEVICES=0 python rcd-sdar/generate.py \
  --model_dir yuezhouhu/RCD-SDAR-4B-b64-Thinking \
  --trust_remote_code \
  --block_length 64 \
  --denoising_steps 64 \
  --temperature 0 \
  --dtype bfloat16 \
  --confidence_threshold 0.85

Repository Layout

residual-context-diffusion/
├── rcd-sdar/                  # RCD on SDAR backbone
│   ├── generate.py            #   Standalone generation
│   ├── lighteval/             #   Evaluation harness
│   ├── recipes/               #   Training recipes
│   ├── eval_simple.sh         #   Eval: GSM8K + MATH500
│   └── eval_aime.sh           #   Eval: AIME24 + AIME25

├── seqd-sdar/                 # SeqD on SDAR backbone (baseline)
│   ├── generate.py
│   ├── lighteval/
│   ├── recipes/
│   ├── eval_simple.sh
│   └── eval_aime.sh

├── rcd-llada/                 # RCD on LLaDA backbone
│   ├── examples/              #   Eval and training examples
│   └── dllm/                  #   dLLM model code

├── seqd-llada/                # SeqD on LLaDA backbone (baseline)
│   ├── examples/
│   └── dllm/

├── jetengine/                 # High-performance inference engine
│   ├── rcd/                   #   RCD engine (with residual guidance)
│   ├── seqd/                  #   SeqD engine (baseline)
│   └── README.md

└── assets/                    # Figures and diagrams

Installation

Each sub-project is self-contained and has its own environment. Follow the per-directory README for setup:

  • RCD SDAR: rcd-sdar/README.md
  • SeqD SDAR: seqd-sdar/README.md
  • RCD LLaDA: rcd-llada/README.md
  • SeqD LLaDA: seqd-llada/README.md

Evaluation

  • SDAR: rcd-sdar/eval_simple.sh / rcd-sdar/eval_aime.sh (RCD) and corresponding scripts under seqd-sdar/
  • LLaDA: rcd-llada/examples/llada/eval_openmathinstruct.sh and seqd-llada/examples/llada/eval_openmathinstruct.sh

High-Performance Inference (JetEngine)

For batched, high-throughput inference or RL training loops, see jetengine/README.md. JetEngine provides:

  • Paged KV-cache with block-level allocation
  • Fused Triton attention and MoE kernels
  • Native block-diffusion scheduling
  • Residual hidden-state support (RCD engine only)

Training

Training recipes are in each method's directory:

  • SDAR: rcd-sdar/recipes/ (RCD) and seqd-sdar/recipes/ (SeqD)
  • LLaDA: rcd-llada/examples/llada/ and seqd-llada/examples/llada/

Citation

@misc{hu2026residualcontextdiffusionlanguage,
      title={Residual Context Diffusion Language Models}, 
      author={Yuezhou Hu and Harman Singh and Monishwaran Maheswaran and Haocheng Xi and Coleman Hooper and Jintao Zhang and Aditya Tomar and Michael W. Mahoney and Sewon Min and Mehrdad Farajtabar and Kurt Keutzer and Amir Gholami and Chenfeng Xu},
      year={2026},
      eprint={2601.22954},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2601.22954}, 
}

Footnotes

  1. We observed potential data contamination in the original Chat models on GSM8K, which may inflate the Chat baseline.

  2. Chat variants are instruction-following models; SeqD/RCD are further adapted for mathematical reasoning. 2 3 4

  3. LLaDA-Base results are taken from the original LLaDA paper.