Text-to-Image
Diffusers
English
stable-diffusion-xl
inference-time-alignment
preference-optimization
pg-map
neurips-2026
Instructions to use sophialan/pg-map-sdxl with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use sophialan/pg-map-sdxl with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("sophialan/pg-map-sdxl", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps
- Draw Things
- DiffusionBee
PG-MAP for Stable Diffusion XL
Custom diffusers pipeline for PG-MAP (Preference-Guided Adaptive MAP) on SDXL. Per-step refinement of the token-level conditioning $c$ and the latent $z_t$ at every DDIM step. Pooled embeddings and time_ids are kept frozen (paper §3.5).
NeurIPS 2026 — see github.com/sophialanlan/PG-MAP for the paper, full configs, and reproduction scripts.
Install
pip install pg-map
# or
pip install git+https://github.com/sophialanlan/PG-MAP
Usage
from diffusers import DiffusionPipeline
from pgmap import sdxl_defaults, FrozenRewardModel
import torch
pipe = DiffusionPipeline.from_pretrained(
"stabilityai/stable-diffusion-xl-base-1.0",
custom_pipeline="sophialan/pg-map-sdxl",
torch_dtype=torch.float16,
variant="fp16",
).to("cuda")
cfg = sdxl_defaults() # paper defaults
reward = FrozenRewardModel("pickscore", device="cuda")
image = pipe(
"a phoenix rising from ashes, vivid orange and red feathers",
pg_map_config=cfg,
reward_model=reward,
).images[0]
Compute
| Setting | Per-image wall-clock (RTX PRO 6000 Blackwell, fp16) |
|---|---|
| Vanilla pass-through, 50 steps, 1024² | ~6 s |
| PG-MAP default (K=2, λ=0.1), 50 steps | ~30 s |
| Reward-free MAP-cz (λ=0) | ~12 s |
The reward backward dominates per-image cost; the reward-free MAP-cz path tracks PG-MAP within 0.3 pp PickScore at ~2.6× lower wall-clock and is the recommended deployment when latency matters.
Paper headline (SDXL, PartiPrompts $n=1632$, seed 123)
| Method | PickScore | HPS | Aesthetic | CLIP |
|---|---|---|---|---|
| PG-MAP (default) | 56.4% | 47.1% | 56.2% | 48.1% |
| Tuned-CFG + PG-MAP (w*=7.5) | 51.3% | 64.6% | 56.5% | 52.8% |
Win-rate vs. same-seed static SDXL baseline (w=5.0).
Citation
@inproceedings{sun2026pgmap,
title={{PG-MAP}: Joint {MAP} Optimization for Inference-Time Alignment of Diffusion and Flow-Matching Models},
author={Sun, Ruolan and Polak, Pawel},
booktitle={Advances in Neural Information Processing Systems (NeurIPS)},
year={2026}
}
License
MIT (see LICENSE). SDXL weights are under the CreativeML Open RAIL++-M license.
- Downloads last month
- -