# igorberezkin/wat architecture

> Architecture diagram of the GitHub repository igorberezkin/wat, 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/igorberezkin/wat
- Repository: https://github.com/igorberezkin/wat

## Overview

This repository is a research codebase for comparing successive WAT language-model designs with Transformer baselines on long-context Shakespeare next-token prediction. The user workflow is to run a versioned benchmark: load Shakespeare text, encode characters and create sequence batches, train and evaluate both models, then report accuracy; V2/V3 also generate sample text during training. Model implementations and benchmark scripts are version-specific rather than a shared application. The graph reflects the README and sampled files; result artifacts and visualization HTML are not runtime stages.

Main entry points: [`WAT_V2/shakespeare_long_512_v2.py`](https://github.com/igorberezkin/wat/blob/main/WAT_V2/shakespeare_long_512_v2.py) (V2 Train and Eval), [`WAT_V3/shakespeare_long_512_v3.py`](https://github.com/igorberezkin/wat/blob/main/WAT_V3/shakespeare_long_512_v3.py) (V3 Train and Eval), [`WAT_V1/shakespeare_long_512_v1.py`](https://github.com/igorberezkin/wat/blob/main/WAT_V1/shakespeare_long_512_v1.py) (V1 Benchmark), [`WAT_V1/WAT_v1.py`](https://github.com/igorberezkin/wat/blob/main/WAT_V1/WAT_v1.py) (V1 WAT Model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_benchmarks["Versioned Benchmarks"]
  node_v1run["V1 Benchmark"]
  node_v2run["V2 Benchmark"]
  node_v3run["V3 Benchmark"]
end

subgraph group_models["Model Implementations"]
  node_v1wat["V1 WAT Model<br/>[WAT_v1.py]"]
  node_v2wat["V2 WAT Model<br/>[WAT_v2.py]"]
  node_v3wat["V3 WAT Model<br/>[WAT_v3.py]"]
  node_v1transformer["V1 Transformer"]
  node_v2transformer["V2 Transformer"]
  node_v3transformer["V3 Transformer"]
end

subgraph group_workflow["Data and Evaluation"]
  node_v1data["V1 Data Prep"]
  node_v2data["V2 Data Prep"]
  node_v3data["V3 Data Prep"]
  node_v1train["V1 Train and Eval"]
  node_v2train["V2 Train and Eval"]
  node_v3train["V3 Train and Eval"]
  node_v2generation["V2 Text Generation"]
  node_v3generation["V3 Text Generation"]
end

node_user(("Researcher"))
node_shakespeare["Shakespeare Text"]

node_user -->|"runs benchmark"| node_v1run
node_user -->|"runs benchmark"| node_v2run
node_user -->|"runs benchmark"| node_v3run
node_v1run -->|"prepares data"| node_v1data
node_v2run -->|"prepares data"| node_v2data
node_v3run -->|"prepares data"| node_v3data
node_v1data -->|"loads text"| node_shakespeare
node_v2data -->|"loads text"| node_shakespeare
node_v3data -->|"loads text"| node_shakespeare
node_v1run -->|"runs training"| node_v1train
node_v2run -->|"runs training"| node_v2train
node_v3run -->|"runs training"| node_v3train
node_v1train -->|"invokes model"| node_v1wat
node_v1train -->|"invokes baseline"| node_v1transformer
node_v2train -->|"invokes model"| node_v2wat
node_v2train -->|"invokes baseline"| node_v2transformer
node_v3train -->|"invokes model"| node_v3wat
node_v3train -->|"invokes baseline"| node_v3transformer
node_v2train -->|"generates samples"| node_v2generation
node_v3train -->|"generates samples"| node_v3generation

click node_v1run "https://github.com/igorberezkin/wat/blob/main/WAT_V1/shakespeare_long_512_v1.py"
click node_v2run "https://github.com/igorberezkin/wat/blob/main/WAT_V2/shakespeare_long_512_v2.py"
click node_v3run "https://github.com/igorberezkin/wat/blob/main/WAT_V3/shakespeare_long_512_v3.py"
click node_v1data "https://github.com/igorberezkin/wat/blob/main/WAT_V1/shakespeare_long_512_v1.py"
click node_v2data "https://github.com/igorberezkin/wat/blob/main/WAT_V2/shakespeare_long_512_v2.py"
click node_v3data "https://github.com/igorberezkin/wat/blob/main/WAT_V3/shakespeare_long_512_v3.py"
click node_v1train "https://github.com/igorberezkin/wat/blob/main/WAT_V1/shakespeare_long_512_v1.py"
click node_v2train "https://github.com/igorberezkin/wat/blob/main/WAT_V2/shakespeare_long_512_v2.py"
click node_v3train "https://github.com/igorberezkin/wat/blob/main/WAT_V3/shakespeare_long_512_v3.py"
click node_v1wat "https://github.com/igorberezkin/wat/blob/main/WAT_V1/WAT_v1.py"
click node_v2wat "https://github.com/igorberezkin/wat/blob/main/WAT_V2/WAT_v2.py"
click node_v3wat "https://github.com/igorberezkin/wat/blob/main/WAT_V3/WAT_v3.py"
click node_v1transformer "https://github.com/igorberezkin/wat/blob/main/WAT_V1/shakespeare_long_512_v1.py"
click node_v2transformer "https://github.com/igorberezkin/wat/blob/main/WAT_V2/shakespeare_long_512_v2.py"
click node_v3transformer "https://github.com/igorberezkin/wat/blob/main/WAT_V3/shakespeare_long_512_v3.py"
click node_v2generation "https://github.com/igorberezkin/wat/blob/main/WAT_V2/shakespeare_long_512_v2.py"
click node_v3generation "https://github.com/igorberezkin/wat/blob/main/WAT_V3/shakespeare_long_512_v3.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_v1run,node_v2run,node_v3run toneBlue
class node_v1wat,node_v2wat,node_v3wat,node_v1transformer,node_v2transformer,node_v3transformer toneAmber
class node_v1data,node_v2data,node_v3data,node_v1train,node_v2train,node_v3train,node_v2generation,node_v3generation toneMint
class node_user,node_shakespeare toneIndigo
```

## Components

### Versioned Benchmarks

- [V1 Benchmark](https://github.com/igorberezkin/wat/blob/main/WAT_V1/shakespeare_long_512_v1.py): `WAT_V1/shakespeare_long_512_v1.py`
- [V2 Benchmark](https://github.com/igorberezkin/wat/blob/main/WAT_V2/shakespeare_long_512_v2.py): `WAT_V2/shakespeare_long_512_v2.py`
- [V3 Benchmark](https://github.com/igorberezkin/wat/blob/main/WAT_V3/shakespeare_long_512_v3.py): `WAT_V3/shakespeare_long_512_v3.py`

### Model Implementations

- [V1 WAT Model](https://github.com/igorberezkin/wat/blob/main/WAT_V1/WAT_v1.py): `WAT_V1/WAT_v1.py`
- [V2 WAT Model](https://github.com/igorberezkin/wat/blob/main/WAT_V2/WAT_v2.py): `WAT_V2/WAT_v2.py`
- [V3 WAT Model](https://github.com/igorberezkin/wat/blob/main/WAT_V3/WAT_v3.py): `WAT_V3/WAT_v3.py`
- [V1 Transformer](https://github.com/igorberezkin/wat/blob/main/WAT_V1/shakespeare_long_512_v1.py): `WAT_V1/shakespeare_long_512_v1.py`
- [V2 Transformer](https://github.com/igorberezkin/wat/blob/main/WAT_V2/shakespeare_long_512_v2.py): `WAT_V2/shakespeare_long_512_v2.py`
- [V3 Transformer](https://github.com/igorberezkin/wat/blob/main/WAT_V3/shakespeare_long_512_v3.py): `WAT_V3/shakespeare_long_512_v3.py`

### Data and Evaluation

- [V1 Data Prep](https://github.com/igorberezkin/wat/blob/main/WAT_V1/shakespeare_long_512_v1.py): `WAT_V1/shakespeare_long_512_v1.py`
- [V2 Data Prep](https://github.com/igorberezkin/wat/blob/main/WAT_V2/shakespeare_long_512_v2.py): `WAT_V2/shakespeare_long_512_v2.py`
- [V3 Data Prep](https://github.com/igorberezkin/wat/blob/main/WAT_V3/shakespeare_long_512_v3.py): `WAT_V3/shakespeare_long_512_v3.py`
- [V1 Train and Eval](https://github.com/igorberezkin/wat/blob/main/WAT_V1/shakespeare_long_512_v1.py): `WAT_V1/shakespeare_long_512_v1.py`
- [V2 Train and Eval](https://github.com/igorberezkin/wat/blob/main/WAT_V2/shakespeare_long_512_v2.py): `WAT_V2/shakespeare_long_512_v2.py`
- [V3 Train and Eval](https://github.com/igorberezkin/wat/blob/main/WAT_V3/shakespeare_long_512_v3.py): `WAT_V3/shakespeare_long_512_v3.py`
- [V2 Text Generation](https://github.com/igorberezkin/wat/blob/main/WAT_V2/shakespeare_long_512_v2.py): `WAT_V2/shakespeare_long_512_v2.py`
- [V3 Text Generation](https://github.com/igorberezkin/wat/blob/main/WAT_V3/shakespeare_long_512_v3.py): `WAT_V3/shakespeare_long_512_v3.py`

### Other components

- **Researcher**
- **Shakespeare Text**

## Connections

- Researcher → V1 Benchmark: runs benchmark (evidence: `README.md`)
- Researcher → V2 Benchmark: runs benchmark (evidence: `README.md`)
- Researcher → V3 Benchmark: runs benchmark (evidence: `README.md`)
- V1 Benchmark → V1 Data Prep: prepares data (evidence: `WAT_V1/shakespeare_long_512_v1.py`)
- V2 Benchmark → V2 Data Prep: prepares data (evidence: `WAT_V2/shakespeare_long_512_v2.py`)
- V3 Benchmark → V3 Data Prep: prepares data (evidence: `WAT_V3/shakespeare_long_512_v3.py`)
- V1 Data Prep → Shakespeare Text: loads text (evidence: `WAT_V1/shakespeare_long_512_v1.py`)
- V2 Data Prep → Shakespeare Text: loads text (evidence: `WAT_V2/shakespeare_long_512_v2.py`)
- V3 Data Prep → Shakespeare Text: loads text (evidence: `WAT_V3/shakespeare_long_512_v3.py`)
- V1 Benchmark → V1 Train and Eval: runs training (evidence: `WAT_V1/shakespeare_long_512_v1.py`)
- V2 Benchmark → V2 Train and Eval: runs training (evidence: `WAT_V2/shakespeare_long_512_v2.py`)
- V3 Benchmark → V3 Train and Eval: runs training (evidence: `WAT_V3/shakespeare_long_512_v3.py`)
- V1 Train and Eval → V1 WAT Model: invokes model (evidence: `WAT_V1/shakespeare_long_512_v1.py`)
- V1 Train and Eval → V1 Transformer: invokes baseline (evidence: `WAT_V1/shakespeare_long_512_v1.py`)
- V2 Train and Eval → V2 WAT Model: invokes model (evidence: `WAT_V2/shakespeare_long_512_v2.py`)
- V2 Train and Eval → V2 Transformer: invokes baseline (evidence: `WAT_V2/shakespeare_long_512_v2.py`)
- V3 Train and Eval → V3 WAT Model: invokes model (evidence: `WAT_V3/shakespeare_long_512_v3.py`)
- V3 Train and Eval → V3 Transformer: invokes baseline (evidence: `WAT_V3/shakespeare_long_512_v3.py`)
- V2 Train and Eval → V2 Text Generation: generates samples (evidence: `WAT_V2/shakespeare_long_512_v2.py`)
- V3 Train and Eval → V3 Text Generation: generates samples (evidence: `WAT_V3/shakespeare_long_512_v3.py`)
