# xi-l/paretomtl architecture

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

- Interactive diagram: https://gitdiagram.com/xi-l/paretomtl
- Repository: https://github.com/xi-l/paretomtl

## Overview

#### Purpose and Entry Points
This repository implements Pareto Multi-Task Learning (Pareto MTL) from the NeurIPS 2019 paper. It has two independent execution tracks:
- A NumPy synthetic optimization demonstration: `synthetic_example/run_synthetic_example.py`
- A PyTorch multiMNIST training program: `multiMNIST/train.py`

The supplied PDFs document the algorithm and results: `ParetoMTL_NeurIPS2019_Full.pdf` and `ParetoMTL_NeurIPS2019_Poster.pdf`.

#### Pareto MTL Optimization Core
Pareto MTL turns multi-task loss optimization into preference-conditioned subproblems. For each preference/reference direction, training identifies active constraints and computes a descent direction balancing task-loss gradients with preference constraints.

The minimum-norm convex-combination solver is the central optimization primitive:
- PyTorch-oriented implementation: `multiMNIST/min_norm_solvers.py`
- NumPy implementation for the synthetic experiment: `synthetic_example/min_norm_solvers_numpy.py`

These parallel implementations establish a boundary between framework-specific gradient handling and the shared Pareto optimization method.

#### Synthetic Experiment Pipeline
`synthetic_example/run_synthetic_example.py` is a standalone numerical driver. It defines or evaluates the synthetic multi-objective problem, obtains task gradients, invokes `min_norm_solvers_numpy.py` to select Pareto-aware update directions, and iterates toward a set of trade-off solutions.

This path requires NumPy rather than the neural-network/data pipeline and is intended to validate or visualize Pareto-front behavior independently of deep learning.

#### multiMNIST Training Pipeline
`multiMNIST/train.py` orchestrates the learned multi-task experiment: dataset loading, model selection, forward passes, per-task losses, Pareto MTL gradient aggregation, optimization, and saved-model handling.

Its data boundary is the locally provisioned multiMNIST dataset:
- Dataset location and acquisition notes: `multiMNIST/data/README.md`
- Expected data root: `multiMNIST/data`
- Model output location notes: `multiMNIST/saved_model/README.md`

#### Shared-Backbone Task Models
The multiMNIST experiment offers two network families implementing shared representation learning with task-specific predictions:
- LeNet-style model: `multiMNIST/model_lenet.py`
- ResNet-style model: `multiMNIST/model_resnet.py`

`train.py` owns the integration boundary: models produce task outputs, task losses produce gradients, and Pareto MTL replaces ordinary scalar loss summation with a minimum-norm, preference-aware update.

#### Runtime and External Dependencies
The repository is primarily Python. The synthetic path uses NumPy; the multiMNIST path uses PyTorch-style neural-network training and local image data. There is no service layer, web runtime, database, or cloud infrastructure indicated by the repository structure. Training artifacts are written under `multiMNIST/saved_model`.

Main entry points: [`multiMNIST/train.py`](https://github.com/xi-l/paretomtl/blob/master/multiMNIST/train.py) (Training orchestrator), [`synthetic_example/run_synthetic_example.py`](https://github.com/xi-l/paretomtl/blob/master/synthetic_example/run_synthetic_example.py) (Synthetic driver), [`synthetic_example/min_norm_solvers_numpy.py`](https://github.com/xi-l/paretomtl/blob/master/synthetic_example/min_norm_solvers_numpy.py) (NumPy min-norm solver), [`multiMNIST/data`](https://github.com/xi-l/paretomtl/tree/master/multiMNIST/data) (multiMNIST data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_synthetic["Synthetic experiment"]
  node_synthetic_driver["Synthetic driver<br/>Python entry point"]
  node_synthetic_problem["Synthetic objectives<br/>numerical problem"]
  node_numpy_solver["NumPy min-norm solver<br/>Pareto optimizer"]
  node_pareto_solutions["Trade-off solutions<br/>optimization output"]
  node_numpy["NumPy<br/>runtime dependency"]
end

subgraph group_multimnist["multiMNIST training"]
  node_train["Training orchestrator<br/>Python entry point<br/>[train.py]"]
  node_dataset[("multiMNIST data<br/>local dataset")]
  node_data_notes["Data acquisition notes<br/>documentation<br/>[README.md]"]
  node_lenet["LeNet task model<br/>shared-backbone model<br/>[model_lenet.py]"]
  node_resnet["ResNet task model<br/>shared-backbone model<br/>[model_resnet.py]"]
  node_task_losses["Per-task losses and gradients<br/>training layer<br/>[train.py]"]
  node_torch_solver["PyTorch min-norm solver<br/>Pareto optimizer"]
  node_checkpoints[("Saved models<br/>training artifacts<br/>[README.md]")]
  node_pytorch["PyTorch<br/>runtime dependency"]
end

node_synthetic_driver -->|"evaluates"| node_synthetic_problem
node_synthetic_problem -->|"task gradients"| node_numpy_solver
node_numpy_solver -->|"update direction"| node_synthetic_driver
node_synthetic_driver -->|"iterates to"| node_pareto_solutions
node_numpy -.->|"numerical runtime"| node_synthetic_driver
node_data_notes -.->|"documents setup"| node_dataset
node_dataset -->|"training batches"| node_train
node_train -->|"selects"| node_lenet
node_train -->|"selects"| node_resnet
node_lenet -->|"task outputs"| node_task_losses
node_resnet -->|"task outputs"| node_task_losses
node_task_losses -->|"task gradients"| node_torch_solver
node_torch_solver -->|"Pareto update"| node_train
node_train -->|"writes"| node_checkpoints
node_pytorch -.->|"training runtime"| node_train

click node_synthetic_driver "https://github.com/xi-l/paretomtl/blob/master/synthetic_example/run_synthetic_example.py"
click node_synthetic_problem "https://github.com/xi-l/paretomtl/blob/master/synthetic_example/run_synthetic_example.py"
click node_numpy_solver "https://github.com/xi-l/paretomtl/blob/master/synthetic_example/min_norm_solvers_numpy.py"
click node_train "https://github.com/xi-l/paretomtl/blob/master/multiMNIST/train.py"
click node_dataset "https://github.com/xi-l/paretomtl/tree/master/multiMNIST/data"
click node_data_notes "https://github.com/xi-l/paretomtl/blob/master/multiMNIST/data/README.md"
click node_lenet "https://github.com/xi-l/paretomtl/blob/master/multiMNIST/model_lenet.py"
click node_resnet "https://github.com/xi-l/paretomtl/blob/master/multiMNIST/model_resnet.py"
click node_task_losses "https://github.com/xi-l/paretomtl/blob/master/multiMNIST/train.py"
click node_torch_solver "https://github.com/xi-l/paretomtl/blob/master/multiMNIST/min_norm_solvers.py"
click node_checkpoints "https://github.com/xi-l/paretomtl/blob/master/multiMNIST/saved_model/README.md"

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_synthetic_driver,node_synthetic_problem,node_numpy_solver,node_pareto_solutions,node_numpy toneBlue
class node_train,node_dataset,node_data_notes,node_lenet,node_resnet,node_task_losses,node_torch_solver,node_checkpoints,node_pytorch toneAmber
```

## Components

### Synthetic experiment

Standalone NumPy Pareto-front demonstration.

- [Synthetic driver](https://github.com/xi-l/paretomtl/blob/master/synthetic_example/run_synthetic_example.py): Python entry point · Runs iterative multi-objective optimization. · `synthetic_example/run_synthetic_example.py`
- [Synthetic objectives](https://github.com/xi-l/paretomtl/blob/master/synthetic_example/run_synthetic_example.py): numerical problem · Produces objective values and task gradients. · `synthetic_example/run_synthetic_example.py`
- [NumPy min-norm solver](https://github.com/xi-l/paretomtl/blob/master/synthetic_example/min_norm_solvers_numpy.py): Pareto optimizer · Selects convex gradient combinations for updates. · `synthetic_example/min_norm_solvers_numpy.py`
- **Trade-off solutions**: optimization output · Approximate Pareto-front points.
- **NumPy**: runtime dependency

### multiMNIST training

PyTorch multi-task learning pipeline.

- [Training orchestrator](https://github.com/xi-l/paretomtl/blob/master/multiMNIST/train.py): Python entry point · Coordinates data, models, losses, Pareto updates, and checkpoints. · `multiMNIST/train.py`
- [multiMNIST data](https://github.com/xi-l/paretomtl/tree/master/multiMNIST/data): local dataset · Locally provisioned image data. · `multiMNIST/data`
- [Data acquisition notes](https://github.com/xi-l/paretomtl/blob/master/multiMNIST/data/README.md): documentation · `multiMNIST/data/README.md`
- [LeNet task model](https://github.com/xi-l/paretomtl/blob/master/multiMNIST/model_lenet.py): shared-backbone model · Shared representation with task-specific predictions. · `multiMNIST/model_lenet.py`
- [ResNet task model](https://github.com/xi-l/paretomtl/blob/master/multiMNIST/model_resnet.py): shared-backbone model · Shared representation with task-specific predictions. · `multiMNIST/model_resnet.py`
- [Per-task losses and gradients](https://github.com/xi-l/paretomtl/blob/master/multiMNIST/train.py): training layer · Supplies task gradients to Pareto aggregation. · `multiMNIST/train.py`
- [PyTorch min-norm solver](https://github.com/xi-l/paretomtl/blob/master/multiMNIST/min_norm_solvers.py): Pareto optimizer · Computes preference-aware aggregate descent directions. · `multiMNIST/min_norm_solvers.py`
- [Saved models](https://github.com/xi-l/paretomtl/blob/master/multiMNIST/saved_model/README.md): training artifacts · Checkpoint output location. · `multiMNIST/saved_model/README.md`
- **PyTorch**: runtime dependency

## Connections

- Synthetic driver → Synthetic objectives: evaluates
- Synthetic objectives → NumPy min-norm solver: task gradients
- NumPy min-norm solver → Synthetic driver: update direction
- Synthetic driver → Trade-off solutions: iterates to
- NumPy → Synthetic driver: numerical runtime
- Data acquisition notes → multiMNIST data: documents setup
- multiMNIST data → Training orchestrator: training batches
- Training orchestrator → LeNet task model: selects
- Training orchestrator → ResNet task model: selects
- LeNet task model → Per-task losses and gradients: task outputs
- ResNet task model → Per-task losses and gradients: task outputs
- Per-task losses and gradients → PyTorch min-norm solver: task gradients
- PyTorch min-norm solver → Training orchestrator: Pareto update
- Training orchestrator → Saved models: writes
- PyTorch → Training orchestrator: training runtime
