Abstract: The customization of multiple attributes has gained increasing popularity with the rising demand for personalized content creation. Despite promising empirical results, the contextual coherence between different attributes has been largely overlooked. In this paper, we argue that subsequent attributes should follow the multivariable conditional distribution introduced by former attributes creation. In light of this, we reformulate multi-attribute creation from a conditional probability theory perspective and tackle the challenging zero-shot setting. By explicitly modeling the dependencies between attributes, we further enhance the coherence of generated images across diverse attribute combinations. Furthermore, we identify connections between multi-attribute customization and multi-task learning, effectively addressing the high computing cost encountered in multi-attribute synthesis. Extensive experiments demonstrate that Z-Magic outperforms existing models in zero-shot image generation, with broad implications for AI-driven design and creative applications.
1. Introduction: The Challenge of Multi-Attribute Synthesis
When generating images with multiple specific attributes—such as a specific person's face, a particular hair color, and a specific artistic style—most current models treat these instructions as independent variables. In technical terms, the model calculates a "gradient" (a direction for optimization) for each attribute separately and sums them up.
However, in high-dimensional space, these gradient vectors are often nearly orthogonal (perpendicular). This "orthogonality trap" causes the model to "fight" itself, leading to images where attributes feel disjointed or where one instruction overrides another. Z-Magic addresses this by treating multi-attribute generation as a conditional probability problem rather than a simple sum of independent constraints.
2. Methodology: From Independence to Dependency
The core of Z-Magic is a shift from Conditional Independent Creation to Conditional Dependent Creation.
Sequential Conditioning
Instead of summing gradients ($\sum \nabla \log p(c_i|x_t)$), Z-Magic uses the chain rule of probability. It calculates the gradient for the first attribute, then calculates the gradient for the second attribute given the influence of the first. This ensures that subsequent attributes refine, rather than contradict, the earlier ones. This approach recognizes that attributes are naturally mutually informative; for instance, knowing a subject is "Sunflowers" should naturally guide the application of a "Van Gogh" style.
Hessian-Free Optimization
Calculating dependencies usually requires a Hessian matrix (a massive table of second-order derivatives), which is computationally ruinous for high-resolution images. Z-Magic introduces a mathematical reformulation that converts the product of a Hessian and a gradient into the gradient of a scalar product, making the process efficient enough for practical use without requiring model retraining.
Multi-Task Learning (MTL) Perspective
To handle more than two attributes, the framework treats the problem as a multi-task optimization. It employs CAGrad (Conflict-Averse Gradient descent), an algorithm that finds an optimal "consensus" direction that minimizes the loss across all attributes simultaneously, avoiding the pitfalls of conflicting gradients.
3. Experimental Results and Insights
The authors evaluated Z-Magic using standard benchmarks including CeleB-HQ for face synthesis and Stable Diffusion v1.4 for text-to-image tasks.
- Face Synthesis: On CeleB-HQ, Z-Magic achieved an FID of 123, significantly better than the baseline FreeDoM (136). It also showed lower distance scores for Identity (ArcFace) and Landmarks, indicating better adherence to user constraints.
- Style Transfer: In text-and-style guided tasks, Z-Magic achieved the lowest Style Loss (10.14) and Text Distance (0.7152) compared to existing zero-shot methods.
- Visual Coherence: Qualitatively, the model produces images where complex combinations (e.g., "a cat wearing glasses" in a specific abstract style) look like a single, unified piece of art rather than a collage of disjointed ideas.
4. Conclusion and Future Directions
Z-Magic demonstrates that explicitly modeling attribute dependencies significantly enhances the visual and contextual coherence of generated images. As a training-free, plug-and-play method, it is highly adaptable to various pre-trained diffusion models.
While the MTL approach is effective, future work may explore more sophisticated heuristics for a very high number of conditions, as the complexity of calculating every possible $p(c_j|c_i)$ relationship grows. Additionally, the authors noted that maintaining condition control in the very final denoising steps remains a challenge for balancing constraint adherence with overall image fidelity.
Summary updated