NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

AnyStory: Towards Unified Single and Multiple Subject Personalization in Text-to-Image Generation

Junjie He, Yuxiang Tuo, Binghui Chen, Chongyang Zhong, Yifeng Geng, Liefeng BoarXiv 2025 · DOI

Abstract

Personalizing text-to-image (T2I) models to generate specific subjects remains a significant challenge, particularly when multiple subjects are involved. Existing methods often suffer from "concept bleeding" or require restrictive manual layout masks. This paper presents AnyStory, a unified, tuning-free framework designed for both single- and multi-subject personalization. By employing an "encode-then-route" paradigm—combining a dual-encoder for high-fidelity representation with a novel instance-aware subject router—AnyStory achieves high-quality, mask-free generation while maintaining subject identity and preventing semantic leakage.

Introduction

Large-scale diffusion models, such as Stable Diffusion XL (SDXL), have revolutionized image synthesis from textual descriptions. However, the ability to generate specific, user-defined subjects (e.g., a particular character or pet) consistently across different contexts remains an open problem. This difficulty is compounded in multi-subject scenarios where features from different subjects often blend together, a phenomenon known as "semantic leakage" or "concept bleeding."

Current solutions typically rely on fine-tuning models on specific subjects or requiring users to provide spatial constraints like bounding boxes. These approaches are either computationally expensive or limit the model's creative flexibility. AnyStory addresses these limitations by providing a general-purpose, zero-shot framework that handles multiple subjects without requiring manual masks or domain-specific constraints.

The AnyStory Framework

AnyStory operates on an "encode-then-route" paradigm, decoupling the extraction of subject features from their spatial placement in the generated image.

1. Enhanced Subject Representation Encoder

To capture both the high-level semantics and the fine-grained visual details of a reference subject, AnyStory utilizes a dual-encoder architecture:

  • CLIP Vision Encoder: This component extracts coarse semantic information, ensuring the model understands the general category and attributes of the subject.
  • Simplified ReferenceNet: To capture high-resolution appearance details, the framework incorporates a ReferenceNet. In a key optimization, the authors removed all text cross-attention layers from the standard ReferenceNet, as it serves purely as a visual feature extractor in this context. This reduction in complexity decreases the parameter count from 2.57B to 2.02B, improving inference speed.

2. Decoupled Instance-Aware Subject Router

The core innovation of AnyStory is the Subject Router. Instead of injecting subject features globally into the U-Net, the router dynamically predicts the potential location of each subject within the latent space during the denoising process. Modeled as a miniature image segmentation decoder with masked cross-attention, it restricts the injection of a subject's features strictly to its predicted region. This mechanism effectively prevents subjects from interfering with one another or the background.

AnyStory demonstrates robust personalization across diverse subjects and artistic styles, including both single and multi-subject scenarios.

Training Strategy

The model is trained in two distinct stages:

  1. Subject Encoder Training: This stage uses ~6.5M paired images (the same subject in different poses or environments) sourced from datasets like DeepFashion2, human dancing videos, and Objaverse 3D renders. Paired data is crucial to prevent the model from simply memorizing the reference image's pose.
  2. Router Training: With the subject encoder frozen, the router is trained on 300k unpaired multi-person images from the LAION dataset. This stage teaches the router to identify and separate distinct instances in a scene.

Results and Discussion

AnyStory demonstrates superior performance in maintaining subject identity across complex interactions. A notable finding is the router's ability to act as an unsupervised segmenter; the routing maps generated during diffusion closely resemble instance segmentation masks.

Multi-subject consistency: AnyStory maintains character identity across complex narrative sequences without semantic leakage.

Generalization and Background Control

Despite being trained primarily on human-centric data, the router generalizes remarkably well to diverse subjects, including cartoon characters and inanimate objects. Furthermore, the introduction of a dedicated "background" routing feature—fed by a null image input—allows the model to generate complex, prompt-driven backgrounds without interference from the foreground subjects' reference images.

Efficiency Gains

By simplifying the ReferenceNet architecture, AnyStory achieves a significant reduction in computational overhead. Inference time on an NVIDIA A100 GPU was reduced from 62.0 ms/img to 53.2 ms/img, making it more practical for real-world applications without compromising image quality.

Conclusion

AnyStory represents a significant step toward flexible and high-fidelity subject personalization. By replacing manual masks with an automated routing mechanism, it enables the generation of complex multi-subject narratives. Future work will focus on extending this personalization to background elements and further reducing "copy-paste" artifacts through enhanced data augmentation and more powerful base models.

Summary updated

BibTeX
@misc{he2025anystory,
  author = {Junjie He and Yuxiang Tuo and Binghui Chen and Chongyang Zhong and Yifeng Geng and Liefeng Bo},
  title = {{AnyStory: Towards Unified Single and Multiple Subject Personalization in Text-to-Image Generation}},
  year = {2025},
  eprint = {2501.09503},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2501.09503},
}
Figure