Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
6c11ac2
chore: initial project setup
555aaditya Aug 1, 2026
201e0c2
docs: align the TDD with the RoPE/RMSNorm/GQA/SwiGLU stack and add TD…
555aaditya Aug 1, 2026
3a8eb19
build: raise the Python floor to 3.12 across runtime, ruff, mypy and CI
555aaditya Aug 1, 2026
eabc693
feat: add memory-mapped, streaming and synthetic token datasets
555aaditya Aug 1, 2026
6d93b33
feat: add grouped-query causal attention with RoPE and a KV cache
555aaditya Aug 1, 2026
1e010bd
feat: add device resolution and YAML-typed CLI config overrides
555aaditya Aug 1, 2026
a2fa71b
test: cover the tokenizer, dataset and attention seams
555aaditya Aug 1, 2026
655b3b5
ci: test on Python 3.12-3.14 and smoke the dataset and attention path
555aaditya Aug 1, 2026
a7b70d5
docs: rewrite the README with architecture and infrastructure diagrams
555aaditya Aug 1, 2026
d8ada22
fix: correct the dataset source enum comment and add the path/tie_wei…
555aaditya Aug 1, 2026
601dac6
feat: add RMSNorm, SwiGLU, pre-norm blocks and the CausalLM head
555aaditya Aug 1, 2026
36ca046
feat: add a hand-written AdamW and a cosine schedule with linear warmup
555aaditya Aug 1, 2026
5f60fc7
feat: add the training loop with AMP, gradient accumulation and check…
555aaditya Aug 1, 2026
b9660ae
feat: add temperature, top-k and top-p sampling with cached generation
555aaditya Aug 1, 2026
6974fd2
feat: run a real training loop from the CLI entry point
555aaditya Aug 1, 2026
76de9df
test: verify the full pipeline learns real text end to end
555aaditya Aug 1, 2026
2340010
docs: record stages 3-5 as implemented and pin the caller-owned cache…
555aaditya Aug 1, 2026
89c86e0
style: apply ruff formatting
555aaditya Aug 1, 2026
41f16ce
feat: add int8/int4 weight quantization and a preallocated KV arena
555aaditya Aug 1, 2026
c7dba32
feat: add the benchmark harness with a reproducible deterministic bas…
555aaditya Aug 1, 2026
9409479
docs: record stages 6-7 as implemented and publish measured benchmark…
555aaditya Aug 1, 2026
1b0d834
fix: interpolate benchmark percentiles and report p50/p90/p95/p99
555aaditya Aug 1, 2026
06aec47
perf: pre-tokenize before BPE merges, caching pieces (encode 2.9 KB/s…
555aaditya Aug 1, 2026
d6dae24
perf: recompute scores in the tiled attention backward so O(T) memory…
555aaditya Aug 1, 2026
4598c43
docs: record TDR-020 pre-tokenization and TDR-021 recomputing backward
555aaditya Aug 1, 2026
a1244ad
feat: add corpus download and content-hashed document-level train/val…
555aaditya Aug 1, 2026
c2db42e
feat: add held-out validation loss and perplexity to the trainer
555aaditya Aug 1, 2026
bdb7a53
feat: add batched generation with left padding and per-row completion
555aaditya Aug 1, 2026
b83ee59
test: cover document splitting, validation perplexity and batched gen…
555aaditya Aug 1, 2026
9406785
feat: add email and chat message document preparation with cleaning a…
555aaditya Aug 1, 2026
88fd8ef
feat: add a corpus preparation CLI and a runnable TinyShakespeare config
555aaditya Aug 1, 2026
f3c17dd
feat: report held-out validation perplexity during training runs
555aaditya Aug 1, 2026
a06a90c
docs: document the real-data pipeline, message prep and the recomputi…
555aaditya Aug 1, 2026
9e16a77
fix: accept a string out_dir and fail clearly when a split cannot fil…
555aaditya Aug 1, 2026
6ca09bb
feat: track best validation loss, save best.pt on improvement, and su…
555aaditya Aug 1, 2026
b42d580
feat: add a showcase CLI printing architecture, memory, latency and l…
555aaditya Aug 1, 2026
4a0ce41
feat: measure held-out perplexity live and report cache speedup acros…
555aaditya Aug 1, 2026
0addd15
feat: add an --evidence block proving kernel equivalence, tiled memor…
555aaditya Aug 1, 2026
522238b
fix: mask padded keys so ragged batched generation matches single-str…
555aaditya Aug 1, 2026
3d584a4
docs: update contracts and test counts for the key-padding mask
555aaditya Aug 1, 2026
9d096cb
ci: bound the training smoke step, run on all branches, and quote the…
555aaditya Aug 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 110 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: CI


on:
# PRs into main are the merge gate (TDR-014). Pushes to any branch also run,
# so breakage on Linux or an older Python is found while the work is in
# progress rather than at PR time -- this workflow sat unexecuted for its
# whole life because nothing had been pushed to main or opened as a PR.
push:
branches: ["**"]
pull_request:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

env:
# Floor is 3.12 (see the comment on requires-python in pyproject.toml).
PYTHON_VERSION: "3.12"

jobs:
lint:
name: Lint (ruff)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install ruff
run: pip install ruff
- name: Ruff check
run: ruff check .
- name: Ruff format (check only)
run: ruff format --check .

typecheck:
name: Type check (mypy)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: pip
- name: Install package + type stubs
run: pip install -e ".[dev]"
- name: mypy
run: mypy tokenizer dataset model attention training inference optimization benchmark

test:
name: Tests (pytest, py${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# 3.14 is the version this project is developed on; 3.12 is the floor.
python-version: ["3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install package
run: pip install -e ".[dev]"
- name: Run tests with coverage
run: pytest --cov=tokenizer --cov=dataset --cov=model --cov=attention --cov=training --cov=inference --cov=optimization --cov=benchmark --cov-report=term-missing

import-smoke:
name: Import smoke
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: pip
- name: Install package
run: pip install -e .
- name: Modules import cleanly
run: |
python -c "import tokenizer, dataset, model, attention, training, inference, optimization, benchmark; print('all modules import OK')"
python -c "from tokenizer import BPE; t=BPE(vocab_size=256); ids=t.encode('hello'); assert t.decode(ids)=='hello'; print('tokenizer smoke OK')"
python -c "
import torch
from attention import CausalAttention
from dataset import DataEngine
e = DataEngine.from_config({'dataset': {'source': 'synthetic', 'seq_len': 16, 'batch_size': 2}}, vocab_size=64)
b = e.next_batch()
assert b['input_ids'].shape == (2, 16)
a = CausalAttention(d_model=32, n_heads=4, n_kv_heads=2, max_seq_len=64).eval()
out, cache = a(torch.randn(2, 16, 32), use_cache=True)
assert out.shape == (2, 16, 32) and len(cache) == 16
print('dataset + attention smoke OK')
"
- name: Training entry point runs
# Bounded deliberately. This step is a wiring check, not a training run:
# the shipped config is 2000 steps of a 32.5M model, which on a CPU
# runner is ~1.8 minutes and writes ~1.8 GB of checkpoints.
run: |
python -m training.train --config configs/default.yaml \
dataset.batch_size=2 dataset.seq_len=32 \
training.steps=5 training.warmup_steps=1 \
training.ckpt_every=0 training.log_every=1 \
training.out_dir="${RUNNER_TEMP:-/tmp}/ci-checkpoints"
125 changes: 125 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# ---------------------------------------------------------------------------
# Python
# ---------------------------------------------------------------------------
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# ---------------------------------------------------------------------------
# Testing / Linting / Type-checking caches
# ---------------------------------------------------------------------------
.mypy_cache/
.pytest_cache/
.ruff_cache/
.coverage
.coverage.*
htmlcov/
.tox/
.nox/
.hypothesis/
nosetests.xml
coverage.xml

# ---------------------------------------------------------------------------
# Virtual environments / package managers
# ---------------------------------------------------------------------------
.venv/
venv/
env/
ENV/
env.bak/
venv.bak/
.conda/
.python-version
poetry.lock.persona
uv.lock.persona

# ---------------------------------------------------------------------------
# Model checkpoints / training artifacts (large binaries, never commit)
# ---------------------------------------------------------------------------
checkpoints/*
!checkpoints/.gitkeep
runs/
logs/
wandb/
*.pt
*.pth
*.ckpt
*.safetensors
*.bin
*.onnx

# ---------------------------------------------------------------------------
# Data files / datasets (large, regenerable, or licensed)
# ---------------------------------------------------------------------------
dataset/data/
data/
*.npy
*.npz
*.memmap
*.h5
*.hdf5
*.parquet
*.arrow

# ---------------------------------------------------------------------------
# Raw / source text dumps
# ---------------------------------------------------------------------------
arxiv.txt

# ---------------------------------------------------------------------------
# Secrets & environment files (NEVER commit API keys / tokens)
# ---------------------------------------------------------------------------
.env
.env.*
*.env
.env.local
.env.production
secrets/
credentials/
*.pem
*.key
*.p12
config/api_keys*.yaml

# ---------------------------------------------------------------------------
# OS / editor / editor-config files
# ---------------------------------------------------------------------------
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes/
ehthumbs.db
Thumbs.db
.idea/
.vscode/
*.swp
*.swo
*~
*.orig
*.rej
.vscode/

# ---------------------------------------------------------------------------
# Notebooks / scratch experiments (work-in-progress, not part of the package)
# ---------------------------------------------------------------------------
test_agent.py
Loading
Loading