FlexControl: Computation-Aware Conditional Control with Differentiable Router for Text-to-Image Generation

Zheng Fang, Lichuan Xiang, Xu Cai, Kaicheng Zhou, Hongkai WenICML 2025

Overview

FlexControl replaces the rigid, hard-coded block selection in controllable diffusion models (like ControlNet) with a dynamic, trainable router. By learning to activate control signals only when and where they are needed during the denoising process, it achieves better image quality and spatial alignment while keeping computational costs strictly in check.

The Problem with Static Control

Controllable text-to-image diffusion models—such as ControlNet and T2I-Adapter—allow users to guide image generation using spatial conditions like depth maps, edge maps, or segmentation masks. However, these models rely on rigid, ad-hoc heuristics to decide which neural network blocks should receive these control signals. For instance, ControlNet on Stable Diffusion 1.5 only injects control into the decoder blocks.

This static approach has three major flaws:

  1. Task Inflexibility: The optimal placement of control signals varies wildly depending on the task (e.g., depth vs. edges), but static models use a one-size-fits-all architecture.
  2. Quality Degradation: Forcing control signals into every block can disrupt the pre-trained diffusion model's latent representations, actually harming image quality.
  3. Computational Bloat: Running auxiliary control networks at every single denoising step adds massive computational overhead (FLOPs) and slows down inference.

The FlexControl Method

To solve this, the authors introduce FlexControl, a framework that makes conditional control dynamic and data-driven.

Comparison of standard ControlNet and FlexControl architectures, highlighting the dynamic router and temporal sparsity across inference steps.
  1. The Architecture: Instead of guessing which blocks to control, the authors start by equipping all diffusion blocks with control signals (a baseline they call ControlNet-Large).
  2. The Differentiable Router: They introduce a lightweight "router unit" before each control block. Think of it as a smart traffic cop. Based on the current latent image and the timestep, the router outputs a binary mask (0 or 1) deciding whether to activate or skip the control block.
  3. End-to-End Training via Gumbel-Sigmoid: Because binary decisions (0 or 1) aren't differentiable, they use a Gumbel-Sigmoid trick during training. This allows the router to be trained end-to-end alongside the rest of the network using standard gradient descent.
  4. Computation-Aware Loss: To prevent the model from just turning every block on, they introduce a cost loss. This loss penalizes the model if the percentage of activated blocks exceeds a target sparsity level (e.g., $\gamma = 0.5$, meaning only 50% of blocks should be active on average).

The method is plug-and-play and works across both older UNet architectures (Stable Diffusion 1.5) and modern Diffusion Transformers (DiT, like SD3.0 and FLUX.1).

Key Insights

  • Timing is Everything (Temporal Sparsity): The router naturally learned that early denoising steps require sparse control, while late denoising steps require dense control. Early steps focus on global structure (needing less intervention), while late steps refine high-frequency details like edges and textures (needing heavy guidance).
  • Brute Force is Suboptimal: Simply turning on all control blocks (ControlNet-Large) actually performs worse than FlexControl operating at 50% capacity. Selectively applying conditions prevents the control signals from overwhelming the base model's generative priors.
  • Task-Specific Routing: The router learns different activation patterns depending on the input condition. A depth map triggers a different sequence of network blocks than a fine-grained Canny edge map, proving that hard-coded architectures leave performance on the table.

Key Results

FlexControl establishes a new Pareto frontier for quality versus compute in controllable generation.

Qualitative comparison of FlexControl against baseline methods across depth, edge, and segmentation tasks.
  • Superior Image Quality: On SD1.5 (at 50% sparsity), FlexControl achieved an FID of 14.80, significantly outperforming standard ControlNet (21.33) and even the computationally heavy ControlNet-Large (16.78).
  • Better Controllability: FlexControl aligns better with spatial inputs. For example, it reduced depth map RMSE by 6.30% compared to standard ControlNet.
  • Maintained Efficiency: On SD3.0 (DiT), FlexControl at 50% sparsity outperformed ControlNet in image quality (FID 22.47 vs 27.21) while using fewer FLOPs (3.11T vs 3.25T).
  • Universal Compatibility: The dynamic routing strategy successfully improved other state-of-the-art efficient control architectures, including ControlNeXt and OminiControl (FLUX.1).

Limitations and Future Work

  • Training Complexity: FlexControl requires a "warm-up" training phase where the router is forced to keep all blocks active before it can learn to selectively turn them off.
  • Sparsity-Specific Training: While you can manually tweak the router's threshold at inference time to change sparsity without retraining, explicitly training a model for a specific target sparsity (e.g., 30% vs 70%) yields the best performance.
  • Future Work: The authors suggest this data-driven block activation strategy paves the way for designing highly efficient, generalizable control mechanisms for increasingly complex, multi-condition generative pipelines.

Summary updated

BibTeX
@inproceedings{fang2025flexcontrol,
  author = {Zheng Fang and Lichuan Xiang and Xu Cai and Kaicheng Zhou and Hongkai Wen},
  title = {{FlexControl: Computation-Aware Conditional Control with Differentiable Router for Text-to-Image Generation}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=PRa4e2BHIf},
}
Figure