Downloads · 30 days
5
21% of all-time downloads
bickett/zeptogpt-abc-318p
zeptogpt-abc-318p is a machine learning model from bickett. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
A tiny GPT‑style transformer that learns the Python‑like sorted() behavior on {a,b,c} — autoregressively — in ~318 trainable parameters.
Downloads · 30 days
5
21% of all-time downloads
All-time downloads
24
Public
Parameters
367
2.6 KB on disk
Likes
0
Public
Click a slice to open those files.
.ipynb26 KB · 70%
From the Hugging Face model README
A tiny GPT‑style transformer that learns the Python‑like sorted() behavior on {a,b,c} — autoregressively — in ~318 trainable parameters.
{a,b,c} (duplicates allowed), e.g. caa → aac[x1, x2, x3, <sep>, y1, y2, y3]<sep> is forbidden after the separator{a,b,c} with duplicatesArchitecturally, this is a decoder‑only Transformer trained with a causal next‑token objective and used autoregressively at inference. It’s “GPT‑style” rather than a pretrained language model (the “P” in GPT).
At inference we start from [x1, x2, x3, <sep>] and generate one token at a time:
start [c, a, a, <sep>] (heads=2, head_dim=3) step1: p(a)=0.999, p(b)=0.000, p(c)=0.000 -> 'a' step2: p(a)=0.998, p(b)=0.000, p(c)=0.002 -> 'a' step3: p(a)=0.000, p(b)=0.000, p(c)=1.000 -> 'c' full [c, a, a, <sep>, a, a, c] -> outputs [a, a, c]
Each step shows the next‑token distribution and the greedy choice. The printed attention rows per head show how the last position attends to the inputs and previous outputs (useful to see “counting” behavior emerge).
4 × 6 = 247 × 6 = 42 (toggle off to save 42 params)4 × (6 × 6) = 1446 × 6 + 6 × 6 = 723 × (2 × 6) = 360Total: 318 (or 276 without positional embeddings)
Colab (one click): https://colab.research.google.com/github/joshbickett/zeptoGPT/blob/main/notebook.ipynb
Local
python micro_abc_sorter_e6.py
The script trains, evaluates on all 27 triples, prints AR traces, and exposes a simple text box (in notebooks) to try your own inputs.
| Variant | Params | Notes |
|---|---|---|
| E=6, H=2, MLP×1, pos=ON | 318 | Default. Robust 27/27. |
| E=6, H=2, MLP×1, pos=OFF | 276 | Usually 27/27; may need more steps. |
| E=4, H=2, MLP×1, pos=OFF | 136 | Finicky; can fail on duplicates. |
| E=8, H=2, MLP×2, pos=ON | 648 | Very reliable, converges fast. |
MIT (or your choice)