Skip to main content
Back

FAPE-IR Fixes Rainy, Hazy, Dark Photos Where Every Other AI Fails

A frozen vision-language model plans the restoration, then routes work to high- and low-frequency experts inside a diffusion executor, beating specialists across seven tasks.

Pro

  • FAPE-IR combines a frozen Qwen2.5-VL planner with a FLUX diffusion executor for all-in-one image restoration.
  • A LoRA-MoE module routes tokens to high- or low-frequency experts based on both text and spectral cues.
  • Beats prior AIO-IR methods by 6 to 8 dB PSNR on deraining, desnowing, and dehazing benchmarks.
  • Uses adversarial training instead of flow matching, avoiding hallucinated textures and edge warps.
  • Generalizes zero-shot to compound degradations despite training only on single-degradation data.
  • Code and models available at github.com/Programmergg/FAPE-IR.

Restoring a real photo that is simultaneously rainy, hazy, and underexposed usually breaks any single image restoration model. The dominant fix has been to train one giant network with task-specific branches or prompts, but those systems tend to collapse under unknown or mixed degradations. A new paper called FAPE-IR proposes something different: let a multimodal language model read the image, write a short restoration plan in plain text, and then hand that plan to a diffusion model whose experts are split by frequency band rather than by task label.

The result is a unified model that achieves state-of-the-art performance across seven restoration tasks and exhibits strong zero-shot generalization under mixed degradations, with the code released on GitHub.

Why all-in-one restoration keeps breaking

Two design patterns dominate current all-in-one image restoration (AIO-IR). The first injects task labels or prompts into a shared backbone, which is prone to severe cross-task interference because gradients from deraining, denoising, and dehazing fight each other for the same weights. The second clusters features or routes them to task-specific experts, but this makes learning nearly independent per task and hurts robustness on compound degradations.

Both approaches share a deeper problem: they treat degradation as an opaque label. The model never really understands what is wrong with the image, so it cannot adapt when a scene contains rain plus haze plus low light at once.

Comparison of AIO-IR approaches showing multi-branch mapping, clustering, and FAPE-IR frequency sharing

Planning in words, executing in frequencies

FAPE-IR splits the problem into a planner and an executor. The planner is a frozen Qwen2.5-VL multimodal LLM. Instead of asking it to generate pixels, the authors constrain it to output a short structured plan containing four fields: the detected task, whether the fix belongs mostly in the high- or low-frequency band, a natural-language pipeline, and a rationale.

To ground that plan in pixel evidence rather than guesswork, the planner receives a label-free low-level feature pool computed directly from the image. These are cheap statistics like oriented gradient histograms for rain streaks, bright-blob counts for snow, Laplacian responses for blur, and dark-channel and saturation values for haze. They are calculated in a single pass and require no supervision.

The frequency grouping is the core insight. Rain streaks, snow particles, noise, and motion blur mostly damage high frequencies. Haze and poor illumination corrupt low frequencies. By routing similar-frequency tasks to shared experts, the model can transfer knowledge between deraining and desnowing without letting dehazing gradients interfere.

Frequency-aware LoRA-MoE

The executor is built on the FLUX diffusion transformer with a parameter-efficient LoRA-MoE executor with two experts specialized for high- and low-frequency bands. What makes it interesting is the dual-gate router:

  • A text gate reads the planner's textual tokens and proposes which expert should fire.
  • A spectral gate applies a depthwise FIR low-pass filter along the token axis, splits generation tokens into high and low components, computes their relative energy, and refines the routing decision based on what the executor is actually seeing at that layer.

The two signals are fused with a learnable scalar and passed through a top-1 selector, so exactly one LoRA expert lights up per token. A frequency regularizer penalizes each expert for producing energy in the wrong band, forcing genuine specialization instead of both experts drifting toward a shared solution.

FAPE-IR architecture showing planner, executor, and adversarial training pipeline

Adversarial training beats flow matching here

Most modern unified models train with flow matching, the loss behind Stable Diffusion 3 and FLUX. The FAPE-IR authors argue and prove theoretically that flow matching is a bad fit for pixel-accurate restoration because exponential high-frequency damping and null bands where the operator is tiny make FM insensitive to null-space errors, weak on textures and edges. In their early experiments, flow matching produced sharp but hallucinated facades and warped edges.

They swap it for adversarial training with a multi-level discriminator built on a frozen SigLIP-v2 backbone, plus L2 pixel loss and LPIPS perceptual loss. The paper shows that this composite objective bounds off-manifold hallucination while anchoring outputs to the ground truth.

The numbers

Trained once and evaluated across all seven tasks, FAPE-IR posts large gains on weather-heavy benchmarks. On deraining it lifts PSNR from 21.94 dB to 28.30 dB and FID from around 100.07 to 21.55. On desnowing, PSNR jumps from 24.19 to 30.29 dB. On dehazing, PSNR climbs from 21.94 to 33.85 dB with FID collapsing from 24 to 7.

Super-resolution shows similar wins against dedicated SR diffusion models like SeeSR and OSEDiff, with PSNR moving from 26.87 to 28.53 dB. Denoising and low-light are the weaker areas, where FAPE-IR trades a bit of PSNR for better SSIM and lower perceptual distances.

Ablations on the URHI haze benchmark show the compute allocation matters more than raw capacity: injecting token-derived spectral priors into the gate yields the best result of 29.71 dB PSNR, a +4.68 dB gain over the no-planner baseline. Skewed LoRA rank allocations without frequency priors actually hurt performance.

Where it fits, and where it does not

Practical considerations before dropping this into a pipeline:

  • Latency: Inference on a 512x512 image takes about 1.57 seconds on an H200 with a 38.92 GB memory footprint. That is roughly 100x faster than the PURE autoregressive baseline but around 15x slower than lightweight AIO-IR networks like DFPIR.
  • Compound degradations: Despite training only on single-degradation data, the model generalizes to real-world haze-plus-rain and low-light mixtures on the CDD-11 benchmark.
  • Weak spots: Simple Gaussian denoising on BSD68 and light rain on Rain100_L underperform, likely because the planner biases toward stronger high-frequency suppression than these mild degradations need.
  • Interpretability: Because the planner emits human-readable plans, every restoration decision leaves an audit trail.

The broader takeaway is that separating a low-level vision task into semantic planning followed by band-specialized execution seems to reconcile the two things AIO-IR has struggled to combine: knowledge sharing across related degradations and clean isolation between conflicting ones. Whether the same MLLM-plus-diffusion recipe extends to video restoration or medical imaging is the obvious next question.