From Open Loop to Closed Loop: A Test-Time Iterative Optimization Framework for Reference-Consistent Image Generation

Baixuan Zhao, Xinyu Zhang, Huayu Zheng, Shuaicheng Liu, Xiongkuo Min, Guangtao Zhai, Xiaohong LiuarXiv 2026

TL;DR

Current controllable image generation models operate in an "open-loop" fashion, injecting reference conditions (like faces or poses) without checking if the final image actually matches them. This paper introduces a training-free, test-time optimization framework that treats image generation as a closed-loop dynamic tracking problem regulated by a modified PID controller. By iteratively adjusting latent control signals based on active sensor feedback, it significantly boosts reference fidelity across identity, pose, and depth-guided generation tasks without altering model weights.

What Problem Does This Paper Address?

Controllable text-to-image diffusion models have made massive leaps forward, allowing users to guide image synthesis using visual references—such as a specific person's face (ID-preserving) or a target spatial layout (pose or depth maps).

However, existing state-of-the-art adapters (like ControlNet or IP-Adapter) are strictly feed-forward, open-loop systems. Once the reference condition is encoded and injected into the network, the model has no mechanism to look at its generated output, measure deviations, and correct errors. This lack of feedback often leads to "identity drift" in portraits or geometric artifacts like misplaced limbs and distorted boundaries in spatial control tasks.

The authors ask a fundamental control-theoretic question: Can reference-consistent generation be formulated as a closed-loop dynamic tracking problem?

Methods

Instead of retraining models or adding heavy architecture extensions, the authors introduce an elegant, training-free wrapper that sits around existing diffusion pipelines.

Fig. 1: Overview of the proposed closed-loop optimization framework. We reformu- late reference-consistent generation as feedback control over a generative model. The encoder and sensor are the same pre-trained module F, reused in different roles for target extraction and feedback measurement. A modified PID controller iteratively updates the latent control input uk to reduce the generation error. This closed-loop optimization improves reference consistency over open-loop baselines across ID-, pose-, and depth-controlled generation.

The framework conceptualizes the pre-trained generative model as a "control plant" and introduces a classic sensor-controller feedback loop:

  1. The Dual-Role Feature Extractor ($\mathcal{F}$): A single pre-trained model acts as both the encoder (extracting the target state $u^*$ from the reference image) and the sensor (extracting the actual state from the generated image at iteration $k$).
  2. The Tracking Error ($e_k$): The system calculates the discrepancy between the target state and the current generated state ($e_k = u^* - \mathcal{F}(I_k)$).
  3. Modified PID Controller: Standard Proportional-Integral-Derivative (PID) controllers reduce the control signal to zero as the error vanishes. However, generative models are "memoryless"—they require a persistent baseline signal to keep the target subject present. To fix this, the authors design a Modified PID Algorithm that injects the target state $u^*$ as a persistent bias term: $$u_{k+1} = u^* + K_p e_k + K_i \sum_{n=1}^{k} e_n + K_d (e_k - e_{k-1})$$

This loop runs for a set number of iterations at test time, progressively nudging the latent control inputs closer to perfect reference alignment. The authors instantiate this across three tasks:

  • ID-Preservation: Using a facial recognition encoder as the sensor.
  • Pose Control: Using a structural keypoint estimator as the sensor.
  • Depth Control: Using a monocular depth estimator as the sensor.

Datasets

The authors evaluated their framework across several standard benchmarks:

  • ID-Preserving Portrait Generation: Evaluated on Web100 (a multi-reference dataset containing 130 non-celebrity identities) and CelebA300 (300 randomly selected identities from CelebA-HQ).
  • Spatial Control Tasks (Pose & Depth): Evaluated on a filtered subset of 477 single-person photos sourced from a public ControlNet repository.

Note: To prevent evaluation bias ("sensor-evaluator coupling"), the authors intentionally used different models for the feedback sensor and the final evaluation metric (e.g., using InsightFace ResNet100 for the control loop but ResNet50 for the final evaluation).

Key Insights and Ideas

  • Generative Models as Black-Box Plants: The core "aha" moment is treating frozen, highly complex diffusion models as classical dynamic systems that can be steered externally without touching their internal weights.
  • Adapting PID for Static Systems: Recognizing that standard PID fails on memoryless generative networks led to the crucial modification of adding the persistent target bias ($u^*$). Without it, the controller would wash away the very features it is trying to preserve as the error minimizes.
  • Two-Phase Convergence: The optimization dynamics reveal a highly stable, two-phase trajectory: a rapid correction phase during the first 1–5 iterations, followed by a stable fine-tuning phase. This ensures monotonic convergence without divergence.

Key Results

The closed-loop framework was pitted against computation-matched "best-of-$N$" open-loop baselines (where the open-loop model generates multiple images, and the best one is selected).

  • Identity Preservation: When integrated with baselines like PuLID, PhotoMaker v2, and InstantID, the closed-loop approach achieved relative facial similarity gains of up to 25.36% on CelebA300 and 12.98% on Web100.
  • Spatial Precision: For pose-controlled generation using ControlNet, it reduced the Mean Per Joint Position Error (MPJPE) by 27.71%. For depth control, it slashed the Mean Absolute Error (MAE) by 28.50%.
  • Robustness to Prompts and Seeds: The framework proved highly robust against text prompt complexity. Remarkably, even when given no text prompt, the closed-loop feedback successfully anchored the generation strictly to the visual reference, effectively overriding textual ambiguity.

Limitations and Future Work

Despite the impressive alignment gains, the authors note a few practical hurdles:

  • Inference Latency: Because the framework runs an explicit "generation-and-check" loop, each iteration requires a full diffusion denoising pass. Running 15–20 iterations significantly increases total latency, scaling linearly with the iteration count.
  • Manual Parameter Tuning: The PID gains ($K_p, K_i, K_d$) currently rely on manual task-specific tuning. Automated, adaptive control strategies will be needed to make this fully plug-and-play across arbitrary tasks.
Table 1: Parameter configurations.
  • Sensor Dependency: The system's accuracy is fundamentally bounded by the quality of the external sensor. If the face encoder or depth estimator provides noisy feedback, the controller will pass that noise into the generation process.

Summary updated

BibTeX
@misc{zhao2026from,
  author = {Baixuan Zhao and Xinyu Zhang and Huayu Zheng and Shuaicheng Liu and Xiongkuo Min and Guangtao Zhai and Xiaohong Liu},
  title = {{From Open Loop to Closed Loop: A Test-Time Iterative Optimization Framework for Reference-Consistent Image Generation}},
  year = {2026},
  eprint = {2607.04691},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2607.04691},
}
Figure