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

Can Diffusion Models Learn Hidden Inter-Feature Rules Behind Images?

Yujin Han, Andi Han, Wei Huang, Chaochao Lu, Difan Zou

Executive Summary

While diffusion models (DMs) like Stable Diffusion can generate stunningly realistic images, they often fail to grasp the underlying "rules" of a scene—such as the exact geometric relationship between a sun's height and a shadow's length. This paper demonstrates that DMs can learn rough, "coarse-grained" rules but fundamentally struggle with precise, "fine-grained" dependencies. It provides both empirical evidence and a mathematical proof explaining why the standard training objective, Denoising Score Matching (DSM), is inherently limited in capturing these exact relationships.

The Problem: Compositionality vs. Inter-Feature Rules

When prompting state-of-the-art models to draw a "sun over a pole," the model knows a shadow should appear. However, it often gets the geometry wrong: the shadow might be too long, too short, or pointing in an impossible direction.

Most research into DMs focuses on compositionality—the ability to combine independent concepts (e.g., "a red cat" and "a blue hat"). This paper shifts the focus to inter-feature rules: the hidden dependencies where one feature ($\mathbf{x}$) dictates another ($\mathbf{y}$). If a model perfectly learns a joint distribution $p(\mathbf{x}, \mathbf{y})$, it theoretically should capture the conditional rule $p(\mathbf{y}|\mathbf{x})$. The authors investigate why this doesn't happen in practice, leading to "hallucinations" where the basic physics or logic of a scene is violated.

Examples of real-world failures in DMs and the proposed synthetic tasks.

Methodology

The authors tackle the problem through three distinct lenses:

  1. Empirical Stress-Testing: They evaluated top-tier models like Stable Diffusion 3.5 Large and Flux.1 Dev on real-world scenarios involving shadows, reflections, and semantic correlations (e.g., a brush tip color matching the paint on a canvas).
  2. Synthetic Benchmarking: They designed four controlled synthetic tasks (A-D) with two levels of difficulty:
  3. Coarse-grained: Simple logical constraints (e.g., "the shadow must be on the opposite side of the sun").
  4. Fine-grained: Precise mathematical functions (e.g., "the shadow length must be exactly $L = f(\text{height})$").
  5. Theoretical Analysis: Using a multi-patch data model, the researchers mathematically prove that DMs trained via Denoising Score Matching (DSM) exhibit a constant error in rule conformity. Score estimation errors prevent the model from perfectly "locking in" on the precise manifold where the rule lives.
  6. Mitigation Testing: They tested Guided DDPM (using a classifier to nudge generation) and Filtered DDPM (rejection sampling) to see if common interventions solve the problem.

Key Findings

  • The "Vibe" vs. The "Math": DMs are excellent at capturing the general "vibe" (coarse rules). For instance, they almost never put a shadow on the same side as the sun, achieving a near 0% violation rate for coarse-grained rules in synthetic tasks. However, they treat precise geometric relationships as suggestions rather than laws, showing poor correlation for fine-grained rules.
Scatter plot for Task A showing the variance and error in fine-grained rule learning.
  • The DSM Conflict: The paper’s most significant contribution is proving that the DSM training objective is fundamentally incompatible with perfect rule conformity. Because the model is trained to estimate the "score" (the gradient of the log-density) under noise, small estimation errors propagate and prevent the model from identifying the exact mathematical rule.
  • SOTA Failures: Even massive 12-billion parameter models like Flux.1 failed to generate consistent reflections or correct shadow lengths in simple prompts.
  • Guidance Offers Limited Help: Using a classifier to guide the diffusion process reduced the "Error" metric (a combination of bias and variance) across all tasks. However, the improvement is limited because the difference between a "mostly right" shadow and an "exactly right" shadow is a very subtle signal that classifiers struggle to detect in high-dimensional pixel space.
  • Memorization Check: The authors confirmed that when DMs do get the rule right, they aren't just memorizing the training set; they generate novel samples that happen to follow the rule, albeit inconsistently.

Limitations and Future Directions

The authors acknowledge that their mitigation strategies (guidance and filtering) rely on prior knowledge—you must know the rule to build a classifier for it. In the real world, these rules are often unknown or too complex to define manually.

Future Directions: * Stronger Reward Signals: Moving beyond simple classifiers to Reinforcement Learning from Human Feedback (RLHF) or specialized reward models that understand physical laws. * Rule-Aware Tokenization: Incorporating inter-feature rules directly into how the model "sees" the image at the tokenizer level, rather than trying to fix it during generation. * Architectural Changes: Exploring if different loss functions or model backbones (like Transformers vs. U-Nets) can better capture the hidden laws of the physical world.

Summary updated

BibTeX
@inproceedings{han2025can,
  author = {Yujin Han and Andi Han and Wei Huang and Chaochao Lu and Difan Zou},
  title = {{Can Diffusion Models Learn Hidden Inter-Feature Rules Behind Images?}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=ERU7QgD6gc},
}
Figure