LoRA diff
A LoRA that's literally the quantization error of your GGUF
- model
- gguf_model
LoRA diff is the strangest node in this pack, and honestly the most interesting. Where ImatrixUNETLoader and Save Imatrix try to make the quantizer smarter, this one gives up on that entirely. It takes the damage a GGUF quant already did and bakes it into a LoRA you can apply on top. Same goal - less embarrassment at Q2_K/Q3_K - completely different strategy.
How it works
You feed it two models: the full-precision original and the same model loaded as GGUF. For every layer that's actually quantized, it computes the difference between the original fp16 weight and the dequantized GGUF weight. That difference is the quantization error - a per-layer record of exactly what the quantizer lost. Then it runs an SVD on that error matrix, keeps the top rank singular components, clamps the values to the 99th percentile, and writes a standard lora_unet_*.safetensors into your loras folder.
Apply that LoRA on top of the quantized model and you patch the error back in. It's a residual-correction patch, not a trained LoRA, which is both the point and the trap.
The inputs that matter
- model - the full-precision
MODEL. This is the reference. - gguf_model - the same architecture loaded from a
.ggufvia ComfyUI-GGUF's loader, so its weights come back quantized. The two must match layer-for-layer; the code zips their module lists together and assumes identical ordering. - rank - 1–320, default 16. Higher captures more of the error but bloats the file and eats VRAM; this is your quality/size dial.
- device -
cudaorcpu. Heads up: the dequant step hardcodes.to("cuda")in the source, so a CPU-only box may not sail through this node even withdevice=cpu. - dtype -
float32default;float16/bfloat16halve the output size if you're testing. - file_name (default
diff) and extension -safetensorsis the only extension offered.
No outputs. It's an output node; the file just appears in your loras folder.
Why you'd reach for it
The nice property is iteration. Changing quant level means re-quantizing a multi-gigabyte model; changing a LoRA rank means re-running one SVD. So you can settle on a quant you like, then tune the error-correction rank until the artifacts you actually care about (text, faces, fine detail) come back. That's a workflow no imatrix alone gives you.
Where people get burned
First, it loads two copies of the model at once - the full-precision one is the whole point, so don't expect this to run on a card that barely fits the GGUF. Second, treat the result with suspicion: SVD truncation can add its own artifacts, and the "LoRA" doesn't behave like a trained one - think of strength 1.0 as "undo the quant," not "add a style." And it only writes entries for layers that are actually quantized in the GGUF, so its usefulness tracks how aggressive your quant is. At Q8 there's nothing to correct; at Q2_K there's plenty, and also the most risk. It's experimental in exactly the way the pack's Japanese README admits - worth playing with, not something to bet a production workflow on.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| gguf_model | MODEL | — | |
| rank | INT | 161–320 | — |
| device | COMBO | 2 options: cuda, cpu | |
| dtype | COMBO | 3 options: float32, float16, bfloat16 | |
| file_name | STRING | diff | — |
| extension | COMBO | 1 options: safetensors |
Outputs (0)
No outputs