Full Continual Unlearning Experiment
The experiment in Configure CUL Main Experiment section is continual unlearning main experiment (CUL Main). The evaluation of continual unlearning main experiment can only produce basic results, which include the evaluation of the objective of continual learning, not the objective of unlearning. To get full results of evaluation including the latter, we need run additional reference experiment, and use their results to evaluate:
- Retraining: Retrain continual learning from scratch without tasks requested to unlearn. It is used to calculate the unlearning metric Distribution Distance (DD).
- Original: Retrain continual learning from scratch including all tasks. It is used to calculate the metric Accuracy Difference (AD).
These reference models are trained and evaluated by the following 3 commands:
clarena train culrefretrain
clarena train culreforiginal
then passed to a evaluation command clarena eval cul
that calculate the related metrics using the results of both CUL main and reference experiments. These processes can be combined into one single command of the full continual unlearning experiment. We introduce them below.
Usage of clarena train culrefretrain
This command construct a corresponding retraining experiment from the specified continual unlearning main experiment config:
clrun train clrefretrain experiment=<CULMain-experiment-name>
This will preprocess the CUL Main experiment config into joint learning experiment config, which involves:
- Set the
output_dir
as subfolderclrefretrain
under the CUL Main experiment output directory. - Exclude the unlearned tasks (as shown in
unlearning_requests
) in the fieldtrain_tasks
andeval_after_tasks
. - Remove fields related to unlearning, such as
unlearning_requests
,/unlearning_algorithm
. - Switch
/callbacks
fromcul_default.yaml
tocl_default.yaml
.
For details, please check the source code.
Usage of clarena train culreforiginal
This command construct a corresponding retraining experiment from the specified continual unlearning main experiment config:
clrun train culreforiginal experiment=<CULMain-experiment-name>
This will preprocess the CUL Main experiment config into joint learning experiment config, which involves:
- Set the
output_dir
as subfolderculreforiginal
under the CUL Main experiment output directory. - Remove fields related to unlearning, such as
unlearning_requests
,/unlearning_algorithm
. - Switch
/callbacks
fromcul_default.yaml
tocl_default.yaml
.
For details, please check the source code.
Usage of clarena eval cul
This command run a continual unlearning full evaluation experiment, which evaluates model trained from the main experiment and reference experiment on the CL test dataset, and calculate unlearning metrics:
- Evaluate Distribution Distance (DD) using the model trained from CUL Main experiment and the model trained from reference retraining experiment, on the CL test dataset. Save the data and figures.
- Evaluate Accuracy Difference (AD) using the model trained from CUL Main experiment and the model trained from reference original experiment, on the CL test dataset. Save the data and figures.
Below shows an example and the required fields of its experiment index config.
Example
configs/experiment/example_cul_eval.yaml
# @package _global_
# make sure to include the above commented global setting!
main_model_path: outputs/example_culmain_train/2023-10-01_12-00-00/saved_models/model.pth
refretrain_model_path: outputs/example_culmain_train/2023-10-01_12-00-00/culrefretrain/results/model.pth
reforiginal_model_path: outputs/example_culmain_train/2023-10-01_12-00-00/culreforiginal/results/model.pth
dd_eval_tasks: 5
ad_eval_tasks: 5
cl_paradigm: TIL
global_seed: 1
defaults:
- /cl_dataset: permuted_mnist.yaml
- /trainer: cpu.yaml
- /metrics: cul_full_eval_default.yaml
- /callbacks: cl_default.yaml
- /hydra: default.yaml
- /misc: default.yaml
output_dir: outputs/example_culmain_train/2023-10-01_12-00-00
Required Config Fields
Field | Description | Allowed Values |
---|---|---|
main_model_path |
The file path of the CUL Main model to evaluate |
|
refretrain_model_path |
The file path of the reference retraining model |
|
reforiginal_model_path |
The file path of the reference original model |
|
dd_eval_tasks |
The list of task IDs1 that the metric DD is evaluated and averaged on |
|
ad_eval_tasks |
The list of task IDs2 that the metric AD is evaluated and averaged on |
|
cl_paradigm |
The continual learning paradigm |
|
global_seed |
The global seed for the experiment. It helps reproduce the results |
|
/cl_dataset |
The original continual learning dataset that the model is evaluated on |
|
/trainer |
The PyTorch Lightning Trainer object which contains all configs for testing process |
|
/metrics |
The metrics to be monitored, logged or visualized |
|
/callbacks |
The callbacks applied to this evaluation experiment. Callbacks are additional actions integrated in different timing of the experiment |
|
output_dir |
The folder path storing the experiment results. |
|
/hydra |
Configuration for Hydra itself |
|
/misc |
Miscellaneous configs that are less related to the experiment |
|
The output results are summarized in Output Results (CUL) section.
The experiment run by clarena eval cul
is managed by a CULFullMetricsCalculation
class. To learn how these fields work, please refer to its source code.
Full CUL Experiment in One Command
We integrate all the process above into one command as a full CUL experiment:
clarena run cul experiment=<experiment-name>
Note that this experiment config remains the same as the CUL Main experiment.
This effectively run these:
clarena train culmain experiment=<CULMain-experiment-name>
clarena train culrefretrain experiment=<CULMain-experiment-name>
clarena train culreforiginal experiment=<CULMain-experiment-name>
clarena eval cul experiment=<experiment-name>
, where this experiment is a CUL full metrics calculation experiment, its config is constructed based on the above CUL main and reference experiments, detailed as follows (for details, please check the source code):- Align
main_acc_csv_path
with the path where the continual learning main experiment outputs the accuracy metrics data to. - Align
refretrain_acc_csv_path
with the path where the reference retraining experiment outputs the accuracy metrics data to. - Align
reforiginal_acc_csv_path
with the path where the reference original experiment outputs the accuracy metrics data to. - Set
output_dir
and allsave_dir
as the same as the CUL main experiment output directory, so that all the results are saved in the same folder. - Set
dd_csv_name
,ad_csv_name
,dd_plot_name
,ad_plot_name
as the default names.
- Align
The full output results are summarized in Output Results (CUL) section.
Footnotes
The task IDs are integers starting from 1, ending with number of tasks of the CL dataset. Each corresponds to a task-specific dataset in the CL dataset.↩︎
The task IDs are integers starting from 1, ending with number of tasks of the CL dataset. Each corresponds to a task-specific dataset in the CL dataset.↩︎