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

Rarity Score : A New Metric to Evaluate the Uncommonness of Synthesized Images

Jiyeon Han, Hwanil Choi, Yunjey Choi, Junho Kim, Jung-Woo Ha, Jaesik Choi

TL;DR

The paper introduces the rarity score, a novel evaluation metric that quantifies the uniqueness or uncommonness of individual images synthesized by generative models. By leveraging $k$-nearest neighbor ($k$-NN) distances in a feature space, it allows researchers to identify rare generations, compare the diversity of different models, and analyze the intrinsic rarity of entire datasets.

What Problem Does This Paper Address?

While generative models like GANs have gotten incredibly good at producing high-fidelity images, standard evaluation metrics (such as FID, KID, Precision, and Recall) only assess performance at the distribution level. They tell us how well a set of generated images matches a set of real images, but they cannot tell us how unique or rare a single, specific generated image is.

Consequently, generative models often suffer from a subtle bias: they favor high-density regions of the training data, leading to a lack of individual individuality or "edge-case" generation. Tricks like the truncation trick stabilize training and improve average image quality, but they do so by actively suppressing rare samples. Until now, there has been no reliable way to quantitatively score the rarity of an individual generated image while ensuring it still maintains high fidelity.

Methods

The authors base their metric on an empirical observation: in a pretrained feature space (like VGG16 or CLIP), typical or common images cluster closely together, resulting in small nearest-neighbor distances (NNDs). Conversely, rare images are sparsely distributed and have much larger NNDs.

Figure 1: Real samples with the smallest nearest neighborhood distances (NNDs), middle NNDs, and the largest NNDs, respectively. For ‘Middle NND’ column, the images are randomly selected among the middle-ranked 200 images.

To calculate the rarity score for a generated image:

  1. The image is embedded into a high-dimensional feature space.
  2. The method identifies all $k$-NN spheres of real images that contain this generated sample.
  3. The rarity score is defined as the minimum radius among these overlapping real-data spheres.
Figure 2: Real and fake images and their embeddings in the feature space when calculating the rarity score. The transparent circle represents the k-NN sphere of the corresponding real sample at the center. (a) When g1 is only in k-NN sphere of r1, g1 is scored by the radius of r1 (d1). (b) When g2 is in both k-NN spheres of r2 and r3, g2 is scored by the smallest radius (d2). Since g1 has the higher score than g2, g1 looks more unique than g2. (c) If a sample is out of real manifold as g3, we cannot guarantee the fidelity of the image and thus exclude it from the scoring procedure.

If the radius of the smallest enclosing sphere is large, it means the generated sample resides in a low-density region of the real data manifold, indicating high rarity. Crucially, if a generated sample falls completely outside of all real $k$-NN spheres (Case 3 in the figure above), it is classified as an Out-of-Manifold (OOM) sample. Its rarity score is left undefined and it is excluded from evaluation, preventing the metric from rewarding unrealistic artifacts or distorted images.

Datasets

The metric was validated across several standard image synthesis datasets:

  • FFHQ (Flickr-Faces-HQ) and CelebA-HQ (Human faces)
  • AFHQ-Wild (Animal faces)
  • MetFaces (Oil portraits and statues)
  • LSUN-Car, LSUN-Cat, and LSUN-Horse

Key Insights and Ideas

  • NND as a Proxy for Rarity: The largest NNDs in real datasets naturally correspond to images with strong individuality (e.g., people with face paint or unique accessories in FFHQ, or statues in MetFaces), validating NND as a solid foundation for a rarity metric.
  • Quantifying the Truncation Trick: The metric successfully quantifies the exact impact of the truncation parameter ($\psi$). Lowering $\psi$ shifts the entire rarity score distribution to the left, mathematically demonstrating how truncation sacrifices rare generations for safe, typical ones.
  • Feature Space Sensitivity: What is considered "rare" depends entirely on the feature extractor used. For example, VGG16 flags colorful patterns and textures as rare; DINO (a self-supervised ViT) focuses on structural elements like extreme face angles; and CLIP captures high-level semantics, identifying baby faces as common and distinct from adult faces.

Key Results

  • Model Comparisons: When comparing models trained on FFHQ, StyleGAN2 achieved the highest mean rarity scores for the top $p\%$ of samples, outperforming models like UnetGAN, which generated images much more conservatively.
  • Dataset Rarity Comparison: By merging CelebA-HQ and FFHQ into a unified real manifold, the authors showed that FFHQ's rarity distribution is skewed significantly further to the right than CelebA-HQ's. This quantitatively proves that FFHQ contains a much higher proportion of uncommon, diverse images than the celebrity-focused dataset.
  • Robustness to $k$: The authors demonstrated that the ranking of rarity scores remains highly consistent for any choice of $k \ge 3$, making the metric robust to hyperparameter tuning.
The portion of Out-of-Manifold (OOM) samples decreases as $k$ increases.

Limitations and Future Work

  • Feature Extractor Bias: The metric is inherently bound to the biases of the underlying feature extractor (VGG16, CLIP, etc.). If the embedding space ignores a certain attribute, the rarity score will fail to account for it.
  • Data Dependency: Approximating the real data manifold accurately requires a sufficiently large and representative real dataset.
  • OOM Discarding: Because the metric completely discards Out-of-Manifold samples rather than penalizing them continuously, it cannot provide a graded evaluation for images that are just slightly unrealistic.

Summary updated

BibTeX
@inproceedings{han2023rarity,
  author = {Jiyeon Han and Hwanil Choi and Yunjey Choi and Junho Kim and Jung-Woo Ha and Jaesik Choi},
  title = {{Rarity Score : A New Metric to Evaluate the Uncommonness of Synthesized Images}},
  booktitle = {International Conference on Learning Representations},
  year = {2023},
  url = {https://openreview.net/forum?id=JTGimap_-F},
}
Figure