Machine Unlearning, Healthcare

Erasing Medical Footprints: A Machine Unlearning Study on an Histopathology Dataset

By
Tomer Raviv
August 20, 2024

TL;DR

The BreaKHis dataset contains images of breast tumor tissues categorized as either benign or malignant, including detailed subclasses. In this post, we explore state-of-the-art machine unlearning approaches to forget either particular patients in the dataset, or a subset of random images from all patients. These cases, especially the specific-patient forgetting case, resemble potential use cases of applying the GDPR’s “Right to Be Forgotten” or patient opt-out of clinical trials. Our findings show that by using unlearning, it is possible to achieve results equivalent to a completely-retrained model, with only a fraction of the time.

The BreaKHis Dataset

The BreaKHis dataset is a medical histopathology dataset comprising images from 81 patients, each with approximately 100 biopsy images, totaling nearly 8,000 images after de-duplication. Each patient's image set belongs to one of two superclasses, 'benign' or 'malignant,' and further to a specific subclass, such as 'adenosis,' 'fibroadenoma,' 'lobular carcinoma,' and others, making up a total of 8 subclasses. Achieving highly accurate models on this dataset can assist in early detection of malignant tumors, potentially leading to earlier treatment and better prognosis for patients.

‘Malignant’ Labelled Image
'Benign' Labelled Image

Motivation for Unlearning

As we described in a previous post, the General Data Protection Regulation (GDPR) enforces the "right to be forgotten," requiring that individuals can request the deletion of their personal data. This regulation is particularly important in the medical field, where patients can opt out of medical experiments.  Furthermore, the removal of outdated or irrelevant data is essential to maintain the accuracy of machine learning models.

One way to comply with such requests is to train a new model on the entire dataset, excluding the patients' images that need to be removed (typically referred to as the forget set). However, retraining from scratch is costly, and the cost is magnified with multiple removal requests. Unlearning presents an enticing alternative as a low-cost and low-complexity solution. By implementing unlearning techniques, we can ensure compliance with GDPR, protect patient privacy, and keep the dataset current.

SOTA Methods

Several unlearning methods exist in current literature, each with its own merits and drawbacks:

  1. Selective Synaptic Dampening (SSD): This method calculates a ratio for each neuron in the network, measuring its importance to the forget set versus its importance to the entire dataset. Neurons with a high ratio are considered important to the forget set but not to the total dataset, so they can be attenuated or removed. However, if the forget set is similar to the full dataset, this ratio may be close to 1 for all neurons, rendering the method ineffective. We use the adaptive SSD variant to refrain from choosing the α and λ hyperparameters manually.
  2. Bad Teaching Unlearning: This approach trains the model to behave randomly on the forget set while retaining its original behavior on the rest of the samples. However, this random behavior can significantly deteriorate the model's performance on the full dataset.
  3. Hirundo Unlearning (Our Own Approach): We have developed a new method inspired by the above techniques and several others, aiming to balance the benefits while mitigating the drawbacks.

10 Patients Unlearning Results

We tested different unlearning methods by forgetting the data of 10 patients from the training set. The validation set consisted of 18 patients not used in training, while the training set initially had 63 patients. We used the ResNet-18 architecture and the binary ‘benign’/’malignant’ labels. For comparison, we retrained the model on 52 patients, excluding the forget set, and applied the other methods to forget the 10 patients. We also measured the time taken for each method. To ensure accuracy, all training, retraining, and forgetting processes were averaged over three different random seeds.

Table 1: Patients Unlearning Benchmark

Our findings show that our approach closely matches the retrained model baseline in terms of accuracy, with an error at most only 1% lower than the retrained model. It is worth noting that being as similar as possible to this model, both in terms of effective forgetting and in terms of model functionality, is the ultimate goal of unlearning. Our method is also the most stable, having the smallest standard deviation, while the SSD approach shows large deviations between runs, and the bad teaching method significantly harms validation performance.

In terms of runtime, our approach is not the fastest, and similarly as the bad teaching method, it depends only on the size of the forget set. Therefore, as the original dataset increases, the runtime of retraining would increase, but the runtime of our approach (and of the bad teaching method) would remain the same. As for SSD, though it is the fastest of the methods in this constellation, it still requires to run back-propagation once on the entire retained dataset, as well as the forget set. Thus, as the dataset’s size increases, its runtime will increase as well.

We can visualize the results by showing images where the original model’s prediction is flipped by both retraining and our approach. Both methods agree on the unlearned sample’s label.

Original model: ‘Malignant’
Re-trained model: ‘Benign’
Hirundo model: ‘Benign’
Original model: ‘Benign’
Re-trained model: ‘Malignant’
Hirundo model: ‘Malignant’

100 Random Samples Unlearning Results

We repeated the experiment, this time forgetting 100 samples drawn randomly from the training set. This scenario represents a use-case of outdated or corrupted data removal. The challenge here is to retain high performance on the validation patients while forgetting a few images from random train patients.

Table 2: Random Samples Unlearning Benchmark

In this case, the bad teaching method closely matched our method’s validation results, while being faster. The random behavior induced by the bad teaching method seems to work well in this scenario. However, our results remain more consistent across both this and the previous scenario.

Again, visualizing the results shows that one of the unlearned samples has both retrained model and our approach’s model agreeing on.

Original model: ‘Benign’
Re-trained model: ‘Malignant’
Hirundo model: ‘Malignant’

Labels Flipping Unlearning

Finally, we consider the case of mislabels. Mislabels almost always occur to some extent, even when the training data is labeled by expert professionals (see more in our VinDr-CXR case study, where we uncover mislabels done by certified radiologists). When there are such issues in the training data, it can considerably degrade the model’s performance. By unlearning specifically the wrong samples we can induce desired behavior and sometimes even increase its performance.

To conduct a test for this setting, we "flipped" (changed the labels) of 5% of the samples at random, corrupting ~400 samples and training a model using the entire dataset again. Then, we use Hirundo’s dataset optimization to detect the mislabeled samples, and consider the detected set of images as the forget set. Then, unlearning is done as above using the same methods.

Table 3: Label Flipping Unlearning Benchmark

Observing the results, we can see that the original model did not overfit to the corrupted forget set. The model retrained without the forget set is less accurate on it, and can better generalize to unseen data as indicated by the higher validation accuracy. The SSD and bad teaching approaches only decrease the validation accuracy, showing they are not suitable for this scenario. Finally, our approach is able to explicitly reduce performance on the forget set and increase validation accuracy, being most similar in performance to the retrained model. Note that this is a simple binary classification, and further investigation of this phenomena on multi-class classification is required.

Corrupted image sample.
Before corruption: ‘Benign’;
After: ‘Malignant’.

In the case of predicting the label for the example image, which was originally labeled as 'Benign,' both the original and retrained models incorrectly predicted it as 'Malignant’. However, by specifically forgetting this sample, our model successfully predicted the image's label as 'Benign'. This demonstrates the effectiveness of our unlearning approach in correcting label predictions and even surpassing the retrained model under these unique conditions.

Conclusions

Machine unlearning is becoming increasingly crucial across many domains and applications. Harnessing this technology is not free from drawbacks, which one must weigh depending on the specific use case and goals. In the medical field, for instance, it seems feasible to forget a subset of images or patients without compromising performance, provided the right methods are used.

At Hirundo, we have developed a novel approach that strives to achieve a balanced model across all performance metrics, being almost indistinguishable from the re-trained model in terms of accuracy, but with significantly smaller runtime.

Tomer Raviv
Senior Deep Learning Researcher, Hirundo

Ready to forget?

Start removing unwanted data with a few clicks