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

Unlocking Feature Visualization for Deep Network with MAgnitude Constrained Optimization

Thomas Fel, Thibaut Boissin, Victor Boutin, Agustin Picard, Paul Novello, Julien Colin, Drew Linsley, Tom Rousseau, Rémi Cadène, Lore Goetschalckx, Laurent Gardes, Thomas Serre

Introduction

In the realm of Explainable AI (XAI), attribution methods like Grad-CAM excel at telling us where a model is looking in an image. However, they fall short of explaining what semantic feature the model is actually searching for. Feature visualization addresses this gap by using gradient ascent to generate an image from scratch that maximally activates a specific neuron or layer, providing a direct window into the network's learned representations.

While early feature visualization methods worked beautifully on older models like VGG16, they completely break down on modern, deeper networks such as ResNet50 or Vision Transformers (ViTs). Without heavy regularization, deep models cheat the optimization process by generating incomprehensible, high-frequency noise—similar to adversarial attacks.

To fix this, recent approaches have relied on generative models (like GANs) to force the generated images to look realistic. Unfortunately, this introduces a massive bias: it becomes impossible to tell which features come from the classifier being studied and which were simply hallucinated by the GAN prior. The authors of this paper introduce a novel method to bypass these issues entirely, unlocking feature visualization for state-of-the-art models without relying on biased generative priors.

The Challenge with Modern Architectures

The core issue with scaling feature visualization is that deep models tend to push optimization into high frequencies. When standard feature visualization is applied to ViTs, the resulting power spectrum contains vastly more high-frequency energy than natural images, resulting in visual static rather than interpretable features.

Comparison of standard Fourier feature visualization versus MACO across VGG16, ResNet50, and ViT architectures.

MACO: Magnitude Constrained Optimization

To solve this, the authors propose MACO (Magnitude Constrained Optimization). MACO shifts the optimization process entirely into the Fourier domain using polar coordinates, splitting the spectrum into two components: magnitude and phase.

  1. The Constraint: The magnitude is hard-coded to match the average magnitude spectrum of natural images (calculated once from a dataset like ImageNet).
  2. The Optimization: The gradient ascent only updates the phase of the image.

This approach is heavily inspired by psychophysics, which shows that human visual recognition is driven far more by phase than by magnitude. By locking the magnitude to a natural baseline, the optimizer is physically prevented from pumping energy into adversarial high frequencies.

Furthermore, because MACO's magnitude constraint acts as a powerful natural image prior, it requires far fewer image augmentations during optimization. Previous methods required dozens of heavy augmentations (jitter, rotation, scaling) to prevent noise, whereas MACO achieves stability with just two simple augmentations: random crop and additive noise.

Transparency for Free

MACO also provides an attribution mask alongside the generated image. By averaging the intermediate gradients during the optimization process (similar to SmoothGrad), MACO highlights exactly which spatial regions of the generated image the neuron actually cares about. This localized "transparency for free" significantly reduces human confirmation bias when interpreting the visualizations.

Key Results and Benchmarks

The authors introduced a new benchmark to quantitatively evaluate feature visualizations without generative priors, testing across architectures like FlexiViT, ViT, and ResNetV2:

  • Plausibility & FID: MACO generates images that are significantly closer to the distribution of natural images. On FlexiViT, MACO achieved an FID score of 230.68, a marked improvement over the 250.25 scored by standard Fourier methods.
  • Transferability: If a visualization truly captures a universal semantic concept (e.g., a "dog ear"), it should activate other models as well. MACO visualizations transferred exceptionally well. Images generated from FlexiViT achieved 68% accuracy when fed into a MobileNet, compared to just 38% for baseline methods.
  • Human Interpretability: In a psychophysics study with 174 participants, users were asked to predict which of two images a model would "prefer." Participants using MACO visualizations were significantly better at predicting model behavior than those using older methods, proving the visualizations are genuinely interpretable to humans.

Limitations and Future Work

The authors note an important philosophical limitation: realism does not always equal faithfulness. By forcing the generated images to share the magnitude spectrum of natural images, MACO might inadvertently hide spurious, unnatural features that the model actually relies on. If a model is "cheating" using high-frequency noise, MACO might mask that flaw by forcing the explanation to look natural.

To combat this, the authors suggest that feature visualization should not be used in isolation. In practical applications, they recommend combining MACO with concept-based explainability frameworks to provide a holistic view of both the semantic concepts a model learns and exactly how it applies them.

Summary updated

BibTeX
@inproceedings{fel2023unlocking,
  author = {Thomas Fel and Thibaut Boissin and Victor Boutin and Agustin Picard and Paul Novello and Julien Colin and Drew Linsley and Tom Rousseau and Rémi Cadène and Lore Goetschalckx and Laurent Gardes and Thomas Serre},
  title = {{Unlocking Feature Visualization for Deep Network with MAgnitude Constrained Optimization}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=J7VoDuzuKs},
}
Figure