Downloads · 30 days
63
13% of all-time downloads
vistralis/FLUX.2-klein-base-4b-INT8-transformer
FLUX.2-klein-base-4b-INT8-transformer is a text-to-image model from vistralis. Use it when you need an image from a text prompt. It is set up for diffusers. The card lists the license as apache-2.0.
Quantized transformer checkpoint for [FLUX.2 [klein] 4B](https://huggingface.co/black-forest-labs/FLUX.2-klein-base-4B) (base).
Downloads · 30 days
63
13% of all-time downloads
All-time downloads
489
Public
Repo size
4.1 GB
Likes
1
Public
Click a slice to open those files.
.safetensors4.1 GB · 100%
From the Hugging Face model README
Quantized transformer checkpoint for FLUX.2 [klein] 4B (base).
INT8 weight and activation quantization via NVIDIA ModelOpt with calibrated input scales.
Note: This repo contains only the quantized transformer weights. The text encoder, VAE, tokenizer, and scheduler are loaded from the base model:
black-forest-labs/FLUX.2-klein-base-4B.
| Property | Value |
|---|---|
| Base Model | black-forest-labs/FLUX.2-klein-base-4B |
| Parameters | 4B |
| Quantization Format | INT8 (W8A8) |
| Quantization Type | Weight + Activation (W8A8) |
| Compression | ~2x vs BF16 |
| Weight dtype | int8 |
| Scale dtype | float32 |
| Key format | Single-file safetensors |
| Checkpoint | flux-2-klein-base-4b-int8.safetensors |
| Property | Value |
|---|---|
| Framework | NVIDIA TensorRT Model Optimizer (ModelOpt) |
| Calibration Method | NVIDIA ModelOpt max (per-channel max abs) |
| Calibration Dataset | 256 samples from 768 diverse prompts (256 T2I, 256 editing, 256 composition) |
| Denoising Steps (calibration) | 50 per sample |
| Weight Quantization | Per-channel symmetric (axis=0) |
| Activation Quantization | Per-tensor via baked input_scale / weight_scale tensors |
| Preserved Layers | Embedder layers (time_embed, context_embedder, x_embedder) and output projection kept in BF16 |
Evaluated on 48 prompts (T2I (16 each), editing (16 each), composition (16 each)). Both BF16 baseline and INT8 outputs are generated with identical prompts and seeds, then scored independently.
<details> <summary><strong>📊 Understanding the Metrics</strong></summary>We report two categories of metrics:
Text-Image Alignment — measures output quality independently:
Fidelity — measures how closely the quantized output matches the BF16 baseline:
CLIP score measures how well the generated image matches the text prompt (higher = better). Both models are evaluated independently:
| Model | CLIP Score |
|---|---|
| BF16 (baseline) | 0.6423 |
| INT8 | 0.6423 |
These metrics measure how closely the quantized output matches the BF16 reference:
| Metric | Value | Description |
|---|---|---|
| LPIPS ↓ | 0.1012 | Perceptual distance (0 = identical) |
| PSNR ↑ | 21.40 dB | Signal-to-noise ratio |
| FID ↓ | 42.91 | Distribution distance |
| Task | CLIP ↑ | LPIPS ↓ | PSNR ↑ |
|---|---|---|---|
| Text-to-Image | 0.6495 | 0.0700 | 22.36 dB |
| Editing | 0.6322 | 0.1424 | 20.11 dB |
| Composition | 0.6453 | 0.0912 | 21.74 dB |
Black Forest Labs officially provides FP8 quantized checkpoints for FLUX.2 Klein. However, FP8 (float8_e4m3fn) requires hardware support introduced with NVIDIA Ada Lovelace (RTX 40-series / L4 / L40). INT8 offers a quantized alternative at the same ~2× compression ratio for GPUs that lack native FP8 support (e.g., Ampere, Turing, or non-NVIDIA hardware with INT8 acceleration).
The table below compares both formats against the same BF16 baseline (CLIP 0.6423), evaluated with identical prompts and seeds:
| Metric | INT8 | FP8 |
|---|---|---|
| CLIP ↑ | 0.6423 | 0.6434 |
| LPIPS ↓ | 0.1012 | 0.1187 |
| PSNR ↑ | 21.40 dB | 20.09 dB |
| FID ↓ | 42.91 | 56.83 |
| Task | INT8 CLIP ↑ | FP8 CLIP ↑ | INT8 LPIPS ↓ | FP8 LPIPS ↓ | INT8 PSNR ↑ | FP8 PSNR ↑ |
|---|---|---|---|---|---|---|
| Text-to-Image | 0.6495 | 0.6499 | 0.0700 | 0.1082 | 22.36 dB | 20.03 dB |
| Editing | 0.6322 | 0.6358 | 0.1424 | 0.1195 | 20.11 dB | 20.36 dB |
| Composition | 0.6453 | 0.6444 | 0.0912 | 0.1283 | 21.74 dB | 19.87 dB |
All images generated with identical prompts and seeds (50 denoising steps, 1024×1024).
"Oil painting of a stormy seascape in the style of J.M.W. Turner, violent waves crashing against rocks, ship barely visible in mist, thick impasto texture"

Base: "A red sports car parked in a garage" Edit: "Change the car color to yellow and make the garage look like a futuristic space hangar"

Ref 1: "A weathered bronze statue of a Greek philosopher" Ref 2: "A lush tropical rainforest canopy" Compose: "The statue is being reclaimed by the jungle, with vines and flowers growing over its features"

<table> <tr><th>Model</th><th>Steps</th><th>Eager</th><th>Compiled</th><th>Throughput</th><th>VRAM</th></tr> <tr><td>klein-4b</td><td>4</td><td>1.77s</td><td>0.72s</td><td>1.387 img/s</td><td>11.25 GB</td></tr> <tr style="background-color: rgba(128,128,128,0.15);"><td><strong>klein-base-4b ◂</strong></td><td><strong>50</strong></td><td><strong>33.25s</strong></td><td><strong>9.92s</strong></td><td><strong>0.101 img/s</strong></td><td><strong>11.26 GB</strong></td></tr> <tr><td>klein-9b</td><td>4</td><td>3.04s</td><td>1.09s</td><td>0.917 img/s</td><td>20.15 GB</td></tr> <tr><td>klein-base-9b</td><td>50</td><td>62.49s</td><td>18.70s</td><td>0.053 img/s</td><td>20.16 GB</td></tr> </table>Measured on NVIDIA RTX 5090 with PyTorch 2.10.0+cu130 and CUDA 13.0. Full INT8 stack (INT8 transformer + INT8 text encoder). Resolution: 1024×1024.
torch.compilespeedup: 2.5× (klein-4b), 3.4× (klein-base-4b), 2.8× (klein-9b), 3.3× (klein-base-9b)Why the large speedup? Our pipeline loads INT8 weights using TorchAO, which represents linear layers as W8A8 quantized tensors. In eager mode, each quantized matmul dispatches separate CUDA kernels for dequantization and computation. With
torch.compile, the full graph is traced and these operations are fused into optimized Triton kernels that perform dequantize + matmul in a single pass, eliminating kernel launch overhead and intermediate memory traffic.
🚧 Code release coming soon. A pip-installable loader library is in preparation.
This checkpoint uses the official FLUX.2 single-file safetensors format — the same key layout and structure used by Black Forest Labs for their official FP8 and NVFP4 quantized models. Any loader that supports quantized FLUX.2 single-file checkpoints can load this INT8 checkpoint.
This model inherits the license from the base model: Apache 2.0.