Skip to content
shreshthsainiPublic

About

Training-free HDR generation for diffusion models: shape the luminance distribution at sampling time (Flux.1-dev, arXiv 2607.26237)

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Repository files navigation

LumaGuide: Distribution Shaping for Training-Free HDR Generation in Diffusion Models

Paper PDF arXiv Hugging Face weights Project Page MIT License Colab coming soon

✨ Under Review at NeurIPS 2026 ✨

Bowen Chen1 · Shreshth Saini1 · Balu Adsumilli2 · Alan C. Bovik1

1 The University of Texas at Austin    2 Google

LumaGuide is a training-free framework for distribution shaping in pretrained diffusion models. Instead of touching weights, we steer the sampling trajectory to match a target feature distribution via differentiable, energy-based guidance, and instantiate it for HDR image generation by shaping luminance in perceptually-uniform PQ space.

🚀 Zero-training: no fine-tuning, no LoRAs, only a tiny 32-bin text→histogram regressor (~300K params)
🎯 PQ-domain, VAE-grounded: soft histogram + Wasserstein-1 guidance back-propagated through the Flux VAE
🎛 Three target modes: caption-driven regressor, reference HDR image, or a manual 32-bin histogram
📡 HDR I/O out of the box: writes Radiance .hdr in linear cd/m² + a diagnostic ACES Filmic EV ladder
🧩 Backbone-agnostic in design: Flux.1-dev shipped today; SD3 / SDXL / CogVideoX on the roadmap

LumaGuide teaser

🔥 News

⚙️ Environment Setup

Tested with CUDA 12.1, PyTorch 2.4, Python 3.10/3.11/3.13 on a single A100 (40 / 80 GB). The script needs ≈ 30 GB VRAM at 512² (the W₁ backward through the VAE adds ≈ 6 GB peak over vanilla Flux inference); 1024² needs ≈ 60 GB.

python -m venv lumaguide-env
source lumaguide-env/bin/activate
pip install -r requirements.txt

You will also need:

  • Flux.1-dev: downloaded automatically from Hugging Face on first run (~24 GB). Run huggingface-cli login if you don't already have gated-model access.
  • regressor.pt: the pretrained text→histogram regressor (~1.1 MB) is bundled in this repo and is the default for --target regressor.

🚀 Usage

lumaguide.py is a single self-contained inference script. The target HDR luminance distribution can come from three sources:

--target what you provide use case
regressor a pretrained regressor.pt + caption open-ended text → HDR
reference a reference .hdr / .exr image match an existing HDR's mood
manual a 32-element .npy array (sums to 1) precise user-specified DR

Mode 1: caption-driven (regressor)

python lumaguide.py \
    --prompt "A hot-air balloon launches at dawn over rolling farmland, the burner flame brilliantly bright against pre-dawn dusk." \
    --output_hdr out/balloon.hdr \
    --target regressor \
    --regressor_ckpt regressor.pt

Mode 2: reference-driven

python lumaguide.py \
    --prompt "A hot-air balloon launches at dawn over rolling farmland, the burner flame brilliantly bright against pre-dawn dusk." \
    --output_hdr out/balloon_v2.hdr \
    --target reference \
    --reference my_reference.hdr

Mode 3: manually-specified histogram

Construct any 32-bin distribution over PQ codes that sums to 1:

import numpy as np

# Example: low-key (mostly dark, narrow highlight peak around 800 cd/m²)
n = 32
hist = np.zeros(n, dtype=np.float32)
hist[:6]    = np.linspace(2.0, 1.0, 6)   # heavy shadow occupancy
hist[20:24] = 0.5                         # small highlight bump
hist /= hist.sum()
np.save("low_key.npy", hist)
python lumaguide.py \
    --prompt "A hot-air balloon launches at dawn over rolling farmland, the burner flame brilliantly bright against pre-dawn dusk." \
    --output_hdr out/balloon_v3.hdr \
    --target manual --manual_hist low_key.npy

Outputs

For each run the script writes:

  • <output_hdr>: Radiance .hdr in linear cd/m² (BT.2020 RGB primaries)
  • <output_dir>/ev{-2,+0,+2}.png: diagnostic ACES Filmic + sRGB EV ladder

To view the HDR file: any of the standard tools work: pfsview, OCIO-aware DaVinci Resolve, the pfstools suite. The EV ladder PNGs let you preview shadow / midtone / highlight content separately on any sRGB display.

🎛 Key hyperparameters

flag default notes
--s0 2000 W₁ guidance scale. 0 = vanilla Flux. Sweet spot 1000–3000 on Flux.
--n_steps 28 scheduler steps. Reducing increases speed but degrades alignment.
--cfg_scale 3.5 distilled-CFG strength for Flux (passed via guidance_emb).
--schedule const guidance schedule. late_quad weights toward the clean stage.
--n_bins 32 histogram resolution. K=32 is the paper's sweet spot.
--height/--width 512 generation resolution. 512 fits in 30 GB VRAM, 1024 needs ≈ 60 GB.
--seed 42 RNG seed for the initial latent.
--model_id black-forest-labs/FLUX.1-dev HF model id for the Flux backbone.

📋 Test prompts

test_prompts.csv ships the 100 HDR-leaning prompts used in the paper (512×512 by default). It has the columns prompt,width,height and can be batched directly through the script.

💡 Why LumaGuide Works

LumaGuide rests on two observations about how distribution constraints interact with diffusion sampling.

(i) Diffusion priors already encode rich semantics; HDR is a distributional mismatch. Pretrained image / video diffusion models reproduce the statistical biases of their training data, mostly 8-bit SDR content. They can generate plausible scenes but cannot reach the dynamic range of real HDR captures. LumaGuide leaves the semantic prior untouched and only constrains global luminance statistics, so the model is free to handle structure and content.

Method overview

(ii) A permutation-invariant target lets the prior do the spatial work. At every denoising step we compute a soft, differentiable PQ-luminance histogram of the Tweedie estimate, take its Wasserstein-1 distance to a target histogram, and back-propagate through the VAE decoder only (the transformer is always called under torch.no_grad(), which is what makes the method zero-training). Because the histogram is permutation-invariant, LumaGuide only constrains which luminances appear and in what proportions, not where, which is exactly the part the diffusion prior is bad at.

Per-pixel PQ comparison

The same objective extends to video by adding a Temporal Luminance Coherence (TLC) term that penalizes highlight flicker between frames, yielding zero-shot HDR video without retraining the backbone (release pending, see Roadmap).

📊 Results

LumaGuide reshapes generated PQ-luminance distributions toward HDR targets while preserving semantics. See the project page and Tables 1–3 in the paper for full quantitative results, including subjective JOD scores against HDR baselines.

📋 Roadmap

Shipped today: ✅   Open: ⬜

Code

  • Reference PyTorch implementation (lumaguide.py)
  • Soft differentiable histogram + Wasserstein-1 distance module
  • PQ-space luminance utilities (PQ EOTF / inverse-EOTF, BT.2020 luminance)
  • Sampler hooks for Flux.1-dev
  • HDR I/O (Radiance .hdr + .exr) and ACES Filmic EV-ladder diagnostics
  • requirements.txt with pinned minimums
  • LICENSE (MIT; note Flux.1-dev's own non-commercial license applies)
  • Sampler hooks for SD3 and SDXL
  • CogVideoX integration with Temporal Luminance Coherence (TLC)
  • Hydra / YAML configs to reproduce all paper results

Pretrained assets

  • regressor.pt: pretrained text→histogram regressor (32-bin, ~300K params)
  • test_prompts.csv: 100-prompt HDR test set used in the paper
  • Library of named target presets (hdr_outdoor, low_key, neon, …)
  • Regressor training script + caption ↔ HDR histogram pairs
  • Subjective-study stimuli + JOD scores (subject to data licensing)

Demo

  • Single-prompt CLI demo (lumaguide.py)
  • notebooks/quickstart.ipynb walkthrough
  • Colab notebook (free-tier GPU defaults)
  • Hugging Face Space (Gradio)

Evaluation

  • Scripts for Q-quality, Q-alignment, DRstops, JOD
  • Reproduction scripts for Tables 1–3
  • Baseline configs (LEDiff, BracketDiffusion, X2HDR)

Docs & polish

  • arXiv preprint + canonical citation
  • docs/method.md: soft-histogram gradient derivation
  • CONTRIBUTING.md
  • Project page: video reel, author profile links

Citation

If you find LumaGuide useful, please cite:

@article{chen2026lumaguide,
  title   = {LumaGuide: Distribution Shaping for Training-Free HDR Generation in Diffusion Models},
  author  = {Chen, Bowen and Saini, Shreshth and Adsumilli, Balu and Bovik, Alan C.},
  journal = {arXiv preprint arXiv:2607.26237},
  year    = {2026}
}

Acknowledgements

This work was conducted at the Laboratory for Image and Video Engineering (LIVE), The University of Texas at Austin, with support from Google. We thank the authors of the projects our pipeline builds on:

License

Released under the MIT License. Flux.1-dev is governed by Black Forest Labs' own license (non-commercial); comply with both before redistribution.

Contact

For questions about the paper, code, or roadmap, please open an issue or reach out to the authors directly.

About

Training-free HDR generation for diffusion models: shape the luminance distribution at sampling time (Flux.1-dev, arXiv 2607.26237)

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages