# aria-funded-trend/ihms architecture

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

- Interactive diagram: https://gitdiagram.com/aria-funded-trend/ihms
- Repository: https://github.com/aria-funded-trend/ihms

## Overview

This repository is a research implementation of the Co⁴ architecture, with reinforcement-learning experiments and a separate vision-classification implementation. The documented workflow configures and trains agents or vision models, evaluates experiments, and uses pretrained checkpoints; vision inference also loads weights and produces class predictions. Sampled RL task code shows environment construction and wrappers, while vision source shows the model-to-attention stack. Some training and evaluation wiring is documented only at repository level, so those links are identified as documented rather than inferred from unsampled code.

Main entry points: [`Vision/object_recognition/inference.py`](https://github.com/aria-funded-trend/ihms/blob/main/Vision/object_recognition/inference.py) (Image inference), [`Reinforcement Learning/AttentionNeuron/util.py`](https://github.com/aria-funded-trend/ihms/blob/main/Reinforcement%20Learning/AttentionNeuron/util.py) (RL utilities), [`Reinforcement Learning/AttentionNeuron/eval_agent.py`](https://github.com/aria-funded-trend/ihms/blob/main/Reinforcement%20Learning/AttentionNeuron/eval_agent.py) (RL evaluation), [`Reinforcement Learning/AttentionNeuron/train_agent.py`](https://github.com/aria-funded-trend/ihms/blob/main/Reinforcement%20Learning/AttentionNeuron/train_agent.py) (RL training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_rl["RL experiments"]
  node_rl_train["RL training<br/>[train_agent.py]"]
  node_rl_eval["RL evaluation<br/>[eval_agent.py]"]
  node_rl_util["RL utilities<br/>[util.py]"]
  node_rl_task["Task factory<br/>[util.py]"]
  node_rl_solution["Solution factory<br/>[util.py]"]
  node_rl_tasks["RL environments<br/>[rl_tasks.py]"]
  node_cartpole["CartPole dynamics<br/>[cartpole_env.py]"]
  node_atari["Atari wrappers<br/>[atari_wrappers.py]"]
  node_rl_policies["RL policies<br/>[torch_solutions.py]"]
  node_rl_layers["RL modulation layers<br/>[torch_modules.py]"]
  node_base_solution["Solution contract<br/>[base_solution.py]"]
end

subgraph group_vision["Vision models"]
  node_vision_inference["Image inference<br/>[inference.py]"]
  node_vision_eval["Vision evaluation<br/>[evaluation.py]"]
  node_vit["Vision transformer<br/>[vit.py]"]
  node_transformer["Transformer blocks<br/>[transformer.py]"]
  node_attention["Modulated attention<br/>[attention.py]"]
end

subgraph group_experiment["Experiment assets"]
  node_configs["Experiment configs"]
  node_checkpoints[("Pretrained checkpoints")]
end

node_researcher(("Researcher"))
node_vision_input(("Image input"))
node_predictions["Class predictions"]
node_label_service(("Label service"))

node_researcher -->|"starts training"| node_rl_train
node_researcher -->|"starts evaluation"| node_rl_eval
node_researcher -.->|"requests inference"| node_vision_inference
node_rl_train -.->|"uses configurations"| node_configs
node_rl_eval -.->|"uses configurations"| node_configs
node_rl_train -->|"uses utilities"| node_rl_util
node_rl_eval -->|"uses utilities"| node_rl_util
node_rl_util -->|"checks solution type"| node_base_solution
node_rl_util -->|"constructs tasks"| node_rl_task
node_rl_util -->|"constructs solutions"| node_rl_solution
node_rl_tasks -->|"constructs environment"| node_cartpole
node_rl_tasks -->|"wraps Atari environment"| node_atari
node_rl_policies -->|"instantiates layers"| node_rl_layers
node_rl_policies -->|"implements contract"| node_base_solution
node_rl_eval -.->|"loads pretrained models"| node_checkpoints
node_vision_input -->|"provides image"| node_vision_inference
node_vision_inference -->|"builds model"| node_vit
node_vision_eval -->|"evaluates model"| node_vit
node_vit -->|"uses blocks"| node_transformer
node_transformer -->|"selects attention"| node_attention
node_vision_inference -.->|"loads weights"| node_checkpoints
node_vision_inference -->|"fetches labels"| node_label_service
node_vision_inference -->|"returns top classes"| node_predictions

click node_rl_train "https://github.com/aria-funded-trend/ihms/blob/main/Reinforcement%20Learning/AttentionNeuron/train_agent.py"
click node_rl_eval "https://github.com/aria-funded-trend/ihms/blob/main/Reinforcement%20Learning/AttentionNeuron/eval_agent.py"
click node_rl_util "https://github.com/aria-funded-trend/ihms/blob/main/Reinforcement%20Learning/AttentionNeuron/util.py"
click node_rl_task "https://github.com/aria-funded-trend/ihms/blob/main/Reinforcement%20Learning/AttentionNeuron/util.py"
click node_rl_solution "https://github.com/aria-funded-trend/ihms/blob/main/Reinforcement%20Learning/AttentionNeuron/util.py"
click node_rl_tasks "https://github.com/aria-funded-trend/ihms/blob/main/Reinforcement%20Learning/AttentionNeuron/tasks/rl_tasks.py"
click node_cartpole "https://github.com/aria-funded-trend/ihms/blob/main/Reinforcement%20Learning/AttentionNeuron/tasks/cartpole_env.py"
click node_atari "https://github.com/aria-funded-trend/ihms/blob/main/Reinforcement%20Learning/AttentionNeuron/tasks/atari_wrappers.py"
click node_rl_policies "https://github.com/aria-funded-trend/ihms/blob/main/Reinforcement%20Learning/AttentionNeuron/solutions/torch_solutions.py"
click node_rl_layers "https://github.com/aria-funded-trend/ihms/blob/main/Reinforcement%20Learning/AttentionNeuron/solutions/torch_modules.py"
click node_base_solution "https://github.com/aria-funded-trend/ihms/blob/main/Reinforcement%20Learning/AttentionNeuron/solutions/base_solution.py"
click node_configs "https://github.com/aria-funded-trend/ihms/tree/main/Reinforcement%20Learning/AttentionNeuron/configs"
click node_checkpoints "https://github.com/aria-funded-trend/ihms/tree/main/Reinforcement%20Learning/AttentionNeuron/pretrained"
click node_vision_inference "https://github.com/aria-funded-trend/ihms/blob/main/Vision/object_recognition/inference.py"
click node_vision_eval "https://github.com/aria-funded-trend/ihms/blob/main/Vision/object_recognition/evaluation.py"
click node_vit "https://github.com/aria-funded-trend/ihms/blob/main/Vision/object_recognition/vit.py"
click node_transformer "https://github.com/aria-funded-trend/ihms/blob/main/Vision/object_recognition/transformer.py"
click node_attention "https://github.com/aria-funded-trend/ihms/blob/main/Vision/object_recognition/attention.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_rl_train,node_rl_eval,node_rl_util,node_rl_task,node_rl_solution,node_rl_tasks,node_cartpole,node_atari,node_rl_policies,node_rl_layers,node_base_solution toneBlue
class node_vision_inference,node_vision_eval,node_vit,node_transformer,node_attention toneAmber
class node_configs,node_checkpoints toneMint
class node_researcher,node_vision_input,node_predictions,node_label_service toneIndigo
```

## Components

### RL experiments

- [RL training](https://github.com/aria-funded-trend/ihms/blob/main/Reinforcement%20Learning/AttentionNeuron/train_agent.py): `Reinforcement Learning/AttentionNeuron/train_agent.py`
- [RL evaluation](https://github.com/aria-funded-trend/ihms/blob/main/Reinforcement%20Learning/AttentionNeuron/eval_agent.py): `Reinforcement Learning/AttentionNeuron/eval_agent.py`
- [RL utilities](https://github.com/aria-funded-trend/ihms/blob/main/Reinforcement%20Learning/AttentionNeuron/util.py): `Reinforcement Learning/AttentionNeuron/util.py`
- [Task factory](https://github.com/aria-funded-trend/ihms/blob/main/Reinforcement%20Learning/AttentionNeuron/util.py): `Reinforcement Learning/AttentionNeuron/util.py`
- [Solution factory](https://github.com/aria-funded-trend/ihms/blob/main/Reinforcement%20Learning/AttentionNeuron/util.py): `Reinforcement Learning/AttentionNeuron/util.py`
- [RL environments](https://github.com/aria-funded-trend/ihms/blob/main/Reinforcement%20Learning/AttentionNeuron/tasks/rl_tasks.py): `Reinforcement Learning/AttentionNeuron/tasks/rl_tasks.py`
- [CartPole dynamics](https://github.com/aria-funded-trend/ihms/blob/main/Reinforcement%20Learning/AttentionNeuron/tasks/cartpole_env.py): `Reinforcement Learning/AttentionNeuron/tasks/cartpole_env.py`
- [Atari wrappers](https://github.com/aria-funded-trend/ihms/blob/main/Reinforcement%20Learning/AttentionNeuron/tasks/atari_wrappers.py): `Reinforcement Learning/AttentionNeuron/tasks/atari_wrappers.py`
- [RL policies](https://github.com/aria-funded-trend/ihms/blob/main/Reinforcement%20Learning/AttentionNeuron/solutions/torch_solutions.py): `Reinforcement Learning/AttentionNeuron/solutions/torch_solutions.py`
- [RL modulation layers](https://github.com/aria-funded-trend/ihms/blob/main/Reinforcement%20Learning/AttentionNeuron/solutions/torch_modules.py): `Reinforcement Learning/AttentionNeuron/solutions/torch_modules.py`
- [Solution contract](https://github.com/aria-funded-trend/ihms/blob/main/Reinforcement%20Learning/AttentionNeuron/solutions/base_solution.py): `Reinforcement Learning/AttentionNeuron/solutions/base_solution.py`

### Vision models

- [Image inference](https://github.com/aria-funded-trend/ihms/blob/main/Vision/object_recognition/inference.py): `Vision/object_recognition/inference.py`
- [Vision evaluation](https://github.com/aria-funded-trend/ihms/blob/main/Vision/object_recognition/evaluation.py): `Vision/object_recognition/evaluation.py`
- [Vision transformer](https://github.com/aria-funded-trend/ihms/blob/main/Vision/object_recognition/vit.py): `Vision/object_recognition/vit.py`
- [Transformer blocks](https://github.com/aria-funded-trend/ihms/blob/main/Vision/object_recognition/transformer.py): `Vision/object_recognition/transformer.py`
- [Modulated attention](https://github.com/aria-funded-trend/ihms/blob/main/Vision/object_recognition/attention.py): `Vision/object_recognition/attention.py`

### Experiment assets

- [Experiment configs](https://github.com/aria-funded-trend/ihms/tree/main/Reinforcement%20Learning/AttentionNeuron/configs): `Reinforcement Learning/AttentionNeuron/configs`
- [Pretrained checkpoints](https://github.com/aria-funded-trend/ihms/tree/main/Reinforcement%20Learning/AttentionNeuron/pretrained): `Reinforcement Learning/AttentionNeuron/pretrained`

### Other components

- **Researcher**
- **Image input**
- **Class predictions**
- **Label service**

## Connections

- Researcher → RL training: starts training (evidence: `README.md`)
- Researcher → RL evaluation: starts evaluation (evidence: `README.md`)
- Researcher → Image inference: requests inference
- RL training → Experiment configs: uses configurations (evidence: `README.md`)
- RL evaluation → Experiment configs: uses configurations (evidence: `README.md`)
- RL training → RL utilities: uses utilities (evidence: `Reinforcement Learning/AttentionNeuron/train_agent.py`)
- RL evaluation → RL utilities: uses utilities (evidence: `Reinforcement Learning/AttentionNeuron/eval_agent.py`)
- RL utilities → Solution contract: checks solution type (evidence: `Reinforcement Learning/AttentionNeuron/util.py`)
- RL utilities → Task factory: constructs tasks (evidence: `Reinforcement Learning/AttentionNeuron/util.py`)
- RL utilities → Solution factory: constructs solutions (evidence: `Reinforcement Learning/AttentionNeuron/util.py`)
- RL environments → CartPole dynamics: constructs environment (evidence: `Reinforcement Learning/AttentionNeuron/tasks/rl_tasks.py`)
- RL environments → Atari wrappers: wraps Atari environment (evidence: `Reinforcement Learning/AttentionNeuron/tasks/rl_tasks.py`)
- RL policies → RL modulation layers: instantiates layers (evidence: `Reinforcement Learning/AttentionNeuron/solutions/torch_solutions.py`)
- RL policies → Solution contract: implements contract (evidence: `Reinforcement Learning/AttentionNeuron/solutions/torch_solutions.py`)
- RL evaluation → Pretrained checkpoints: loads pretrained models (evidence: `README.md`)
- Image input → Image inference: provides image (evidence: `Vision/object_recognition/inference.py`)
- Image inference → Vision transformer: builds model (evidence: `Vision/object_recognition/inference.py`)
- Vision evaluation → Vision transformer: evaluates model (evidence: `Vision/object_recognition/evaluation.py`)
- Vision transformer → Transformer blocks: uses blocks (evidence: `Vision/object_recognition/vit.py`)
- Transformer blocks → Modulated attention: selects attention (evidence: `Vision/object_recognition/transformer.py`)
- Image inference → Pretrained checkpoints: loads weights
- Image inference → Label service: fetches labels (evidence: `Vision/object_recognition/inference.py`)
- Image inference → Class predictions: returns top classes (evidence: `Vision/object_recognition/inference.py`)
