Trout: a from-scratch diffusion language model for 16Γ—16 pixel art

Author: FrameXlabs Live demo: Trout Pixel Studio License: CC BY-NC 4.0 β€” free for education, research and personal non-commercial use with credit. Named after: the trout, a small fish β€” small, real, and trained from scratch.

Trout is a from-scratch re-implementation of the same kind of model as Tessera-small (TheJagStudio) with the same parameter count (47.6M): a joint text+pixel bidirectional masked-diffusion transformer that treats a 16Γ—16 sprite as a 256-token sentence over a learned 512-colour palette, conditioned on a frozen CLIP text encoder. Nothing was copied from the reference β€” the palette is rebuilt from the source data with our own frequency-weighted OKLab k-means, the weights are trained from random initialisation with our own code, and the sampler is our own implementation of the same decoding strategy (parallel confidence-ordered unmasking with CFG, Gumbel-annealed choice and spatial NMS).

Model

Parameters 47.6M (47,597,568) (Trout-small) β€” frozen CLIP text tower not included (MIT licensed)
Architecture joint text+pixel bidirectional transformer, hourglass 2 + 8 + 2 blocks (2Γ—2 patch-merged core), width 512, 8 heads, QK-RMSNorm, 2D axial RoPE, Conv-SwiGLU, adaLN-single, 4 registers, self-conditioning
Text encoder frozen openai/clip-vit-base-patch32 text tower, 24 tokens
Vocabulary 512 palette tokens (frequency-weighted OKLab k-means on the data, Ξ”E 0.010 mean quantisation error) + <mask>
Objective absorbing-state masked diffusion, cosine schedule, blob masks, perceptual (OKLab) label smoothing, CFG dropout, self-conditioning
Sampler parallel confidence-ordered unmasking with CFG, Gumbel-annealed choice, spatial NMS; inpainting supported

Training (honest numbers)

Trout was trained from scratch on Pixel Art Atlas 1.4M (5 of 15 train shards, 16-sprite batches, 3000 optimizer steps β‰ˆ 48,000 sprites seen) on a shared CPU sandbox β€” roughly 0.11% of the sprite-passes of the reference recipe (82,342 steps Γ— 512 sprites on an RTX PRO 6000). The optimizer is AdamW (the reference used Muon+AdamW) with warmup + cosine decay, EMA 0.99. It is a real training run, but a very short one, so the model is intentionally undertrained: expect plausible palettes, silhouettes and colour blobs rather than crisp objects. Increase sampling steps / CFG scale for the best of what it has learned.

Metric (final checkpoint) Value
Validation NLL 2.108 nats / pixel (perplexity 8.23 of 512)
Validation accuracy 56.0% of masked pixels
Palette quantisation mean Ξ”E 0.010, p95 Ξ”E 0.025
Trainable parameters 47,597,568

(For scale: Tessera-small reports validation NLL 0.859 nats/pixel and 78.8% masked-pixel accuracy after its full 82,342-step run.)

Usage (non-commercial)

from huggingface_hub import hf_hub_download
from trout.pipeline import TroutPipeline   # code in this repo's `trout/` folder

ckpt = hf_hub_download("FrameXlabs/Trout", "trout-small-fp16.pt")
pipe = TroutPipeline.from_checkpoint(ckpt, device="cpu")
images = pipe(["red health potion bottle"], num_per_prompt=8, steps=16, cfg_scale=3.0, seed=0)
pipe.grid(images).save("potions.png")

Or try it live (the model runs in the Space): Trout Pixel Studio.

Files

File Contents
trout-small-fp16.pt fp16 weights, model config, palette, text-encoder id, training step
model_config.json, train_config.json architecture and training hyper-parameters actually used
palette.json the 512-entry palette learned from the dataset
metrics.jsonl the full training + validation log
showcase.png sample grid (12 prompts Γ— 4 samples)
trout/ inference code (model, sampler, palette, pipeline, CLIP wrapper)

Credits

  • Angais for creating and openly releasing Pixel Art Atlas 1.4M β€” Trout was trained on it.
  • Jagrat Patel (TheJagStudio) β€” Tessera-small inspired this from-scratch build and defines the model family Trout reimplements at the same size.
  • The frozen text encoder is OpenAI's CLIP ViT-B/32 text tower (MIT).

License

Trout is released under CC BY-NC 4.0. Free for education, research and personal non-commercial use with credit ("Trout by FrameXlabs"). Commercial use requires a separate license. Third-party parts keep their own licenses: the CLIP text encoder (OpenAI, MIT) and the Pixel Art Atlas 1.4M dataset (Angais).

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Dataset used to train FrameXlabs/Trout

Space using FrameXlabs/Trout 1