[ICML 2026 (Spotlight)] Alignment-Guided Score Matching
for Text-to-Image Alignment in Diffusion Models
TL;DR: AGSM is a lightweight reward-free post-training method that improves text-image alignment in diffusion models.
Jaa-Yeon Lee*, Yeobin Hong*, Taesung Kwon, Jong Chul Ye†.
KAIST
- No external reward. No reward model, preference labels, or human feedback.
-
No rollout or
$x_0$ approximation. No full denoising trajectories or Tweedie-style reconstruction. - No credit assignment. Alignment signals are computed directly at each timestep.
- Timestep-wise implicit reward. Derived from the model's own score-matching likelihood via Plackett-Luce modeling.
- Alignment-guided score matching. Turns text-image alignment into a score-matching target on the forward noising process.
- Positive/negative soft tokens. Lightweight guidance for matched and mismatched text-image pairs.
- [2026.06.21] Our code is released on Github.
- [2026.05.29] Our paper is released on arXiv.
- [2026.05.01] Our paper is accepted to ICML 2026 as a Spotlight.
git clone [email protected]:jaayeon/AGSM.git
cd AGSM
conda env create -f environment.yaml
conda activate agsmIf you already have a compatible Python environment:
pip install -r requirements.txttrain.py # final DDP AGSM training code
sample.py # generate samples from learned AGSM tokens
eval.py # ImageReward/CLIP/PickScore evaluation
sampler.py # SD1.5, SDXL, and SD3 samplers with AGSM tokens
transformer.py # token-injected diffusion model wrappers
dataset/ # COCO dataset loader
scripts/ # clean launch scripts
checkpoints/ # released AGSM token checkpoints
Set DATADIR to the parent directory containing COCO:
DATADIR/
└── coco/
├── train2017/
├── val2017/
└── annotations/
├── captions_train2017.json
└── captions_val2017.json
DATADIR=/path/to/datasets \
MODEL=sd3 \
NPROC_PER_NODE=1 \
scripts/train_coco.shThe trainer loads images directly by default and writes checkpoints/validation samples under LOGDIR, which defaults to ./outputs/train.
If you already have precomputed latents and prompt embeddings, set USE_PRECOMPUTED_ENCODINGS=true and ENCODING_DIR=/path/to/encodings_sd3.
The launch scripts are configured through environment variables. Common overrides are:
| Variable | Used by | Description |
|---|---|---|
MODEL |
train/sample/eval | One of sd3, sd1.5, sdxl. |
DATADIR |
train/sample/eval | Parent directory containing coco/. |
NPROC_PER_NODE |
train | Number of DDP processes/GPUs for torchrun. |
LOGDIR |
train | Training output directory. |
NUM_SAMPLES |
sample/eval | -1 for all COCO validation images, or an integer. |
OUTPUT_DIR |
sample | Sampling output directory. |
RESULT_ROOT |
eval | Directory containing sampled images/results JSON. |
BENCHMARKS |
eval | Comma-separated evaluation metrics. |
Released AGSM token checkpoints are included under checkpoints/ and mirrored on Hugging Face. To sample with the default SD3 checkpoint:
| Model | Checkpoint | CFG |
|---|---|---|
sd3 |
checkpoints/sd3 |
4.0 |
sd1.5 |
checkpoints/sd1.5 |
7.0 |
sdxl |
checkpoints/sdxl |
7.0 |
DATADIR=/path/to/datasets \
MODEL=sd3 \
scripts/sample_coco.shUse MODEL=sd1.5 or MODEL=sdxl to use the corresponding released checkpoint. You can still override CHECKPOINT_DIR, CFG_SCALE, or UNCON2NEG.
This creates an image folder and a matching results-*.json file under OUTPUT_DIR.
After sampling, evaluate the matching results:
DATADIR=/path/to/datasets \
MODEL=sd3 \
scripts/eval_coco.shBy default, samples are written to ./outputs/samples/${MODEL} and evaluation reads from the same location.
Use BENCHMARKS to choose metrics, for example:
BENCHMARKS=ImageReward-v1.0,CLIP,PickScore scripts/eval_coco.shWANDB=falseby default. SetWANDB=trueinscripts/train_coco.shif you want W&B logging.- Generated data, logs, checkpoints, and local datasets are ignored by git.
@article{lee2026alignment,
title={Alignment-Guided Score Matching for Text-to-Image Alignment in Diffusion Models},
author={Lee, Jaa-Yeon and Hong, Yeobin and Kwon, Taesung and Ye, Jong Chul},
journal={arXiv preprint arXiv:2605.30038},
year={2026}
}