# trentbrick/sdmcontinuallearner architecture

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

- Interactive diagram: https://gitdiagram.com/trentbrick/sdmcontinuallearner
- Repository: https://github.com/trentbrick/sdmcontinuallearner

## Overview

This repository is research code for continual-learning experiments centered on Sparse Distributed Memory (SDM), with preprocessing and model configuration alongside implementations of NISPA and several comparison baselines. The documented workflow is to prepare and split image datasets, configure a model and experiment, then train/evaluate across tasks; experiment scripts cover pretraining, continual learning, and ablations. NISPA’s entry point and learner flow are visible in excerpts. Other connections are included only where the README or source index supports them; many experiment and training implementations were not sampled.

Main entry points: [`NISPA/NISPA/NISPA/learner.py`](https://github.com/trentbrick/sdmcontinuallearner/blob/master/NISPA/NISPA/NISPA/learner.py) (NISPA learner), [`py_scripts/combine_params.py`](https://github.com/trentbrick/sdmcontinuallearner/blob/master/py_scripts/combine_params.py) (Parameter assembly), [`NISPA/NISPA/main.py`](https://github.com/trentbrick/sdmcontinuallearner/blob/master/NISPA/NISPA/main.py) (NISPA entry point), [`NISPA/Baselines/EWC_SI_MAS/iBatchLearn.py`](https://github.com/trentbrick/sdmcontinuallearner/blob/master/NISPA/Baselines/EWC_SI_MAS/iBatchLearn.py) (Baseline runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_prep["Data preparation"]
  node_setup["Dataset setup"]
  node_data_params["Dataset parameters<br/>[dataset_params.py]"]
  node_loaders["Data loaders<br/>[data_loaders.py]"]
end

subgraph group_sdm["SDM experiments"]
  node_model_params["Model parameters<br/>[model_params.py]"]
  node_combine["Parameter assembly<br/>[combine_params.py]"]
  node_sdm_models["SDM model family<br/>[SDM.py]"]
  node_base_model["Model base<br/>[Base_Model.py]"]
  node_benchmarks["CL benchmarks<br/>[CL_Benchmarks.py]"]
  node_conv_sdm["ConvSDM<br/>[Conv_SDM.py]"]
  node_experiment["Continual-learning run"]
  node_pretrain["Pretraining runs"]
  node_ablations["K-value ablations"]
end

subgraph group_nispa["NISPA"]
  node_nispa_entry["NISPA entry point<br/>[main.py]"]
  node_nispa_dataset["NISPA scenarios<br/>[dataset.py]"]
  node_nispa_learner["NISPA learner<br/>[learner.py]"]
  node_nispa_model["Masked networks<br/>[model.py]"]
  node_nispa_grow["Connection growth<br/>[grow.py]"]
  node_nispa_utils["Learning utilities<br/>[utils.py]"]
  node_nispa_training["Task training<br/>[training.py]"]
  node_nispa_report["Results reporting<br/>[report.py]"]
  node_replay_learner["Replay learner<br/>[learner.py]"]
  node_replay_model["Replay model<br/>[model.py]"]
end

subgraph group_baselines["Comparison baselines"]
  node_clnp["CLNP models<br/>[models.py]"]
  node_ewc_agents["EWC SI MAS agents<br/>[default.py]"]
  node_replay_agents["Experience replay agent<br/>[exp_replay.py]"]
  node_baseline_data["Baseline data loaders<br/>[base.py]"]
  node_baseline_runner["Baseline runner<br/>[iBatchLearn.py]"]
  node_stl_model["Single-task model<br/>[model.py]"]
end

subgraph group_fly["FlyModel"]
  node_fly_loader["FlyModel loader<br/>[load.py]"]
  node_fly_experiment["FlyModel continual run<br/>[main_cl.py]"]
  node_facebook_ewc["Facebook EWC<br/>[EWC_facebook.py]"]
  node_gem["GEM baseline<br/>[GEM.py]"]
end

node_researcher(("Researcher"))

node_researcher -->|"prepares data"| node_setup
node_researcher -->|"selects experiments"| node_experiment
node_setup -.->|"prepares splits"| node_data_params
node_combine -->|"combines settings"| node_model_params
node_combine -->|"combines settings"| node_data_params
node_base_model -->|"uses benchmarks"| node_benchmarks
node_nispa_entry -->|"loads scenarios"| node_nispa_dataset
node_nispa_entry -->|"creates learner"| node_nispa_learner
node_nispa_learner -->|"uses networks"| node_nispa_model
node_nispa_learner -->|"grows connections"| node_nispa_grow
node_nispa_learner -->|"uses utilities"| node_nispa_utils
node_nispa_learner -->|"runs training"| node_nispa_training
node_nispa_learner -->|"logs summaries"| node_nispa_report
node_nispa_model -.->|"shares masks"| node_nispa_utils
node_baseline_runner -->|"uses loaders"| node_baseline_data
node_baseline_runner -->|"selects agents"| node_ewc_agents
node_ewc_agents -->|"imports models"| node_clnp

click node_setup "https://github.com/trentbrick/sdmcontinuallearner/blob/master/py_scripts/setup_cont_learning_datasets.py"
click node_data_params "https://github.com/trentbrick/sdmcontinuallearner/blob/master/py_scripts/dataset_params.py"
click node_loaders "https://github.com/trentbrick/sdmcontinuallearner/blob/master/py_scripts/data_loaders.py"
click node_model_params "https://github.com/trentbrick/sdmcontinuallearner/blob/master/py_scripts/model_params.py"
click node_combine "https://github.com/trentbrick/sdmcontinuallearner/blob/master/py_scripts/combine_params.py"
click node_sdm_models "https://github.com/trentbrick/sdmcontinuallearner/blob/master/models/SDM.py"
click node_base_model "https://github.com/trentbrick/sdmcontinuallearner/blob/master/models/Base_Model.py"
click node_benchmarks "https://github.com/trentbrick/sdmcontinuallearner/blob/master/models/CL_Benchmarks.py"
click node_conv_sdm "https://github.com/trentbrick/sdmcontinuallearner/blob/master/models/Conv_SDM.py"
click node_experiment "https://github.com/trentbrick/sdmcontinuallearner/blob/master/exp_commands/cont_learn_on_SplitCIFAR10_embeddings.py"
click node_pretrain "https://github.com/trentbrick/sdmcontinuallearner/blob/master/exp_commands/pretrain_on_ImgNet32_embeddings.py"
click node_ablations "https://github.com/trentbrick/sdmcontinuallearner/blob/master/exp_commands/ablate_test_k_vals_10K_Neurons_SplitCIFAR10_embeddings.py"
click node_nispa_entry "https://github.com/trentbrick/sdmcontinuallearner/blob/master/NISPA/NISPA/main.py"
click node_nispa_dataset "https://github.com/trentbrick/sdmcontinuallearner/blob/master/NISPA/NISPA/dataset.py"
click node_nispa_learner "https://github.com/trentbrick/sdmcontinuallearner/blob/master/NISPA/NISPA/NISPA/learner.py"
click node_nispa_model "https://github.com/trentbrick/sdmcontinuallearner/blob/master/NISPA/NISPA/NISPA/model.py"
click node_nispa_grow "https://github.com/trentbrick/sdmcontinuallearner/blob/master/NISPA/NISPA/NISPA/grow.py"
click node_nispa_utils "https://github.com/trentbrick/sdmcontinuallearner/blob/master/NISPA/NISPA/NISPA/utils.py"
click node_nispa_training "https://github.com/trentbrick/sdmcontinuallearner/blob/master/NISPA/NISPA/NISPA/training.py"
click node_nispa_report "https://github.com/trentbrick/sdmcontinuallearner/blob/master/NISPA/NISPA/NISPA/report.py"
click node_replay_learner "https://github.com/trentbrick/sdmcontinuallearner/blob/master/NISPA/NISPA_Replay/NISPA/learner.py"
click node_replay_model "https://github.com/trentbrick/sdmcontinuallearner/blob/master/NISPA/NISPA_Replay/NISPA/model.py"
click node_clnp "https://github.com/trentbrick/sdmcontinuallearner/blob/master/NISPA/Baselines/CLNP/models.py"
click node_ewc_agents "https://github.com/trentbrick/sdmcontinuallearner/blob/master/NISPA/Baselines/EWC_SI_MAS/agents/default.py"
click node_replay_agents "https://github.com/trentbrick/sdmcontinuallearner/blob/master/NISPA/Baselines/EWC_SI_MAS/agents/exp_replay.py"
click node_baseline_data "https://github.com/trentbrick/sdmcontinuallearner/blob/master/NISPA/Baselines/EWC_SI_MAS/dataloaders/base.py"
click node_baseline_runner "https://github.com/trentbrick/sdmcontinuallearner/blob/master/NISPA/Baselines/EWC_SI_MAS/iBatchLearn.py"
click node_stl_model "https://github.com/trentbrick/sdmcontinuallearner/blob/master/NISPA/Baselines/STL/model.py"
click node_fly_loader "https://github.com/trentbrick/sdmcontinuallearner/blob/master/FlyModel/BI_R/load.py"
click node_fly_experiment "https://github.com/trentbrick/sdmcontinuallearner/blob/master/FlyModel/BI_R/main_cl.py"
click node_facebook_ewc "https://github.com/trentbrick/sdmcontinuallearner/blob/master/FlyModel/codes/EWC_facebook.py"
click node_gem "https://github.com/trentbrick/sdmcontinuallearner/blob/master/FlyModel/codes/GEM.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_setup,node_data_params,node_loaders toneBlue
class node_model_params,node_combine,node_sdm_models,node_base_model,node_benchmarks,node_conv_sdm,node_experiment,node_pretrain,node_ablations toneAmber
class node_nispa_entry,node_nispa_dataset,node_nispa_learner,node_nispa_model,node_nispa_grow,node_nispa_utils,node_nispa_training,node_nispa_report,node_replay_learner,node_replay_model toneMint
class node_clnp,node_ewc_agents,node_replay_agents,node_baseline_data,node_baseline_runner,node_stl_model toneRose
class node_fly_loader,node_fly_experiment,node_facebook_ewc,node_gem,node_researcher toneIndigo
```

## Components

### Data preparation

- [Dataset setup](https://github.com/trentbrick/sdmcontinuallearner/blob/master/py_scripts/setup_cont_learning_datasets.py): `py_scripts/setup_cont_learning_datasets.py`
- [Dataset parameters](https://github.com/trentbrick/sdmcontinuallearner/blob/master/py_scripts/dataset_params.py): `py_scripts/dataset_params.py`
- [Data loaders](https://github.com/trentbrick/sdmcontinuallearner/blob/master/py_scripts/data_loaders.py): `py_scripts/data_loaders.py`

### SDM experiments

- [Model parameters](https://github.com/trentbrick/sdmcontinuallearner/blob/master/py_scripts/model_params.py): `py_scripts/model_params.py`
- [Parameter assembly](https://github.com/trentbrick/sdmcontinuallearner/blob/master/py_scripts/combine_params.py): `py_scripts/combine_params.py`
- [SDM model family](https://github.com/trentbrick/sdmcontinuallearner/blob/master/models/SDM.py): `models/SDM.py`
- [Model base](https://github.com/trentbrick/sdmcontinuallearner/blob/master/models/Base_Model.py): `models/Base_Model.py`
- [CL benchmarks](https://github.com/trentbrick/sdmcontinuallearner/blob/master/models/CL_Benchmarks.py): `models/CL_Benchmarks.py`
- [ConvSDM](https://github.com/trentbrick/sdmcontinuallearner/blob/master/models/Conv_SDM.py): `models/Conv_SDM.py`
- [Continual-learning run](https://github.com/trentbrick/sdmcontinuallearner/blob/master/exp_commands/cont_learn_on_SplitCIFAR10_embeddings.py): `exp_commands/cont_learn_on_SplitCIFAR10_embeddings.py`
- [Pretraining runs](https://github.com/trentbrick/sdmcontinuallearner/blob/master/exp_commands/pretrain_on_ImgNet32_embeddings.py): `exp_commands/pretrain_on_ImgNet32_embeddings.py`
- [K-value ablations](https://github.com/trentbrick/sdmcontinuallearner/blob/master/exp_commands/ablate_test_k_vals_10K_Neurons_SplitCIFAR10_embeddings.py): `exp_commands/ablate_test_k_vals_10K_Neurons_SplitCIFAR10_embeddings.py`

### NISPA

- [NISPA entry point](https://github.com/trentbrick/sdmcontinuallearner/blob/master/NISPA/NISPA/main.py): `NISPA/NISPA/main.py`
- [NISPA scenarios](https://github.com/trentbrick/sdmcontinuallearner/blob/master/NISPA/NISPA/dataset.py): `NISPA/NISPA/dataset.py`
- [NISPA learner](https://github.com/trentbrick/sdmcontinuallearner/blob/master/NISPA/NISPA/NISPA/learner.py): `NISPA/NISPA/NISPA/learner.py`
- [Masked networks](https://github.com/trentbrick/sdmcontinuallearner/blob/master/NISPA/NISPA/NISPA/model.py): `NISPA/NISPA/NISPA/model.py`
- [Connection growth](https://github.com/trentbrick/sdmcontinuallearner/blob/master/NISPA/NISPA/NISPA/grow.py): `NISPA/NISPA/NISPA/grow.py`
- [Learning utilities](https://github.com/trentbrick/sdmcontinuallearner/blob/master/NISPA/NISPA/NISPA/utils.py): `NISPA/NISPA/NISPA/utils.py`
- [Task training](https://github.com/trentbrick/sdmcontinuallearner/blob/master/NISPA/NISPA/NISPA/training.py): `NISPA/NISPA/NISPA/training.py`
- [Results reporting](https://github.com/trentbrick/sdmcontinuallearner/blob/master/NISPA/NISPA/NISPA/report.py): `NISPA/NISPA/NISPA/report.py`
- [Replay learner](https://github.com/trentbrick/sdmcontinuallearner/blob/master/NISPA/NISPA_Replay/NISPA/learner.py): `NISPA/NISPA_Replay/NISPA/learner.py`
- [Replay model](https://github.com/trentbrick/sdmcontinuallearner/blob/master/NISPA/NISPA_Replay/NISPA/model.py): `NISPA/NISPA_Replay/NISPA/model.py`

### Comparison baselines

- [CLNP models](https://github.com/trentbrick/sdmcontinuallearner/blob/master/NISPA/Baselines/CLNP/models.py): `NISPA/Baselines/CLNP/models.py`
- [EWC SI MAS agents](https://github.com/trentbrick/sdmcontinuallearner/blob/master/NISPA/Baselines/EWC_SI_MAS/agents/default.py): `NISPA/Baselines/EWC_SI_MAS/agents/default.py`
- [Experience replay agent](https://github.com/trentbrick/sdmcontinuallearner/blob/master/NISPA/Baselines/EWC_SI_MAS/agents/exp_replay.py): `NISPA/Baselines/EWC_SI_MAS/agents/exp_replay.py`
- [Baseline data loaders](https://github.com/trentbrick/sdmcontinuallearner/blob/master/NISPA/Baselines/EWC_SI_MAS/dataloaders/base.py): `NISPA/Baselines/EWC_SI_MAS/dataloaders/base.py`
- [Baseline runner](https://github.com/trentbrick/sdmcontinuallearner/blob/master/NISPA/Baselines/EWC_SI_MAS/iBatchLearn.py): `NISPA/Baselines/EWC_SI_MAS/iBatchLearn.py`
- [Single-task model](https://github.com/trentbrick/sdmcontinuallearner/blob/master/NISPA/Baselines/STL/model.py): `NISPA/Baselines/STL/model.py`

### FlyModel

- [FlyModel loader](https://github.com/trentbrick/sdmcontinuallearner/blob/master/FlyModel/BI_R/load.py): `FlyModel/BI_R/load.py`
- [FlyModel continual run](https://github.com/trentbrick/sdmcontinuallearner/blob/master/FlyModel/BI_R/main_cl.py): `FlyModel/BI_R/main_cl.py`
- [Facebook EWC](https://github.com/trentbrick/sdmcontinuallearner/blob/master/FlyModel/codes/EWC_facebook.py): `FlyModel/codes/EWC_facebook.py`
- [GEM baseline](https://github.com/trentbrick/sdmcontinuallearner/blob/master/FlyModel/codes/GEM.py): `FlyModel/codes/GEM.py`

### Other components

- **Researcher**

## Connections

- Researcher → Dataset setup: prepares data (evidence: `README.md`)
- Researcher → Continual-learning run: selects experiments (evidence: `README.md`)
- Dataset setup → Dataset parameters: prepares splits
- Parameter assembly → Model parameters: combines settings (evidence: `py_scripts/combine_params.py`)
- Parameter assembly → Dataset parameters: combines settings (evidence: `py_scripts/combine_params.py`)
- Model base → CL benchmarks: uses benchmarks (evidence: `models/Base_Model.py`)
- NISPA entry point → NISPA scenarios: loads scenarios (evidence: `NISPA/NISPA/main.py`)
- NISPA entry point → NISPA learner: creates learner (evidence: `NISPA/NISPA/main.py`)
- NISPA learner → Masked networks: uses networks (evidence: `NISPA/NISPA/NISPA/learner.py`)
- NISPA learner → Connection growth: grows connections (evidence: `NISPA/NISPA/NISPA/learner.py`)
- NISPA learner → Learning utilities: uses utilities (evidence: `NISPA/NISPA/NISPA/learner.py`)
- NISPA learner → Task training: runs training (evidence: `NISPA/NISPA/NISPA/learner.py`)
- NISPA learner → Results reporting: logs summaries (evidence: `NISPA/NISPA/NISPA/learner.py`)
- Masked networks → Learning utilities: shares masks
- Baseline runner → Baseline data loaders: uses loaders (evidence: `NISPA/Baselines/EWC_SI_MAS/iBatchLearn.py`)
- Baseline runner → EWC SI MAS agents: selects agents (evidence: `NISPA/Baselines/EWC_SI_MAS/iBatchLearn.py`)
- EWC SI MAS agents → CLNP models: imports models (evidence: `NISPA/Baselines/EWC_SI_MAS/agents/default.py`)
