Assessing Sample Quality in Conditional Generation under Compositional Shift

Berker Demirel, Valentino Maiorca, Marco Fumero, Theofanis Karaletsos, Francesco Locatello

TL;DR

Evaluating conditional generative models on unseen attribute combinations usually creates a paradox: standard metrics require real target samples for comparison, but those samples don't exist yet. This paper introduces a reference-free, per-sample "trust score" that combines global realism and attribute faithfulness using only the training distribution. This score allows researchers to filter out low-quality generations and even reject bad samples early during the diffusion process, saving massive amounts of compute.

What Problem Does This Paper Address?

Conditional diffusion models are incredibly powerful for exploring "what if" scenarios, especially in scientific fields like drug discovery or biological imaging. For instance, a researcher might want to generate an image of a cell population exposed to a completely novel combination of drugs (a compositional shift).

However, evaluating these models faces a fundamental circularity issue. Standard evaluation metrics like Fréchet Inception Distance (FID) or Kernel Inception Distance (KID) score generated samples by comparing them to a ground-truth reference set from the target distribution. But in an extrapolative regime, that target distribution is unavailable by definition. How do you know if a generated image is trustworthy if you've never seen a real example of that specific combination before?

Methods

The authors propose a post-hoc, reference-free trust score ($T$) computed in the latent space of a pretrained feature extractor ($\Phi$). The score decomposes sample quality into two distinct, real-data-calibrated geometric quantities:

$$T = R + F$$

  1. Global Realism ($R$): Measures how close the sample is to the overall training data manifold using Mahalanobis energy. It answers: Does this look like a real image from this domain?
  2. Attribute-wise Faithfulness ($F$): Instead of evaluating the unseen joint condition as a whole, it decomposes the condition into independent attributes. It calculates a target-vs-competitor margin to see if the sample is closer to the requested attribute value than to alternative, plausible values. It answers: Does this image actually show the specific attributes I asked for?
Figure 1: Pipeline for trust scoring under compositional shift. A conditional diffusion model Gθ is queried with an unseen joint condition a⋆and produces candidate samples ˆx. Features from Φ are used to compute a realism term R, which measures proximity to the real training distribution, and a faithfulness term F, which measures alignment with the requested attribute values. Their sum T = R + F provides a calibrated trust score used to rank, filter, or abstain from generated samples.

Early Sample Rejection

Crucially, the authors show that this score doesn't just have to be applied after generation. By training a lightweight multi-layer perceptron (MLP) translator, they map the internal denoising representations of a diffusion model directly into the feature extractor space. This allows the trust score to be evaluated mid-trajectory, enabling online abstention—discarding low-quality samples before wasting compute on full decoding.

Datasets

The method was validated on two primary datasets:

  • RxRx1: A complex biological dataset containing fluorescent microscopy images of 4 cell types subjected to 1,138 genetic (siRNA) perturbations. The authors constructed a challenging 50-condition subset (25 seen during training, 25 unseen) to test support shift.
  • CelebA: A controlled computer vision benchmark using a subset of face images with 4 binary attributes (Male, Smiling, Blond_Hair, Eyeglasses), creating 16 joint conditions where training only sees a minimal subset.

Key Insights and Ideas

  • Attribute-Level Identifiability: While certifying full conditional fidelity for an unseen joint distribution is theoretically impossible without assumptions, individual attribute-level comparisons are point-identified under a mild "reference coverage" condition (i.e., if the attributes are observed individually in other contexts during training).
  • Decoupling Failure Modes: Realism and faithfulness can fail independently. A generated image can look incredibly realistic but completely miss the requested prompt, or it can strictly follow the prompt while looking completely artificial. Evaluating them together provides a calibrated filter.
  • Geometry Matters for Alignment: Standard representation alignment techniques (like REPA) align internal states using cosine distance, which destroys the covariance structure. The authors' custom whitening-geometry objective preserves the Mahalanobis geometry necessary for accurate trust scoring during generation.

Key Results

  • Effective Data Curation: Using a threshold set at the 95th percentile of real-sample trust scores, the method consistently filters out poor generations. It improved generation quality ($\Delta$KID) by 39% to 44% on CelebA and 39% to 42% on RxRx1 compared to random baselines.
  • Downstream Utility: Sorting generations into "trust deciles" revealed that higher-trust samples serve as significantly better training data for downstream classifiers.
Figure 2: CelebA decile binning (REPA-DINOv3 held-out, DINOv3 scoring). ∆KID increases monotonically from bin 0 (best trust) to bin 9 (worst) (left), and correlates with downstream classifi- cation accuracy drops (right). Binning results with faithfulness and realism components, together with RxRx1 DINOv3 decile curves are reported in Section K
  • Biological Validation: Evaluated independently using CellProfiler (an interpretable morphology analysis tool completely separate from the deep learning encoders), trust-selected samples on RxRx1 removed 18% to 29% of excess morphological deviation from real cell structures.
  • Massive Compute Savings: During online abstention on RxRx1, rejecting samples at denoising step $k=27$ (out of 250) saved roughly 89% of the denoising compute while still capturing the majority of the quality filtering performance.

Limitations and Future Work

  • Discrete Attributes Only: The current theoretical framework and formulation are strictly tailored to discrete conditioning variables. Extending this to continuous variables (e.g., dose-response curves in biology) remains an open challenge.
  • Coverage Requirements: The mathematical guarantees rely on "reference coverage," meaning the attributes cannot be completely confounded or entirely unobserved during training.
  • Passive Filtering vs. Active Guidance: Currently, the trust score acts as a passive filter or early-stopping mechanism. A promising future direction is using the score's gradients to actively guide or "drift" the diffusion process toward higher-trust regions during generation.

Summary updated

BibTeX
@inproceedings{demirel2026assessing,
  author = {Berker Demirel and Valentino Maiorca and Marco Fumero and Theofanis Karaletsos and Francesco Locatello},
  title = {{Assessing Sample Quality in Conditional Generation under Compositional Shift}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=x6NGTz0aAP},
}
Figure