---
license: mit
library_name: pytorch
pipeline_tag: text-to-image
tags:
- pixel-art
- weight-space-programming
- hand-written-weights
- no-training
- tiny-model
- pico-8
- toy
language:
- en
---
# ๐น๏ธ PixelGen
**A text-to-pixel-art model with 1,257 parameters. Zero of them were trained.**
Every weight was typed in by hand. It still works.
Every sprite above: `" "` โ PixelGen โ 16ร16 PICO-8 sprite. No gradients were harmed.





---
## What this is
A tiny PyTorch `nn.Module` that turns a text prompt like `"red potion"` or `"blue invader"` into a 16ร16 pixel-art sprite in the PICO-8 palette, upscaled to 128ร128.
It's an experiment in **weight-space programming**, inspired by [this post](https://rikiyat.github.io/blog/weight-space-programming/): instead of training a network, you write a program and *compile it into weights*. Linear layers become lookup tables, argmax becomes a decision, a 1ร1 conv becomes a palette. The model is a real `nn.Module` โ you can call `.forward()`, save a `state_dict`, load it back โ but no optimizer ever touched it.
The fun part is that an image generator with the parameter count of a single small MLP layer produces consistently cute, correctly-coloured, correctly-shaped sprites, and you can read the entire "model" as source code.
## Numbers (measured, not estimated)
| | |
|---|---|
| Registered parameters | **1,257** |
| Non-trainable buffers (shape/shade/ramp banks) | 3,611 |
| Total values in the checkpoint | 4,868 (โ19.5 KB fp32) |
| `pixelgen.pt` on disk | 23.5 KB |
| Training steps | **0** |
| Optimizers, backward passes, `requires_grad=True` in the repo | 0 (grep-verified) |
| Sprite classes | 11 |
| Colour ramps | 9 |
| Output | 16ร16 โ 128ร128 RGB, every pixel โ PICO-8 (16 colours) |
| Build reproducibility | `build.py` twice โ identical SHA-256 |
| `pixelgen.pt` SHA-256 | `175cc5249fba8c756ea019f418f4aa0a9633017ffad7f238b863865758c49b80` |