Compare commits

..
7 Commits
Author SHA1 Message Date
jzzliu bd349c6193 Add byte-level BPE tokenizer trained from scratch
Lossless on any string (256-byte base vocab), regex pre-tokenization so merges never
cross word boundaries, incremental pair-count training with deterministic tie-breaks,
special tokens, and JSON persistence. The trainer gains --tokenizer bpe and reports
bits/byte so tokenizers are comparable; old character checkpoints still load.

Tests check the incremental trainer against a naive reference, round-trips on random
unicode, and merge-priority semantics; mutation checks confirmed they fail on broken code.
2026-11-07 20:48:09 -07:00
jzzliu 046b09c88f Add speculative decoding with exact-distribution tests; expand README
Draft proposes gamma tokens, target verifies them in one pass using rejection sampling
with residual resampling, and both KV caches roll back to the accepted prefix. Tests
check greedy equivalence and compare sampled output against the brute-force target
distribution; mutation checks confirm the test fails on deliberately broken variants.
2026-11-07 20:33:28 -07:00
jzzliu 73ff04d77f Add continuous-batching engine with variable-length KV cache
Requests of different lengths share one left-padded cache with explicit per-row RoPE
positions and a key mask. Requests join mid-flight and leave on EOS/length, and unused
padding columns are trimmed. Greedy output is verified identical to solo generation.
2026-11-07 20:27:21 -07:00
jzzliu 7f194aba23 Add grouped-query attention with parity tests against multi-head
GQA/MQA via GPTConfig.n_kv_head; the cache stores only the KV heads. Attention
also accepts per-row positions and a key padding mask, used by batched decoding.
2026-11-07 20:25:52 -07:00
jzzliu 3657ef88a8 README: correct model line count 2026-11-07 20:19:18 -07:00
jzzliu 6b7927c16c Add microgpt: from-scratch GPT with RoPE, KV cache, sampling, tests and benchmark 2026-11-07 20:19:10 -07:00
jzzliu 5c1eb15b0a Initial commit 2026-11-08 02:55:44 +00:00

Diff Content Not Available