Class Interference of Deep Neural Networks

Dongcui Diao, Hengshuai Yao, Bei Jiang

Abstract

Recognizing and telling similar objects apart is even hard for human beings. In this paper, we show that there is a phenomenon of class interference with all deep neural networks. Class interference represents the learning difficulty in data, and it constitutes the largest percentage of generalization errors by deep networks. To understand class interference, we propose cross-class tests, class ego directions and interference models. We show how to use these definitions to study minima flatness and class interference of a trained model. We also show how to detect class interference during training through label dancing pattern and class dancing notes.

Introduction

Deep neural networks are remarkably good at classification, but they still have "blind spots" that researchers struggle to explain. While it is well-established that some models generalize better than others—often attributed to the "flatness" of the loss landscape—traditional visualization methods often fail to capture the nuances of why specific errors occur. Standard techniques, such as interpolating between models or picking random directions in the parameter space, are somewhat arbitrary. They do not account for the fact that generalization errors are non-uniform: in a dataset like CIFAR-10, a model rarely confuses a "ship" with a "cat," but it frequently confuses a "dog" with a "cat."

This research identifies Class Interference as a primary source of generalization error. By introducing a framework to quantify this interference, we can probe the geometry of the loss landscape more meaningfully than with random directions.

Methods and Analytical Tools

The authors propose several novel tools to analyze model behavior and quantify interference:

  1. Cross-Class Test Matrix (CCTM): This is a normalized version of a confusion matrix that specifically measures how much one class interferes with another. It highlights the symmetric nature of interference between similar categories.
  2. Class Ego Directions: Instead of random directions, the authors calculate the gradient of the loss for a single class ($c$). Moving in this "ego direction" optimizes the model specifically for that class, often at the expense of others.
  3. Interference Space: By picking two classes (e.g., Cat and Dog) and using their ego directions as axes, the authors create a 2D plane to visualize the loss. This allows them to see how the model balances the needs of competing classes.
Cross-Class Test Maps for VGG19 and ResNet18 showing interference patterns.
  1. Label Dancing & Dancing Notes: A visualization technique used during training to track which classes are "winning" or "losing" at any given epoch. If the recall for "Cat" drops while "Dog" rises, they are "dancing"—a clear sign of interference.

Key Insights: Flatness is Directional

One of the most significant findings is that the "flatness" of a minimum depends entirely on the classes being observed. A minimum that appears "flat" when looking at distinct classes like "Horse vs. Ship" might look incredibly "sharp" or spiky when looking at "Cat vs. Dog." This suggests that previous research into flat minima was incomplete because it didn't consider these class-specific "valleys."

3D loss landscapes in interference space for various class pairs.

The authors also found that learning rate annealing (starting high and decaying) doesn't just find a flat minimum—it finds a "lowland." This is a massive, flat terrain in the loss landscape that is much larger than the minima found by constant large learning rates. Furthermore, interference is largely symmetric: if a model struggles to distinguish a cat from a dog, it almost certainly has the same difficulty distinguishing a dog from a cat. This symmetry suggests that interference is a property of the data's inherent difficulty rather than just a model quirk.

Results on CIFAR-10

The study primarily used the CIFAR-10 dataset to evaluate architectures like VGG19 and ResNet18. Key results include:

  • Generalization Bottleneck: Cat and Dog classes account for the vast majority of errors. For instance, while VGG19 achieves 96.5% accuracy on "Ship," it only reaches 86.7% on "Cat."
  • Optimizer Impact: Small learning rates lead to "spiky," sharp minima that generalize poorly. In contrast, annealed learning rates produced the best results (e.g., 95.15% accuracy on ResNet18) and created the largest "lowland" areas in the interference space.
  • Visualizing the "Banana": In the Cat-Dog interference space, the loss landscape often resembles a Rosenbrock function—a narrow, curved valley. This explains why these classes are so difficult for gradient descent to optimize simultaneously.

Limitations and Future Work

While the paper provides excellent diagnostic tools, it focuses exclusively on CIFAR-10. Scaling "class ego directions" to datasets with thousands of classes (like ImageNet) would be computationally expensive. Additionally, the paper identifies interference but does not yet propose a new training algorithm to mitigate it. Future work could involve using these ego directions to develop optimization strategies that explicitly minimize interference during training.

Summary updated

Abstract

Recognizing and telling similar objects apart is even hard for human beings. In this paper, we show that there is a phenomenon of class interference with all deep neural networks. Class interference represents the learning difficulty in data, and it constitutes the largest percentage of generalization errors by deep networks. To understand class interference, we propose cross-class tests, class ego directions and interference models. We show how to use these definitions to study minima flatness and class interference of a trained model. We also show how to detect class interference during training through label dancing pattern and class dancing notes.
BibTeX
@inproceedings{diao2023class,
  author = {Dongcui Diao and Hengshuai Yao and Bei Jiang},
  title = {{Class Interference of Deep Neural Networks}},
  booktitle = {International Conference on Learning Representations},
  year = {2023},
  url = {https://openreview.net/forum?id=tkvyCt1PzpvP},
}
Figure