# trufoox/rnn_from_scratch architecture

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

- Interactive diagram: https://gitdiagram.com/trufoox/rnn_from_scratch
- Repository: https://github.com/trufoox/rnn_from_scratch

## Overview

This is a small C++ console application that trains a vanilla RNN to estimate arithmetic results. The user selects an operation and maximum operand; the program initializes weights and enters a training loop that runs recurrent forward passes, computes gradients, updates weights, and prints predictions and errors. Binary vector serialization helpers exist, but the sampled code does not show them being used by training. The map reflects the sampled call flow; no persistence or model-loading connection is established.

Main entry points: [`AI_Project/rnn.cpp`](https://github.com/trufoox/rnn_from_scratch/blob/master/AI_Project/rnn.cpp) (Training loop), [`AI_Project/AI_Project.cpp`](https://github.com/trufoox/rnn_from_scratch/blob/master/AI_Project/AI_Project.cpp) (CLI entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Console app"]
  node_entry["CLI entry<br/>[AI_Project.cpp]"]
end

subgraph group_learn["RNN training"]
  node_trainer["Training loop<br/>[rnn.cpp]"]
  node_forward["Forward pass<br/>[rnn.cpp]"]
  node_backward["Backward pass<br/>[rnn.cpp]"]
end

subgraph group_io["Binary serialization"]
  node_serialization["Vector serialization<br/>[IO.cpp]"]
end

node_user(("User"))

node_user -->|"selects inputs"| node_entry
node_entry -->|"starts training"| node_trainer
node_trainer -->|"calls"| node_forward
node_trainer -->|"calls"| node_backward
node_forward -->|"prints results"| node_user

click node_entry "https://github.com/trufoox/rnn_from_scratch/blob/master/AI_Project/AI_Project.cpp"
click node_trainer "https://github.com/trufoox/rnn_from_scratch/blob/master/AI_Project/rnn.cpp"
click node_forward "https://github.com/trufoox/rnn_from_scratch/blob/master/AI_Project/rnn.cpp"
click node_backward "https://github.com/trufoox/rnn_from_scratch/blob/master/AI_Project/rnn.cpp"
click node_serialization "https://github.com/trufoox/rnn_from_scratch/blob/master/AI_Project/IO.cpp"

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_user toneBlue
class node_trainer,node_forward,node_backward toneAmber
class node_serialization toneMint
```

## Components

### Console app

- [CLI entry](https://github.com/trufoox/rnn_from_scratch/blob/master/AI_Project/AI_Project.cpp): `AI_Project/AI_Project.cpp`

### RNN training

- [Training loop](https://github.com/trufoox/rnn_from_scratch/blob/master/AI_Project/rnn.cpp): `AI_Project/rnn.cpp`
- [Forward pass](https://github.com/trufoox/rnn_from_scratch/blob/master/AI_Project/rnn.cpp): `AI_Project/rnn.cpp`
- [Backward pass](https://github.com/trufoox/rnn_from_scratch/blob/master/AI_Project/rnn.cpp): `AI_Project/rnn.cpp`

### Binary serialization

- [Vector serialization](https://github.com/trufoox/rnn_from_scratch/blob/master/AI_Project/IO.cpp): `AI_Project/IO.cpp`

### Other components

- **User**

## Connections

- User → CLI entry: selects inputs (evidence: `AI_Project/AI_Project.cpp`)
- CLI entry → Training loop: starts training (evidence: `AI_Project/AI_Project.cpp`)
- Training loop → Forward pass: calls (evidence: `AI_Project/rnn.cpp`)
- Training loop → Backward pass: calls (evidence: `AI_Project/rnn.cpp`)
- Forward pass → User: prints results (evidence: `AI_Project/rnn.cpp`)
