Attaining Class-Level Forgetting in Pretrained Model Using Few Samples

Pravendra Singh, Pratik Mazumder, Mohammed Asad Karim

Abstract

In order to address real-world problems, deep learning models are jointly trained on many classes. However, in the future, some classes may become restricted due to privacy/ethical concerns, and the restricted class knowledge has to be removed from the models that have been trained on them. The available data may also be limited due to privacy/ethical concerns, and re-training the model will not be possible. We propose a novel approach to address this problem without affecting the model’s prediction power for the remaining classes. Our approach identifies the model parameters that are highly relevant to the restricted classes and removes the knowledge regarding the restricted classes from them using the limited available training data. Our approach is significantly faster and performs similar to the model re-trained on the complete data of the remaining classes.

Introduction

In the era of GDPR and increasing ethical scrutiny, "the right to be forgotten" has become a critical requirement for AI systems. When specific categories of data—such as faces of individuals who withdrew consent or restricted medical categories—become "off-limits," a model trained on that data must be stripped of its ability to recognize those classes. This process is known as machine unlearning.

The standard solution is Full Data Retraining (FDR), where the restricted data is discarded and the model is trained from scratch. However, FDR is often infeasible because the original full dataset may no longer be available, or the computational cost is prohibitive for large-scale models. Simple fixes, like deleting the final classification layer's weights, fail because the "knowledge" of the restricted class remains embedded in the model's feature-extracting backbone. This research introduces the RCRMR-LD problem: how to remove restricted categories from model representations using only limited data.

The goal of class-level forgetting: transitioning from a model $M_o$ containing all classes to a model $M$ where restricted classes $C^e$ are erased from both internal representations and outputs.

The ERwP Methodology

The authors propose ERwP (Efficient Removal with Preservation), a framework designed to surgically remove class-specific knowledge while preserving the model's performance on remaining classes. The method operates in two main stages:

1. Identifying Class-Specific Parameters

To avoid damaging the entire network, ERwP first identifies which weights in a massive neural network are most relevant to a specific class. The researchers employ a novel "augmentation as a probe" technique: they take a few samples of the restricted class and apply a data augmentation (such as grayscaling) that the model did not encounter during initial training. By performing a backward pass on these augmented samples, the parameters that receive the largest gradient updates are deemed the most "relevant" to that specific class. This allows for the creation of a mask ($\Theta_{exrel}$) of class-specific parameters, ensuring that subsequent optimization is targeted.

2. Optimization via Combined Losses

Instead of updating the entire network, ERwP only optimizes the identified relevant parameters using a combination of three distinct loss functions:

  • Gradient Ascent ($\mathcal{L}^e_c$): For the restricted (excluded) classes, the model maximizes classification loss to effectively "break" its ability to recognize them.
  • Gradient Descent ($\mathcal{L}^{ne}_c$): For the remaining (non-excluded) classes, the model minimizes loss to maintain standard performance.
  • Knowledge Distillation ($\mathcal{L}_{kd}$): To prevent catastrophic forgetting of general features, the original unmodified model acts as a "teacher." The new "student" model is encouraged to keep its predictions for remaining classes as close to the original as possible.
The ERwP optimization framework utilizing teacher-student distillation and class-specific losses to achieve forgetting while maintaining performance on non-excluded classes.

Experimental Evaluation

The researchers evaluated ERwP on three standard benchmarks: CIFAR-100 (ResNet-20, 56, 164), ImageNet-1k (ResNet-18, 50, MobileNet-V2), and CUB-200. To simulate a realistic "limited data" setting, they used only 10% of CIFAR-100 data and 5% of ImageNet data for the forgetting process.

Key Results

  • Efficiency: On ImageNet, ERwP is approximately 200x faster than retraining from scratch.
  • Effectiveness: The "Forgetting Accuracy" (FAe) dropped to near 0% across all tested architectures, indicating successful erasure.
  • Preservation: The "Constraint Accuracy" (CAne)—performance on classes the model is supposed to remember—remained within ~1% of the original model's performance.
  • Superiority over Baselines: ERwP significantly outperformed 9 different baseline methods. The authors demonstrated that simple weight-zeroing is insufficient because a "nearest prototype" classifier can still identify restricted classes using the model's internal features—a phenomenon they call the "Feature-Level Trap."

Conclusion

ERwP provides a scalable and efficient solution for class-level unlearning in deep learning models. By identifying class-specific parameters through novel augmentations and using a multi-faceted loss approach, it achieves the performance of full retraining at a fraction of the cost. Future work may extend this framework to incremental and federated learning scenarios where data privacy is paramount.

Summary updated

BibTeX
@misc{singh2022attaining,
  author = {Pravendra Singh and Pratik Mazumder and Mohammed Asad Karim},
  title = {{Attaining Class-Level Forgetting in Pretrained Model Using Few Samples}},
  year = {2022},
  eprint = {2210.10670},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2210.10670},
}
Figure