ChromaGPT
a 10,816-parameter micro-transformer for AI research
2 min readupdated
ChromaGPT (d16_l2_h4) is a microscope-style research model built to examine how transformers work from the inside. It tackles the task of predicting the next color in an 8-step sequence using only abstract token ID integers (from 0 to 255) without access to RGB coordinates or the OKLab color space. Built from scratch by author purplejedi on a causal decoder-only Transformer architecture (in the style of GPT-2), the model is exported to the native GPT2LMHeadModel format. Unlike large language models, its tiny size and simple domain make it easy to trace how color geometry forms within embeddings and attention layers. The tool is useful for researchers and students exploring mechanistic interpretability (understanding the internal logic of AI models).
Key features
- Ultra-compact size: Just 10,816 trainable parameters (2 layers, 4 attention heads,
d_model=16dimensionality). - Blind geometry training: The model receives only token indices
0..255yet reconstructs relationships between colors across linear, Bézier curve, and cyclic trajectories. - Training snapshots included: The repository contains embedding matrices from different epochs (
embedding_snapshots.pt), a 256-color OKLab palette, and the source checkpoint featuring themodel.inspect()method. - Zero unnecessary dependencies: Weights are compatible with the standard
transformerslibrary with verified logit accuracy.
What you can do
- Explore internal network mechanics: Run experiments with logit lens, linear probes, attention head ablations, and Q/K/V activation analysis.
- Visualize embedding evolution: Build an atlas showing how chaotic token vectors organize into a meaningful color space from epoch 0 to 60.
- Test contextual resolution: Evaluate how the model distinguishes future gradient directions given identical final colors.
Example
import torch
from transformers import AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained("purplejedi/chromagpt-baseline-d16-l2").eval()
input_ids = torch.tensor([[12, 18, 25, 34, 45, 58, 72, 88]], dtype=torch.long)
with torch.no_grad():
probs = torch.softmax(model(input_ids=input_ids).logits[:, -1, :], dim=-1)[0]
print(torch.topk(probs, k=5))Read more
DetailsMetrics (Test, N=1000): Top-1 Accuracy 0.318, Top-5 Accuracy 0.798, Perceptual OKLab ΔE 0.0529 (outperforms linear RGB extrapolation).
Context: Fixed vocabulary of 256 colors, context length of 8 tokens.
Training: 10,000 trajectories (train), 60 epochs on a Tesla T4 GPU.
Limitations: Educational and research synthetic model, not intended for production gradient generation.










Comments