[CVPR 2026] L2P: Learnable Linear Predictor for Efficient Diffusion Models
July 13, 2026 Β· View on GitHub
[CVPR 2026] L2P: Learnable Linear Predictor for Efficient Diffusion Models
Beyond Fixed Formulas: Data-Driven Linear Predictor for Efficient Diffusion Models
Zhirong Shen1, Rui Huang1, Jiacheng Liu1, Chang Zou1, Peiliang Cai1, Shikang Zheng1, Zhengyi Shi1, Liang Feng1, Linfeng Zhang1
[π Paper] Β· [π€ FLUX.1-dev] Β· [π» Code]
π₯ News
2026/04/29π L2P is accepted by CVPR 2026! Paper is available on arXiv.2026/07/13π L2P-FLUX code is released β FLUX.1-dev inference, weight training, and evaluation scripts.- Coming soon π L2P for Qwen-Image and HunyuanVideo, along with full experiment reproduction.
π Table of Contents
- Abstract
- Highlights
- Method
- Main Results
- Roadmap
- Installation
- Quick Start
- Usage
- Project Structure
- Acknowledgements
- Citation
π Abstract
To address the high sampling cost of Diffusion Transformers (DiTs), feature caching offers a training-free acceleration method. However, existing methods rely on hand-crafted forecasting formulas that fail under aggressive skipping.
We propose L2P (Learnable Linear Predictor), a simple data-driven caching framework that replaces fixed coefficients with learnable per-timestep weights. Rapidly trained in ~20 seconds on a single GPU, L2P accurately reconstructs current features from past trajectories.
L2P significantly outperforms existing baselines: it achieves a 4.55Γ FLOPs reduction and 4.15Γ latency speedup on FLUX.1-dev, and maintains high visual fidelity under up to 7.18Γ acceleration on Qwen-Image models, where prior methods show noticeable quality degradation.
β¨ Highlights
| π§ Data-driven | Replace fixed Taylor / reuse formulas with learnable linear weights |
| β‘ Ultra-fast training | ~20 seconds on a single GPU, no DiT fine-tuning required |
| π― Aggressive skipping | Stable quality where hand-crafted predictors break down |
| π Plug-and-play | Drop-in acceleration on top of existing DiT inference pipelines |
π¬ Method
At each denoising step, L2P maintains a history of past output features. On cache steps, instead of running the full transformer, L2P predicts the current feature as a causal linear combination of history β weights are per-timestep and learned from data.
flowchart LR
A[Past Features<br/>xβ, xβ, β¦, xβββ] --> B[Learnable Weights<br/>Wβ Β· lower-triangular]
B --> C[Predicted Feature xΜβ]
C --> D[Skip Transformer]
E[Full Step] --> F[Run Transformer]
F --> G[Update History]
G --> A
Training objective: minimize MSE between predicted and ground-truth features over denoising trajectories. The weight matrix is lower-triangular (causal) and shared across spatial tokens after FFT decomposition.
π Main Results
FLUX.1-dev (this repo)
| Method | FLOPs β | Latency β | Training Cost |
|---|---|---|---|
| Full compute | 1.00Γ | 1.00Γ | β |
| L2P (Ours) | 4.55Γ | 4.15Γ | ~20 s / 1 GPU |
Qwen-Image (coming soon)
| Method | Max Acceleration | Quality under Aggressive Skipping |
|---|---|---|
| Prior caching methods | β | Noticeable degradation |
| L2P (Ours) | 7.18Γ | High visual fidelity |
Full benchmark tables, Geneval / ImageReward / DrawBench numbers, and comparison with TaylorSeer, ToCa, FORA will be released with the complete experiment suite.
πΊοΈ Roadmap
| Module | Status | Description |
|---|---|---|
| L2P-FLUX | β | Inference, weight training, DrawBench200 eval |
| L2P-Qwen-Image | π | Image generation acceleration |
| L2P-HunyuanVideo | π | Video generation acceleration |
| Full Experiments | π | All main paper results & reproduction scripts |
π οΈ Installation
Requirements
Python >= 3.10
CUDA >= 11.8
PyTorch >= 2.5
Setup
git clone https://github.com/Aredstone/L2P-Cache.git
cd L2P-Cache
python3.10 -m venv .venv
source .venv/bin/activate
pip install -e .
# Optional: PSNR / SSIM / LPIPS evaluation
pip install -e ".[eval]"
Model Weights
Download FLUX.1-dev and set environment variables:
export FLUX_DEV=/path/to/FLUX.1-dev/flux1-dev.safetensors
export AE=/path/to/FLUX.1-dev/ae.safetensors
export FLUX_MODEL_DIR=/path/to/FLUX.1-dev # optional: local diffusers layout
export HF_HOME=/path/to/huggingface/cache # optional
Tip: If
FLUX_MODEL_DIRpoints to a diffusers-style folder, T5 (text_encoder_2/) and CLIP (text_encoder/) are loaded locally with their tokenizers. Otherwise they are fetched from HuggingFace.
β‘ Quick Start
Generate images with L2P acceleration on DrawBench200:
export PYTHONPATH=src
python src/sample.py \
--prompt_file predictor/DrawBench200.txt \
--output_dir outputs/samples \
--interval 7 \
--width 1024 --height 1024 \
--num_steps 50 \
--device 0
Compare against full-compute baseline (--interval 1) and evaluate with evaluate.py.
π Usage
Inference
export PYTHONPATH=src
python src/sample.py \
--prompt_file predictor/DrawBench200.txt \
--output_dir outputs/samples \
--interval 7 \
--width 1024 \
--height 1024 \
--num_steps 50 \
--seed 0 \
--device 0
| Argument | Description |
|---|---|
--interval 1 | Full compute baseline (transformer at every step) |
| `--interval 7$ | \text{L2P} \text{accelerated} (~5 \times \text{faster} \text{in} \text{practice}) |
| $--test_FLOPs` | FLOPs profiling mode (no image output) |
Supported intervals with tuned step schedules: 5, 6, 7, 8, 10, 16 β see FULL_STEP_SCHEDULES in src/flux/model.py.
GenEval evaluation
python src/geneval_flux.py \
/path/to/evaluation_metadata.jsonl \
--model_name flux-dev \
--steps 50 --width 1024 --height 1024 \
--output_dir outputs/geneval
``$
</\text{details}>
### \text{Train} \text{Predictor} \text{Weights}
\text{L2P} \text{learns} \text{a} **50 \times 50 \text{lower}-\text{triangular}** \text{weight} \text{matrix} \text{via} \text{MSE} \text{on} \text{feature} \text{trajectories}:
$``bash
python predictor/train.py \
--weight_path predictor/weight.txt \
--device cuda:0
Prerequisites: pre-extracted feature tensors at ./train/features.pt and ./valid/features.pt.
Training time: ~20 seconds on a single GPU.
Evaluation
Compare L2P outputs against a full-compute reference:
# 1. Generate L2P samples
python src/sample.py --interval 7 --output_dir outputs/l2p ...
# 2. Generate baseline samples
python src/sample.py --interval 1 --output_dir outputs/baseline ...
# 3. Compute metrics
python evaluate.py \
--test_folder outputs/l2p \
--reference_folder outputs/baseline \
--prompt_file predictor/DrawBench200.txt
| Metric | Description |
|---|---|
| PSNR / SSIM / LPIPS | Pixel-level quality vs. baseline |
| CLIP Score | Text-image alignment (optional) |
| ImageReward / PickScore | Human preference proxies (optional) |
ποΈ Project Structure
L2P-Cache/
βββ src/
β βββ sample.py # Batch inference entry point
β βββ geneval_flux.py # GenEval benchmark
β βββ flux/
β βββ model.py # L2P integration in FLUX forward
β βββ learnable_utils/ # Linear predictor (FFT + weight apply)
β βββ l2p_cache.py # Step scheduling & cache state
β βββ ideas/cache_denoise.py # Cache-aware denoising loop
βββ predictor/
β βββ train.py # Weight training (~20s)
β βββ weight.txt # Pre-trained FLUX weights
β βββ DrawBench200.txt # Benchmark prompts
βββ evaluate.py # Quality & alignment metrics
βββ README.md
π Acknowledgements
This project builds upon the excellent open-source work of:
- FLUX β inference framework
- TaylorSeer Β· ToCa β prior feature caching methods that inspired this line of research
We thank the authors for their contributions to the community.
π Citation
If you find L2P useful for your research, please cite:
@inproceedings{shen2026l2p,
title = {Beyond Fixed Formulas: Data-Driven Linear Predictor for Efficient Diffusion Models},
author = {Shen, Zhirong and Huang, Rui and Liu, Jiacheng and Zou, Chang and Cai, Peiliang and Zheng, Shikang and Shi, Zhengyi and Feng, Liang and Zhang, Linfeng},
booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
year = {2026}
}