File size: 11,756 Bytes
5df6a54 4893387 5df6a54 4893387 5df6a54 4893387 96a559b 4893387 1e0352b 6db0ba4 f6fa143 6db0ba4 1e0352b 5df6a54 96a559b 1e0352b 96a559b 48b7d84 f6fa143 96a559b 1e0352b c590523 1e0352b c73a98c bde8c5a f6fa143 4893387 5df6a54 ed9da68 f6fa143 96a559b 5df6a54 4893387 5df6a54 1e0352b ed9da68 05452d6 4893387 05452d6 b8c4b36 5df6a54 b8c4b36 06ee509 b8c4b36 4893387 c1b761b b8c4b36 4893387 b8c4b36 5df6a54 96a559b 1e0352b 96a559b a9db07f 96a559b 5ce1cca 1e0352b 5df6a54 1e0352b bde8c5a 96a559b 5df6a54 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | ---
base_model:
- circlestone-labs/Anima
license: other
license_name: circlestone-labs-non-commercial-license
license_link: LICENSE.md
tags:
- anima
- decoder
---
# Anima Pixel Decoder
A 25M-parameter decoder that reads the last-layer features of the
[Anima](https://huggingface.co/circlestone-labs/Anima) DiT at the final sampling step and
writes RGB pixels directly, in place of the VAE decode. The head and its training follow
[FastFrames](https://arxiv.org/html/2611.23226)' pixel head (a ConvNeXt readout on the diffusion transformer's features).
| | |
|---|---|
| Input | the input of the DiT's `final_layer.linear` (2048-dim per token, after the adaLN-modulated LayerNorm) |
| Output | a 16×16 RGB patch per token (×2 file: 32×32), in [-1, 1] |
| Architecture | linear projection of the feature + linear embedding of the x_t patch, 2 ConvNeXt, one 2× pixel-shuffle upsample, 1 ConvNeXt, linear to 8×8×3 |
| DiT | `anima-base-v1.0` (28 blocks) |
## Files
| path | output | what it is |
|---|---|---|
| `x1/anima_pixel_decoder_base.safetensors` | ×1 | trained with a DINOv3 feature term |
| `x1/anima_pixel_decoder_sharp.safetensors` | ×1 | the base with a GAN finish: sharper detail, further from the VAE decode |
| `x1/anima_pixel_decoder_rgba_preview.safetensors` | ×1, RGBA | preview (2026-11-24): RGB and alpha in one readout, a transparent PNG from a white-background render |
| `x2/anima_pixel_head_x2_v3.safetensors` | ×2 | decode + 2× upscale in one readout |
| `multi/` | | reserved |
Files moved into `x1/` and `x2/` on 2026-11-23; links to the old root paths no longer resolve.
## Use
- ComfyUI: the [ComfyUI-Anima-PixelDecoder](https://github.com/sorryhyun/ComfyUI-Anima-PixelDecoder)
node pack (ComfyUI Manager: "Anima Pixel Decoder"). Put the file (no folder) in `models/pixel_heads/`,
add **Anima Pixel Head Tap** on the MODEL before the KSampler (stock or Spectrum) and decode
the sampler's LATENT with **Anima Pixel Decode** instead of VAE Decode. The file decides the
scale: ×1 for the `x1/` files, ×2 for the `x2/` files (node 0.3.1 or later). The RGBA file
needs node 0.4.0 or later.
Run the DiT on the fp32 stream (Anima Adapter Loader, `stream = fp32`).
- [anima_lora](https://github.com/sorryhyun/anima_lora): `inference.py --decoder pixel_head`
(`make test PIXEL=1`, `make test-turbo PIXEL=1`; ×2: `make test PIXEL=1 PIXEL_SCALE=2`); the
module, loader and feature tap are in `library/anima/pixel_head.py`. It fetches
`x1/anima_pixel_decoder_base` (and `x2/anima_pixel_head_x2` for ×2) on first use; any other
file: `make test PIXEL=1 PIXEL_HEAD=<path>`.
## Base
`x1/anima_pixel_decoder_base.safetensors` replaces the LPIPS term of the previous head with a
DINOv3 ViT-S/16 term on image tiles (12,000 rollouts). Targets: the original image at the base
points; VAE(x̂0) of the same forward at the turbo point, x̂0 = x_t − σ·v. Screentone keeps its dot pattern and
hatching keeps its strokes, where earlier heads smoothed them; the cost is about 0.2 dB of
PSNR at the base points.
Base DiT, Euler 28 steps, shift 3, CFG 4, seed 0, the same latent in each row; 768×768 crops at
native resolution.

Held-out images against the original, at the decode points (dB / DINO distance ×1e-3, lower is
closer). `VAE(x̂0)` decodes the same step's x̂0 with the VAE, the comparison at equal input:
| point | set | head | VAE(x̂0) |
|---|---|---|---|
| base, σ 0.058 (50 steps) | test (30) | 34.00 / 0.109 | 35.10 / 0.136 |
| | text (8) | 29.00 / 0.085 | 30.27 / 0.083 |
| | manga (10) | 26.23 / 0.128 | 26.95 / 0.151 |
| base, σ 0.136 (20 steps) | test | 31.18 / 0.159 | 31.32 / 0.204 |
| | text | 26.34 / 0.127 | 26.41 / 0.139 |
| | manga | 24.02 / 0.178 | 23.93 / 0.210 |
| turbo, σ 0.5 | test | 22.84 / 0.492 | 22.73 / 0.486 |
| | text | 18.35 / 0.470 | 18.12 / 0.459 |
| | manga | 17.41 / 0.527 | 17.22 / 0.522 |
Against the same recipe trained with the LPIPS term (not published) on the same images, the
DINO distance is 12 – 34 % lower at the base points and unchanged at the turbo point.
## Sharp
`x1/anima_pixel_decoder_sharp.safetensors` is `anima_pixel_decoder_base` finished with a GAN term
on PE-Spatial features (2,000 rollouts, the DINOv3 term kept). The discriminator sees random
512×512 crops, so its patch grid does not stay aligned with the DiT's 16-px tokens. Foliage,
hair and small detail come out sharper. The head draws that detail itself, so it is further
from the original pixel by pixel. On generated images (base 28 steps, CFG 4, 16 prompts × 2
seeds), it scores 31.17 dB against the VAE decode, where `anima_pixel_decoder_base` scores 32.25.
Base DiT, Euler 28 steps, shift 3, CFG 4, seed 0, the same latent in each row; 378×378 crops at
native resolution. Columns: VAE Decode, `anima_pixel_decoder_base`, `anima_pixel_decoder_sharp`.

Held-out images against the original (dB / DINO distance ×1e-3), sharp against base:
| point | set | sharp | base |
|---|---|---|---|
| base, σ 0.058 (50 steps) | test (30) | 33.27 / 0.116 | 34.00 / 0.109 |
| | text (8) | 28.34 / 0.089 | 29.00 / 0.085 |
| | manga (10) | 25.60 / 0.127 | 26.23 / 0.128 |
| base, σ 0.136 (20 steps) | test | 30.65 / 0.164 | 31.18 / 0.159 |
| | text | 25.83 / 0.129 | 26.34 / 0.127 |
| | manga | 23.50 / 0.174 | 24.02 / 0.178 |
| turbo, σ 0.5 | test | 22.83 / 0.494 | 22.84 / 0.492 |
The GAN term was trained at the base points only. At the turbo point the head was trained with
the regression loss alone, so on the turbo it decodes like the base file. On manga pages, a faint
regular pattern can appear in screentone areas. For manga, compare both files.
## RGBA (preview)
`x1/anima_pixel_decoder_rgba_preview.safetensors` is `anima_pixel_decoder_base` with a fourth
output channel, trained on for 4,000 rollouts: one readout writes the colour and the alpha, and
the render is saved as a transparent PNG. No second head, no background-removal pass.
- End the prompt with `white background`. The head was trained on character cutouts laid on
white and light simple backgrounds, at the base points only.
- ComfyUI: pick the file in **Anima Pixel Decode**; the IMAGE has four channels and **Save Image**
writes the transparent PNG. A node that expects three channels needs **Split Image with Alpha**
first.
- anima_lora: `make test PIXEL=1 PIXEL_HEAD=models/pixel_heads/anima_pixel_decoder_rgba_preview.safetensors`.
- The colour is straight (not premultiplied).
Base DiT, Euler 28 steps, shift 3, CFG 4, seeds 7 and 8, on a checker. Prompts the head was not
tuned on: a wizard, a robot, a horse, a birdcage, a jellyfish, a dandelion.

What the preview does not do yet: background enclosed by thin structure (between a cage's bars, a
wheel's spokes) comes out as 8-px blocks of mixed alpha, and translucent material (the
jellyfish's veil, glass) comes out mostly opaque. People, creatures and objects with a closed
outline split cleanly, hair strands included.
## Compatibility
Read the head only where it was trained:
- **Base DiT**: Euler, shift 3, 20 … 50 steps (last-step σ 0.058 … 0.136), read at CFG 4,
Spectrum included (its last step is an actual forward).
- **Turbo**: the 4-step turbo LoRA of
[anima-turbo-4step](https://huggingface.co/sorryhyun/anima-turbo-4step), Euler 4 steps,
shift 3, CFG 1 (last-step σ 0.5). Trained on `anima_turbo_4step_v4_longer.safetensors`.
The ×2 files and the RGBA preview were trained at the base points only; on the turbo they decode
with a warning.
## Benchmark
The benchmarks, samples and held-out reads below were measured on an earlier ×1 head of the
same architecture (no longer published). Decode time and VRAM do not depend on the weights.
### In ComfyUI
Turbo 4 steps, CFG 1, RTX 5070 Ti, 16 prompts at ~1 MP, one seed
| | KSampler + VAE Decode | KSampler + Anima Pixel Decode |
|---|---|---|
| KSampler | 0.976 s | 0.998 s (with the tap) |
| decode | 151 ms | 7 ms |
| decode peak VRAM above the loaded models | 1.22 GB | 0.21 GB |
| PSNR against VAE Decode | — | 36.9 dB |
| **total per image** | **1.13 s** | **1.00 s (1.12×)** |
ComfyUI keeps the VAE on the card after its first decode, so the VAE column has no move cost.
### In anima_lora
The same turbo setting and prompts through anima_lora's `inference.py` (compiled DiT blocks);
medians. The VAE column is the usual interactive path: the VAE waits on the CPU and goes to the
card for the decode.
| | turbo + VAE | turbo + pixel head |
|---|---|---|
| DiT sampling | 0.97 s | 0.97 s |
| load VAE | 710 ms | — |
| VAE move to the card and back | 35 ms | — |
| decode | 141 ms | 7 ms |
| decode peak VRAM above the DiT | 1.38 GB | 0.24 GB |
| **total per image (DiT + decode)** | **1.86 s** | **0.98 s** |
## ×2 output
`x2/anima_pixel_head_x2.safetensors` decodes and upscales 2× in one readout: the ×1 head plus a
second 2× stage (pixel shuffle, 2 ConvNeXt blocks at width 256, linear to 8×8×3 per position), so
a 1024² render leaves the head at 2048².
Held-out against the real 2× image (one seed): 29.82 dB / LPIPS 0.158 on 12 test images,
25.52 dB / LPIPS 0.145 on 5 text images.
Base DiT, Euler 28 steps, shift 3, CFG 4, seed 42, 1024×1024, the prompts of the samples above,
through anima_lora's `inference.py`; left VAE Decode (1024²), right the ×2 head (2048²). Crops:
left 384×384 of the VAE decode, bicubic to 768×768; right the same region of the ×2 output at
native resolution.
| | VAE Decode | ×2 head |
|---|---|---|
| colour |  |  |
| crop |  |  |
| monochrome |  |  |
| crop |  |  |
On the monochrome crop the ×2 head turns the screentone on the shorts into a wavy pattern.
## Held-out reads
Held-out reads during training, earlier ×1 head (dB, colour / mono):
| decode point | colour | mono |
|---|---|---|
| turbo 4 steps | 35.90 | 29.01 |
| base 20 steps | 33.71 | 26.58 |
| base 28 steps | 33.83 | 26.38 |
| base 50 steps | 33.49 | 25.48 |
| base 28 + Spectrum | 34.37 | 26.00 |
## Known limits
- The lowest per-image PSNRs are manga pages and sketches.
- `anima_pixel_decoder_sharp`: a faint regular pattern in some screentone areas.
- ×2: screentone comes out as a wavy pattern instead of dots (see the monochrome crop).
- One trained head per file, one seed; no run spread.
## License
The weights in this repository are a **Derivative** of
[Anima](https://huggingface.co/circlestone-labs/Anima) and are distributed under the
**[CircleStone Labs Non-Commercial License](LICENSE.md)** (see [NOTICE.md](NOTICE.md)). Any
rights to use them are granted directly by CircleStone Labs LLC under that license.
- The model/weights may only be used for non-commercial purposes. Generated images (Outputs)
may be used commercially.
- Anima is itself a Derivative Model of NVIDIA Cosmos-Predict2-2B-Text2Image and is subject
to the [NVIDIA Open Model License Agreement](https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-open-model-license/)
insofar as it applies to Derivative Models.
- This is not an official CircleStone Labs product and is not endorsed by CircleStone Labs.
Built on NVIDIA Cosmos.
|