ChromaGPT — Baseline Tiny Color Transformer (d16_l2_h4)
ChromaGPT is a microscope for transformers, not a gradient-generation product.
A tiny 10,816-parameter GPT-2-style causal decoder-only Transformer trained from scratch in PyTorch to predict sequences of discrete color tokens (0..255) generated from geometric trajectories (linear, curved Bézier, and cyclic) through color space.
The model receives only opaque integer token IDs (0..255)—never RGB or OKLab coordinates—so we can study how embeddings, causal attention, Q/K/V activations, and residual-stream layers develop color geometry and contextual representations.
Exported to native Hugging Face GPT2LMHeadModel (model.safetensors, config.json) + 256-token #RRGGBB PreTrainedTokenizerFast (tokenizer.json, tokenizer_config.json) with verified numerical logit parity (max_abs_logit_diff = 4.77e-06), alongside the original PyTorch checkpoint (best_checkpoint.pt), training embedding snapshots (embedding_snapshots.pt), and fixed 256-color OKLab palette (palette_256_oklab_256_v1.json).
Provenance
- Source Repository:
sriramrathinavelu/ChromaGPT - Git Commit SHA:
3959108d73f5291558983823c53de2d5d3bc696d - Notebook:
notebooks/02_training.ipynb - Weights & Biases Run: https://wandb.ai/chillyskywalker/chromagpt/runs/4cif8pf3
- Palette Version / SHA-256:
oklab_256_v1/d230c189d9a021cb482d7ed749a0981aa9934511ced10bd07a1c31b9f1d5f29b - Dataset Version / SHA-256:
trajectories_v1(10,000 train / 1,000 val / 1,000 test, trajectory-disjoint, zero prefix overlap) /fd09fbadcb42f9aed770751da0c6cfa00d9125738c30cd4dd8d4657410d82ea4 - Seed:
42 - Training Hardware:
Tesla T4
Model Architecture & Tokenizer
- From-Scratch Class:
chromagpt.model.ChromaGPT(Pre-LN causal decoder, exact GELU, tied token/LM-head embeddings) - Hugging Face Format: Native
GPT2LMHeadModel(config.json,model.safetensors,generation_config.json) +PreTrainedTokenizerFast(tokenizer.json,tokenizer_config.json) - Tokenizer: 256-token
WordLevelhex vocabulary (#RRGGBB, case-insensitive, whitespace-separated,len == 256) backed bypalette_256_oklab_256_v1.jsonfor continuous OKLab quantization - Parameters:
10,816unique trainable parameters - Config:
vocab_size=256,context_length=8,d_model=16,n_layers=2,n_heads=4,d_ff=64,tie_weights=True
Evaluation Metrics (Held-Out Test Split, N=1,000)
| Metric | ChromaGPT (d16_l2_h4) | 3-pt RGB Linear Extrap (uses RGB) | Last-Token Empirical $P(x_8 \mid x_7)$ |
|---|---|---|---|
| Best Epoch | 59 | — | — |
| Val Loss / Perplexity | 2.2508 / 9.50 | — | — |
| Test Loss / Perplexity | 2.2931 / 9.91 | — | — |
| Test Next-Color Top-1 Accuracy | 0.318 | 0.290 | 0.200 |
| Test Next-Color Top-5 Accuracy | 0.798 | 0.709 | 0.580 |
| Test RGB L2 Error | 0.1286 | 0.1414 | 0.1711 |
| Test Perceptual OKLab $\Delta E$ | 0.0529 | 0.0586 | 0.0752 |
Per-Family Held-Out Test Breakdown
| Trajectory Family | Top-1 Acc | Top-5 Acc | RGB L2 Error | OKLab $\Delta E$ |
|---|---|---|---|---|
linear | 0.386 | 0.886 | 0.1100 | 0.0449 |
curved | 0.294 | 0.835 | 0.1262 | 0.0520 |
cyclic | 0.273 | 0.673 | 0.1496 | 0.0618 |

Included Files
config.json,model.safetensors,generation_config.json— Native Hugging FaceGPT2LMHeadModelweightstokenizer.json,tokenizer_config.json— Native Hugging FacePreTrainedTokenizerFast(256-token#RRGGBBhex vocabulary)best_checkpoint.pt— Original PyTorchChromaGPTcheckpoint for instrumentedmodel.inspect()microscope analysisembedding_snapshots.pt— Token embedding matrices saved across training epochs (0, 1, 3, 5, 10, 20, 40, 59, 60)palette_256_oklab_256_v1.json— Deterministic 256-color OKLab vocabulary (token_id <-> RGB/OKLab/hex)palette_swatch_grid.png,training_curves.png,run_metadata.json,training_history.json— Palette reference, curves, and full provenance
Usage (Zero Custom Dependencies)
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
repo_id = "purplejedi/chromagpt-baseline-d16-l2"
tokenizer = AutoTokenizer.from_pretrained(repo_id)
model = AutoModelForCausalLM.from_pretrained(repo_id).eval()
# Any 8 space-separated hex colors from the 256-color vocabulary below (case-insensitive)
prompt = "#000000 #1F0B0B #0A1708 #261826 #392D1E #4F453E #5F5F55 #7E6D7D"
inputs = tokenizer(prompt, return_tensors="pt")
with torch.no_grad():
logits = model(input_ids=inputs["input_ids"]).logits[:, -1, :]
probs = torch.softmax(logits, dim=-1)[0]
top5 = torch.topk(probs, k=5)
for tok_id, prob in zip(top5.indices.tolist(), top5.values.tolist()):
print(f"token {tok_id:3d} ({tokenizer.decode([tok_id])}): p={prob:.4f}")
Complete 256-Color Vocabulary (0..255)
Each token ID (0..255) corresponds to one fixed sRGB color selected via deterministic farthest-point initialization + Lloyd's k-means relaxation in perceptual OKLab space (oklab_256_v1, SHA-256 d230c189d9a021cb...).
- The included
AutoTokenizer(tokenizer.json) maps space-separated#RRGGBBhex tokens from this table (case-insensitive) 1-to-1 to token IDs0..255. - To quantize arbitrary continuous
(R, G, B)coordinates to the nearest vocabulary color in OKLab space, usepalette_256_oklab_256_v1.json(orchromagpt.palette.ColorPalette.quantize).

| ID · Hex (1) | ID · Hex (2) | ID · Hex (3) | ID · Hex (4) | ID · Hex (5) | ID · Hex (6) | ID · Hex (7) | ID · Hex (8) |
|---|---|---|---|---|---|---|---|
000 #000000 | 001 #1F0B0B | 002 #0A1708 | 003 #261826 | 004 #392D1E | 005 #4F453E | 006 #5F5F55 | 007 #7E6D7D |
008 #898871 | 009 #A2A095 | 010 #C0C0B6 | 011 #CCD9D4 | 012 #ECE0F1 | 013 #EFF9ED | 014 #520F18 | 015 #78133E |
016 #9E2137 | 017 #BE194B | 018 #994E65 | 019 #C34061 | 020 #E2206C | 021 #BA6564 | 022 #F9255A | 023 #EB5363 |
024 #D17288 | 025 #F67492 | 026 #F3979E | 027 #130000 | 028 #3A0F0D | 029 #6C1116 | 030 #73321D | 031 #8C1719 |
032 #7E4A48 | 033 #B11619 | 034 #98421C | 035 #B7412D | 036 #CD1E1C | 037 #976151 | 038 #E11D36 | 039 #DA4325 |
040 #F92E23 | 041 #D86430 | 042 #F76728 | 043 #D38473 | 044 #F76E63 | 045 #552B13 | 046 #72481C | 047 #B45F23 |
048 #B2815E | 049 #D8842D | 050 #CE9F8A | 051 #F58C44 | 052 #F2AA86 | 053 #F2CCB1 | 054 #8A6123 | 055 #B57924 |
056 #C99E4D | 057 #D8AB2E | 058 #F7A938 | 059 #F1C470 | 060 #494818 | 061 #5F6021 | 062 #807550 | 063 #8F7F27 |
064 #AC922C | 065 #ABAD2E | 066 #C3B982 | 067 #CFC63A | 068 #F3CF32 | 069 #F2E08A | 070 #E9EA46 | 071 #EBEBC6 |
072 #F3FB4A | 073 #657929 | 074 #6A9039 | 075 #81A02B | 076 #91A167 | 077 #78BA2E | 078 #8DB974 | 079 #A3C646 |
080 #80D331 | 081 #B6E033 | 082 #CAD59C | 083 #CCE174 | 084 #91F93D | 085 #C6FA3F | 086 #E8FAA4 | 087 #182513 |
088 #173313 | 089 #1C4719 | 090 #235B28 | 091 #266D1F | 092 #2E7F23 | 093 #2B9225 | 094 #2D9E63 | 095 #3EA428 |
096 #45B05E | 097 #32B928 | 098 #42C769 | 099 #36D22D | 100 #40DF74 | 101 #93D09D | 102 #4FE637 | 103 #91E07E |
104 #41F933 | 105 #47F87F | 106 #A6F0BB | 107 #A3FA8D | 108 #2C6D57 | 109 #2A875D | 110 #5E8171 | 111 #6E9E86 |
112 #37AD8D | 113 #3AC597 | 114 #85B8A1 | 115 #3FDEA2 | 116 #48EBCF | 117 #4CF9B4 | 118 #BDFCE2 | 119 #215353 |
120 #2E9390 | 121 #3AB8BD | 122 #41D2C8 | 123 #8FD5D4 | 124 #49EAF5 | 125 #A4EDF2 | 126 #59FDE9 | 127 #1C3B3E |
128 #297A83 | 129 #4EA2AF | 130 #34BCE8 | 131 #8BB9C9 | 132 #3FD2F0 | 133 #1B4567 | 134 #235F7E | 135 #2F75A5 |
136 #2E87B9 | 137 #2D9ECA | 138 #32ABF5 | 139 #6EACE1 | 140 #81C8F5 | 141 #000019 | 142 #071122 | 143 #060643 |
144 #14223E | 145 #0E1C5B | 146 #0D0C74 | 147 #25315A | 148 #121299 | 149 #1A2E7F | 150 #1314BD | 151 #1835A8 |
152 #254682 | 153 #2E49A7 | 154 #161BEC | 155 #2144CD | 156 #2C60A5 | 157 #2143F4 | 158 #3356CC | 159 #546583 |
160 #2A6CCC | 161 #2C60F3 | 162 #2C7AF0 | 163 #71809F | 164 #6B90C8 | 165 #2E92EE | 166 #B8CAF0 | 167 #2C0F7F |
168 #3818A5 | 169 #2F1ECC | 170 #554491 | 171 #4F25CA | 172 #411FF3 | 173 #661FF1 | 174 #6C4DC7 | 175 #5649EF |
176 #7D4EF1 | 177 #5F76C9 | 178 #6B6CF1 | 179 #6A85F2 | 180 #949ABD | 181 #7E98F3 | 182 #98ADF2 | 183 #1E0644 |
184 #2D0F5C | 185 #4B0C68 | 186 #432181 | 187 #661388 | 188 #531BA5 | 189 #554563 | 190 #6C2CAB | 191 #6C1CCB |
192 #881ECC | 193 #6D5DA2 | 194 #891FF4 | 195 #9944C6 | 196 #A31DE9 | 197 #8763D2 | 198 #9567B2 | 199 #A44BF2 |
200 #C026F8 | 201 #9A71F1 | 202 #9681CD | 203 #BF64F5 | 204 #AE87F2 | 205 #B99BE8 | 206 #BDACC8 | 207 #D2AEF2 |
208 #160119 | 209 #350630 | 210 #3E1C48 | 211 #5D2466 | 212 #7D136A | 213 #753584 | 214 #8719A4 | 215 #971B83 |
216 #754F73 | 217 #8D4796 | 218 #A41CB8 | 219 #B24C9D | 220 #C425B4 | 221 #C11ED7 | 222 #BB4ECF | 223 #DF1FC7 |
224 #E11EF3 | 225 #DD51BF | 226 #C16ED1 | 227 #DB4CEE | 228 #BB81B8 | 229 #F92DEB | 230 #EC6AF4 | 231 #D789EC |
232 #F68DF5 | 233 #F5B1F5 | 234 #EEC7EB | 235 #5A0B44 | 236 #572E45 | 237 #812F52 | 238 #9B1658 | 239 #A53774 |
240 #B21E96 | 241 #C01D75 | 242 #A4698B | 243 #D92297 | 244 #D24E84 | 245 #C962A5 | 246 #F81F8B | 247 #A48794 |
248 #F826B9 | 249 #F44E99 | 250 #E573B7 | 251 #F862D1 | 252 #D192B3 | 253 #F785C4 | 254 #EF9ED4 | 255 #EDB5C7 |
Limitations & Epistemic Notes
- Synthetic educational research model operating strictly over the fixed 256-color vocabulary above with context length 8.
- Designed for mechanistic interpretability experiments (embedding atlas, attention/QKV inspection, head ablations, logit lens, linear probes, and same-final-color contextual disambiguation), not production color generation.