483,040 parameters 38 verified classes CPU-only · no GPU ~1.8 MB fp32 bundle 0 network calls

plain English →
pixel sprites — fully offline

PXG-Tiny is a deliberately miniature text-to-sprite model: 483k parameters, a pure NumPy inference runtime, and a built-in verifier that checks every sprite against your prompt before showing it. Runs on any laptop CPU in ~0.6 s per sprite.

every sprite on this page was generated by the final v0.4 model — prompt & seed recorded in manifest.json
attribute grounding

Prompt words actually change pixels

The corpus is built from a procedural rasterizer with counterfactual twin pairs — identical geometry, one changed word — so the model learns word→pixel causality, not vibes.

measured, not marketed

Benchmarks

100%
38-class grid
152/152 prompts
99.1%
fresh-phrasing sweep
116/117
31/31
showcase gallery
shipped pipeline
98.89%
val top-1
teacher-forced
100%
INT8↔fp32 parity
max |Δlogit| 2e-05
ProtocolResultWhat it measures
Full 38-class grid152/152 = 100%2 prompt styles × 2 seeds per class, exact shipped pipeline (verifier-guided retries on)
Fresh-phrasing sweep116/117 = 99.1%39 novel phrasings × 3 seeds, same pipeline — guards against overfitting to test prompts
Raw held-out (verifier off)59.4% mean · 50% strict46 adversarial rephrasings, single free-run sample — the honest backbone-only number
Parity gatePASSNumPy runtime vs trained torch model, bit-level teacher-forced comparison
Why the raw number is low and the shipped number is 100%: the 483k backbone knows every class (perfect teacher-forced accuracy) but autoregressive sampling drifts on hard prompts. The verifier-guided escalation — palette bias → spatial priors → canonical anchor — closes that gap for the user path. Both numbers are published on purpose.
5-minute quickstart

Run it on your laptop

No GPU. No PyTorch at inference. No internet. Python ≥ 3.9 with numpy and pillow.

# 1. get the bundle
git clone https://github.com/tarulahsan/PXG-Tiny-AI
cd PXG-Tiny-AI
pip install numpy pillow pytest

# 2. single sprite
python3 cli.py "a golden sword" -o sword.png

# 3. four variations on one sheet
python3 cli.py "an iron chest" --variations 4 \
  --sheet chest_variants.png

# 4. batch from a prompt list
python3 cli.py --sheet-from-prompts prompts.txt \
  --outdir sprites/
# Python API
from pxg_tiny.pipeline import PXGPipeline

pipe = PXGPipeline()
grid, meta = pipe.generate_pixels(
    "a ruby potion that glows", seed=7)

if grid is None:
    print(meta["message"])  # clarify / refuse
else:
    pipe.generate_png("a ruby potion that glows",
                      "ruby_potion.png")

# ask-first gate (rule-based, offline)
PXGPipeline.ask("render a 3d photo")
# -> "i only make 16x16 pixel-art sprites..."
honest limitations

What it won't do

under the hood

Architecture in 30 seconds

caption ids (32 chars) ──► intent encoder (bi-attention, fp32) ──► 8 prefix vectors
[8 prefixes | 256 visual tokens] ──► 4× pre-LN causal blocks (d=96, 4 heads, FFN 256)
                                    └─► 32-way softmax over master-palette indices (0 = transparent)

teacher-forced top-1 98.89% · KV-cached decode ~0.6 s/sprite on 2 CPU cores
training corpus: 97,005 fully procedural rows (CC0), counterfactual twins + paraphrase engine