ComfyUI Qwen-Image 2.1 PixelHead (Zero-VAE)
Direct RGBA pixel readout head (1x & 2x) for Qwen-Image 2.1 in ComfyUI (~5.5 ms decode, 48.8 MiB BF16)
ComfyUI-QwenImage21-PixelHead
Direct RGBA pixel readout head (1x & 2x) for Qwen-Image 2.1 in ComfyUI, replacing the 644.2 MiB 64-channel WanVAE decoder at the end of sampling.
Based on the direct pixel readout formulation in FastFrames (arXiv:2611.23226), this node captures the final sampling step's 4096-dim hidden states right before proj_out together with the denoised 64-channel latent x0_hat, and decodes them directly to 4-channel RGBA pixels (25.4M parameters, 48.8 MiB in BF16).
At 768×768 on an NVIDIA L4, median decode time drops from 372.3 ms (stock VAE) to 5.55 ms (67.1×), with peak extra VRAM under 0.2 GB.
![]()
Features
- Low latency and low VRAM: Decodes in
5.55 ms(1x) or~12 ms(2x1024 → 2048) and moves weights back to CPU after execution, avoiding high-resolutionVAEDecodememory spikes. - High-dimensional input (
4096 + 64channels): Unlike latent-only tiny decoders that read only the compressed64-channel latent, reading pre-proj_outDiT features retains small text and fine linework (38.57 dBPSNR on typography). The final linear layer runs inFP32to avoidBF16color banding on flat gradients. - Single checkpoint across sampling modes:
- Supports both 8-step Turbo LoRA (
CFG = 1.0) and 20–35 step Base sampling (CFG > 1.0). - Supports Text-to-Image and
<image1>multi-image reference editing (norm_outstrips reference prefix tokens beforeproj_out). - Compatible with ComfyUI's
QwenImage21Cache.
- Supports both 8-step Turbo LoRA (
- 4-channel RGBA: Outputs
image_rgb,alpha_mask, andimage_rgbain one pass.
Benchmark (768×768 Held-Out Split, NVIDIA L4)
Evaluated against qwen_image_2.1_vae_bf16.safetensors (Comfy-Org/Qwen-Image-2.1) on the same seeds and denoised latents (50% 8-step LoRA, 50% multi-step Base):
| Decoder | Size | Median Latency | Speedup | PSNR (↑) | LPIPS-VGG (↓) | RGBA |
| :--- | :---: | :---: | :---: | :---: | :---: | :---: |
| Official Qwen-Image 2.1 VAE | 644.2 MiB | 372.30 ms | 1.0× | (ref) | 0.0000 | Yes |
| QwenImage21 PixelHead (1x) | 48.8 MiB (BF16) / 97.0 MiB (FP32) | 5.55 ms | 67.1× | 33.91 dB | 0.1524 | Yes |
Held-out breakdown by category:
- Typography & posters:
38.57 dBPSNR (0.0653LPIPS) - 2D anime & cel shading:
34.69 dBPSNR (0.1363LPIPS) - Paintings & engravings:
33.76 dBmean PSNR (37.4–41.3 dBon portraits and low-key lighting)
Related Repositories
Each diffusion model has its own internal feature space and needs a separate pixel head:
| Model | ComfyUI Node | Weights | Notes |
| :--- | :--- | :--- | :--- |
| Qwen-Image 2.1 (this repo) | Wither033/ComfyUI-QwenImage21-PixelHead | pocis/Qwen-Image-2.1-PixelHead | 48.8 MiB (1x) / 52.1 MiB (1x+2x), 4-ch RGBA, 5.55 ms (67.1×), 33.91 dB |
| Krea-2 | Wither033/ComfyUI-Krea2-PixelHead | pocis/Krea-2-PixelHead | 52.6 MiB BF16, 6144d bridged RGB, 59.55 ms (24.7×), 33.33 dB |
| MiniMax-H3 (preview) | Wither033/ComfyUI-MiniMaxH3-PixelHead | pocis/MiniMax-H3-Video-PixelHead | Experimental preview (not recommended for production yet; high-frequency textures are soft) |
| Training Code & Notes | Wither033/FastFrames-PixelHead-Trainer | HF Collection | Training toolkit, DiT hook notes, and Colab L4 scripts |
Installation
1. Custom Node
Install via ComfyUI Manager (ComfyUI-QwenImage21-PixelHead), comfy node install comfyui-qwenimage21-pixelhead, or git clone:
cd ComfyUI/custom_nodes
git clone https://github.com/Wither033/ComfyUI-QwenImage21-PixelHead.git
2. Weights
Download from pocis/Qwen-Image-2.1-PixelHead into ComfyUI/models/pixel_heads/ (or ComfyUI/models/vae/):
qwen_image_2.1_pixel_head_bf16.safetensors(48.8 MiB):1xnative resolution (5.55 ms, BF16 trunk + FP32 output).qwen_image_2.1_pixel_head_x2_bf16.safetensors(52.1 MiB): combined1x+2x(1024 → 2048in~12 ms, switchable viaoutput_scale).qwen_image_2.1_pixel_head.safetensors(97.0 MiB) /qwen_image_2.1_pixel_head_x2.safetensors(103.3 MiB): full FP32 checkpoints.
Usage
Example workflows are in example_workflows/:
[Load Diffusion Model] ──► (Optional 8-Step LoRA / QwenImage21Cache) ──► [Qwen-Image 2.1 Pixel Head Tap]
│ │
MODEL│ │pixel_tap
▼ │
[KSampler] │
│LATENT │
▼ ▼
[Load Qwen-Image 2.1 Pixel Head] ──► [Qwen-Image 2.1 Pixel Decode (Zero VAE)]
For pure Text-to-Image, no VAE needs to be loaded. For <image1> reference editing, keep a VAE connected to TextEncodeQwenImage21 to encode the input image, and use Qwen-Image 2.1 Pixel Decode after KSampler.
Limitations
- Step range: Trained on
ModelSamplingFlux(shift=0.69)final-step $\sigma \in [0.038, 0.300]$ (5–12 step Turbo LoRA and 18–35 step Base). - Offline
.latentfiles: Decoding requires the final-step4096-dim DiT features captured by the Tap node during sampling; it cannot decode standalone saved.latentfiles on their own. - Dense micro-hatching: On fine monochrome woodcuts or 2px screentones, 1px phase shifts lower pixelwise PSNR even though line structure stays separated.
License & Credits
- License: MIT (clean-room PyTorch implementation).
- References: Direct pixel readout formulation from FastFrames: Video Generation at Interactive Latency (Apple Research, 2026); single-step replay distillation and ComfyUI hook design informed by
sorryhyun/anima-pixel-decoder.