# ✨ FLUX 3 Image Klein – Native RGBA Transparent Layer LoRA
Generate **true 4-channel transparent PNGs (RGBA)** directly from text prompts with **FLUX 3 Image Klein (5.6B)** no background removal post-processing rembg / BiRefNet) required!
Instead of generating a flat RGB image and guessing a mask afterward, this LoRA shifts **FLUX 3 Image Klein** into the native 4-channel RGBA latent space of the **AlphaVAE AutoencoderKLFlux2 4-channel RGBA VAE)**, allowing the diffusion model to natively synthesize clean alpha silhouettes, crisp cutouts, and soft edge transitions directly during sampling.
---
## 🔧 Required Components (Important!)
Because standard VAEs only decode 3 channels (RGB), **you MUST use the 4-channel RGBA VAE and the RGBA Decode nodes** to get the alpha channel:
1. **LoRA:** flux3_klein_transparent_lora.safetensors (place in ComfyUI/models/loras/)
2. **4-Channel RGBA VAE:** flux2_3_rgba_vae.safetensors](https://huggingface.co/trmz/flux2-klein-alpha/resolve/main/vae/diffusion_pytorch_model.safetensors) (place in ComfyUI/models/vae/ — auto-downloads automatically if enabled in the loader node)
3. **ComfyUI Custom Nodes:** *denrakeiw_nodes**
🔧 Flux 2/3 RGBA VAE Loader DRE
🔍 Flux 2/3 RGBA VAE Decode DRE
* 👁️ Preview Transparent Image (Checkerboard / White / Black preview)
* 💾 Save Transparent Image (Saves true 32-bit RGBA PNGs)
---
## ⚡ Trigger Words & Prompting Tips
Include one or more of the following phrases at the beginning or end of your prompt:
* *RGBA transparent background, isolated foreground object** (recommended full trigger)
* *transparent background**
**Example Prompt:**
> RGBA transparent background, isolated foreground object, a cute 3D glossy red toy robot holding a golden star, studio lighting, transparent background.
---
## ⚙️ Recommended Settings in ComfyUI
This LoRA works with **both** the fast distilled/quantized **FLUX 3 Image Klein** models and the undistilled **FLUX 3 Image Klein Base** model:
### Option A: Fast Distilled / Quantized flux3-image-klein-bf16 / flux3-image-klein-int8-convrot)
* **LoRA Strength:** 0.95 – 1.00
* **Steps:** 8 (or 4 – 8)
* **CFG:** 1.0
* **Sampler / Scheduler:** euler / simple
* **Resolution:** 1024x1024 (or 512x512 – 1024x1024 via EmptyFlux2LatentImage)
### Option B: Base Model flux3-image-klein-base-bf16)
* **LoRA Strength:** 1.00
* **Steps:** 20 – 25
* **CFG:** 3.5 – 4.0
* **Sampler / Scheduler:** euler / simple
---
## 🧠 Training & Technical Details
* **Base Architecture:** Trained on flux3-image-klein-base-bf16.safetensors (5.6B, 3072 hidden dim, 5 early mode blocks + 28 joint single-stream blocks) + f3_qwen3vl_4b.safetensors CLIPType.FLUX3).
* **Network Rank / Alpha:** Rank 32 / Alpha 32 across **203 linear layers** (62.9M trainable parameters), including emb_in.image 128 -> 3072), content_mode_blocks.image.0..4, single_blocks.0..27, and final_layer.image.linear 3072 -> 128).
* **Latent Space:** Premultiplied RGBA [0, 0, 0, 0] background) encoded into the 128-channel packed AutoencoderKLFlux2 RGBA latent space.
* **Loss Function:**
* **128-Channel Alpha-Sensitivity Weighting:** Per-channel Jacobian weighting boosting latent channels that control the decoder's 4th (Alpha) channel 3.0x boost).
* **Edge-Weighted Flow-Matching Loss:** 3.0x spatial weight on object boundaries and semi-transparent transition pixels.
* **Spatial Gradient Sharpness Loss:** Preserves crisp cutout silhouettes without dark halos.
* **Dataset:** 800 curated multi-style RGBA layers from PrismLayersPro (3D renders, designer toys, anime, cartoons, watercolor paintings, steampunk assets).
---
## 🙏 Credits & Acknowledgements
* **RGBA VAE AutoencoderKLFlux2 4-channel):** Adapted by **Xavier Jara** ([Teaching a FLUX.2 VAE to See Transparency / trmz/flux2-klein-alpha](https://tr-mz.github.io/papers/flux2-klein-alpha/)), following the [AlphaVAE (Wang et al., 2025)](https://arxiv.org/abs/2507.09308) method (Apache-2.0 License).
* **Dataset Source:** [PrismLayersPro](https://huggingface.co/datasets/artplus/PrismLayersPro).
* **ComfyUI Nodes & FLUX 3 Klein LoRA Training:** **DenRakEiw denrakeiw_nodes)**.









