# attentionseekers/cnntention architecture

> Architecture diagram of the GitHub repository attentionseekers/cnntention, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/attentionseekers/cnntention
- Repository: https://github.com/attentionseekers/cnntention

## Overview

The project is a research & experimentation repository that explores whether standard CNNs or various attention-augmented CNN models (such as CBAM, self-attention, multi-head self-attention) perform better – and why. The file tree shows a clear separation between experimental tracking (via mlruns with MLflow), model definitions (in the models folder with many variants for CIFAR10 and MNIST), and interactive experimentation (in the notebooks folder). There are additional components for reports and visualization (report and utils folders) along with a pipeline template which likely organizes the training–evaluation procedure.

##### Experiment Management and Logging
- MLflow as a dedicated module. The “mlruns” folder indicates logging of metrics, parameters, and artifacts from various training runs.
- Directional flows from the training pipeline to the MLflow tracking server.
- That experiment parameters, model states, and evaluation metrics (accuracy, loss, etc.) are stored and later used for comparisons.

##### Experiment Pipeline and Execution
- A “Pipeline” component (corresponding to pipeline_template.py) which is responsible for invoking training sessions. This component orchestrates the training, evaluation of models, and communicates with the MLflow logger.
- Sketch how user-controlled hyperparameters (batch_size, learning_rate, epochs, etc.) move from configuration files (or notebooks) into this pipeline, then into model training.

##### Visualization & Reporting
- Directional relationships showing that results and artifacts (from MLflow and training) are sent to the “Report” for further documentation.

##### Data Flow and Connections
– From “Notebooks” (interactive experiments) to “Pipeline” (execution).
– From “Pipeline” to “Models” (training).
– From “Models” to “MLflow Logger” (recording metrics, parameters, and artifacts).
– From “MLflow Logger” to “Report/Visualization” (for analysis).

##### Architectural Patterns & Design Principles
- Modular separation of concerns: model training, experiment logging, and interactive experimentation are clearly decoupled.
- That the repository is designed for reproducible research: model definitions, experiment configurations (as seen in experiment_configs.py), and MLflow tracking ensure traceability.
- That this separation aids in comparing multiple approaches (CNN vs. various attention modules) in a systematic way.

- Be detailed but not overly complex—focus on the key logical interactions.

## Diagram (Mermaid)

```mermaid
graph TD
    Dataset["Dataset (CIFAR10, MNIST)"]:::dataset
    Notebooks["Notebooks/Interactive Analysis"]:::notebook
    Pipeline["Experiment Pipeline"]:::pipeline

    subgraph "Model Architectures"
        CNN1["CIFAR10 ResNet"]:::model
        CNN2["MNIST ResNet"]:::model
        Attention["Attention Modules"]:::model
    end

    MLflow["MLflow Logging"]:::mlflow

    subgraph "Reporting & Visualization"
        Report["Report"]:::report
        Utils["Utils"]:::utils
    end

    Dataset -->|"providesData"| Pipeline
    Notebooks -->|"triggersRun"| Pipeline
    Pipeline -->|"invokesTraining"| CNN1
    Pipeline -->|"invokesTraining"| CNN2
    Pipeline -->|"invokesTraining"| Attention
    CNN1 -->|"logsMetrics"| MLflow
    CNN2 -->|"logsMetrics"| MLflow
    Attention -->|"logsMetrics"| MLflow
    Pipeline -->|"logsConfig"| MLflow
    Notebooks -->|"viewsLogs"| MLflow
    MLflow -->|"updatesArtifacts"| Report
    MLflow -->|"updatesArtifacts"| Utils

    click Notebooks "https://github.com/attentionseekers/cnntention/tree/main/notebooks"
    click Pipeline "https://github.com/attentionseekers/cnntention/blob/main/pipeline_template.py"
    click CNN1 "https://github.com/attentionseekers/cnntention/blob/main/models/cifar10resnet.py"
    click CNN2 "https://github.com/attentionseekers/cnntention/blob/main/models/mnistresnet.py"
    click Attention "https://github.com/attentionseekers/cnntention/tree/main/models/attention"
    click MLflow "https://github.com/attentionseekers/cnntention/tree/main/mlruns"
    click Report "https://github.com/attentionseekers/cnntention/tree/main/report"
    click Utils "https://github.com/attentionseekers/cnntention/tree/main/utils"

    classDef notebook fill:#F4A261,stroke:#000,stroke-width:1px;
    classDef pipeline fill:#2A9D8F,stroke:#000,stroke-width:1px;
    classDef model fill:#E9C46A,stroke:#000,stroke-width:1px;
    classDef mlflow fill:#E76F51,stroke:#000,stroke-width:1px;
    classDef report fill:#264653,stroke:#fff,stroke-width:1px;
    classDef utils fill:#2A9D8F,stroke:#fff,stroke-width:1px;
    classDef dataset fill:#457B9D,stroke:#000,stroke-width:1px;
```
