# celiktepesahin/chatgpt-from-scratch-tr architecture

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

- Interactive diagram: https://gitdiagram.com/celiktepesahin/chatgpt-from-scratch-tr
- Repository: https://github.com/celiktepesahin/chatgpt-from-scratch-tr

## Overview

This repository is a Turkish-language course, delivered as one notebook, that guides a learner from tokenizer and tensor concepts through GPT-2 construction, training, and fine-tuning. The README documents the major stages and data sources, but no notebook source was sampled, so the graph reflects documented course flow and capabilities rather than verified internal calls.

Main entry points: [`FULL-SERIES.ipynb`](https://github.com/celiktepesahin/chatgpt-from-scratch-tr/blob/main/FULL-SERIES.ipynb) (Weight handling), [`_data/instruction-data.json`](https://github.com/celiktepesahin/chatgpt-from-scratch-tr/blob/main/_data/instruction-data.json) (Instruction dataset), [`_data/how-words-work.txt`](https://github.com/celiktepesahin/chatgpt-from-scratch-tr/blob/main/_data/how-words-work.txt) (Pretraining corpus)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_course["Course and data"]
  node_notebook["Course notebook<br/>[FULL-SERIES.ipynb]"]
  node_pretraining_data["Pretraining corpus<br/>[how-words-work.txt]"]
  node_instruction_data["Instruction dataset"]
end

subgraph group_model["Model construction"]
  node_tokenizer["BPE tokenizer<br/>[FULL-SERIES.ipynb]"]
  node_data_pipeline["Tensor pipeline<br/>[FULL-SERIES.ipynb]"]
  node_attention["Attention<br/>[FULL-SERIES.ipynb]"]
  node_multihead["Causal multi-head<br/>[FULL-SERIES.ipynb]"]
  node_layers["Network layers<br/>[FULL-SERIES.ipynb]"]
  node_transformer["GPT-2 blocks<br/>[FULL-SERIES.ipynb]"]
end

subgraph group_training["Training and generation"]
  node_pretraining["Pretraining loop<br/>[FULL-SERIES.ipynb]"]
  node_weights["Weight handling<br/>[FULL-SERIES.ipynb]"]
  node_generation["Text generation<br/>[FULL-SERIES.ipynb]"]
end

subgraph group_finetuning["Fine-tuning"]
  node_classifier["Topic classifier<br/>[FULL-SERIES.ipynb]"]
  node_instruction_tuning["Instruction tuning<br/>[FULL-SERIES.ipynb]"]
  node_assistant["Assistant evaluation<br/>[FULL-SERIES.ipynb]"]
end

node_learner(("Learner"))

node_learner -->|"runs lessons"| node_notebook
node_notebook -->|"searches for data"| node_pretraining_data
node_notebook -->|"uses for tuning"| node_instruction_data
node_tokenizer -->|"prepares tokens"| node_data_pipeline
node_data_pipeline -.->|"feeds examples"| node_attention
node_attention -->|"extends to"| node_multihead
node_multihead -.->|"combines with"| node_layers
node_layers -->|"forms blocks"| node_transformer
node_transformer -->|"trains model"| node_pretraining
node_pretraining -->|"saves weights"| node_weights
node_weights -->|"supports sampling"| node_generation
node_weights -->|"fine-tunes for classification"| node_classifier
node_instruction_data -->|"supplies examples"| node_instruction_tuning
node_weights -->|"fine-tunes for instructions"| node_instruction_tuning
node_instruction_tuning -->|"evaluates answers"| node_assistant

click node_notebook "https://github.com/celiktepesahin/chatgpt-from-scratch-tr/blob/main/FULL-SERIES.ipynb"
click node_pretraining_data "https://github.com/celiktepesahin/chatgpt-from-scratch-tr/blob/main/_data/how-words-work.txt"
click node_instruction_data "https://github.com/celiktepesahin/chatgpt-from-scratch-tr/blob/main/_data/instruction-data.json"
click node_tokenizer "https://github.com/celiktepesahin/chatgpt-from-scratch-tr/blob/main/FULL-SERIES.ipynb"
click node_data_pipeline "https://github.com/celiktepesahin/chatgpt-from-scratch-tr/blob/main/FULL-SERIES.ipynb"
click node_attention "https://github.com/celiktepesahin/chatgpt-from-scratch-tr/blob/main/FULL-SERIES.ipynb"
click node_multihead "https://github.com/celiktepesahin/chatgpt-from-scratch-tr/blob/main/FULL-SERIES.ipynb"
click node_layers "https://github.com/celiktepesahin/chatgpt-from-scratch-tr/blob/main/FULL-SERIES.ipynb"
click node_transformer "https://github.com/celiktepesahin/chatgpt-from-scratch-tr/blob/main/FULL-SERIES.ipynb"
click node_pretraining "https://github.com/celiktepesahin/chatgpt-from-scratch-tr/blob/main/FULL-SERIES.ipynb"
click node_weights "https://github.com/celiktepesahin/chatgpt-from-scratch-tr/blob/main/FULL-SERIES.ipynb"
click node_generation "https://github.com/celiktepesahin/chatgpt-from-scratch-tr/blob/main/FULL-SERIES.ipynb"
click node_classifier "https://github.com/celiktepesahin/chatgpt-from-scratch-tr/blob/main/FULL-SERIES.ipynb"
click node_instruction_tuning "https://github.com/celiktepesahin/chatgpt-from-scratch-tr/blob/main/FULL-SERIES.ipynb"
click node_assistant "https://github.com/celiktepesahin/chatgpt-from-scratch-tr/blob/main/FULL-SERIES.ipynb"

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_notebook,node_pretraining_data,node_instruction_data toneBlue
class node_tokenizer,node_data_pipeline,node_attention,node_multihead,node_layers,node_transformer toneAmber
class node_pretraining,node_weights,node_generation toneMint
class node_classifier,node_instruction_tuning,node_assistant toneRose
class node_learner toneIndigo
```

## Components

### Course and data

- [Course notebook](https://github.com/celiktepesahin/chatgpt-from-scratch-tr/blob/main/FULL-SERIES.ipynb): `FULL-SERIES.ipynb`
- [Pretraining corpus](https://github.com/celiktepesahin/chatgpt-from-scratch-tr/blob/main/_data/how-words-work.txt): `_data/how-words-work.txt`
- [Instruction dataset](https://github.com/celiktepesahin/chatgpt-from-scratch-tr/blob/main/_data/instruction-data.json): `_data/instruction-data.json`

### Model construction

- [BPE tokenizer](https://github.com/celiktepesahin/chatgpt-from-scratch-tr/blob/main/FULL-SERIES.ipynb): `FULL-SERIES.ipynb`
- [Tensor pipeline](https://github.com/celiktepesahin/chatgpt-from-scratch-tr/blob/main/FULL-SERIES.ipynb): `FULL-SERIES.ipynb`
- [Attention](https://github.com/celiktepesahin/chatgpt-from-scratch-tr/blob/main/FULL-SERIES.ipynb): `FULL-SERIES.ipynb`
- [Causal multi-head](https://github.com/celiktepesahin/chatgpt-from-scratch-tr/blob/main/FULL-SERIES.ipynb): `FULL-SERIES.ipynb`
- [Network layers](https://github.com/celiktepesahin/chatgpt-from-scratch-tr/blob/main/FULL-SERIES.ipynb): `FULL-SERIES.ipynb`
- [GPT-2 blocks](https://github.com/celiktepesahin/chatgpt-from-scratch-tr/blob/main/FULL-SERIES.ipynb): `FULL-SERIES.ipynb`

### Training and generation

- [Pretraining loop](https://github.com/celiktepesahin/chatgpt-from-scratch-tr/blob/main/FULL-SERIES.ipynb): `FULL-SERIES.ipynb`
- [Weight handling](https://github.com/celiktepesahin/chatgpt-from-scratch-tr/blob/main/FULL-SERIES.ipynb): `FULL-SERIES.ipynb`
- [Text generation](https://github.com/celiktepesahin/chatgpt-from-scratch-tr/blob/main/FULL-SERIES.ipynb): `FULL-SERIES.ipynb`

### Fine-tuning

- [Topic classifier](https://github.com/celiktepesahin/chatgpt-from-scratch-tr/blob/main/FULL-SERIES.ipynb): `FULL-SERIES.ipynb`
- [Instruction tuning](https://github.com/celiktepesahin/chatgpt-from-scratch-tr/blob/main/FULL-SERIES.ipynb): `FULL-SERIES.ipynb`
- [Assistant evaluation](https://github.com/celiktepesahin/chatgpt-from-scratch-tr/blob/main/FULL-SERIES.ipynb): `FULL-SERIES.ipynb`

### Other components

- **Learner**

## Connections

- Learner → Course notebook: runs lessons (evidence: `README.md`)
- Course notebook → Pretraining corpus: searches for data (evidence: `README.md`)
- Course notebook → Instruction dataset: uses for tuning (evidence: `README.md`)
- BPE tokenizer → Tensor pipeline: prepares tokens (evidence: `README.md`)
- Tensor pipeline → Attention: feeds examples
- Attention → Causal multi-head: extends to (evidence: `README.md`)
- Causal multi-head → Network layers: combines with
- Network layers → GPT-2 blocks: forms blocks (evidence: `README.md`)
- GPT-2 blocks → Pretraining loop: trains model (evidence: `README.md`)
- Pretraining loop → Weight handling: saves weights (evidence: `README.md`)
- Weight handling → Text generation: supports sampling (evidence: `README.md`)
- Weight handling → Topic classifier: fine-tunes for classification (evidence: `README.md`)
- Instruction dataset → Instruction tuning: supplies examples (evidence: `README.md`)
- Weight handling → Instruction tuning: fine-tunes for instructions (evidence: `README.md`)
- Instruction tuning → Assistant evaluation: evaluates answers (evidence: `README.md`)
