# rafiqulexe/machine-unlearning architecture

> Architecture diagram of the GitHub repository rafiqulexe/machine-unlearning, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rafiqulexe/machine-unlearning
- Repository: https://github.com/rafiqulexe/machine-unlearning

## Overview

This repository is a machine-unlearning experiment framework: configure a run, form forget/retain data splits, obtain original and retrained baselines, apply an unlearning method, then evaluate and save results. The README also describes class and random-image forgetting, several methods, and optional ViT support; method implementations are not present in the tree, so their internal behavior is not expanded here. Source excerpts show the runner and core data, training, model, and evaluation components; unsampled subsystem links are omitted where their calls cannot be verified.

Main entry points: [`unlearn/runner.py`](https://github.com/rafiqulexe/machine-unlearning/blob/main/unlearn/runner.py) (Experiment runner), [`unlearn/train.py`](https://github.com/rafiqulexe/machine-unlearning/blob/main/unlearn/train.py) (Training and checkpoints), [`unlearn/models/__init__.py`](https://github.com/rafiqulexe/machine-unlearning/blob/main/unlearn/models/__init__.py) (Model registry), [`unlearn/data.py`](https://github.com/rafiqulexe/machine-unlearning/blob/main/unlearn/data.py) (CIFAR-10 splits)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experiment["Experiment orchestration"]
  node_config["Run configuration<br/>[config.py]"]
  node_runner["Experiment runner<br/>[runner.py]"]
  node_methods["Unlearning methods"]
  node_utils["Shared utilities<br/>[utils.py]"]
end

subgraph group_data["Data preparation"]
  node_data_splits["CIFAR-10 splits<br/>[data.py]"]
end

subgraph group_models["Models and training"]
  node_base_models["Baseline trainer<br/>[base_models.py]"]
  node_training["Training and checkpoints<br/>[train.py]"]
  node_resnet["ResNet-18<br/>[resnet.py]"]
  node_vit["Small ViT<br/>[vit.py]"]
  node_model_registry["Model registry<br/>[__init__.py]"]
end

subgraph group_evaluation["Evaluation"]
  node_metrics["Accuracy metrics<br/>[metrics.py]"]
  node_mia["Membership inference<br/>[mia.py]"]
  node_results[("Run results")]
end

node_user(("Experiment user"))
node_cifar[("CIFAR-10 dataset")]

node_user -->|"sets options"| node_config
node_user -->|"starts run"| node_runner
node_runner -->|"loads settings"| node_config
node_runner -->|"builds splits"| node_data_splits
node_data_splits -->|"loads dataset"| node_cifar
node_runner -->|"loads or trains"| node_training
node_training -->|"creates model"| node_model_registry
node_model_registry -->|"selects model"| node_resnet
node_model_registry -->|"selects model"| node_vit
node_runner -->|"dispatches method"| node_methods
node_runner -->|"computes accuracy"| node_metrics
node_runner -->|"computes attack"| node_mia
node_runner -->|"saves run"| node_results
node_training -->|"uses helpers"| node_utils
node_runner -->|"uses helpers"| node_utils

click node_config "https://github.com/rafiqulexe/machine-unlearning/blob/main/unlearn/config.py"
click node_runner "https://github.com/rafiqulexe/machine-unlearning/blob/main/unlearn/runner.py"
click node_methods "https://github.com/rafiqulexe/machine-unlearning/tree/main/unlearn/methods"
click node_data_splits "https://github.com/rafiqulexe/machine-unlearning/blob/main/unlearn/data.py"
click node_base_models "https://github.com/rafiqulexe/machine-unlearning/blob/main/unlearn/base_models.py"
click node_training "https://github.com/rafiqulexe/machine-unlearning/blob/main/unlearn/train.py"
click node_resnet "https://github.com/rafiqulexe/machine-unlearning/blob/main/unlearn/models/resnet.py"
click node_vit "https://github.com/rafiqulexe/machine-unlearning/blob/main/unlearn/models/vit.py"
click node_model_registry "https://github.com/rafiqulexe/machine-unlearning/blob/main/unlearn/models/__init__.py"
click node_metrics "https://github.com/rafiqulexe/machine-unlearning/blob/main/unlearn/metrics.py"
click node_mia "https://github.com/rafiqulexe/machine-unlearning/blob/main/unlearn/mia.py"
click node_results "https://github.com/rafiqulexe/machine-unlearning/tree/main/results/runs"
click node_utils "https://github.com/rafiqulexe/machine-unlearning/blob/main/unlearn/utils.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_config,node_runner,node_methods,node_utils,node_user toneBlue
class node_data_splits,node_cifar toneAmber
class node_base_models,node_training,node_resnet,node_vit,node_model_registry toneMint
class node_metrics,node_mia,node_results toneRose
```

## Components

### Experiment orchestration

- [Run configuration](https://github.com/rafiqulexe/machine-unlearning/blob/main/unlearn/config.py): `unlearn/config.py`
- [Experiment runner](https://github.com/rafiqulexe/machine-unlearning/blob/main/unlearn/runner.py): `unlearn/runner.py`
- [Unlearning methods](https://github.com/rafiqulexe/machine-unlearning/tree/main/unlearn/methods): `unlearn/methods`
- [Shared utilities](https://github.com/rafiqulexe/machine-unlearning/blob/main/unlearn/utils.py): `unlearn/utils.py`

### Data preparation

- [CIFAR-10 splits](https://github.com/rafiqulexe/machine-unlearning/blob/main/unlearn/data.py): `unlearn/data.py`

### Models and training

- [Baseline trainer](https://github.com/rafiqulexe/machine-unlearning/blob/main/unlearn/base_models.py): `unlearn/base_models.py`
- [Training and checkpoints](https://github.com/rafiqulexe/machine-unlearning/blob/main/unlearn/train.py): `unlearn/train.py`
- [ResNet-18](https://github.com/rafiqulexe/machine-unlearning/blob/main/unlearn/models/resnet.py): `unlearn/models/resnet.py`
- [Small ViT](https://github.com/rafiqulexe/machine-unlearning/blob/main/unlearn/models/vit.py): `unlearn/models/vit.py`
- [Model registry](https://github.com/rafiqulexe/machine-unlearning/blob/main/unlearn/models/__init__.py): `unlearn/models/__init__.py`

### Evaluation

- [Accuracy metrics](https://github.com/rafiqulexe/machine-unlearning/blob/main/unlearn/metrics.py): `unlearn/metrics.py`
- [Membership inference](https://github.com/rafiqulexe/machine-unlearning/blob/main/unlearn/mia.py): `unlearn/mia.py`
- [Run results](https://github.com/rafiqulexe/machine-unlearning/tree/main/results/runs): `results/runs`

### Other components

- **Experiment user**
- **CIFAR-10 dataset**

## Connections

- Experiment user → Run configuration: sets options (evidence: `README.md`)
- Experiment user → Experiment runner: starts run (evidence: `README.md`)
- Experiment runner → Run configuration: loads settings (evidence: `unlearn/runner.py`)
- Experiment runner → CIFAR-10 splits: builds splits (evidence: `unlearn/runner.py`)
- CIFAR-10 splits → CIFAR-10 dataset: loads dataset (evidence: `unlearn/data.py`)
- Experiment runner → Training and checkpoints: loads or trains (evidence: `unlearn/runner.py`)
- Training and checkpoints → Model registry: creates model (evidence: `unlearn/train.py`)
- Model registry → ResNet-18: selects model (evidence: `unlearn/models/__init__.py`)
- Model registry → Small ViT: selects model (evidence: `unlearn/models/__init__.py`)
- Experiment runner → Unlearning methods: dispatches method (evidence: `unlearn/runner.py`)
- Experiment runner → Accuracy metrics: computes accuracy (evidence: `unlearn/runner.py`)
- Experiment runner → Membership inference: computes attack (evidence: `unlearn/runner.py`)
- Experiment runner → Run results: saves run (evidence: `unlearn/runner.py`)
- Training and checkpoints → Shared utilities: uses helpers (evidence: `unlearn/train.py`)
- Experiment runner → Shared utilities: uses helpers (evidence: `unlearn/runner.py`)
