Tessera-small: a diffusion language model for 16Γ—16 pixel art

Author: Jagrat Patel (TheJagStudio) Live demo: Tessera Pixel Studio (server GPU/CPU, or in your browser with WebGPU) License: CC BY-NC 4.0. Free for education, research and personal non-commercial use with credit. Commercial use is not allowed without a separate license from the author.

showcase

Tessera treats a 16Γ—16 sprite as a 256-token sentence. Every pixel is one token from a learned 512-color palette (token 0 = transparent). A bidirectional transformer starts from a fully masked canvas and unmasks all 256 pixels in parallel in about 16 steps, conditioned on a frozen CLIP text encoder. It has no VAE, no latent space and no autoregression.

Model

Parameters 47.6M (Tessera-small)
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 (MIT licensed; an ONNX copy is included for browser use)
Vocabulary 512 palette tokens (frequency-weighted OKLab k-means, Ξ”E 0.010) + [MASK]
Objective absorbing-state masked diffusion, cosine schedule, blob masks, perceptual label smoothing, CFG dropout
Sampler parallel confidence-ordered unmasking with CFG, Gumbel-annealed choice, spatial NMS; inpainting supported

Training

82,342 steps Γ— 512 sprites (30 epochs over 1.4M sprites) on one NVIDIA RTX PRO 6000 Blackwell (β‰ˆ5.5 h). The optimizer is Muon for hidden matrices plus AdamW, with a Warmup-Stable-Decay schedule, EMA 0.9995, bf16 and torch.compile.

Metric (EMA weights) Value
Validation NLL 0.859 nats / pixel (perplexity 2.36 of 512)
Validation accuracy 78.8% of masked pixels
CLIP score (ViT-B/32) 25.24 generated vs 25.28 real sprites

Usage (non-commercial)

from huggingface_hub import hf_hub_download
from tessera.pipeline import TesseraPipeline   # code: see the demo Space's files

ckpt = hf_hub_download("thejagstudio/tessera-small", "tessera-small-fp16.safetensors")   # or the .pt
pipe = TesseraPipeline.from_checkpoint(ckpt, device="cuda")
images = pipe(["golden crown with blue gems"], num_per_prompt=8, steps=16, cfg_scale=3.0, seed=0)
pipe.grid(images).save("crowns.png")

The safetensors file holds the same EMA weights as the .pt (fp16, bit-identical). The model config, palette, text-encoder id and training step are stored in its metadata, so it loads without unpickling anything:

from safetensors import safe_open
with safe_open(ckpt, "pt") as f:
    print(f.metadata()["model_config"], f.metadata()["step"])

In the browser (WebGPU, ONNX)

onnx/ holds everything needed to run Tessera client-side with ONNX Runtime Web on WebGPU. The demo Space's WebGPU mode uses exactly these files (226 MB, downloaded once and cached by the browser):

File Inputs β†’ outputs
onnx/clip_text_encoder.onnx input_ids int64 [B, 24] β†’ last_hidden_state [B, 24, 512], pooler_output [B, 512]
onnx/tessera_denoiser.onnx tokens int64 [B, 256] (palette id or 512 = mask), text_states, text_pooled, sc_probs float32 [B, 256, 512] (self-conditioning, zeros at the first step), drop_text bool [B] (true = unconditional, for CFG) β†’ logits [B, 256, 512]
onnx/tokenizer.json CLIP BPE tokenizer (prompts are padded/truncated to 24 tokens, keeping the end token)
onnx/webgpu_config.json shapes, special ids, palette and the export checks

Weights are stored in fp16 and cast to fp32 inside the graph (onnxruntime folds the casts at load), so the download is half-size while the GPU computes in fp32 and no shader-f16 support is needed. The sampler (confidence-ordered parallel unmasking with CFG, Gumbel choice noise, spatial NMS, polish and inpainting) runs in JavaScript; see ui/webgpu.js in the demo Space. Export checks against PyTorch: denoiser logits within 3e-5 with 100% argmax agreement, and with deterministic settings the browser sampler paints the same sprites as the PyTorch sampler, pixel for pixel.

Files

File Contents
tessera-small-fp16.safetensors EMA weights (fp16); model config, palette, text-encoder id and training step in the metadata
tessera-small-fp16.pt the same weights and metadata as a PyTorch checkpoint
onnx/ ONNX graphs, tokenizer and config for in-browser (WebGPU) inference; onnx/LICENSE-CLIP covers the CLIP files
model_config.json, train_config.json architecture and training hyperparameters
metrics.jsonl full training and validation log
showcase.png sample grid (16 prompts Γ— 8 samples)

Credits

Huge thanks to Angais for creating and openly releasing Pixel Art Atlas 1.4M. This model was trained on it and would not exist without it.

License

Tessera is released under Creative Commons Attribution-NonCommercial 4.0.

  • βœ… Allowed (free): education, teaching, academic and independent research, personal projects and experiments. You can download, run, fine-tune and share the model, with credit ("Tessera by Jagrat Patel (TheJagStudio)").
  • ❌ Not allowed: any commercial use of the model or of images generated with it, such as selling or licensing it, paid apps, games or products, or monetized hosted services.
  • πŸ’Ό Commercial license: contact Jagrat Patel via Hugging Face.

Third-party parts keep their own licenses: the CLIP text encoder (OpenAI, MIT; this also covers onnx/clip_text_encoder.onnx and onnx/tokenizer.json, see onnx/LICENSE-CLIP) and the Pixel Art Atlas 1.4M dataset (Angais).

Β© 2026 Jagrat Patel (TheJagStudio).

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

Model tree for thejagstudio/tessera-small

Adapters
1 model
Finetunes
1 model
Quantizations
2 models

Dataset used to train thejagstudio/tessera-small

Spaces using thejagstudio/tessera-small 8