# furkankirat/konjin-ai architecture

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

- Interactive diagram: https://gitdiagram.com/furkankirat/konjin-ai
- Repository: https://github.com/furkankirat/konjin-ai

## Overview

konjin-ai is a small PyTorch byte-level GPT learning project with two product workflows: generate C# boilerplate and conduct Turkish chat. Data preparation feeds model training; trained checkpoints are used by interactive applications and boilerplate evaluation. The model, training loop, data pipeline and sampling live in one file, so those responsibilities share its exact path. Edges reflect the README and shown imports/calls; unsampled implementation details are not inferred.

Main entry points: [`src/model/minigpt.py`](https://github.com/furkankirat/konjin-ai/blob/main/src/model/minigpt.py) (Training and sampling), [`src/eval/bp_demo.py`](https://github.com/furkankirat/konjin-ai/blob/main/src/eval/bp_demo.py) (Boilerplate demo), [`src/datagen/gen_boilerplate.py`](https://github.com/furkankirat/konjin-ai/blob/main/src/datagen/gen_boilerplate.py) (C# example generator), [`src/datagen/prep_tr.py`](https://github.com/furkankirat/konjin-ai/blob/main/src/datagen/prep_tr.py) (Turkish data preparation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_bpgen["C&#35; example generator<br/>[gen_boilerplate.py]"]
  node_trprep["Turkish data preparation<br/>[prep_tr.py]"]
end

subgraph group_model["Model and training"]
  node_training["Training and sampling<br/>[minigpt.py]"]
  node_gpt["Byte-level GPT<br/>[minigpt.py]"]
  node_checkpoint["Model checkpoint"]
end

subgraph group_apps["User applications"]
  node_demo["Boilerplate demo<br/>[bp_demo.py]"]
  node_chat["Turkish chat REPL<br/>[tr_chat.py]"]
end

subgraph group_eval["Boilerplate evaluation"]
  node_bpeval["Held-out evaluator<br/>[bp_eval.py]"]
  node_bpcheck["Exact-match scorer<br/>[bp_check.py]"]
end

node_developer(("User"))
node_datasets["Training datasets"]

node_developer -->|"requests data"| node_bpgen
node_bpgen -->|"supplies examples"| node_training
node_developer -->|"prepares corpus"| node_trprep
node_datasets -->|"provides source data"| node_trprep
node_trprep -->|"writes training text"| node_training
node_training -->|"builds and trains"| node_gpt
node_training -->|"saves weights"| node_checkpoint
node_developer -->|"provides class fields"| node_demo
node_demo -->|"builds reference output"| node_bpgen
node_demo -->|"loads and samples"| node_training
node_checkpoint -->|"loads model"| node_demo
node_developer -->|"sends messages"| node_chat
node_chat -->|"loads and samples"| node_training
node_checkpoint -->|"loads model"| node_chat
node_bpeval -->|"loads and samples"| node_training
node_bpcheck -->|"reports exact match"| node_developer

click node_bpgen "https://github.com/furkankirat/konjin-ai/blob/main/src/datagen/gen_boilerplate.py"
click node_trprep "https://github.com/furkankirat/konjin-ai/blob/main/src/datagen/prep_tr.py"
click node_training "https://github.com/furkankirat/konjin-ai/blob/main/src/model/minigpt.py"
click node_gpt "https://github.com/furkankirat/konjin-ai/blob/main/src/model/minigpt.py"
click node_demo "https://github.com/furkankirat/konjin-ai/blob/main/src/eval/bp_demo.py"
click node_chat "https://github.com/furkankirat/konjin-ai/blob/main/src/model/tr_chat.py"
click node_bpeval "https://github.com/furkankirat/konjin-ai/blob/main/src/eval/bp_eval.py"
click node_bpcheck "https://github.com/furkankirat/konjin-ai/blob/main/src/eval/bp_check.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_bpgen,node_trprep,node_developer toneBlue
class node_training,node_gpt,node_checkpoint toneAmber
class node_demo,node_chat toneMint
class node_bpeval,node_bpcheck toneRose
class node_datasets toneIndigo
```

## Components

### Data preparation

- [C# example generator](https://github.com/furkankirat/konjin-ai/blob/main/src/datagen/gen_boilerplate.py): `src/datagen/gen_boilerplate.py`
- [Turkish data preparation](https://github.com/furkankirat/konjin-ai/blob/main/src/datagen/prep_tr.py): `src/datagen/prep_tr.py`

### Model and training

- [Training and sampling](https://github.com/furkankirat/konjin-ai/blob/main/src/model/minigpt.py): `src/model/minigpt.py`
- [Byte-level GPT](https://github.com/furkankirat/konjin-ai/blob/main/src/model/minigpt.py): `src/model/minigpt.py`
- **Model checkpoint**

### User applications

- [Boilerplate demo](https://github.com/furkankirat/konjin-ai/blob/main/src/eval/bp_demo.py): `src/eval/bp_demo.py`
- [Turkish chat REPL](https://github.com/furkankirat/konjin-ai/blob/main/src/model/tr_chat.py): `src/model/tr_chat.py`

### Boilerplate evaluation

- [Held-out evaluator](https://github.com/furkankirat/konjin-ai/blob/main/src/eval/bp_eval.py): `src/eval/bp_eval.py`
- [Exact-match scorer](https://github.com/furkankirat/konjin-ai/blob/main/src/eval/bp_check.py): `src/eval/bp_check.py`

### Other components

- **User**
- **Training datasets**

## Connections

- User → C# example generator: requests data (evidence: `README.md`)
- C# example generator → Training and sampling: supplies examples (evidence: `README.md`)
- User → Turkish data preparation: prepares corpus (evidence: `README.md`)
- Training datasets → Turkish data preparation: provides source data (evidence: `src/datagen/prep_tr.py`)
- Turkish data preparation → Training and sampling: writes training text (evidence: `README.md`)
- Training and sampling → Byte-level GPT: builds and trains (evidence: `src/model/minigpt.py`)
- Training and sampling → Model checkpoint: saves weights (evidence: `README.md`)
- User → Boilerplate demo: provides class fields (evidence: `src/eval/bp_demo.py`)
- Boilerplate demo → C# example generator: builds reference output (evidence: `src/eval/bp_demo.py`)
- Boilerplate demo → Training and sampling: loads and samples (evidence: `src/eval/bp_demo.py`)
- Model checkpoint → Boilerplate demo: loads model (evidence: `README.md`)
- User → Turkish chat REPL: sends messages (evidence: `src/model/tr_chat.py`)
- Turkish chat REPL → Training and sampling: loads and samples (evidence: `src/model/tr_chat.py`)
- Model checkpoint → Turkish chat REPL: loads model (evidence: `README.md`)
- Held-out evaluator → Training and sampling: loads and samples (evidence: `src/eval/bp_eval.py`)
- Exact-match scorer → User: reports exact match (evidence: `src/eval/bp_check.py`)
