# gucchi3/e_ai architecture

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

- Interactive diagram: https://gitdiagram.com/gucchi3/e_ai
- Repository: https://github.com/gucchi3/e_ai

## Overview

E_AI is a CIFAR-10 training and evaluation application for FP32 and quantization-aware models. Users select a JSON configuration and run `main.py`; the workflow loads data, builds the selected model, trains and evaluates it, then saves metrics and model artifacts. The model families include CNN, ResNet-18, MobileNetV2, and BasicViT, with varied quantization experiments. Edges reflect the shown imports, calls, or README documentation; some model-family wiring is documented but its implementation was not fully sampled.

Main entry points: [`utils/workflows.py`](https://github.com/gucchi3/e_ai/blob/main/utils/workflows.py) (Run orchestration), [`utils/quantization/layers.py`](https://github.com/gucchi3/e_ai/blob/main/utils/quantization/layers.py) (Quantized layers), [`model/builder.py`](https://github.com/gucchi3/e_ai/blob/main/model/builder.py) (Model selection), [`main.py`](https://github.com/gucchi3/e_ai/blob/main/main.py) (CLI entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_run["Run workflow"]
  node_entry["CLI entry<br/>[main.py]"]
  node_config["Config loading<br/>[config.py]"]
  node_workflow["Run orchestration<br/>[workflows.py]"]
  node_dataset["CIFAR-10 loaders<br/>[data.py]"]
  node_augmentation["Batch augmentation<br/>[augmentation.py]"]
  node_engine["Train and evaluate<br/>[engine.py]"]
end

subgraph group_models["Model families"]
  node_modelbuilder["Model selection<br/>[builder.py]"]
  node_cnn["CNN variants"]
  node_resnet["ResNet-18 variants"]
  node_mobilenet["MobileNetV2 variants"]
  node_vit["BasicViT variants"]
  node_blocks["Quantized CNN blocks"]
end

subgraph group_quant["Quantization"]
  node_quantlayers["Quantized layers<br/>[layers.py]"]
  node_integer["Integer quantization<br/>[integer.py]"]
  node_fp4["FP4 quantization<br/>[fp4.py]"]
  node_ufp4["UFP4 quantization<br/>[ufp4.py]"]
  node_rounding["Rounding modes<br/>[rounding.py]"]
end

subgraph group_results["Training results"]
  node_artifacts[("Run artifacts<br/>[artifacts.py]")]
  node_display["Training display<br/>[display.py]"]
  node_weights["Weight loading<br/>[weights.py]"]
  node_profiler["Model profiling<br/>[profiling.py]"]
end

node_user(("Researcher"))
node_cifar[("CIFAR-10 source")]

node_user -->|"runs"| node_entry
node_entry -->|"loads config"| node_config
node_entry -->|"starts run"| node_workflow
node_workflow -->|"uses settings"| node_config
node_workflow -->|"creates loaders"| node_dataset
node_cifar -->|"provides images"| node_dataset
node_workflow -->|"builds model"| node_modelbuilder
node_modelbuilder -->|"selects variant"| node_cnn
node_modelbuilder -->|"selects variant"| node_resnet
node_modelbuilder -->|"selects variant"| node_mobilenet
node_modelbuilder -->|"selects variant"| node_vit
node_workflow -->|"loads weights"| node_weights
node_workflow -->|"runs epochs"| node_engine
node_engine -->|"augments batches"| node_augmentation
node_workflow -->|"records results"| node_artifacts
node_workflow -->|"prints progress"| node_display
node_workflow -->|"measures MACs"| node_profiler
node_cnn -->|"uses blocks"| node_blocks
node_blocks -->|"uses layers"| node_quantlayers
node_cnn -->|"uses layers"| node_quantlayers
node_mobilenet -->|"uses layers"| node_quantlayers
node_resnet -->|"uses layers"| node_quantlayers
node_vit -->|"uses quantization"| node_quantlayers
node_quantlayers -->|"uses quantizer"| node_integer
node_quantlayers -->|"uses quantizer"| node_fp4
node_quantlayers -->|"uses rounding"| node_rounding
node_fp4 -->|"uses rounding"| node_rounding
node_ufp4 -->|"uses rounding"| node_rounding
node_workflow -->|"saves models"| node_artifacts

click node_entry "https://github.com/gucchi3/e_ai/blob/main/main.py"
click node_config "https://github.com/gucchi3/e_ai/blob/main/utils/config.py"
click node_workflow "https://github.com/gucchi3/e_ai/blob/main/utils/workflows.py"
click node_dataset "https://github.com/gucchi3/e_ai/blob/main/utils/data.py"
click node_augmentation "https://github.com/gucchi3/e_ai/blob/main/utils/augmentation.py"
click node_engine "https://github.com/gucchi3/e_ai/blob/main/utils/engine.py"
click node_modelbuilder "https://github.com/gucchi3/e_ai/blob/main/model/builder.py"
click node_cnn "https://github.com/gucchi3/e_ai/tree/main/model/basic_cnn"
click node_resnet "https://github.com/gucchi3/e_ai/tree/main/model/ResNet18"
click node_mobilenet "https://github.com/gucchi3/e_ai/tree/main/model/MobileNet_v2"
click node_vit "https://github.com/gucchi3/e_ai/tree/main/model/basic_vit"
click node_blocks "https://github.com/gucchi3/e_ai/blob/main/model/blocks/quant_conv_block.py"
click node_quantlayers "https://github.com/gucchi3/e_ai/blob/main/utils/quantization/layers.py"
click node_integer "https://github.com/gucchi3/e_ai/blob/main/utils/quantization/integer.py"
click node_fp4 "https://github.com/gucchi3/e_ai/blob/main/utils/quantization/fp4.py"
click node_ufp4 "https://github.com/gucchi3/e_ai/blob/main/utils/quantization/ufp4.py"
click node_rounding "https://github.com/gucchi3/e_ai/blob/main/utils/quantization/rounding.py"
click node_artifacts "https://github.com/gucchi3/e_ai/blob/main/utils/artifacts.py"
click node_display "https://github.com/gucchi3/e_ai/blob/main/utils/display.py"
click node_weights "https://github.com/gucchi3/e_ai/blob/main/utils/weights.py"
click node_profiler "https://github.com/gucchi3/e_ai/blob/main/utils/profiling.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_entry,node_config,node_workflow,node_dataset,node_augmentation,node_engine toneBlue
class node_modelbuilder,node_cnn,node_resnet,node_mobilenet,node_vit,node_blocks,node_cifar toneAmber
class node_quantlayers,node_integer,node_fp4,node_ufp4,node_rounding toneMint
class node_artifacts,node_display,node_weights,node_profiler toneRose
class node_user toneIndigo
```

## Components

### Run workflow

- [CLI entry](https://github.com/gucchi3/e_ai/blob/main/main.py): `main.py`
- [Config loading](https://github.com/gucchi3/e_ai/blob/main/utils/config.py): `utils/config.py`
- [Run orchestration](https://github.com/gucchi3/e_ai/blob/main/utils/workflows.py): `utils/workflows.py`
- [CIFAR-10 loaders](https://github.com/gucchi3/e_ai/blob/main/utils/data.py): `utils/data.py`
- [Batch augmentation](https://github.com/gucchi3/e_ai/blob/main/utils/augmentation.py): `utils/augmentation.py`
- [Train and evaluate](https://github.com/gucchi3/e_ai/blob/main/utils/engine.py): `utils/engine.py`

### Model families

- [Model selection](https://github.com/gucchi3/e_ai/blob/main/model/builder.py): `model/builder.py`
- [CNN variants](https://github.com/gucchi3/e_ai/tree/main/model/basic_cnn): `model/basic_cnn`
- [ResNet-18 variants](https://github.com/gucchi3/e_ai/tree/main/model/ResNet18): `model/ResNet18`
- [MobileNetV2 variants](https://github.com/gucchi3/e_ai/tree/main/model/MobileNet_v2): `model/MobileNet_v2`
- [BasicViT variants](https://github.com/gucchi3/e_ai/tree/main/model/basic_vit): `model/basic_vit`
- [Quantized CNN blocks](https://github.com/gucchi3/e_ai/blob/main/model/blocks/quant_conv_block.py): `model/blocks/quant_conv_block.py`

### Quantization

- [Quantized layers](https://github.com/gucchi3/e_ai/blob/main/utils/quantization/layers.py): `utils/quantization/layers.py`
- [Integer quantization](https://github.com/gucchi3/e_ai/blob/main/utils/quantization/integer.py): `utils/quantization/integer.py`
- [FP4 quantization](https://github.com/gucchi3/e_ai/blob/main/utils/quantization/fp4.py): `utils/quantization/fp4.py`
- [UFP4 quantization](https://github.com/gucchi3/e_ai/blob/main/utils/quantization/ufp4.py): `utils/quantization/ufp4.py`
- [Rounding modes](https://github.com/gucchi3/e_ai/blob/main/utils/quantization/rounding.py): `utils/quantization/rounding.py`

### Training results

- [Run artifacts](https://github.com/gucchi3/e_ai/blob/main/utils/artifacts.py): `utils/artifacts.py`
- [Training display](https://github.com/gucchi3/e_ai/blob/main/utils/display.py): `utils/display.py`
- [Weight loading](https://github.com/gucchi3/e_ai/blob/main/utils/weights.py): `utils/weights.py`
- [Model profiling](https://github.com/gucchi3/e_ai/blob/main/utils/profiling.py): `utils/profiling.py`

### Other components

- **Researcher**
- **CIFAR-10 source**

## Connections

- Researcher → CLI entry: runs (evidence: `README.md`)
- CLI entry → Config loading: loads config (evidence: `main.py`)
- CLI entry → Run orchestration: starts run (evidence: `main.py`)
- Run orchestration → Config loading: uses settings (evidence: `utils/workflows.py`)
- Run orchestration → CIFAR-10 loaders: creates loaders (evidence: `utils/workflows.py`)
- CIFAR-10 source → CIFAR-10 loaders: provides images (evidence: `README.md`)
- Run orchestration → Model selection: builds model (evidence: `utils/workflows.py`)
- Model selection → CNN variants: selects variant (evidence: `model/builder.py`)
- Model selection → ResNet-18 variants: selects variant (evidence: `model/builder.py`)
- Model selection → MobileNetV2 variants: selects variant (evidence: `model/builder.py`)
- Model selection → BasicViT variants: selects variant (evidence: `model/builder.py`)
- Run orchestration → Weight loading: loads weights (evidence: `utils/workflows.py`)
- Run orchestration → Train and evaluate: runs epochs (evidence: `utils/workflows.py`)
- Train and evaluate → Batch augmentation: augments batches (evidence: `utils/engine.py`)
- Run orchestration → Run artifacts: records results (evidence: `utils/workflows.py`)
- Run orchestration → Training display: prints progress (evidence: `utils/workflows.py`)
- Run orchestration → Model profiling: measures MACs (evidence: `utils/workflows.py`)
- CNN variants → Quantized CNN blocks: uses blocks (evidence: `model/basic_cnn/ufp4_test_cnn.py`)
- Quantized CNN blocks → Quantized layers: uses layers (evidence: `model/blocks/quant_conv_block.py`)
- CNN variants → Quantized layers: uses layers (evidence: `model/basic_cnn/ufp4_test_cnn.py`)
- MobileNetV2 variants → Quantized layers: uses layers (evidence: `model/MobileNet_v2/MobileNet_v2_ufp4.py`)
- ResNet-18 variants → Quantized layers: uses layers (evidence: `model/ResNet18/ResNet18_int8.py`)
- BasicViT variants → Quantized layers: uses quantization (evidence: `model/basic_vit/BasicViT_test3.py`)
- Quantized layers → Integer quantization: uses quantizer (evidence: `utils/quantization/layers.py`)
- Quantized layers → FP4 quantization: uses quantizer (evidence: `utils/quantization/layers.py`)
- Quantized layers → Rounding modes: uses rounding (evidence: `utils/quantization/layers.py`)
- FP4 quantization → Rounding modes: uses rounding (evidence: `utils/quantization/fp4.py`)
- UFP4 quantization → Rounding modes: uses rounding (evidence: `utils/quantization/ufp4.py`)
- Run orchestration → Run artifacts: saves models (evidence: `utils/workflows.py`)
