FLUX.2 Klein 4B MLX

MLX builds of FLUX.2 Klein 4B, made by Moonbox for Apple Silicon Macs. Each precision is a folder; keep a folder's files together. Only the parts listed below are converted: the rest of the pipeline comes from the original repository unless the section below says otherwise.

Files

The last column is how far each build is from the original PyTorch model on the same inputs (see the section below for what was measured).

Precision File Size sha256 Checked against the original
bf16 bf16/mflux_model.json 0.4 kB 0def12a5f10e PSNR 27.9 dB mean, LPIPS 0.059 mean / 0.131 worst
bf16 bf16/text_encoder/0.safetensors 2.14 GB f365cdfd5a80 PSNR 27.9 dB mean, LPIPS 0.059 mean / 0.131 worst
bf16 bf16/text_encoder/1.safetensors 2.12 GB 9b37dfd33a49 PSNR 27.9 dB mean, LPIPS 0.059 mean / 0.131 worst
bf16 bf16/text_encoder/2.safetensors 2.12 GB 75d797fdfe8a PSNR 27.9 dB mean, LPIPS 0.059 mean / 0.131 worst
bf16 bf16/text_encoder/3.safetensors 1.66 GB 04ffbd079649 PSNR 27.9 dB mean, LPIPS 0.059 mean / 0.131 worst
bf16 bf16/text_encoder/model.safetensors.index.json 22.9 kB 724e5560ec58 PSNR 27.9 dB mean, LPIPS 0.059 mean / 0.131 worst
bf16 bf16/tokenizer/chat_template.jinja 4.2 kB a55ee1b16601 PSNR 27.9 dB mean, LPIPS 0.059 mean / 0.131 worst
bf16 bf16/tokenizer/tokenizer.json 11.4 MB be75606093db PSNR 27.9 dB mean, LPIPS 0.059 mean / 0.131 worst
bf16 bf16/tokenizer/tokenizer_config.json 0.7 kB 1cc816812993 PSNR 27.9 dB mean, LPIPS 0.059 mean / 0.131 worst
bf16 bf16/transformer/0.safetensors 2.14 GB 9971b085ae8a PSNR 27.9 dB mean, LPIPS 0.059 mean / 0.131 worst
bf16 bf16/transformer/1.safetensors 2.13 GB 25416eed4dd0 PSNR 27.9 dB mean, LPIPS 0.059 mean / 0.131 worst
bf16 bf16/transformer/2.safetensors 2.13 GB f84dac0fcbc0 PSNR 27.9 dB mean, LPIPS 0.059 mean / 0.131 worst
bf16 bf16/transformer/3.safetensors 1.34 GB 2571c79447b3 PSNR 27.9 dB mean, LPIPS 0.059 mean / 0.131 worst
bf16 bf16/transformer/model.safetensors.index.json 11.8 kB c77f891d4e2b PSNR 27.9 dB mean, LPIPS 0.059 mean / 0.131 worst
bf16 bf16/vae/0.safetensors 168.1 MB 6093545b5c2a PSNR 27.9 dB mean, LPIPS 0.059 mean / 0.131 worst
bf16 bf16/vae/model.safetensors.index.json 16.5 kB 009c1b40da60 PSNR 27.9 dB mean, LPIPS 0.059 mean / 0.131 worst
8bit 8bit/mflux_model.json 0.4 kB 03da08e92bd6 PSNR 27.4 dB mean, LPIPS 0.043 mean / 0.060 worst
8bit 8bit/text_encoder/0.safetensors 2.15 GB ee6e995dd726 PSNR 27.4 dB mean, LPIPS 0.043 mean / 0.060 worst
8bit 8bit/text_encoder/1.safetensors 2.13 GB e69e29075860 PSNR 27.4 dB mean, LPIPS 0.043 mean / 0.060 worst
8bit 8bit/text_encoder/model.safetensors.index.json 51.3 kB d5df19188a55 PSNR 27.4 dB mean, LPIPS 0.043 mean / 0.060 worst
8bit 8bit/tokenizer/chat_template.jinja 4.2 kB a55ee1b16601 PSNR 27.4 dB mean, LPIPS 0.043 mean / 0.060 worst
8bit 8bit/tokenizer/tokenizer.json 11.4 MB be75606093db PSNR 27.4 dB mean, LPIPS 0.043 mean / 0.060 worst
8bit 8bit/tokenizer/tokenizer_config.json 0.7 kB 1cc816812993 PSNR 27.4 dB mean, LPIPS 0.043 mean / 0.060 worst
8bit 8bit/transformer/0.safetensors 2.14 GB ee5ebfea47e9 PSNR 27.4 dB mean, LPIPS 0.043 mean / 0.060 worst
8bit 8bit/transformer/1.safetensors 1.98 GB 2261b995e720 PSNR 27.4 dB mean, LPIPS 0.043 mean / 0.060 worst
8bit 8bit/transformer/model.safetensors.index.json 26.9 kB 9836c5a1276b PSNR 27.4 dB mean, LPIPS 0.043 mean / 0.060 worst
8bit 8bit/vae/0.safetensors 166.2 MB f420463341ac PSNR 27.4 dB mean, LPIPS 0.043 mean / 0.060 worst
8bit 8bit/vae/model.safetensors.index.json 17.5 kB 4d629a6165dd PSNR 27.4 dB mean, LPIPS 0.043 mean / 0.060 worst
6bit 6bit/mflux_model.json 0.4 kB 0f4eff83d6ce PSNR 24.7 dB mean, LPIPS 0.067 mean / 0.091 worst
6bit 6bit/text_encoder/0.safetensors 2.14 GB 684846f957ca PSNR 24.7 dB mean, LPIPS 0.067 mean / 0.091 worst
6bit 6bit/text_encoder/1.safetensors 1.13 GB 4d87dc8fdfb0 PSNR 24.7 dB mean, LPIPS 0.067 mean / 0.091 worst
6bit 6bit/text_encoder/model.safetensors.index.json 51.3 kB 2dac44af84b5 PSNR 24.7 dB mean, LPIPS 0.067 mean / 0.091 worst
6bit 6bit/tokenizer/chat_template.jinja 4.2 kB a55ee1b16601 PSNR 24.7 dB mean, LPIPS 0.067 mean / 0.091 worst
6bit 6bit/tokenizer/tokenizer.json 11.4 MB be75606093db PSNR 24.7 dB mean, LPIPS 0.067 mean / 0.091 worst
6bit 6bit/tokenizer/tokenizer_config.json 0.7 kB 1cc816812993 PSNR 24.7 dB mean, LPIPS 0.067 mean / 0.091 worst
6bit 6bit/transformer/0.safetensors 2.14 GB 2be5f7f5673f PSNR 24.7 dB mean, LPIPS 0.067 mean / 0.091 worst
6bit 6bit/transformer/1.safetensors 1.01 GB f66e9db7d6fc PSNR 24.7 dB mean, LPIPS 0.067 mean / 0.091 worst
6bit 6bit/transformer/model.safetensors.index.json 26.9 kB 3a3dc7575022 PSNR 24.7 dB mean, LPIPS 0.067 mean / 0.091 worst
6bit 6bit/vae/0.safetensors 165.6 MB c82ac46128a7 PSNR 24.7 dB mean, LPIPS 0.067 mean / 0.091 worst
6bit 6bit/vae/model.safetensors.index.json 17.5 kB a5a21d176b96 PSNR 24.7 dB mean, LPIPS 0.067 mean / 0.091 worst
4bit 4bit/mflux_model.json 0.4 kB e03e43c4959e below threshold (experimental): PSNR 17.7 dB, LPIPS 0.242 mean / 0.377 worst
4bit 4bit/text_encoder/0.safetensors 2.14 GB cc76abeea8b2 below threshold (experimental): PSNR 17.7 dB, LPIPS 0.242 mean / 0.377 worst
4bit 4bit/text_encoder/1.safetensors 127.6 MB e6d457f7580f below threshold (experimental): PSNR 17.7 dB, LPIPS 0.242 mean / 0.377 worst
4bit 4bit/text_encoder/model.safetensors.index.json 51.3 kB d4a512f2850e below threshold (experimental): PSNR 17.7 dB, LPIPS 0.242 mean / 0.377 worst
4bit 4bit/tokenizer/chat_template.jinja 4.2 kB a55ee1b16601 below threshold (experimental): PSNR 17.7 dB, LPIPS 0.242 mean / 0.377 worst
4bit 4bit/tokenizer/tokenizer.json 11.4 MB be75606093db below threshold (experimental): PSNR 17.7 dB, LPIPS 0.242 mean / 0.377 worst
4bit 4bit/tokenizer/tokenizer_config.json 0.7 kB 1cc816812993 below threshold (experimental): PSNR 17.7 dB, LPIPS 0.242 mean / 0.377 worst
4bit 4bit/transformer/0.safetensors 2.15 GB d1297538e694 below threshold (experimental): PSNR 17.7 dB, LPIPS 0.242 mean / 0.377 worst
4bit 4bit/transformer/1.safetensors 34.7 MB aef39fb6b716 below threshold (experimental): PSNR 17.7 dB, LPIPS 0.242 mean / 0.377 worst
4bit 4bit/transformer/model.safetensors.index.json 26.9 kB 3e43ccc1e3b0 below threshold (experimental): PSNR 17.7 dB, LPIPS 0.242 mean / 0.377 worst
4bit 4bit/vae/0.safetensors 165.1 MB 52affd01aa5b below threshold (experimental): PSNR 17.7 dB, LPIPS 0.242 mean / 0.377 worst
4bit 4bit/vae/model.safetensors.index.json 17.5 kB e396f8330c32 below threshold (experimental): PSNR 17.7 dB, LPIPS 0.242 mean / 0.377 worst

How to run

Each folder is the whole pipeline (Qwen3 text encoder, transformer, VAE, tokenizer) saved by mflux 0.24.0 from the original weights at the revision below. Run it with mflux:

pip install mflux==0.24.0
hf download moonbox-ai/FLUX.2-klein-4B-MLX --include "8bit/*" --local-dir klein
mflux-generate-flux2 --model klein/8bit --base-model flux2-klein-4b --steps 4 --guidance 1.0 \
  --prompt "A red fox in fresh snow at sunrise, photo" --width 1024 --height 1024 --seed 7 --output fox.png

8bit/, 6bit/ and 4bit/ quantize the transformer's and the text encoder's linear layers (MLX affine, group size 64); the VAE stays bf16. There is no fp16 folder: mflux computes in bf16 whatever the weights are.

How they were checked. The pipeline in mflux against diffusers' Flux2KleinPipeline in PyTorch (bf16), started from the same initial noise, 3 prompts at 512x512, 4 steps. Pass: LPIPS <= 0.15 on every prompt. For scale, two different seeds of the PyTorch pipeline are 11.2 dB / LPIPS 0.54 apart.

Precision Size PSNR vs PyTorch (mean) LPIPS (mean / worst) Status
bf16/ 16.0 GB 27.9 dB 0.059 / 0.131 passes
8bit/ 8.6 GB 27.4 dB 0.043 / 0.060 passes
6bit/ 6.6 GB 24.7 dB 0.067 / 0.091 passes
4bit/ 4.6 GB 17.7 dB 0.242 / 0.377 below threshold, experimental: same composition, different details

A 512x512 picture takes about 6 s (4 steps) on an Apple M5 with 24 GB, plus loading.

How these were made

From FLUX.2 Klein 4B at revision e7b7dc27f9: the original weights loaded in MLX and stored as bf16 or fp16, or quantized with MLX's affine quantization (8bit, 6bit, 4bit, group size 64; layers MLX can't quantize, such as convolutions and norms, stay bf16). Every build was checked against the original before upload; the sha256 column above is what the files must hash to.

License

Apache-2.0. These files are a derivative of the original model and carry its license: it is copied in this repository, and it governs your use of these files. The original model card follows unchanged.


Original model card

Teaser Teaser Teaser

The FLUX.2 [klein] model family are our fastest image models to date. FLUX.2 [klein] unifies generation and editing in a single compact architecture, delivering state-of-the-art quality with end-to-end inference in as low as under a second. Built for applications that require real-time image generation without sacrificing quality, and runs on consumer hardware, with as little as 13GB VRAM.

FLUX.2 [klein] 4B is a 4 billion parameter rectified flow transformer capable of generating images from text descriptions and supports multi-reference editing capabilities.

Fully open under Apache 2.0. Our most accessible model runs on consumer GPUs like the RTX 3090/4070. Compact but capable: supports text-to-image, image editing, and multi-reference at quality that punches above its size. Built for local development, edge deployment, and production use.

For more information, please read our blog post.

Key Features

  1. Our fastest distilled model for sub-second image generation.
  2. Best suited for interactive workflows, production deployments, and latency-critical applications.
  3. Text-to-image and image-to-image multi-reference editing in a single unified model.
  4. Runs on consumer GPUs (~13GB VRAM).
  5. Open weights available for commercial use under the Apache 2.0 license.

Usage

We provide a reference implementation of FLUX.2 [klein] 4B, as well as sampling code, in a dedicated GitHub repository. Developers and creatives looking to build on top of FLUX.2 [klein] 4B are encouraged to use this as a starting point.

API Endpoints

The FLUX.2 [klein] 4B model is available via the BFL API:

FLUX.2 [klein] 4B is also available in both ComfyUI and Diffusers.

Using with Diffusers ๐Ÿงจ

To use FLUX.2 [klein] 4B with the ๐Ÿงจ Diffusers python library, first install or upgrade diffusers:

pip install git+https://github.com/huggingface/diffusers.git

Then you can use Flux2KleinPipeline to run the model:

import torch
from diffusers import Flux2KleinPipeline

device = "cuda"
dtype = torch.bfloat16

pipe = Flux2KleinPipeline.from_pretrained("black-forest-labs/FLUX.2-klein-4B", torch_dtype=dtype)
pipe.enable_model_cpu_offload()  # save some VRAM by offloading the model to CPU

prompt = "A cat holding a sign that says hello world"
image = pipe(
    prompt=prompt,
    height=1024,
    width=1024,
    guidance_scale=1.0,
    num_inference_steps=4,
    generator=torch.Generator(device=device).manual_seed(0)
).images[0]
image.save("flux-klein.png")

Limitations

  • This model is not intended or able to provide factual information.
  • While the model can output text, text rendered may be inaccurate or subject to distortion.
  • As a statistical model, this checkpoint may represent or amplify biases observed in the training data.
  • The model may fail to generate output that matches the prompts.
  • Prompt following is heavily influenced by the prompting style.

Out-of-Scope Use

The model and its derivatives may not be used:

  • In any way that violates applicable law.
  • For the purpose of exploiting, harming or attempting to exploit or harm minors in any way; including but not limited to the solicitation, creation, acquisition, or dissemination of child exploitative content.
  • To generate or disseminate deceptive, fraudulent, misleading or otherwise harmful content.
  • To generate or disseminate personal identifiable information that can be used to harm an individual.
  • To harass, abuse, threaten, stalk, or bully individuals or groups of individuals.
  • To create non-consensual intimate imagery or illegal pornographic content.
  • For fully automated decision making or high risk applications that adversely impact an individual's legal rights or otherwise create or modify a binding, enforceable obligation.

Nothing contained in this Model Card should be interpreted as or deemed a restriction or modification to the license the model is released under.

Hardware

The FLUX.2 [klein] 4B model fits in ~13GB VRAM and is accessible on NVIDIA RTX 3090/4070 and above.


Responsible AI Development

Black Forest Labs is committed to the responsible development and deployment of our models. Prior to releasing the FLUX.2 family of models, we evaluated and mitigated a number of risks in our model checkpoints and hosted services, including the generation of unlawful content, including child sexual abuse material (CSAM) and nonconsensual intimate imagery (NCII). We implemented a series of pre-release mitigations to help prevent misuse by third parties, with additional post-release mitigations to help address residual risks:

  1. Pre-training mitigation. We filtered pre-training data for multiple categories of "not safe for work" (NSFW) and known child sexual abuse material (CSAM) to help prevent a user generating unlawful content in response to text prompts or uploaded images. We have partnered with the https://www.iwf.org.uk/, an independent nonprofit organization dedicated to preventing online abuse, to filter known CSAM from the training data.
  2. Post-training mitigation. Subsequently, we undertook multiple rounds of targeted fine-tuning to provide additional mitigation against potential abuse, including both text-to-image (T2I) and image-to-image (I2I) attacks. By inhibiting certain behaviors and suppressing certain concepts in the trained model, these techniques can help to prevent a user generating synthetic CSAM or NCII from a text prompt, or transforming an uploaded image into synthetic CSAM or NCII.
  3. Ongoing evaluation. Throughout this process, we conducted multiple internal and external third-party evaluations of model checkpoints to identify further opportunities for mitigation. External third-party evaluations focused on eliciting CSAM and NCII through adversarial testing with (i) text-only prompts, (ii) a single uploaded reference image with text prompts, and (iii) multiple uploaded reference images with text prompts. Based on this feedback, we conducted further safety fine-tuning to produce our open-weight FLUX.2 [klein] models.
  4. Release decision. After safety fine-tuning and prior to release, we conducted a final third-party evaluation of the proposed release checkpoints, focused on T2I and I2I generation of synthetic CSAM and NCII, including a comparison with other open-weight T2I and I2I models. The final FLUX.2 [klein] checkpoints demonstrated high resilience against violative inputs in complex generation and editing tasks, and demonstrated higher resilience than leading open-weight models across these risk categories. Based on these findings, we approved the release of the open-weight FLUX.2 [klein] 4B models under an Apache 2.0 license and the release of the FLUX.2 [klein] 9B models under a non-commercial license to support third-party research and development.
  5. Inference filters. The repository for the FLUX.2 [klein] models includes filters for NSFW and protected content in inputs and outputs. Filters or manual review must be used with the FLUX.2 [klein] 9B models under the terms of the FLUX Non-Commercial License, and we encourage deployers to implement these mitigations when using the FLUX.2 [klein] 4B models. Where we implement these features on our own hosted services, we may apply multiple filters to intercept text prompts, uploaded images, and output images. We utilize both in-house and third-party filters to mitigate against harmful outputs, such as CSAM and NCII outputs, including filters provided by https://thehive.ai/ and https://www.microsoft.com/.
  6. Content provenance. Content provenance features can help users and platforms better identify, label, and interpret AI-generated content online. The inference code for FLUX.2 [klein] implements an example of pixel-layer watermarking. Additionally, this repository includes links to the https://c2pa.org/ standard for metadata. The API for FLUX.2 [klein] applies cryptographically-signed C2PA metadata to downloaded output content to indicate that images were produced with our model.
  7. Policies. Acceptable use of our models and access to our API are governed by policies set out in applicable documentation, including FLUX Non-Commercial License (for our non-commercial open-weight users); Developer Terms of Service, Self-Hosted Commercial License Terms, and Usage Policy (for our commercial open-weight model users); and Developer Terms of Service, FLUX API Service Terms, and Usage Policy (for our API users). These prohibit the generation of unlawful content or the use of generated content for unlawful, defamatory, or abusive purposes.
  8. Safety. Black Forest Labs takes model safety seriously. We provide a dedicated email address (safety@blackforestlabs.ai) to solicit feedback from the community. We maintain a reporting relationship with organizations such as the https://www.iwf.org.uk/ and the https://www.missingkids.org/, and welcome ongoing engagement with authorities, developers, and researchers to share intelligence about emerging risks and develop effective mitigations.

License

This model is licensed under the https://www.apache.org/licenses/LICENSE-2.0.

Trademarks & IP

This project may contain trademarks or logos for projects, products, or services. Use of Black Forest Labs and FLUX trademarks or logos in modified versions of this project must not cause confusion or imply sponsorship or endorsement. Any use of third-party trademarks, intellectual property or logos are subject to those third-party's policies.

Downloads last month

-

Downloads are not tracked for this model. How to track
MLX
Hardware compatibility
Log In to add your hardware

Quantized

Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for moonbox-ai/FLUX.2-klein-4B-MLX

Quantized
(78)
this model