Image customization is a cornerstone of modern digital media and e-commerce, allowing creators to generate new content while maintaining the consistent identity of a specific object or person. However, existing approaches typically split this process into two distinct, incompatible paradigms: position-aware and position-free customization.
IC-Custom introduces a unified framework that seamlessly handles both tasks within a single model. By treating image customization as an in-context learning problem and introducing a novel attention mechanism, IC-Custom achieves state-of-the-art identity consistency and visual harmony while training only 0.4% of the base model's parameters.
The Customization Divide
Historically, customization models have been highly specialized:
- Position-aware customization: Requires a background and a specific mask, dictating exactly where to insert the reference object (e.g., virtual try-on or specific product placement).
- Position-free customization: Relies on a reference image and a text prompt, allowing the model to organically decide where and how the object appears in a newly generated scene (e.g., "a toy rabbit sitting on a snowy mountain").
Because these tasks require different types of spatial reasoning, they usually rely on separate models. Furthermore, existing methods often struggle with imprecise "user-drawn" masks and rely heavily on synthetic training data, resulting in outputs that look overly glossy or artificial.
A Unified Framework: In-Context Learning
To bridge this gap, the researchers developed IC-Custom, which leverages In-Context Learning (ICL). Instead of engineering complex, task-specific neural network branches, the model concatenates the reference image and the target image into a side-by-side "diptych." This allows the model to "read" the reference image on the left and naturally paint it into the target context on the right.
The core technical innovation enabling this is the In-context Multi-Modal Attention (ICMA) module, built on top of the FLUX.1-Fill model using efficient Low-Rank Adaptation (LoRA). ICMA features two vital components:
- Task-oriented Register Tokens: These learnable tokens act as flags that tell the model what type of task it is executing—whether it is dealing with a precise mask, a rough user-drawn scribble, or no mask at all. This prevents the model from forcing an object to fit the exact jagged shape of a careless user scribble.
- Boundary-aware Positional Embeddings: By using specific "Reference Embeddings" and "Fill Embeddings," the model mathematically distinguishes between the source identity and the target generation area, preventing visual artifacts at the blending edges.
Crucially, the authors realized that position-free customization is simply a special case of position-aware customization where the mask covers the entire image. This insight is what allows a single model to rule them all.
Training and Performance
To ensure photorealism, IC-Custom was trained on CustomData, a curated dataset of 12,000 identity-consistent pairs. Unlike previous datasets, this includes 8,000 real-world e-commerce images alongside 4,000 high-quality synthetic samples, helping the model avoid the "plastic" look typical of purely synthetic training.
The model was evaluated on DreamBench (for position-free tasks) and a newly introduced ProductBench, which tests both rigid objects and non-rigid items like clothing.
Key Results: * Human Preference: In user studies, IC-Custom was preferred 72% more often than baseline models across identity consistency, visual harmony, and text alignment. * Quantitative Superiority: It achieved the highest scores on DINO-I (identity preservation) and CLIP-I/T (visual and text alignment) against both open-source and high-end closed-source models. * Visual Quality: The model excels at handling complex lighting, shadows, and perspectives, ensuring inserted objects look naturally integrated rather than copy-pasted.
Limitations and Future Directions
While IC-Custom represents a significant leap forward, it does not explicitly model 3D geometry or lighting, which can occasionally lead to perspective mismatches. It can also struggle with extremely tiny masks (which lack sufficient spatial guidance) or highly complex, high-frequency textures like intricate lace. Future work will explore multi-reference customization and enhanced geometric consistency to further push the boundaries of unified image generation.
Summary updated