Zum Inhalt springen
Node packÜberprüftExtern
Quelle öffnen

ComfyUI-AsymQuantSampler

Stepwise asymmetric quantization for flow matching models. Use low-bit models for early denoising steps and high-bit models for later steps — with no quality loss.

Betreuer@lee09lee26UnratedBewertung

Paketprofil

Status
Überprüft
Verleger
@lee09lee26
Quelle
GitHub

README

ComfyUI-AsymQuantSampler

Stepwise Asymmetric Quantization for Flow Matching Models

Paper ComfyUI License: MIT

Use a lightweight low-bit model (e.g., Q2_K) for early denoising steps and switch to a high-quality model (e.g., Q5_1) for later steps — with no quality loss. Our research shows the first 3 steps of FLUX.1-dev are robust to extreme quantization (2.5-bit), producing images that match or exceed 8-bit quality.

TL;DR: Early denoising steps don't need precision. Save compute by using a tiny model for steps 1–3, then switch to a quality model for the rest.

Overview

Key Findings

Our paper evaluates 2,000 images across 8 GGUF quantization levels on FLUX.1-dev and finds:

  1. Steps 1–3 are quantization-robust. Replacing them with a 2.5-bit model (Q2_K) preserves full image quality (Quality Score 0.0308 vs Q8_0's 0.0306; ImageReward 1.291 vs 1.252).

  2. Reference-based metrics are misleading for model switching. LPIPS and FID measure trajectory divergence, not quality degradation. Configs with FID=62.3 achieve quality matching 8-bit baselines.

  3. CLIP Score is invariant to quantization. Semantic composition is preserved even at 2-bit precision (0.358–0.362 across all levels).

ConfigurationQuality ScoreImageRewardLPIPS vs Q8_0CLIP Score
Q8_0 (baseline)0.03061.252—0.361
Asymmetric k=3 (Q2_K→Q5_1)0.03081.2910.2330.360
Q5_1 (uniform)0.03001.2410.0660.361
Q2_K (uniform)0.02471.0220.3040.358

Nodes Included

This pack provides 5 custom nodes in two categories:

Asymmetric Sampling

NodeDescription
Dual Model KSamplerTwo-model step switching. Use model_a for steps 1–k, model_b for steps k+1–N. Supports 2-phase and 3-phase (sandwich) modes.
Dual Model KSampler BatchBatch experiment node. Test multiple switch points (e.g., "3,5,7,10,15") in one run and output a LATENT batch.

Analysis Tools

NodeDescription
Stepwise KSamplerStandard sampling with per-step latent saving. Saves intermediate .pt files for analysis.
Stepwise Latent LoaderLoad a saved intermediate latent from a specific step.
Stepwise Latent PreviewDecode and display a grid of intermediate latents across steps using a VAE.

Installation

Option 1: ComfyUI Manager (Recommended)

Search for "Asymmetric Quantization Sampler" in ComfyUI Manager and click Install.

Option 2: Git Clone

cd ComfyUI/custom_nodes/
git clone https://github.com/lee09lee26/ComfyUI-AsymQuantSampler.git

No additional pip dependencies required — uses only ComfyUI built-in modules.

Option 3: Comfy CLI

comfy node install asym-quant-sampler

Usage

Basic 2-Phase Workflow (Recommended Starting Point)

Workflow Screenshot

  1. Load two GGUF checkpoints of the same model at different quantization levels (e.g., flux1-dev-Q2_K.gguf and flux1-dev-Q5_1.gguf).
  2. Connect both models to the Dual Model KSampler node.
  3. Set switch_step = 3, steps = 20, cfg = 1.0.
  4. Connect your prompt conditioning and an empty latent image as usual.
  5. The node runs steps 1–3 with model_a (Q2_K), then steps 4–20 with model_b (Q5_1).

Node inputs:

InputTypeDescription
model_aMODELLightweight model for early steps (e.g., Q2_K)
model_bMODELQuality model for later steps (e.g., Q5_1)
switch_stepINTStep at which to switch from model_a to model_b
switch_endINT (optional)If > switch_step, enables 3-phase sandwich mode: A→B→A
steps

Knoten in diesem Paket

5 Knoten (Plural)
  • DualModelKSampler
  • DualModelKSamplerBatch
  • StepwiseKSampler
  • StepwiseLatentLoader
  • StepwiseLatentPreview

Quellen

3 Quellen
GitHubQuelleVersion d38022ec937883cbe0a7933123a6997b6958b457
github.com/lee09lee26/ComfyUI-AsymQuantSampler

Verifiziert 3. Okt.

GitHubQuelle
github.com/lee09lee26/ComfyUI-AsymQuantSampler

Verifiziert 3. Okt.

Quellenauszüge

1 Auszug

Source context: Repo lee09lee26/ComfyUI-AsymQuantSampler