Skip to content
MAC-AutoMLPublic

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

↻ LoopPrune

Recurrent Pruning for Looped Diffusion Transformers

Weizhong Huang · Huaijia Kou · Yan Zhang · Fei Chao · Xiawu Zheng · Liujuan Cao
Xiamen University

arXiv Paper PDF Project Page Apache 2.0 License Python 3.11 PyTorch 2.7+ Backends

Method · Results · Installation · Quick Start · Evaluation · Citation

Four stacked frosted-glass shared Transformer layers linked by a matte-teal recurrent return rail with synchronized pruned modules detaching in parallel.

Important

LoopPrune estimates shared channel/weight importance across every recurrent position in a Looped Diffusion Transformer, reconstructs retained projections from pooled input statistics, and recovers the student against a frozen dense teacher.

🎯 Quality Retention 💾 Peak GPU Memory Saved ⚡ Denoising Speedup
93.14% (B/16, 30% structured) 34.36 – 44.64% (SDXSv3, H20) 1.46 – 1.74× (PyTorch / vLLM-Omni / SGLang)

🔬 Method

LoopPrune workflow from the paper showing recurrent-aware pruning, shared reconstruction, and gradient recovery

1 · Recurrent-Aware Pruning 2 · Shared Reconstruction 3 · Gradient Recovery
Combines coherent shared-removal effects with cross-position sensitivity variation across loop invocations. Pools input activation covariance across all recurrent positions to reconstruct retained projections. Matches complete denoising predictions and text guidance against the frozen dense teacher.

📊 Key Results

Paper Figure 1: Looped-DiT B/16 quality retention across pruning rates and SDXSv3 peak memory savings and denoising speedup

Quality Summary (Avg. across 6 Benchmarks)

Unweighted mean across GenEval, DPG-Bench, TIIF-Bench short, English PRISM-Bench, T2I-CoReBench, and SpatialGenEval.

Model Pruning Regime Dense Best Baseline LoopPrune Gain
Looped-DiT B/16 30% structured 72.32 57.87 67.36 +9.49
Looped-DiT B/16 2:4 semi-structured 72.32 62.96 66.23 +3.27
Looped-DiT B/16 50% unstructured 72.32 69.20 70.88 +1.68
SDXSv3 50% unstructured 43.67 43.33 43.80 +0.47
Surjo-Image-Preview 2:4 semi-structured 48.71 38.10 41.39 +3.29

SDXSv3 Efficiency (1× H20, Batch 16, 768×768, 28 Steps)

Pruning Regime PyTorch (s) vLLM-Omni (s) SGLang (s) Speedup Peak Memory (MiB)
Dense 21.36 21.54 21.36 1.00× 1931.0
30% structured 14.31 14.33 14.32 1.49× 1267.5
60% unstructured 14.68 14.61 14.57 1.47× 1069.1
2:4 semi-structured 12.39 12.40 12.39 1.74× 1144.9

⚙️ Supported Models

Model Loops Native Generation Structured Unstructured 2:4 Sparse
Looped-DiT B/16 4 100 Euler steps · CFG 6.0 · 512×512 ✅ ✅ ✅
Looped-DiT B/32 4 100 Euler steps · CFG 6.0 · 512×512 ✅ ✅ ✅
SDXSv3 2 28 scheduler steps · CFG 4.5 · 512×512 ✅ ✅ ✅
Surjo-Image-Preview 2 50 Euler steps · CFG 3.0 · 256×256 ✅ ✅ ✅

🛠️ Installation

Note

Use Linux and Python 3.11. Training uses CUDA, BF16, and 8 logical NCCL ranks (default local launcher uses 8 GPUs; multi-node runs require a shared work directory). Generation and SDXSv3 worker deployment run on a single GPU.

python3.11 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install torch==2.7.1 torchvision==0.22.1 \
  --index-url https://download.pytorch.org/whl/cu126
python -m pip install -e '.[models,eval]'
loopprune doctor

The archived model environment used Diffusers 0.40.0 and Transformers 5.13.1. See Deployment and Evaluation for SDXSv3 workers and scorer environments.

Prepare Assets

Follow the asset layout and install the upstream Looped-DiT interfaces at the pinned revision:

export ASSETS="$PWD/assets"
mkdir -p "$ASSETS/third_party"
git clone https://github.com/OpenSenseNova/Looped-DiT "$ASSETS/third_party/Looped-DiT"
git -C "$ASSETS/third_party/Looped-DiT" checkout 18ad35c0e35857fd3de8ba2fa8be8e0ac27eb341
git -C "$ASSETS/third_party/Looped-DiT" apply \
  "$(pwd)/src/loopprune/resources/upstream/looped-dit-evaluation.patch"

🚀 Prune and Recover

Use a separate work directory per configuration. --rate specifies the pruned fraction of denoiser parameters (structured) or target weights (unstructured); 2of4 enforces exact 2:4 semi-structured sparsity.

WORK="$PWD/runs/b16-p30"
CASE=$(loopprune configure --model b16 --format structured --rate 0.30 --work "$WORK")
loopprune prepare --assets "$ASSETS" --work "$WORK" --coco "$ASSETS/data/captions_val2014.json"
loopprune prune --assets "$ASSETS" --work "$WORK"
loopprune recover --assets "$ASSETS" --work "$WORK"
CHECKPOINT="$WORK/exports/$CASE.pt"
  • Uses the fixed COCO cohort of 256 fit and 16 diagnostic captions with a shared trajectory cache.
  • Standard recovery runs 208 computed updates (192 retained-path); B/16 10% structured uses 366 computed (350 retained-path) updates. See Method.

🧪 Evaluate a Checkpoint

loopprune generate --assets "$ASSETS" --checkpoint "$CHECKPOINT" --model b16 \
  --benchmark geneval --output "$WORK/eval"
loopprune score --assets "$ASSETS" --benchmark geneval --output "$WORK/eval" \
  --python ./.venv-detector/bin/python

Switch --benchmark to dpg, tiif, prism, corebench, or spatial_geneval. Use --rank and --world-size for sharding (8 logical ranks matches the paper's seed layout). Once all six suites are scored, run loopprune summarize --output "$WORK/eval".

Deploy SDXSv3 in a Diffusion Worker

loopprune deploy --assets "$ASSETS" --checkpoint "$SDXS_CHECKPOINT" \
  --backend pytorch --batch 16 --resolution 768 --output ./runs/sdxs-pytorch

Pass --backend vllm or --backend sglang in its respective environment for vLLM-Omni or SGLang Diffusion.


📚 Documentation & Checks

Guide Description
docs/assets.md Directory layout for checkpoints, datasets, and scorer weights
docs/method.md Fixed research recipe, sensitivity formulation, and distributed flags
docs/evaluation.md Six benchmark suites, detector/judge environments, and provenance checks
docs/deployment.md PyTorch, vLLM-Omni, and SGLang Diffusion worker setup and timing scope
THIRD_PARTY_NOTICES.md Attribution and upstream license notices
📁 Repository Structure & CPU Unit Tests
LoopPrune/
├── docs/                  # Assets, method, evaluation, deployment guides & paper figures
├── src/loopprune/         # CLI, config, recipes, exports, operators & upstream patches
└── tests/                 # CPU verification tests (config, compaction, CSR, provenance)
python -m compileall -q src
python -m unittest discover -s tests

📝 Citation

@article{huang2026loopprune,
  title   = {LoopPrune: Recurrent Pruning for Looped Diffusion Transformers},
  author  = {Huang, Weizhong and Kou, Huaijia and Zhang, Yan and Chao, Fei
             and Zheng, Xiawu and Cao, Liujuan},
  journal = {arXiv preprint arXiv:2611.22757},
  year    = {2026}
}

📄 License

Released under the Apache-2.0 License. See THIRD_PARTY_NOTICES.md for third-party attributions.

Releases

Packages

Contributors

Languages