Instructions to use PrunaAI/P-Flux-2-Klein-4B-DWD-Comfy with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Pruna AI
How to use PrunaAI/P-Flux-2-Klein-4B-DWD-Comfy with Pruna AI:
from pruna import PrunaModel model = PrunaModel.from_pretrained("PrunaAI/P-Flux-2-Klein-4B-DWD-Comfy") - Notebooks
- Google Colab
- Kaggle
⚡ P-Flux-2-Klein-4B-DWD
FLUX.2 [klein] 4B without a VAE decoder — ComfyUI
No VAE decode · 4 steps, cfg 1 · ComfyUI 0.46+ · Text-to-image workflow
This repository holds the ComfyUI files for P-Flux-2-Klein-4B-DWD, FLUX.2 [klein] 4B with a decoder-free head. A fine-tuned copy of the transformer's last 4 blocks and a small linear head write the image's pixels directly at the last sampling step, so the VAE decoder never runs and no VAE file is needed. It is a replication of DWD, Decoding Without a Decoder: Direct Pixel Prediction from Diffusion Transformers (Chen et al., 2026).
It contains the head in ComfyUI format, a small custom node and a ready-to-use text-to-image workflow. The base model and the text encoder come unchanged from Comfy-Org/Flux-2-Klein-4B. The diffusers pipeline, the benchmarks and the training code are in PrunaAI/P-Flux-2-Klein-4B-DWD.
| File | Folder | Size | From |
|---|---|---|---|
flux-2-klein-4b.safetensors |
models/diffusion_models/ |
7.75 GB | Comfy-Org/Flux-2-Klein-4B |
qwen_3_4b.safetensors |
models/text_encoders/ |
8.04 GB | Comfy-Org/Flux-2-Klein-4B |
p_flux_2_klein_4b_dwd_comfyui_bf16.safetensors |
models/dwd/ (new folder) |
1.10 GB | this repo |
pruna_dwd/ (custom node) |
custom_nodes/ |
– | this repo |
No VAE file is needed.
Quickstart
Update ComfyUI to 0.46 or newer. The custom node checks the version and says so if it is older.
Download the base model and the text encoder from Comfy-Org/Flux-2-Klein-4B into the folders above. Use the distilled
flux-2-klein-4b, notflux-2-klein-base-4b. The workflow's Note: Model links has the direct links, and ComfyUI's missing-models dialog offers to download them when you open the workflow.Download this repo, install the custom node and put the head in place:
hf download PrunaAI/P-Flux-2-Klein-4B-DWD-Comfy --local-dir P-Flux-2-Klein-4B-DWD-Comfy cp -r P-Flux-2-Klein-4B-DWD-Comfy/pruna_dwd ComfyUI/custom_nodes/ mkdir -p ComfyUI/models/dwd cp P-Flux-2-Klein-4B-DWD-Comfy/p_flux_2_klein_4b_dwd_comfyui_bf16.safetensors ComfyUI/models/dwd/The node needs no extra Python packages. Restart ComfyUI. It adds the Load DWD Head and DWD Decode nodes (category Pruna) and registers the
models/dwd/folder.📂 ComfyUI/ ├── 📂 custom_nodes/ │ └── 📂 pruna_dwd/ (this repo) └── 📂 models/ ├── 📂 diffusion_models/ │ └── flux-2-klein-4b.safetensors ├── 📂 dwd/ │ └── p_flux_2_klein_4b_dwd_comfyui_bf16.safetensors (this repo) └── 📂 text_encoders/ └── qwen_3_4b.safetensorsOpen the workflow: drag
workflows/p_flux_2_klein_4b_dwd_t2i.jsononto ComfyUI, write a prompt, pick the size and press Run.
Workflow
| Workflow | What it does |
|---|---|
workflows/p_flux_2_klein_4b_dwd_t2i.json |
Text-to-image in 4 steps, pixels from the DWD head, no VAE |
workflows/api/p_flux_2_klein_4b_dwd_t2i_api.json |
The same graph in ComfyUI's API format, for scripts and servers |
The workflow uses ComfyUI's own nodes plus the two Pruna nodes. Load Diffusion Model loads flux-2-klein-4b, and
Load DWD Head attaches the head to it. Load CLIP (type flux2) loads the text encoder, and Basic Guider feeds the
prompt to sampling without CFG. Flux2Scheduler makes the 4-step schedule for the chosen size, and SplitSigmas at step
3 splits it in two: Sampler Custom Advanced (euler) runs steps 1 to 3 on high_sigmas, and DWD Decode runs step
4 on low_sigmas, with the same guider, and returns the image. There is no VAE Decode.
Sampling settings
- 4 steps. Flux2Scheduler
steps4 and SplitSigmasstep3 (always steps − 1). The head was trained at the last sigma of the 4-step schedule; DWD Decode warns when the last sigma differs. - cfg 1, sampler
euler, no negative prompt. DWD Decode refuses other cfg values. - Sizes: width and height must be multiples of 16. The head was trained at about 1 MP: 1024 × 1024, 1152 × 896, 896 × 1152, 1344 × 768 and 768 × 1344. The workflow's Width and Height feed both the latent and the scheduler.
- Always finish with DWD Decode. The model with the DWD head attached is not meant for a full 4-step run followed by VAE Decode: its last-step velocity is not trained, and that image is worse.
Examples
ComfyUI outputs at four of the trained sizes, one run per prompt, not cherry-picked. Left: the stock workflow with VAE Decode. Right: this repo's workflow, with no VAE. Both start from the same noise.
| FLUX.2 [klein] 4B (VAE Decode) | ⚡ P-Flux-2-Klein-4B-DWD (no VAE) |
|---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
A 100% crop of the fox (384 × 384 pixels, same window):
| FLUX.2 [klein] 4B (VAE Decode) | ⚡ P-Flux-2-Klein-4B-DWD (no VAE) |
|---|---|
![]() |
![]() |
Fine texture is slightly softer than with the VAE decode.
Prompts
- 1024 × 1024: a red fox standing in fresh snow at sunrise, professional wildlife photograph
- 1344 × 768: a hand-painted wooden storefront sign that reads "FRESH BREAD" above a small bakery door
- 1152 × 896: a bowl of ramen with a soft-boiled egg and scallions, overhead food photo
- 896 × 1152: a watercolor illustration of a lighthouse on a rocky cliff under dramatic clouds
Benchmark
Fidelity in ComfyUI
One NVIDIA B200, ComfyUI 0.46.0, bf16, batch size 1, the four prompts above at four trained sizes. Every ComfyUI run and the diffusers pipeline start from the same noise. Numbers are mean PSNR over the four images.
| Comparison | PSNR |
|---|---|
| DWD head vs the stock VAE image, both in ComfyUI | 25.79 dB |
| DWD head vs the stock VAE image, both in the diffusers pipeline | 25.67 dB |
| ComfyUI DWD vs the diffusers DWD pipeline, same text embedding | 34.38 dB |
| For scale: stock ComfyUI vs stock diffusers, same text embedding | 32.24 dB |
| ComfyUI DWD vs the diffusers DWD pipeline, each with its own text encoder | 26.74 dB |
| For scale: stock ComfyUI vs stock diffusers, each with its own text encoder | 25.07 dB |
The ComfyUI version stays as close to the diffusers pipeline as stock ComfyUI stays to stock diffusers, and its distance to the stock VAE image matches the pipeline's (25.5 dB on the main repo's 64-prompt evaluation). It is not bit-identical to the diffusers pipeline: ComfyUI uses its own kernels and text encoder, which moves the stock model the same way.
Speed and memory
Speed was measured with the diffusers pipeline from PrunaAI/P-Flux-2-Klein-4B-DWD, not in ComfyUI. One NVIDIA B200, bf16, batch size 1, 4 steps, timed end to end from the prompt to the uint8 image on the host:
| Mode | Resolution | With VAE decode | P-Flux-2-Klein-4B-DWD | Speedup |
|---|---|---|---|---|
| eager | 1024 × 1024 | 316 ms | 234 ms | 1.35x |
torch.compile |
1024 × 1024 | 186 ms | 155 ms | 1.20x |
The saving is the VAE decode (81 ms eager); the head and the Oklab-to-sRGB conversion take about 0.5 ms, and peak activation memory is about 2 GB lower at 1 MP. In ComfyUI, the workflow loads no VAE file. The head is a separate 1.1 GB bf16 module next to the base model, whose own last 4 blocks stay loaded.
How it works
FLUX.2 [klein] 4B has 5 double-stream and 20 single-stream blocks. P-Flux-2-Klein-4B-DWD replaces the last 4 single
blocks with fine-tuned copies (the "tail"), with their own copies of the time embedding, the single-block modulation
and the final layer, and adds a Linear(3072 → 768) head. Each image token becomes one 16 × 16 pixel patch in
normalized Oklab, which is converted to sRGB. The text encoder and the first 21 blocks are the base model's.
In ComfyUI, Load DWD Head reads which model the file belongs to, checks the base model and swaps in the tail, which runs at every step, as in the diffusers pipeline. Steps 1 to 3 sample as usual. At step 4, DWD Decode makes one model call at the last sigma and the head's output is the image: no final Euler update and no VAE decode. An optional VAE input on DWD Decode is used only as a fallback when the model has no head.
Limitations
- Fine texture is slightly softer than with the VAE decode. The image stays close to the stock one for the same noise (about 25.8 dB PSNR in ComfyUI), but it is not identical.
- Text-to-image only. Reference images (ReferenceLatent), inpainting masks and combined or area conditioning are refused with an error.
- Trained at about 1 MP, 4 steps and cfg 1. Other sizes run but are not evaluated.
- Tied to the distilled FLUX.2 [klein] 4B. The head does not work with
flux-2-klein-base-4bor other models, and it is not a VAE replacement for arbitrary latents. - LoRAs: load them before Load DWD Head. The last 4 single blocks and the final layer are replaced, so a LoRA has no effect there. LoRAs are untested.
- Not bit-identical to the diffusers pipeline. Close, as measured above. As with the stock model, an image made in a batch is close to, not identical with, the same image made alone.
- Tested with the bf16 base files on ComfyUI 0.46.0. The extra 1.1 GB for the head adds to the base model's memory.
License
P-Flux-2-Klein-4B-DWD is based on FLUX.2 [klein] 4B and released under the Apache License 2.0. The custom node and the workflows are also under the Apache License 2.0 (LICENSE-APACHE). See NOTICE for details.
Citation
If you use this model, please cite the DWD paper and this release.
@article{chen2026dwd,
title = {Decoding Without a Decoder: Direct Pixel Prediction from Diffusion Transformers},
author = {Chen, Hansheng and Cai, Shengqu and Ackermann, Jan and Zirvi, Rayhan and Wetzstein, Gordon
and Yan, Xinchen and Guibas, Leonidas},
journal = {arXiv preprint arXiv:2611.22287},
year = {2026}
}
@software{pruna2026pflux2klein4bdwd,
title = {P-Flux-2-Klein-4B-DWD: Decoding Without a Decoder for FLUX.2 [klein] 4B},
author = {{Pruna AI}},
year = {2026},
version = {0.1.0},
url = {https://huggingface.co/PrunaAI/P-Flux-2-Klein-4B-DWD}
}
What's next?
- Use P-Flux-2-Klein-4B-DWD to generate FLUX.2 [klein] 4B images in ComfyUI without the VAE decode.
- Compress your own models with Pruna and give us a ⭐️ for more efficiency!
- Want to use our optimized image models right away? Check P-Image-Ideogram and P-Image-Edit.
Model tree for PrunaAI/P-Flux-2-Klein-4B-DWD-Comfy
Base model
black-forest-labs/FLUX.2-klein-4B![fox, FLUX.2 [klein] 4B with VAE Decode](/PrunaAI/P-Flux-2-Klein-4B-DWD-Comfy/resolve/main/assets/examples/fox_vae.png)

![sign, FLUX.2 [klein] 4B with VAE Decode](/PrunaAI/P-Flux-2-Klein-4B-DWD-Comfy/resolve/main/assets/examples/sign_vae.png)

![ramen, FLUX.2 [klein] 4B with VAE Decode](/PrunaAI/P-Flux-2-Klein-4B-DWD-Comfy/resolve/main/assets/examples/ramen_vae.png)

![lighthouse, FLUX.2 [klein] 4B with VAE Decode](/PrunaAI/P-Flux-2-Klein-4B-DWD-Comfy/resolve/main/assets/examples/lighthouse_vae.png)


