# openai/supervised-reptile architecture

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

- Interactive diagram: https://gitdiagram.com/openai/supervised-reptile
- Repository: https://github.com/openai/supervised-reptile

## Overview

This repository implements supervised Reptile meta-learning for Omniglot and Mini-ImageNet: a user selects a dataset and experiment flags, the runner loads few-shot tasks and a classifier, training adapts on sampled tasks and updates the initialization, then evaluation reports accuracy and checkpoints preserve model state. The package separates dataset sampling, model construction, meta-learning, variable-state operations, and evaluation. A browser-side Omniglot classifier is also present. Edges follow the shown runners and training code; browser UI wiring and unsampled modules are not inferred.

Main entry points: [`run_omniglot.py`](https://github.com/openai/supervised-reptile/blob/master/run_omniglot.py) (Omniglot runner), [`run_miniimagenet.py`](https://github.com/openai/supervised-reptile/blob/master/run_miniimagenet.py) (Mini-ImageNet runner), [`supervised_reptile/train.py`](https://github.com/openai/supervised-reptile/blob/master/supervised_reptile/train.py) (Training loop), [`supervised_reptile/reptile.py`](https://github.com/openai/supervised-reptile/blob/master/supervised_reptile/reptile.py) (Task adaptation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experiments["Experiment entrypoints"]
  node_omni_run["Omniglot runner<br/>[run_omniglot.py]"]
  node_mini_run["Mini-ImageNet runner"]
  node_arguments["Experiment options<br/>[args.py]"]
end

subgraph group_data["Datasets"]
  node_omni_data["Omniglot sampling<br/>[omniglot.py]"]
  node_mini_data["Mini-ImageNet sampling<br/>[miniimagenet.py]"]
  node_metadata[("Mini-ImageNet metadata")]
end

subgraph group_learning["Meta-learning"]
  node_models["Classifier models<br/>[models.py]"]
  node_trainer["Training loop<br/>[train.py]"]
  node_reptile["Task adaptation<br/>[reptile.py]"]
  node_variable_state["Variable operations<br/>[variables.py]"]
  node_evaluation["Few-shot evaluation<br/>[eval.py]"]
  node_checkpoints[("Model checkpoints<br/>[train.py]")]
end

subgraph group_browser["Browser demo"]
  node_browser_worker["Browser adaptation<br/>[webworker.js]"]
  node_jsnet["Tensor engine<br/>[jsnet.js]"]
  node_browser_ui["Browser interface<br/>[ui.js]"]
  node_browser_drawing["Image drawing<br/>[drawing.js]"]
  node_browser_eval["Browser evaluation<br/>[evaluator.js]"]
  node_browser_predictions["Prediction display<br/>[predictions.js]"]
  node_browser_defaults["Demo defaults<br/>[default.js]"]
  node_export["Model export<br/>[export.py]"]
end

node_user(("Experimenter"))

node_user -->|"runs"| node_omni_run
node_user -->|"runs"| node_mini_run
node_omni_run -->|"parses options"| node_arguments
node_mini_run -->|"parses options"| node_arguments
node_omni_run -->|"loads and splits"| node_omni_data
node_mini_run -->|"loads"| node_mini_data
node_omni_run -->|"constructs model"| node_models
node_mini_run -->|"constructs model"| node_models
node_omni_run -->|"trains"| node_trainer
node_mini_run -->|"trains"| node_trainer
node_omni_run -->|"evaluates"| node_evaluation
node_mini_run -->|"evaluates"| node_evaluation
node_trainer -->|"runs task steps"| node_reptile
node_trainer -->|"applies decay"| node_variable_state
node_trainer -->|"saves"| node_checkpoints
node_evaluation -->|"evaluates tasks"| node_reptile
node_reptile -->|"updates variables"| node_variable_state
node_browser_worker -->|"uses tensors"| node_jsnet

click node_omni_run "https://github.com/openai/supervised-reptile/blob/master/run_omniglot.py"
click node_mini_run "https://github.com/openai/supervised-reptile/blob/master/run_miniimagenet.py"
click node_arguments "https://github.com/openai/supervised-reptile/blob/master/supervised_reptile/args.py"
click node_omni_data "https://github.com/openai/supervised-reptile/blob/master/supervised_reptile/omniglot.py"
click node_mini_data "https://github.com/openai/supervised-reptile/blob/master/supervised_reptile/miniimagenet.py"
click node_metadata "https://github.com/openai/supervised-reptile/tree/master/metadata/miniimagenet"
click node_models "https://github.com/openai/supervised-reptile/blob/master/supervised_reptile/models.py"
click node_trainer "https://github.com/openai/supervised-reptile/blob/master/supervised_reptile/train.py"
click node_reptile "https://github.com/openai/supervised-reptile/blob/master/supervised_reptile/reptile.py"
click node_variable_state "https://github.com/openai/supervised-reptile/blob/master/supervised_reptile/variables.py"
click node_evaluation "https://github.com/openai/supervised-reptile/blob/master/supervised_reptile/eval.py"
click node_checkpoints "https://github.com/openai/supervised-reptile/blob/master/supervised_reptile/train.py"
click node_browser_worker "https://github.com/openai/supervised-reptile/blob/master/web/src/webworker.js"
click node_jsnet "https://github.com/openai/supervised-reptile/blob/master/web/deps/jsnet.js"
click node_browser_ui "https://github.com/openai/supervised-reptile/blob/master/web/src/ui.js"
click node_browser_drawing "https://github.com/openai/supervised-reptile/blob/master/web/src/drawing.js"
click node_browser_eval "https://github.com/openai/supervised-reptile/blob/master/web/src/evaluator.js"
click node_browser_predictions "https://github.com/openai/supervised-reptile/blob/master/web/src/predictions.js"
click node_browser_defaults "https://github.com/openai/supervised-reptile/blob/master/web/src/default.js"
click node_export "https://github.com/openai/supervised-reptile/blob/master/web/helpers/export.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_omni_run,node_mini_run,node_arguments toneBlue
class node_omni_data,node_mini_data,node_metadata toneAmber
class node_models,node_trainer,node_reptile,node_variable_state,node_evaluation,node_checkpoints toneMint
class node_browser_worker,node_jsnet,node_browser_ui,node_browser_drawing,node_browser_eval,node_browser_predictions,node_browser_defaults,node_export toneRose
class node_user toneIndigo
```

## Components

### Experiment entrypoints

- [Omniglot runner](https://github.com/openai/supervised-reptile/blob/master/run_omniglot.py): `run_omniglot.py`
- [Mini-ImageNet runner](https://github.com/openai/supervised-reptile/blob/master/run_miniimagenet.py): `run_miniimagenet.py`
- [Experiment options](https://github.com/openai/supervised-reptile/blob/master/supervised_reptile/args.py): `supervised_reptile/args.py`

### Datasets

- [Omniglot sampling](https://github.com/openai/supervised-reptile/blob/master/supervised_reptile/omniglot.py): `supervised_reptile/omniglot.py`
- [Mini-ImageNet sampling](https://github.com/openai/supervised-reptile/blob/master/supervised_reptile/miniimagenet.py): `supervised_reptile/miniimagenet.py`
- [Mini-ImageNet metadata](https://github.com/openai/supervised-reptile/tree/master/metadata/miniimagenet): `metadata/miniimagenet`

### Meta-learning

- [Classifier models](https://github.com/openai/supervised-reptile/blob/master/supervised_reptile/models.py): `supervised_reptile/models.py`
- [Training loop](https://github.com/openai/supervised-reptile/blob/master/supervised_reptile/train.py): `supervised_reptile/train.py`
- [Task adaptation](https://github.com/openai/supervised-reptile/blob/master/supervised_reptile/reptile.py): `supervised_reptile/reptile.py`
- [Variable operations](https://github.com/openai/supervised-reptile/blob/master/supervised_reptile/variables.py): `supervised_reptile/variables.py`
- [Few-shot evaluation](https://github.com/openai/supervised-reptile/blob/master/supervised_reptile/eval.py): `supervised_reptile/eval.py`
- [Model checkpoints](https://github.com/openai/supervised-reptile/blob/master/supervised_reptile/train.py): `supervised_reptile/train.py`

### Browser demo

- [Browser adaptation](https://github.com/openai/supervised-reptile/blob/master/web/src/webworker.js): `web/src/webworker.js`
- [Tensor engine](https://github.com/openai/supervised-reptile/blob/master/web/deps/jsnet.js): `web/deps/jsnet.js`
- [Browser interface](https://github.com/openai/supervised-reptile/blob/master/web/src/ui.js): `web/src/ui.js`
- [Image drawing](https://github.com/openai/supervised-reptile/blob/master/web/src/drawing.js): `web/src/drawing.js`
- [Browser evaluation](https://github.com/openai/supervised-reptile/blob/master/web/src/evaluator.js): `web/src/evaluator.js`
- [Prediction display](https://github.com/openai/supervised-reptile/blob/master/web/src/predictions.js): `web/src/predictions.js`
- [Demo defaults](https://github.com/openai/supervised-reptile/blob/master/web/src/default.js): `web/src/default.js`
- [Model export](https://github.com/openai/supervised-reptile/blob/master/web/helpers/export.py): `web/helpers/export.py`

### Other components

- **Experimenter**

## Connections

- Experimenter → Omniglot runner: runs (evidence: `README.md`)
- Experimenter → Mini-ImageNet runner: runs (evidence: `README.md`)
- Omniglot runner → Experiment options: parses options (evidence: `run_omniglot.py`)
- Mini-ImageNet runner → Experiment options: parses options (evidence: `run_miniimagenet.py`)
- Omniglot runner → Omniglot sampling: loads and splits (evidence: `run_omniglot.py`)
- Mini-ImageNet runner → Mini-ImageNet sampling: loads (evidence: `run_miniimagenet.py`)
- Omniglot runner → Classifier models: constructs model (evidence: `run_omniglot.py`)
- Mini-ImageNet runner → Classifier models: constructs model (evidence: `run_miniimagenet.py`)
- Omniglot runner → Training loop: trains (evidence: `run_omniglot.py`)
- Mini-ImageNet runner → Training loop: trains (evidence: `run_miniimagenet.py`)
- Omniglot runner → Few-shot evaluation: evaluates (evidence: `run_omniglot.py`)
- Mini-ImageNet runner → Few-shot evaluation: evaluates (evidence: `run_miniimagenet.py`)
- Training loop → Task adaptation: runs task steps (evidence: `supervised_reptile/train.py`)
- Training loop → Variable operations: applies decay (evidence: `supervised_reptile/train.py`)
- Training loop → Model checkpoints: saves (evidence: `supervised_reptile/train.py`)
- Few-shot evaluation → Task adaptation: evaluates tasks (evidence: `supervised_reptile/eval.py`)
- Task adaptation → Variable operations: updates variables (evidence: `supervised_reptile/reptile.py`)
- Browser adaptation → Tensor engine: uses tensors (evidence: `web/src/webworker.js`)
