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.
Perfil del paquete
- Estado
- Verificado
- Publicador
- @lee09lee26
- Fuente
- GitHub
Léeme
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:
-
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).
-
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.
-
CLIP Score is invariant to quantization. Semantic composition is preserved even at 2-bit precision (0.358–0.362 across all levels).
| Configuration | Quality Score | ImageReward | LPIPS vs Q8_0 | CLIP Score |
|---|---|---|---|---|
| Q8_0 (baseline) | 0.0306 | 1.252 | — | 0.361 |
| Asymmetric k=3 (Q2_K→Q5_1) | 0.0308 | 1.291 | 0.233 | 0.360 |
| Q5_1 (uniform) | 0.0300 | 1.241 | 0.066 | 0.361 |
| Q2_K (uniform) | 0.0247 | 1.022 | 0.304 | 0.358 |
Nodes Included
This pack provides 5 custom nodes in two categories:
Asymmetric Sampling
| Node | Description |
|---|---|
| Dual Model KSampler | Two-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 Batch | Batch experiment node. Test multiple switch points (e.g., "3,5,7,10,15") in one run and output a LATENT batch. |
Analysis Tools
| Node | Description |
|---|---|
| Stepwise KSampler | Standard sampling with per-step latent saving. Saves intermediate .pt files for analysis. |
| Stepwise Latent Loader | Load a saved intermediate latent from a specific step. |
| Stepwise Latent Preview | Decode 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
- Load two GGUF checkpoints of the same model at different quantization levels (e.g.,
flux1-dev-Q2_K.ggufandflux1-dev-Q5_1.gguf). - Connect both models to the Dual Model KSampler node.
- Set
switch_step = 3,steps = 20,cfg = 1.0. - Connect your prompt conditioning and an empty latent image as usual.
- The node runs steps 1–3 with model_a (Q2_K), then steps 4–20 with model_b (Q5_1).
Node inputs:
| Input | Type | Description |
|---|---|---|
model_a | MODEL | Lightweight model for early steps (e.g., Q2_K) |
model_b | MODEL | Quality model for later steps (e.g., Q5_1) |
switch_step | INT | Step at which to switch from model_a to model_b |
switch_end | INT (optional) | If > switch_step, enables 3-phase sandwich mode: A→B→A |
steps |
Nodos de este paquete
5 nodos
Nodos de este paquete
5 nodos- DualModelKSampler
- DualModelKSamplerBatch
- StepwiseKSampler
- StepwiseLatentLoader
- StepwiseLatentPreview
Fuentes
3 fuentes
Fuentes
3 fuentesVerificado 3 oct
Verificado 3 oct
Extractos de fuentes
1 extracto
Extractos de fuentes
1 extractoSource context: Repo lee09lee26/ComfyUI-AsymQuantSampler
