Block Gradient
The six sliders, as a reusable gradient
- model
- LAYER_GRADIENT
Block Gradient is the smallest node in the pack and possibly the most important one to understand, because it's the template for everything else. It takes a model and produces a LAYER_GRADIENT - the dict of per-layer merge ratios that drives every merger in ComfyUI-DareMerge. Six sliders in, one gradient out.
That's also exactly what Model Merger (Block) does internally: that node calls this one and feeds the result straight into the Advanced merger. So if you've used Model Merger (Block), you already know this node's six ratios:
- time and label - conditioning embeddings (timestep, and on SDXL the label embedding).
- input - the encoder blocks.
- middle - the bottleneck blocks.
- output and out - the decoder blocks and the final output layer.
Convention alert, once more, because it's the pack's universal rule: 1 means keep model A, 0 means keep model B. All six default to 1, so a fresh Block Gradient is "keep everything from A."
Why use it as a separate node
Because building the gradient separately means you can do something to it between generation and the merger. The whole gradient toolchain is built on that gap:
- Combine it with another gradient via Gradient Operations (mean, max, multiply, whatever) to make a compound weighting.
- Edit specific layers afterward with Gradient Edit - e.g. take a block gradient, then zero out one individual attention block without touching the others.
- Inspect it with Gradient Reporting to confirm a layer key is actually covered before you spend a merge on it.
The block layout here is the SD1.5/SDXL-aware one - the pack sniffs the architecture from the state dict and buckets keys into input/middle/output accordingly. A gradient is architecture-bound: build it from the same model you merge, or the keys won't line up.
Install and gotchas
ComfyUI Manager (search "DareMerge") or:
cd ComfyUI/custom_nodes
git clone https://github.com/54rt1n/ComfyUI-DareMerge
Restart ComfyUI. Dependencies are matplotlib, numpy, torch, pillow - no downloads, nothing exotic.
Two things worth knowing before you chain this around. First, the six sliders are coarse - every key in the input stage gets the identical ratio, which is fine for stage-level control and useless for attention-level control (that's Attention Gradient's job). Second, remember the gradient is a filter: layers it doesn't name don't merge at all, so if you edit the gradient down to nothing and the merge comes out 100% model A, you've filtered the merge out of existence rather than set everything to A. That's the same silent-contract behavior as the rest of the pack - when in doubt, report first.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| time | FLOAT | 1.000–1 | — |
| label | FLOAT | 1.000–1 | — |
| input | FLOAT | 1.000–1 | — |
| middle | FLOAT | 1.000–1 | — |
| output | FLOAT | 1.000–1 | — |
| out | FLOAT | 1.000–1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| LAYER_GRADIENT | LAYER_GRADIENT | — |