# shunzh/llm.ipynb architecture

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

- Interactive diagram: https://gitdiagram.com/shunzh/llm.ipynb
- Repository: https://github.com/shunzh/llm.ipynb

## Overview

This repository is a small collection of educational deep-learning notebooks, not a packaged application. Its documented capabilities are a decoder-only Transformer notebook covering architecture, training, and generation, an AdamW comparison on toy regression, and a separate KV-cache notebook. The README supports user-to-notebook relationships, but no source excerpts were provided, so internal calls or data flow are not asserted.

Main entry points: [`llm.ipynb`](https://github.com/shunzh/llm.ipynb/blob/main/llm.ipynb) (Transformer workflow), [`llm_with_kv_cache.ipynb`](https://github.com/shunzh/llm.ipynb/blob/main/llm_with_kv_cache.ipynb) (KV-cache Transformer), [`adamw.ipynb`](https://github.com/shunzh/llm.ipynb/blob/main/adamw.ipynb) (AdamW comparison)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_language["Language modeling"]
  node_llm["Transformer workflow<br/>[llm.ipynb]"]
  node_kv["KV-cache Transformer"]
end

subgraph group_optimization["Optimizer study"]
  node_adamw["AdamW comparison<br/>[adamw.ipynb]"]
end

node_user(("Notebook user"))

node_user -->|"runs"| node_llm
node_user -->|"runs"| node_adamw
node_user -.->|"runs"| node_kv

click node_llm "https://github.com/shunzh/llm.ipynb/blob/main/llm.ipynb"
click node_kv "https://github.com/shunzh/llm.ipynb/blob/main/llm_with_kv_cache.ipynb"
click node_adamw "https://github.com/shunzh/llm.ipynb/blob/main/adamw.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_llm,node_kv,node_user toneBlue
class node_adamw toneAmber
```

## Components

### Language modeling

- [Transformer workflow](https://github.com/shunzh/llm.ipynb/blob/main/llm.ipynb): `llm.ipynb`
- [KV-cache Transformer](https://github.com/shunzh/llm.ipynb/blob/main/llm_with_kv_cache.ipynb): `llm_with_kv_cache.ipynb`

### Optimizer study

- [AdamW comparison](https://github.com/shunzh/llm.ipynb/blob/main/adamw.ipynb): `adamw.ipynb`

### Other components

- **Notebook user**

## Connections

- Notebook user → Transformer workflow: runs (evidence: `README.md`)
- Notebook user → AdamW comparison: runs (evidence: `README.md`)
- Notebook user → KV-cache Transformer: runs
