OpenFlowLM-Next icon indicating copy to clipboard operation
OpenFlowLM-Next copied to clipboard

Run quantized (Q4/Q8) FLUX.2 [klein] GGUFs natively on the NPU

Open Cyronius opened this issue 2 months ago • 0 comments

The problem

Most FLUX.2 [klein] GGUF files people share are quantized: their weights are stored as 4-bit (Q4) or 8-bit (Q8) numbers to make them smaller.

Our NPU image engine (#127) can't use those numbers directly. Its kernels only read one format, bfp16, which has more precision than Q4 or Q8. So today a Q4 GGUF could only be expanded back to bfp16 before running. That would give:

  • Q4's quality: the precision lost when the file was made doesn't come back;
  • bfp16's speed and memory use: nothing gained from the smaller file.

In other words, the worst of both.

What this issue is about

Kernels that work on quantized weights directly, so a Q4 or Q8 klein runs at its own precision.

What we'd hope to gain, and what's unclear

  • Smaller downloads and less memory: very likely. The packed weights are about 7.5 GB today. A Q4 version would be around a third of that.
  • Faster images: unclear, and possibly none.
    • At these image sizes, most of the time goes to arithmetic, not to reading weights.
    • Smaller weights only help if the kernels also do their math in lower precision.
    • This needs measuring before we promise it.
  • Quality: needs checking against our "not broken" bar. Images may drift, but must stay coherent, with legible text.

Needs to happen first

  • #127: the image model itself.
  • GGUF support (#14), so there's a way to read these files at all.

Done when

A Q4 (and/or Q8) klein GGUF runs on the NPU at its own precision, and we know three things:

  • how its speed compares with the bfp16 version;
  • how its memory use compares;
  • whether its images still pass the quality bar.

Cyronius avatar Sep 27 '26 20:09 Cyronius