Repository navigation
Default to measured improvements over the paper; fused pre-rotation; Lloyd-Max v3; Vulkan W4A8 - #25
Merged
Merged
Conversation
…Lloyd-Max v3; Vulkan W4A8 (0.17.0) - Defaults: rotation_rounds="auto" (an independent RPBH round in front of the paper round where the block h < 512) and activation_quantizer="auto" (absmax INT8 at 8 activation bits, Lloyd-Max below). recipe(name, paper=True) and PAPER_FIELDS pin the paper method as the baseline. Artifacts without these fields load as one round and Lloyd-Max codes. - Z-Image-Turbo, 10 prompts x 3 seeds, LPIPS against BF16: W4A4 0.348 with the defaults against 0.438 with the paper fields (better on 27 of 30 pairs); W4A8 absmax 0.331, equal to 8-bit Lloyd-Max (0.330) at 3.4-6.6x less GEMM time on an RTX 4090. - output_gain_correction stays off: it raised LPIPS at W2A4 (+0.016, 95% interval +0.004 to +0.029) and lowered it at no tested width, although it lowers layer output error. - Pre-rotation for rotation_rounds 2/"auto" runs as one Triton kernel on CUDA and one Metal kernel on MPS (was PyTorch), and on the fused block runtime and Krea 2. - Lloyd-Max codebook generator v3 (Newton solver, codebook_version 3): 8-bit tables in about 0.1 s per width up to d = 30720; v2 did not converge for d >= 7680. - ExecuTorch Vulkan W4A8 absmax path: rpbh_a8, absmax_a8 and w4a8 shaders, ExecuTorchVulkanW4A8Linear, register_executorch_vulkan_w4a8(); the pre-rotation is exported as a dense block-Hadamard matmul. Verified on Mesa lavapipe only. - README and audits: FLUX.1-dev GenEval subset (W4A4 0.641, BF16 0.615) and CogVideoX-2B VBench subset (the extra round gives no measurable gain at W4A6 and costs 7% time). Version 0.17.0.
0.16.0 was never tagged or published (the latest release is 0.15.0), so this work ships under the same version.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #22. An option becomes the default when it beats the paper recipe on quality, efficiency or speed without losing on the others. The paper method stays available as the baseline:
recipe(name, paper=True)/PAPER_FIELDS.Default changes
rotation_rounds1"auto": adds an independent RPBH round where the blockh < 512activation_quantizer"lloyd_max""auto": absmax INT8 at A8, Lloyd-Max belowcodebook_version23(Newton solver)Artifacts without the new fields still load as one round with Lloyd-Max codes (
from_dictsetdefault).Unchanged on purpose:
output_gain_correctionstaysFalse. It lowers layer output error but raised image LPIPS at W2A4 (+0.016, +0.004 to +0.029, worse on 24 of 30 pairs) and lowered it at no tested width.adaln_scale="mse"stays off (see AdaLN detection by parent class; opt-in rotation, absmax A8, gain and outlier options (0.16.0) #22).outlier_channelsis still not supported on the fused or streaming paths. Its image-level effect stayed within noise, so a side GEMM in the fused kernels is not worth adding.Runtime work
rpbh_a8,absmax_a8,w4a8;ExecuTorchVulkanW4A8Linearandregister_executorch_vulkan_w4a8();.pterun yet.Benchmark subsets (2026-10-29)
These are not full-benchmark reproductions.
FLUX.1-dev, GenEval: 96 prompts × 2 seeds, official evaluator. Default W4A4 equals paper W4A4 here, because every block is ≥ 1024.
CogVideoX-2B, VBench W4A6: 12 prompts, 8 custom-input dimensions. Default (2 rounds at d = 1920) and paper settings differ by less than the pair spread on every dimension and on frame LPIPS. The default took 7% longer. The README now advises
rotation_rounds=1for such models when speed matters.Checks
scripts/run_paper_methodology_checks.shrc=0Version stays 0.16.0, which is not released yet. Not published to PyPI.