# adlarx9/neural-network architecture

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

- Interactive diagram: https://gitdiagram.com/adlarx9/neural-network
- Repository: https://github.com/adlarx9/neural-network

## Overview

This is a from-scratch neural-network learning library with example programs for image generation, text prediction, number recognition, and shape learning. A typical workflow is to prepare training data, build a model from layers or a predefined architecture, train it, and use a script or visualization to inspect results. The graph preserves the documented model families and examples; unsampled implementations are represented at their exact tree paths, but their internal wiring is not inferred.

Main entry points: [`core/block/rcmha.py`](https://github.com/adlarx9/neural-network/blob/main/core/block/rcmha.py) (Causal Attention), [`core/training/trainer.py`](https://github.com/adlarx9/neural-network/blob/main/core/training/trainer.py) (Trainer), [`scripts`](https://github.com/adlarx9/neural-network/tree/main/scripts) (Example Programs), [`core/basics`](https://github.com/adlarx9/neural-network/tree/main/core/basics) (Layers And Blocks)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Core Modeling"]
  node_layers["Layers And Blocks"]
  node_activations["Activations"]
  node_parameters["Parameters And Norms"]
  node_flowops["Flow Operations"]
  node_transforms["Tensor Transforms"]
  node_losses["Loss Functions"]
end

subgraph group_architectures["Model Architectures"]
  node_mlp_cnn["MLP And CNN"]
  node_lstm["LSTM Network<br/>[lstm.py]"]
  node_llama["LLaMA Network<br/>[llama.py]"]
  node_diffusion["Diffusion Models"]
  node_attention["Causal Attention<br/>[rcmha.py]"]
end

subgraph group_text["Text Processing"]
  node_textnetwork["Text Network<br/>[text_network.py]"]
  node_tokenizers["Tokenizers"]
  node_embedding["Text Embedding<br/>[embedding.py]"]
end

subgraph group_training["Training And Persistence"]
  node_trainingdata["Training Data<br/>[data.py]"]
  node_trainer["Trainer<br/>[trainer.py]"]
  node_storage["Model Storage"]
end

subgraph group_examples["Examples And Visualization"]
  node_main["Program Entry<br/>[main.py]"]
  node_scripts["Example Programs"]
  node_graphics["Result Visualizations"]
end

node_actor(("Program Author"))

node_actor -->|"starts"| node_main
node_main -->|"dispatches examples"| node_scripts
node_scripts -.->|"trains image model"| node_diffusion
node_scripts -.->|"shows results"| node_graphics
node_trainer -->|"uses data"| node_trainingdata
node_trainer -->|"uses loss"| node_losses
node_trainer -->|"trains layers"| node_layers
node_textnetwork -->|"extends block"| node_layers
node_textnetwork -->|"embeds input"| node_embedding
node_embedding -->|"tokenizes text"| node_tokenizers
node_attention -->|"uses operations"| node_flowops
node_attention -->|"uses transforms"| node_transforms
node_attention -->|"uses softmax"| node_activations
node_attention -->|"uses projections"| node_parameters
node_layers -.->|"hosts layers"| node_activations
node_storage -.->|"loads models"| node_main

click node_main "https://github.com/adlarx9/neural-network/blob/main/main.py"
click node_scripts "https://github.com/adlarx9/neural-network/tree/main/scripts"
click node_graphics "https://github.com/adlarx9/neural-network/tree/main/graphics"
click node_layers "https://github.com/adlarx9/neural-network/tree/main/core/basics"
click node_activations "https://github.com/adlarx9/neural-network/tree/main/core/activation"
click node_parameters "https://github.com/adlarx9/neural-network/tree/main/core/parameterized"
click node_flowops "https://github.com/adlarx9/neural-network/tree/main/core/flowmakers"
click node_transforms "https://github.com/adlarx9/neural-network/tree/main/core/transform"
click node_losses "https://github.com/adlarx9/neural-network/tree/main/core/loss"
click node_mlp_cnn "https://github.com/adlarx9/neural-network/tree/main/core/network"
click node_lstm "https://github.com/adlarx9/neural-network/blob/main/core/network/lstm.py"
click node_llama "https://github.com/adlarx9/neural-network/blob/main/core/network/llama.py"
click node_diffusion "https://github.com/adlarx9/neural-network/tree/main/core/network/diffusion"
click node_attention "https://github.com/adlarx9/neural-network/blob/main/core/block/rcmha.py"
click node_textnetwork "https://github.com/adlarx9/neural-network/blob/main/core/text/text_network.py"
click node_tokenizers "https://github.com/adlarx9/neural-network/tree/main/core/text"
click node_embedding "https://github.com/adlarx9/neural-network/blob/main/core/parameterized/embedding.py"
click node_trainingdata "https://github.com/adlarx9/neural-network/blob/main/core/training/data.py"
click node_trainer "https://github.com/adlarx9/neural-network/blob/main/core/training/trainer.py"
click node_storage "https://github.com/adlarx9/neural-network/tree/main/data"

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_layers,node_activations,node_parameters,node_flowops,node_transforms,node_losses toneBlue
class node_mlp_cnn,node_lstm,node_llama,node_diffusion,node_attention toneAmber
class node_textnetwork,node_tokenizers,node_embedding toneMint
class node_trainingdata,node_trainer,node_storage toneRose
class node_main,node_scripts,node_graphics,node_actor toneIndigo
```

## Components

### Core Modeling

- [Layers And Blocks](https://github.com/adlarx9/neural-network/tree/main/core/basics): `core/basics`
- [Activations](https://github.com/adlarx9/neural-network/tree/main/core/activation): `core/activation`
- [Parameters And Norms](https://github.com/adlarx9/neural-network/tree/main/core/parameterized): `core/parameterized`
- [Flow Operations](https://github.com/adlarx9/neural-network/tree/main/core/flowmakers): `core/flowmakers`
- [Tensor Transforms](https://github.com/adlarx9/neural-network/tree/main/core/transform): `core/transform`
- [Loss Functions](https://github.com/adlarx9/neural-network/tree/main/core/loss): `core/loss`

### Model Architectures

- [MLP And CNN](https://github.com/adlarx9/neural-network/tree/main/core/network): `core/network`
- [LSTM Network](https://github.com/adlarx9/neural-network/blob/main/core/network/lstm.py): `core/network/lstm.py`
- [LLaMA Network](https://github.com/adlarx9/neural-network/blob/main/core/network/llama.py): `core/network/llama.py`
- [Diffusion Models](https://github.com/adlarx9/neural-network/tree/main/core/network/diffusion): `core/network/diffusion`
- [Causal Attention](https://github.com/adlarx9/neural-network/blob/main/core/block/rcmha.py): `core/block/rcmha.py`

### Text Processing

- [Text Network](https://github.com/adlarx9/neural-network/blob/main/core/text/text_network.py): `core/text/text_network.py`
- [Tokenizers](https://github.com/adlarx9/neural-network/tree/main/core/text): `core/text`
- [Text Embedding](https://github.com/adlarx9/neural-network/blob/main/core/parameterized/embedding.py): `core/parameterized/embedding.py`

### Training And Persistence

- [Training Data](https://github.com/adlarx9/neural-network/blob/main/core/training/data.py): `core/training/data.py`
- [Trainer](https://github.com/adlarx9/neural-network/blob/main/core/training/trainer.py): `core/training/trainer.py`
- [Model Storage](https://github.com/adlarx9/neural-network/tree/main/data): `data`

### Examples And Visualization

- [Program Entry](https://github.com/adlarx9/neural-network/blob/main/main.py): `main.py`
- [Example Programs](https://github.com/adlarx9/neural-network/tree/main/scripts): `scripts`
- [Result Visualizations](https://github.com/adlarx9/neural-network/tree/main/graphics): `graphics`

### Other components

- **Program Author**

## Connections

- Program Author → Program Entry: starts (evidence: `README.md`)
- Program Entry → Example Programs: dispatches examples (evidence: `main.py`)
- Example Programs → Diffusion Models: trains image model (evidence: `README.md`)
- Example Programs → Result Visualizations: shows results (evidence: `README.md`)
- Trainer → Training Data: uses data (evidence: `core/training/trainer.py`)
- Trainer → Loss Functions: uses loss (evidence: `core/training/trainer.py`)
- Trainer → Layers And Blocks: trains layers (evidence: `core/training/trainer.py`)
- Text Network → Layers And Blocks: extends block (evidence: `core/text/text_network.py`)
- Text Network → Text Embedding: embeds input (evidence: `core/text/text_network.py`)
- Text Embedding → Tokenizers: tokenizes text (evidence: `core/parameterized/embedding.py`)
- Causal Attention → Flow Operations: uses operations (evidence: `core/block/rcmha.py`)
- Causal Attention → Tensor Transforms: uses transforms (evidence: `core/block/rcmha.py`)
- Causal Attention → Activations: uses softmax (evidence: `core/block/rcmha.py`)
- Causal Attention → Parameters And Norms: uses projections (evidence: `core/block/rcmha.py`)
- Layers And Blocks → Activations: hosts layers (evidence: `core/activation/activation.py`)
- Model Storage → Program Entry: loads models
