Abstract
Machine Unlearning has recently been emerging as a paradigm for selectively removing the impact of training datapoints from a network. While existing approaches have focused on unlearning either a small subset of the training data or a single class, in this paper we take a different path and devise a framework that can unlearn all classes of an image classification network in a single untraining round. Our proposed technique learns to modulate the inner components of an image classification network through memory matrices so that, after training, the same network can selectively exhibit an unlearning behavior over any of the classes. By discovering weights which are specific to each of the classes, our approach also recovers a representation of the classes which is explainable by-design. We test the proposed framework, which we name Weight Filtering network (WF-Net), on small-scale and medium-scale image classification datasets, with both CNN and Transformer-based backbones.
Introduction
In the era of massive datasets and stringent privacy regulations like GDPR, the "right to be forgotten" has become a critical technical hurdle for machine learning. If a user requests their data be removed, retraining a billion-parameter model from scratch is often prohibitively expensive. Machine Unlearning (MU) aims to solve this by selectively removing the impact of specific training data points. However, most current methods are slow, limited to one class at a time, or significantly degrade the model's overall performance.
The WF-Net Framework
We introduce WF-Net, a framework that allows a model to "untrain" any or all of its classes in a single fine-tuning round while remaining inherently explainable. The core innovation is the Weight-Filtering (WF) layer. Instead of modifying the pre-trained weights ($\hat{w}$) of a network, we encapsulate existing layers (Convolutional or Transformer blocks) with a learnable memory matrix, $\alpha$.
Weight Filtering Mechanism
The modified layer behaves as $\hat{l}(\cdot) = l(\cdot, \alpha_l \odot \hat{w}_l)$. Here, $\alpha$ acts as a mask (values between 0 and 1) that can selectively "turn off" specific filters or attention heads that are highly associated with a specific class. By extending $\alpha$ into a matrix where each row corresponds to a class, the model learns class-specific masks. This allows the user to trigger unlearning for any specific class at runtime simply by indexing the correct row, a process we call Orthogonal Unlearning.
Optimization Strategy
To avoid the instabilities of "negative gradients" (simply moving away from the forget-class gradient), we minimize the reciprocal of the forget loss. This forces the model to maximize the error on the forgotten class as efficiently as possible. This is paired with a "retaining loss" to ensure the model maintains performance on the classes it is supposed to remember, and a regularization term to keep the masks sparse.
Experimental Results
We validated WF-Net across three standard benchmarks: MNIST, CIFAR-10, and ImageNet-1k, using both CNN-based (VGG-16, ResNet-18) and Transformer-based (ViT-Tiny, ViT-Small) architectures.
- Forget Accuracy: On MNIST and CIFAR-10, WF-Net successfully drove the accuracy of forgotten classes down to 0.0% in several configurations (e.g., ViT-S on CIFAR-10).
- Retain Accuracy: The model maintained strong performance on the remaining classes. For ResNet-18 on ImageNet, the retain accuracy only dropped from 70.5% to 64.4%, a much smaller penalty than many competing methods.
- Zero Retrain Forgetting (ZRF): The ZRF score, which measures how "random" a model's behavior is on forgotten data, was consistently higher for WF-Net than for original or retrained models, indicating more thorough unlearning.
Explainability and Insights
WF-Net treats unlearning as a feature selection process rather than simple erasure. Because the $\alpha$ values are explicit masks, we can visualize exactly which parts of the network were "turned off" to forget a class. Using "Insertion" and "Deletion" scores, we demonstrated that these masks are highly effective at identifying the most relevant features for each class, outperforming standard explainability baselines. For example, we found that specific filters in VGG-16 were shared across similar classes (like dogs and horses), while others were uniquely specific to a single category.
Conclusion
WF-Net provides a scalable and explainable solution for multi-class unlearning. By identifying which filters are responsible for which classes, we prove that neural networks often have highly specialized components that can be modulated without full retraining. While there remains a small performance gap in retain accuracy for Transformers, WF-Net represents a significant step toward efficient, verifiable machine unlearning.
Summary updated