TopoRefine: Topology-Aware Correspondence and Residual Refinement for Training-Free Subject-Consistent Generation

Zhanxin Gao, Zexin Ti, Chen Zhao, Beier Zhu, Xiantao Hu, Yanhao Ge, Jian Yang, Ying TaiNeurIPS 2026

TL;DR

Generating the same character across different AI-generated scenes without expensive model fine-tuning usually forces an annoying trade-off: either the character’s identity drifts, or they end up frozen in the exact same pose with weird visual glitches. TopoRefine solves this by treating consistent generation as a controlled identity injection problem, using internal geometric graphs to map features to the right body parts and gentle residual updates to keep the scene's natural structure intact. The result is plug-and-play character consistency with diverse poses and clean visuals across different model architectures.

Figure 1: TopoRefine generates subjects in diverse scenes while preserving their distinctive identities. The results exhibit varied poses, actions, and spatial layouts across different contexts.

What Problem Does This Paper Address?

Imagine illustrating a storyboard with a text-to-image model. You want the exact same dog or the exact same protagonist in every panel, doing different things. Fine-tuning the model on your character (like DreamBooth) works, but it is slow and computationally heavy.

Recently, researchers turned to training-free methods, which hijack the internal representations of pretrained diffusion models at inference time to share features between a reference image and new target images. However, current approaches stumble over two major hurdles:

  1. Blind Spot-Matching (Semantic Correspondence): Existing methods match parts of the reference subject to the target subject based purely on point-by-point appearance similarity. Under repeated textures, symmetric limbs, or non-rigid movement, visually similar patches get confused—routing a left-paw feature onto a right ear, for instance, and warping the target pose.
  2. Attention Tug-of-War (Extended Attention): To refine details in later denoising steps, standard methods throw reference tokens and target tokens into one shared self-attention pool. Because they compete in the same normalization pool, the reference image often overpowers the emerging target image, leading to "pose over-copying" (stiff, repetitive layouts) and shadow-like blotches or corrupted backgrounds.

Methods

TopoRefine splits the generation process into two distinct stages, keeping the pretrained model's native structure in the driver's seat while carefully injecting identity from a reference image. First, using standard cross-attention thresholding, it extracts foreground masks to isolate the subject tokens. Then come the two novel components:

  • Early Stage — Topology-aware Subject Correspondence (TSC): Instead of matching tokens solely by feature similarity (cosine distance), TSC builds an 8-neighbor spatial graph over the foreground mask of both the reference and target subjects. It calculates the shortest-path (geodesic) distances between nodes within each subject. Using an optimal transport formulation called fused Gromov–Wasserstein, it finds a correspondence map that balances local visual similarity with global geometric layout. Put simply: two patches only match if they look similar AND sit in compatible structural positions within the subject's body. High-confidence matches then route reference features into the target.
  • Late Stage — Residual Identity Refinement (RIR): Rather than concatenating reference and target keys/values into one competitive attention pool, RIR leaves the target image’s native self-attention completely untouched. In parallel, target queries attend to the reference foreground to compute a separate "identity residual." This residual is masked so it only affects the target's foreground, scaled by a decaying weight over time, and magnitude-aligned (rescaled so its vector norm matches the native target output) to prevent sudden structural shocks.

Datasets

Because TopoRefine is entirely training-free, no training datasets are used. For evaluation, the authors test on a benchmark of nearly 370 prompt groups totaling almost 1,900 generated images. Each group pairs a shared subject description with varied scenes, actions, and compositions. Nearly half of the groups depict human subjects specifically to allow 2D body keypoint extraction (via ViTPose) for measuring pose diversity.

Key Insights and Ideas

  • Relative geometry beats pixel coordinates: Because TSC normalizes within-subject graph distances by their maximum finite value, the topological matching cares about relative anatomy (e.g., head-to-hand distance along the body) rather than absolute image scale or global position.
  • Decoupling structure from identity prevents "bleeding": Standard extended attention forces target background and structure tokens to compete with reference tokens, which severely corrupts backgrounds in newer Transformer-based diffusion models. Making identity injection an explicit, foreground-gated residual completely eliminates these shadow-like artifacts.
  • Architecture agnosticism: The principles of topological routing and residual attention aren't quirks of one specific neural network—they transfer cleanly from classic convolutional UNets (SDXL) to modern Diffusion Transformers (DiT / Qwen-Image).

Key Results

TopoRefine was tested on both UNet/SDXL (against 1Prompt1Story, ConsiStory, StoryDiffusion, and CoDi) and DiT/Qwen-Image (against CharaConsist) over 50 denoising steps:

  • Better Identity + Higher Pose Diversity: On SDXL, TopoRefine achieves the best subject consistency across all three metrics—CLIP-I (0.8694), DINO-v2 (0.8428), and DreamSim perceptual distance (0.2332, lower is better)—while simultaneously achieving the highest Pose Diversity (0.1021). Prompt fidelity remains right on the heels of the top baseline (0.8724 vs. ConsiStory's 0.8763).
  • Strong DiT Generalization: On Qwen-Image, TopoRefine outperforms CharaConsist on DreamSim (dropping error from 0.3903 down to 0.3581), boosts CLIP-I from 0.7922 to 0.8054, and increases pose diversity from 0.1272 to 0.1320.
  • Ablation proof: Swapping standard semantic matching for TSC alone jumps DiT pose diversity from 0.1146 to 0.1280 while clearing up background corruption; adding RIR pushes it to 0.1320 and removes remaining shadow blotches.

Limitations and Future Work

Not discussed in the paper. (Note: While operational boundaries—such as reliance on Otsu-thresholded cross-attention masks for foreground extraction and handling disconnected mask components via distance heuristics—are described in the methodology, the authors do not include a dedicated section discussing formal limitations or future research directions.)

Summary updated

Abstract

Subject-consistent generation (SCG) aims to preserve subject identity across diverse text-driven contexts. Recent training-free methods move beyond global sharing via correspondence-aware identity transfer. However, semantic-driven correspondence may transfer identity features to appearance-similar but structurally incompatible regions. Meanwhile, extended attention, commonly used in existing methods, enhances identity consistency but may perturb the emerging target structure, from global pose and layout to local structural details. Together, these issues can cause reference-pose over-copying, local structural artifacts, and degraded structural fidelity. We view training-free SCG as controlled identity injection, where the pretrained model determines the target structure, while the reference image provides subject identity. We propose TopoRefine, a training-free framework with Topology-aware Subject Correspondence (TSC) and Residual Identity Refinement (RIR). TSC regularizes semantic matching with subject-internal geodesic relations for structurally compatible identity transfer, while RIR injects reference identity as a foreground-gated, magnitude-aligned residual to preserve the emerging target structure. Both qualitative and quantitative results show that TopoRefine improves subject consistency while better preserving target-driven structure.
BibTeX
@inproceedings{gao2026toporefine,
  author = {Zhanxin Gao and Zexin Ti and Chen Zhao and Beier Zhu and Xiantao Hu and Yanhao Ge and Jian Yang and Ying Tai},
  title = {{TopoRefine: Topology-Aware Correspondence and Residual Refinement for Training-Free Subject-Consistent Generation}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=Ot6yn58Ort},
}
Figure