CustomContrast: A Multilevel Contrastive Perspective for Subject-Driven Text-to-Image Customization

Nan Chen, Mengqi Huang, Zhuowei Chen, Yang Zheng, Lei Zhang, Zhendong Mao

Introduction: The Similarity-Controllability Trade-off

Subject-driven text-to-image (T2I) customization aims to generate new images of a specific subject (e.g., a unique toy or pet) based on text prompts. However, existing methods often struggle with a fundamental trade-off between subject similarity and text controllability.

Most current models rely on a "self-reconstructive" approach, where the model is trained to recreate a reference image as accurately as possible. This often leads to overfitting, where the model entangles the subject's identity with irrelevant details like its original pose, lighting, or background. Consequently, when a user provides a prompt to change the subject's action (e.g., "a teddy bear swimming"), the model either fails to follow the text or loses the subject's unique features.

Comparison of the traditional self-reconstructive perspective versus the proposed contrastive learning perspective.

Methods: Multilevel Contrastive Learning

To address these issues, CustomContrast introduces a multilevel contrastive learning (MCL) paradigm. Instead of simple reconstruction, the model learns to distinguish the "intrinsic features" of a subject from "redundant features" by comparing multiple views of the same subject and contrasting them against different subjects.

The framework consists of several key components:

1. MFI-Encoder (Multimodal Feature Injection)

The MFI-Encoder utilizes both Visual and Textual Qformers to ensure that visual features are well-aligned with the text embedding space from the outset. This cross-modal alignment is crucial for maintaining controllability during the generation process.

2. Crossmodal Semantic Contrastive Learning (CSCL)

CSCL aligns high-level semantic meanings between image and text tokens. By ensuring that the "concept" of the subject is consistent across modalities, the model becomes more robust to variations in prompt phrasing.

3. Multiscale Appearance Contrastive Learning (MACL)

MACL operates within an extended "S+ space" across different layers of the UNet. It enforces intra-consistency (keeping features of the same subject close) and inter-distinctiveness (pushing features of different subjects apart). This allows the model to capture fine-grained textures while remaining flexible enough to adapt to new poses or environments.

The CustomContrast architecture, highlighting the CSCL and MACL modules.

Key Insights

  • Decoupling via Difference: By observing what remains constant across different photos of the same subject (e.g., fur pattern) versus what changes (e.g., background), the model learns to isolate the subject's true identity.
  • Distinctiveness Training: Explicitly contrasting different subjects prevents the model from collapsing into a "generic" representation, ensuring that the generated output looks exactly like the reference subject rather than a generic version of that class.
  • S+ Space Injection: Injecting subject features into multiple layers of the UNet allows the model to handle both high-level shapes and low-level textures more effectively than a single global token.

Experimental Results

CustomContrast was evaluated on the DreamBench dataset using both Stable Diffusion v1.5 and SDXL. As a "finetune-free" method, it provides real-time generation without the need for per-subject optimization.

  • Quantitative Improvements: On SD-v1.5, CustomContrast achieved a 3.8% improvement in text controllability and a 5.9% increase in subject similarity compared to state-of-the-art baselines like BLIP-Diffusion and ELITE.
  • Qualitative Excellence: The model excels at complex prompts requiring significant pose changes. While baseline models often overfit to the reference pose, CustomContrast successfully places subjects in entirely new contexts—such as a specific toy driving a car—while preserving every unique detail.

Conclusion

CustomContrast represents a significant shift in subject-driven customization. By moving from a self-reconstructive to a contrastive perspective, it effectively decouples identity from noise, providing a robust solution to the long-standing similarity-controllability trade-off in generative AI.

Summary updated

BibTeX
@inproceedings{chen2025customcontrast,
  author = {Nan Chen and Mengqi Huang and Zhuowei Chen and Yang Zheng and Lei Zhang and Zhendong Mao},
  title = {{CustomContrast: A Multilevel Contrastive Perspective for Subject-Driven Text-to-Image Customization}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2025},
  doi = {10.1609/aaai.v39i2.32210},
}
Figure