FLUX.1-schnell β€” PRIME-Quant (100% V3_P4_0, Zero CPU Offload)

A 100% 4-bit Prime-Harmonic (V3_P4_0) quantization of FLUX.1-schnell (12B MMDiT + 4.76B T5-XXL, upstream Apache-2.0) built with PRIME-Quant (@batteryphil).

Compresses the entire ~33.7 GB BF16 FLUX.1-schnell text-to-image stack down to 9.37 GB on disk (3.60Γ— compression) β€” running 100% GPU-resident with zero CPU offload (9.49 GB resident VRAM, 11.01 GB peak at 1024Γ—1024) on a single 16 GB AMD Radeon RX 9060 XT (ROCm 7.2) or 12–16 GB NVIDIA CUDA GPU.


Verified Benchmark Results (AMD RX 9060 XT 16 GB, ROCm 7.2)

All measurements freshly executed at 1024Γ—1024, 4 steps, identical 512px-tiled BF16 AutoencoderKL (benchmarks/flux_schnell_bf16_vs_prime_benchmark.json):

Metric BF16 Baseline (Sequential CPU Offload) PRIME-Quant (100% V3_P4_0, Zero CPU Offload)
Compressed Weights on Disk ~33.7 GB 9.37 GB (2.68 GB T5-XXL + 6.69 GB 12B MMDiT β€” 3.60Γ— smaller)
Quantized Linear Coverage 0 / 671 671 / 671 (100%) (169/169 T5-XXL + 502/502 MMDiT)
Total GPU-Resident Footprint Cannot fit on 16 GB 9,493.5 MB (T5-XXL + 12B DiT + CLIP-L + VAE all resident)
Peak PyTorch VRAM (1024Γ—1024) 1,589.4 MB (per-layer CPU swap) 11,005.8 MB (zero CPU offload!)
Warm Time / 1024Γ—1024 Image 19.92 s (181.38 s cold #1) 9.24 s (2.16Γ— faster) (2.4 s for all 4 MMDiT steps)
6-Prompt Parity (BF16 vs. P4_0) Reference 18.94 dB mean PSNR / 0.7097 SSIM (up to 23.88 dB / 0.8678)

Visual Parity (Left = 33.7 GB BF16 Teacher, Right = 9.37 GB 100% PRIME-Quant V3_P4_0)

FLUX.1-schnell 6-Prompt BF16 vs PRIME-Quant Overview FLUX.1-schnell Engraved Brass Typography BF16 vs PRIME-Quant

Multi-aspect stress tests (768Γ—1344 vertical 9:16, 1344Γ—768 panoramic 16:9, engraved brass typography 'PRIME QUANT 2026', architectural blueprint 'STAGE 4') all pass cleanly with zero tile seams or drift (benchmarks/stress/).


Quantization Architecture Highlights

  1. 100% V3_P4_0 Group-32 Prime-Harmonic Codebook: Zero BF16 weights left in either T5-XXL (22.54 dB mean weight SNR) or the 12B FluxTransformer2DModel (22.53 dB mean block SNR).
  2. Verified Exact Zero-Overhead H_64 / H_128 Per-Head Walsh-Hadamard Rotations:
    • T5-XXL: exact H_64 on sa.v <-> sa.o across all 24 blocks + on-the-fly FP32 unpack protection on wo (0 extra VRAM).
    • FLUX.1-schnell 19 Dual-Stream blocks: exact joint-attention H_128 on to_v / add_v_proj <-> to_out.0 / to_add_out (verified 51.8 / 53.0 dB BF16 rotation invariance).
    • FLUX.1-schnell 38 Single-Stream blocks: exact H_128 on attn.to_v <-> proj_out[:, :3072] (verified 58.4 / 58.1 dB BF16 rotation invariance).
  3. Kronecker PRIMAL Conditioning Alignment:
    • time_text_embed (timestep + CLIP-L pooled projection): 46.12 dB validation SNR.
    • Co-Adapted context_embedder: aligns all 256 unmasked tokens (active + pad) from 4-bit T5-XXL straight onto the BF16 Teacher context_embedder manifold (5.13 dB -> 10.16 dB all-token / 12.80 dB active-token SNR).

Quickstart (Standalone β€” Zero Extra Repos Required)

pip install -r requirements.txt

# On AMD RDNA4 (RX 9060 XT / 9070 XT ROCm 7.x), enable experimental AOTriton SDPA:
TORCH_ROCM_AOTRITON_ENABLE_EXPERIMENTAL=1 \
python run_flux_schnell_prime.py \
    --prompt "Macro studio photograph of a polished brass plaque cleanly engraved with 'PRIME QUANT 2026' on dark walnut wood" \
    --width 1024 --height 1024 --steps 4 --seed 101 \
    --output prime_plaque.png

run_flux_schnell_prime.py automatically downloads only the tiny lightweight config, tokenizers, CLIP-L (246 MB), and VAE (168 MB) from unsloth/FLUX.1-schnell (ungated Apache-2.0) β€” it never downloads the 33.7 GB BF16 weights.


Licensing & Attribution

  • PRIME-Quant checkpoints & standalone runtime (prime_infer_runtime.py, run_flux_schnell_prime.py): Copyright (c) 2026 Philip Bartsch (@batteryphil), licensed under the Bartsch Personal-Free & 5% Commercial Profit-Share License v1.0 (free for personal, research, academic, and non-profit use).
  • Upstream Base Model (FLUX.1-schnell): Apache License 2.0 by Black Forest Labs β€” see NOTICE.
Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for batteryphil/FLUX.1-schnell-PRIME-Quant

Quantized
(55)
this model