# guts-yang/asu-unlearning architecture

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

- Interactive diagram: https://gitdiagram.com/guts-yang/asu-unlearning
- Repository: https://github.com/guts-yang/asu-unlearning

## Overview

This repository presents Attention Smoothing Unlearning (ASU): training modifies a language model using a smoothed-attention forget teacher, then benchmark evaluation measures forgetting and retained utility. The tree also contains separate TOFU-style, MUSE, WMDP, and open-unlearning implementations, so the graph preserves these as related but distinct branches. Edges are limited to relationships visible in excerpts or the source index; some benchmark wiring is therefore omitted.

Main entry points: [`open-unlearning/src/train.py`](https://github.com/guts-yang/asu-unlearning/blob/main/open-unlearning/src/train.py) (Training Entry), [`Right-to-be-forgotten/forget.py`](https://github.com/guts-yang/asu-unlearning/blob/main/Right-to-be-forgotten/forget.py) (Unlearning Runner), [`Right-to-be-forgotten/trainer/losses.py`](https://github.com/guts-yang/asu-unlearning/blob/main/Right-to-be-forgotten/trainer/losses.py) (Unlearning Losses), [`Right-to-be-forgotten/trainer/trainer.py`](https://github.com/guts-yang/asu-unlearning/blob/main/Right-to-be-forgotten/trainer/trainer.py) (Forgetting Trainer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_asu["ASU Training"]
  node_asu_method["Attention Smoothing"]
  node_asu_model["Llama Attention Model<br/>[my_llama.py]"]
  node_asu_loss["Unlearning Losses<br/>[losses.py]"]
  node_asu_trainer["Forgetting Trainer<br/>[trainer.py]"]
end

subgraph group_tofu["TOFU Workflow"]
  node_tofu_data["Forget Data Module<br/>[data_module.py]"]
  node_tofu_runner["Unlearning Runner<br/>[forget.py]"]
  node_tofu_eval["TOFU Evaluation<br/>[metrics.py]"]
  node_tofu_eval_runner["Evaluation Runner<br/>[real_world_eval.py]"]
end

subgraph group_muse["MUSE Benchmark"]
  node_muse_runner["MUSE Evaluation<br/>[eval.py]"]
  node_muse_data["MUSE Datasets<br/>[dataset.py]"]
  node_muse_unlearn["MUSE Baselines<br/>[unlearn.py]"]
  node_muse_metrics["MUSE Metrics"]
end

subgraph group_open["Open Unlearning"]
  node_open_train["Training Entry<br/>[train.py]"]
  node_open_data["Training Data"]
  node_open_model["Model Loading<br/>[__init__.py]"]
  node_open_trainer["Unlearning Methods"]
  node_open_evals["Evaluation Framework"]
  node_open_probe["Model Probing<br/>[probe.py]"]
end

subgraph group_wmdp["WMDP Benchmark"]
  node_wmdp_asu["ASU Unlearning<br/>[unlearn.py]"]
  node_wmdp_utils["ASU Utilities<br/>[utils.py]"]
  node_wmdp_model["Mistral Attention Model<br/>[my_mistral.py]"]
  node_wmdp_rmu["RMU Unlearning<br/>[unlearn.py]"]
end

node_researcher(("Researcher"))

node_researcher -->|"selects method"| node_asu_method
node_asu_method -->|"guides distillation"| node_asu_loss
node_asu_trainer -->|"computes loss"| node_asu_loss
node_asu_loss -.->|"uses attention temperature"| node_asu_model
node_tofu_runner -->|"loads data"| node_tofu_data
node_tofu_runner -->|"trains with"| node_asu_trainer
node_tofu_runner -->|"loads model"| node_asu_model
node_tofu_eval_runner -->|"runs metrics"| node_tofu_eval
node_tofu_eval -->|"uses dataset"| node_muse_data
node_muse_runner -->|"dispatches metrics"| node_muse_metrics
node_muse_unlearn -->|"loads dataset"| node_muse_data
node_open_train -->|"loads data"| node_open_data
node_open_train -->|"loads model"| node_open_model
node_open_train -->|"configures training"| node_open_trainer
node_open_train -->|"configures evaluation"| node_open_evals
node_open_model -->|"registers model"| node_open_probe
node_wmdp_asu -->|"uses utilities"| node_wmdp_utils
node_wmdp_utils -->|"imports model"| node_wmdp_model

click node_asu_model "https://github.com/guts-yang/asu-unlearning/blob/main/Right-to-be-forgotten/my_models/my_llama.py"
click node_asu_loss "https://github.com/guts-yang/asu-unlearning/blob/main/Right-to-be-forgotten/trainer/losses.py"
click node_asu_trainer "https://github.com/guts-yang/asu-unlearning/blob/main/Right-to-be-forgotten/trainer/trainer.py"
click node_tofu_data "https://github.com/guts-yang/asu-unlearning/blob/main/Right-to-be-forgotten/dataset/data_module.py"
click node_tofu_runner "https://github.com/guts-yang/asu-unlearning/blob/main/Right-to-be-forgotten/forget.py"
click node_tofu_eval "https://github.com/guts-yang/asu-unlearning/blob/main/Right-to-be-forgotten/metrics/metrics.py"
click node_tofu_eval_runner "https://github.com/guts-yang/asu-unlearning/blob/main/Right-to-be-forgotten/real_world_eval.py"
click node_muse_runner "https://github.com/guts-yang/asu-unlearning/blob/main/muse/eval.py"
click node_muse_data "https://github.com/guts-yang/asu-unlearning/blob/main/muse/baselines/baselines/dataset.py"
click node_muse_unlearn "https://github.com/guts-yang/asu-unlearning/blob/main/muse/baselines/unlearn.py"
click node_muse_metrics "https://github.com/guts-yang/asu-unlearning/tree/main/muse/metrics"
click node_open_train "https://github.com/guts-yang/asu-unlearning/blob/main/open-unlearning/src/train.py"
click node_open_data "https://github.com/guts-yang/asu-unlearning/tree/main/open-unlearning/src/data"
click node_open_model "https://github.com/guts-yang/asu-unlearning/blob/main/open-unlearning/src/model/__init__.py"
click node_open_trainer "https://github.com/guts-yang/asu-unlearning/tree/main/open-unlearning/src/trainer/unlearn"
click node_open_evals "https://github.com/guts-yang/asu-unlearning/tree/main/open-unlearning/src/evals"
click node_open_probe "https://github.com/guts-yang/asu-unlearning/blob/main/open-unlearning/src/model/probe.py"
click node_wmdp_asu "https://github.com/guts-yang/asu-unlearning/blob/main/wmdp/asu/unlearn.py"
click node_wmdp_utils "https://github.com/guts-yang/asu-unlearning/blob/main/wmdp/asu/utils.py"
click node_wmdp_model "https://github.com/guts-yang/asu-unlearning/blob/main/wmdp/asu/my_mistral.py"
click node_wmdp_rmu "https://github.com/guts-yang/asu-unlearning/blob/main/wmdp/rmu/unlearn.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_asu_method,node_asu_model,node_asu_loss,node_asu_trainer toneBlue
class node_tofu_data,node_tofu_runner,node_tofu_eval,node_tofu_eval_runner toneAmber
class node_muse_runner,node_muse_data,node_muse_unlearn,node_muse_metrics toneMint
class node_open_train,node_open_data,node_open_model,node_open_trainer,node_open_evals,node_open_probe toneRose
class node_wmdp_asu,node_wmdp_utils,node_wmdp_model,node_wmdp_rmu,node_researcher toneIndigo
```

## Components

### ASU Training

- **Attention Smoothing**
- [Llama Attention Model](https://github.com/guts-yang/asu-unlearning/blob/main/Right-to-be-forgotten/my_models/my_llama.py): `Right-to-be-forgotten/my_models/my_llama.py`
- [Unlearning Losses](https://github.com/guts-yang/asu-unlearning/blob/main/Right-to-be-forgotten/trainer/losses.py): `Right-to-be-forgotten/trainer/losses.py`
- [Forgetting Trainer](https://github.com/guts-yang/asu-unlearning/blob/main/Right-to-be-forgotten/trainer/trainer.py): `Right-to-be-forgotten/trainer/trainer.py`

### TOFU Workflow

- [Forget Data Module](https://github.com/guts-yang/asu-unlearning/blob/main/Right-to-be-forgotten/dataset/data_module.py): `Right-to-be-forgotten/dataset/data_module.py`
- [Unlearning Runner](https://github.com/guts-yang/asu-unlearning/blob/main/Right-to-be-forgotten/forget.py): `Right-to-be-forgotten/forget.py`
- [TOFU Evaluation](https://github.com/guts-yang/asu-unlearning/blob/main/Right-to-be-forgotten/metrics/metrics.py): `Right-to-be-forgotten/metrics/metrics.py`
- [Evaluation Runner](https://github.com/guts-yang/asu-unlearning/blob/main/Right-to-be-forgotten/real_world_eval.py): `Right-to-be-forgotten/real_world_eval.py`

### MUSE Benchmark

- [MUSE Evaluation](https://github.com/guts-yang/asu-unlearning/blob/main/muse/eval.py): `muse/eval.py`
- [MUSE Datasets](https://github.com/guts-yang/asu-unlearning/blob/main/muse/baselines/baselines/dataset.py): `muse/baselines/baselines/dataset.py`
- [MUSE Baselines](https://github.com/guts-yang/asu-unlearning/blob/main/muse/baselines/unlearn.py): `muse/baselines/unlearn.py`
- [MUSE Metrics](https://github.com/guts-yang/asu-unlearning/tree/main/muse/metrics): `muse/metrics`

### Open Unlearning

- [Training Entry](https://github.com/guts-yang/asu-unlearning/blob/main/open-unlearning/src/train.py): `open-unlearning/src/train.py`
- [Training Data](https://github.com/guts-yang/asu-unlearning/tree/main/open-unlearning/src/data): `open-unlearning/src/data`
- [Model Loading](https://github.com/guts-yang/asu-unlearning/blob/main/open-unlearning/src/model/__init__.py): `open-unlearning/src/model/__init__.py`
- [Unlearning Methods](https://github.com/guts-yang/asu-unlearning/tree/main/open-unlearning/src/trainer/unlearn): `open-unlearning/src/trainer/unlearn`
- [Evaluation Framework](https://github.com/guts-yang/asu-unlearning/tree/main/open-unlearning/src/evals): `open-unlearning/src/evals`
- [Model Probing](https://github.com/guts-yang/asu-unlearning/blob/main/open-unlearning/src/model/probe.py): `open-unlearning/src/model/probe.py`

### WMDP Benchmark

- [ASU Unlearning](https://github.com/guts-yang/asu-unlearning/blob/main/wmdp/asu/unlearn.py): `wmdp/asu/unlearn.py`
- [ASU Utilities](https://github.com/guts-yang/asu-unlearning/blob/main/wmdp/asu/utils.py): `wmdp/asu/utils.py`
- [Mistral Attention Model](https://github.com/guts-yang/asu-unlearning/blob/main/wmdp/asu/my_mistral.py): `wmdp/asu/my_mistral.py`
- [RMU Unlearning](https://github.com/guts-yang/asu-unlearning/blob/main/wmdp/rmu/unlearn.py): `wmdp/rmu/unlearn.py`

### Other components

- **Researcher**

## Connections

- Researcher → Attention Smoothing: selects method
- Attention Smoothing → Unlearning Losses: guides distillation
- Forgetting Trainer → Unlearning Losses: computes loss (evidence: `Right-to-be-forgotten/trainer/trainer.py`)
- Unlearning Losses → Llama Attention Model: uses attention temperature
- Unlearning Runner → Forget Data Module: loads data (evidence: `Right-to-be-forgotten/forget.py`)
- Unlearning Runner → Forgetting Trainer: trains with (evidence: `Right-to-be-forgotten/forget.py`)
- Unlearning Runner → Llama Attention Model: loads model (evidence: `Right-to-be-forgotten/forget.py`)
- Evaluation Runner → TOFU Evaluation: runs metrics (evidence: `Right-to-be-forgotten/real_world_eval.py`)
- TOFU Evaluation → MUSE Datasets: uses dataset (evidence: `Right-to-be-forgotten/metrics/metrics.py`)
- MUSE Evaluation → MUSE Metrics: dispatches metrics (evidence: `muse/eval.py`)
- MUSE Baselines → MUSE Datasets: loads dataset
- Training Entry → Training Data: loads data (evidence: `open-unlearning/src/train.py`)
- Training Entry → Model Loading: loads model (evidence: `open-unlearning/src/train.py`)
- Training Entry → Unlearning Methods: configures training (evidence: `open-unlearning/src/train.py`)
- Training Entry → Evaluation Framework: configures evaluation (evidence: `open-unlearning/src/train.py`)
- Model Loading → Model Probing: registers model (evidence: `open-unlearning/src/model/__init__.py`)
- ASU Unlearning → ASU Utilities: uses utilities (evidence: `wmdp/asu/unlearn.py`)
- ASU Utilities → Mistral Attention Model: imports model (evidence: `wmdp/asu/utils.py`)
