CoolFace
Modelpublic

vistralis/FLUX.2-klein-4b-INT8-transformer-quants

sourceHugging Faceapache-2.0updated 7mo agoView on Hugging Face
1likes120downloads
Model Card

FLUX.2-klein-4b-INT8-transformer-quants

INT8 (W8A8) quantization variants for FLUX.2-klein-4B (step-distilled 4B parameters).

This repository contains multiple INT8 quantization variants for experimentation and comparison.

Status: Static/Max variants (int8-per-row, int8-per-tensor) are available now. SmoothQuant variants are pending and will be added when ready.
VariantAlgorithmScale ModeStatusCheckpoint
int8-per-rowstaticper-row✅ Availableflux-2-klein-4b-int8-per-row.safetensors
int8-per-tensorstaticper-tensor✅ Availableflux-2-klein-4b-int8-per-tensor.safetensors
int8-smoothquant-per-rowsmoothquantper-row🔜 Pendingflux-2-klein-4b-int8-smoothquant-per-row.safetensors
int8-smoothquant-per-tensorsmoothquantper-tensor🔜 Pendingflux-2-klein-4b-int8-smoothquant-per-tensor.safetensors

Quantization Details

All variants use NVIDIA TensorRT Model Optimizer (ModelOpt) INT8 (W8A8) quantization:

PropertyValue
FrameworkNVIDIA ModelOpt
Calibration768 prompts (256 T2I, 256 editing, 256 composition), 4 steps each
Weight QuantizationINT8 symmetric — per-row or per-tensor depending on variant
Activation QuantizationDynamic per-row (quantized on-the-fly at inference, one scale per token)
Preserved LayersEmbedder layers (timeembed, contextembedder, x_embedder) and output projection kept in BF16

Algorithm × Scale Mode

**Per-Row****Per-Tensor**
Static (Max)int8-per-row ✅int8-per-tensor ✅
SmoothQuantint8-smoothquant-per-row 🔜int8-smoothquant-per-tensor 🔜

Algorithm:

  • —Static (Max): Standard INT8 quantization with calibrated min/max ranges
  • —SmoothQuant (pending): Migrates quantization difficulty from activations to weights for better accuracy

Scale Mode:

  • —Per-Row: Independent scale per output channel (finer granularity, higher accuracy)
  • —Per-Tensor: Single scale per tensor (faster, lower memory, slightly reduced accuracy)
Note: In all variants, input activations are always quantized dynamically per-row at inference time (one scale per token). The scale mode above refers to the weight quantization granularity.

Evaluation Results

Compared against BF16 baseline using identical prompts, seeds, and resolution.

Overall Metrics

VariantCLIP ↑LPIPS ↓PSNR ↑MSE ↓FID ↓
BF16 (baseline)0.6518————
FP8 (reference)0.65220.035627.60210.1422.94
int8-per-row0.65260.025329.23142.2715.76
int8-per-tensor0.65170.044726.25254.5524.83
int8-smoothquant-per-row—————
int8-smoothquant-per-tensor—————

Text-to-Image

VariantCLIP ↑LPIPS ↓PSNR ↑
FP8 (reference)0.64520.048024.43
int8-per-row0.64580.034325.89
int8-per-tensor0.64660.062123.23
int8-smoothquant-per-row———
int8-smoothquant-per-tensor———
Dramatic chiaroscuro portrait of a cellist mid-performance, single spotlight from above, instrument bow caught in motion blur, concert hall darkness

[image]

Stained glass window design depicting the four elements, lead came outlines, rich jewel tones of ruby, sapphire, emerald, and topaz

[image]

Editing

VariantCLIP ↑LPIPS ↓PSNR ↑
FP8 (reference)0.64670.017832.28
int8-per-row0.64650.015033.69
int8-per-tensor0.64470.025630.21
int8-smoothquant-per-row———
int8-smoothquant-per-tensor———
Base: A bicycle leaning against a stone wall in a village Edit: Transform the village into an underwater coral reef scene, the bicycle covered in barnacles and sea anemones, fish swimming around

[image]

[image]

Base: A food truck parked on a city street at noon Edit: Change the street to a Venice canal with the food truck floating on a gondola platform, evening golden hour lighting

[image]

[image]

Composition

VariantCLIP ↑LPIPS ↓PSNR ↑
FP8 (reference)0.66490.041026.08
int8-per-row0.66540.026728.10
int8-per-tensor0.66380.046525.32
int8-smoothquant-per-row———
int8-smoothquant-per-tensor———
Create a zen garden where the raked sand patterns flow into and around a giant ramen bowl as the central stone

[image]

[image]

A clockwork mechanical wolf made of brass gears howling at the full moon on the snowy ridge, steam rising from its joints

[image]

[image]

Usage

🚧 Code release coming soon. A pip-installable loader library is in preparation.

In the meantime, these checkpoints can be tested with ComfyUI using the ComfyUI-Flux2-INT8 custom node. Per-row quantization support is available via PR #24.

Technical Details

PropertyValue
Base ModelFLUX.2-klein-4B
Parameters4B
QuantizationINT8 (W8A8) via NVIDIA ModelOpt
Calibration768 prompts (256 per task), 4 steps each
Activation QuantizationDynamic per-row (quantized on-the-fly at inference)
Preserved LayersEmbedder layers and output projection kept in BF16
Inference Steps4
Guidance Scale1.0

License

This model inherits the license from the base model: [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0).