Skip to content

About

Reference implementation of Sticky Jump Diffusions (SJD): a unifying view of masked, continuous, and hybrid diffusion

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

Sticky Jump Diffusions

Reference implementation for the paper "Sticky Jump Diffusions: A Unifying View of Masked, Continuous, and Hybrid Diffusion" (arXiv:2607.10951). Sticky Jump Diffusions (SJDs) are continuous-time Markov processes on R^d whose discrete anchors are the token embeddings: in forward time, anchors release their mass at a hazard rate and diffuse in the ambient space; the time reversal couples a score-driven SDE with a sticky jump kernel whose rate and destination are fixed by flux balance. A single denoising classifier trained by plain cross-entropy supplies both the score and the per-anchor reverse hazards (Denoising Hazard Matching). This repo contains the SJD implementation together with the paper's three experiments — CIFAR-10, Text8, and Sudoku — and the discrete/continuous baselines trained under the same harness (MD4, MDLM, DDPM, Bit Diffusion).

Reverse-time trajectories for masked diffusion, continuous diffusion, and Sticky Jump Diffusion against the data PMF.

Unlike masked diffusion, SJD follows continuous score gradients through the ambient space; unlike continuous diffusion, its sticky jumps snap mass onto the discrete anchors, so it outputs exact tokens without a final projection step.

Installation

With a virtual environment (Python 3.10):

python3.10 -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt

or with conda:

conda env create -f environment.yml
conda activate sticky

The pinned jax==0.4.38 is the CPU build; on CUDA 12 GPUs install jax[cuda12]==0.4.38 instead. All commands below are run from the repo root with src on the import path:

export PYTHONPATH=src

Data setup

Text8 — downloads the 100M-character Mahoney corpus, splits 90M/5M/5M, and writes pretokenized .npy chunks plus the valid-word reference vocabulary to data/text8/:

python tools/prepare_text8.py

Sudoku — the Shah et al. train/test boards are downloaded automatically on first use to data/sudoku/; to fetch them ahead of time:

python tools/prepare_sudoku_data.py

CIFAR-10 — fetched automatically via TensorFlow Datasets into data/cifar10/ on first use. The canonical CIFAR-10 experiment additionally needs the frozen sinusoidal anchor table:

python tools/gen_cifar_sin8.py   # writes data/anchors/cifar_sin8.npz

Training

Each experiment bundle carries the paper's forward process, model, sampler, eval, and training settings:

python -m sticky.cli.train experiment=cifar10/sjd_cifar10   # value-space blur, sigma_B = 2.5
python -m sticky.cli.train experiment=text8/sjd_text8       # 1D Gaussian blend, sigma_W = 1.5
python -m sticky.cli.train experiment=sudoku/sjd_sudoku     # constraint-graph kernel, sigma_W = 1.5

Hydra outputs (checkpoints, metrics, samples) are written under outputs/<date>/<time>_<experiment>/. Useful overrides:

  • forward/[email protected]=none — the identity-kernel hybrid arm (the paper's CADD-equivalent baseline; for CIFAR-10 also select the learned anchors with model/[email protected]=normal_normalized).
  • experiment.forward.blur.sigma=... — blend bandwidth sweeps.
  • training.max_steps=..., experiment.training.num_train_steps=... — shorter runs.
  • wandb.enabled=true wandb.entity=<you> wandb.project=<proj> — Weights & Biases logging (off by default).

The discrete/continuous baselines train under the same harness:

python -m sticky.cli.train experiment=cifar10/md4_cifar10     # also: mdlm, ddpm, bitdiff

Evaluation

Training runs their configured evals periodically (FID/IS for CIFAR-10, valid-word metrics for Text8, board-completion metrics for Sudoku). Checkpoints can be re-evaluated offline:

python -m sticky.cli.eval_checkpoint experiment=cifar10/sjd_cifar10 \
    offline_eval.run_dir=outputs/<date>/<time>_<run>/ \
    offline_eval.checkpoint_source=best

Citation

@article{jutrasdube2026sticky,
  title   = {Sticky Jump Diffusions: A Unifying View of Masked, Continuous, and Hybrid Diffusion},
  author  = {Jutras-Dub{\'e}, Pascal and Pynadath, Patrick and Lu, Jeremy and Gao, Yuan and Zhang, Ruqi},
  journal = {arXiv preprint arXiv:2607.10951},
  year    = {2026}
}

License

Apache License 2.0 (see LICENSE). Files ported from Google's MD4 implementation retain their original Apache-2.0 copyright headers.

Acknowledgements

Parts of this implementation are adapted from or follow the recipes of reference codebases: google-deepmind/md4 (MD4 model, UNet backbone, and training utilities; Apache-2.0), MDLM (Sahoo et al., 2024), CANDI (Pynadath et al., 2025) for the Text8 recipe and valid-word metric, CADD (Zheng et al., 2025), CDCD (Dieleman et al., 2022) for the anchor normalization, the ADM UNet (Dhariwal & Nichol, 2021), and the Sudoku benchmark of Shah et al., 2024.

About

Reference implementation of Sticky Jump Diffusions (SJD): a unifying view of masked, continuous, and hybrid diffusion

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages