Nodes/TechNodes/SDXL MBW Layers
ComfyUI Node

SDXL MBW Layers

Per-block merge weights instead of one global alpha

By TechnoByteJS·Created 2 years ago·Updated 2 years ago· 14
SDXL MBW Layers
    • MBW_LAYERS
    input_blocks.00.50
    input_blocks.10.50
    input_blocks.20.50
    input_blocks.30.50
    input_blocks.40.50
    input_blocks.50.50
    input_blocks.60.50
    input_blocks.70.50
    input_blocks.80.50
    middle_blocks0.50
    output_blocks.00.50
    output_blocks.10.50
    output_blocks.20.50
    output_blocks.30.50
    output_blocks.40.50
    output_blocks.50.50
    output_blocks.60.50
    output_blocks.70.50
    output_blocks.80.50

    A normal checkpoint merge gives you exactly one dial: alpha. Thirty percent of everything from model A, seventy from model B, uniformly across the whole network. Merge Block Weighted (MBW) breaks that open - SDXL's UNet isn't one lump, it's a chain of blocks, and the community's long-standing observation (this technique goes back to an A1111 extension from 2023, sdweb-merge-block-weighted-gui) is that different blocks tend to carry different traits: the early encoder blocks lean toward composition and structure, the later decoder blocks toward fine detail and texture. This node doesn't merge anything by itself - it's a dial board. You set 19 individual weights and it hands you back one MBW_LAYERS bundle to plug into SDNext Merge's optional_mbw_layers_alpha input.

    The layout

    19 floats, all 0–1, all defaulting to 0.5 (a flat merge, identical to not using MBW at all):

    • input_blocks.0 through input_blocks.8 - the 9 encoder blocks.
    • middle_blocks - the single bottleneck block.
    • output_blocks.0 through output_blocks.8 - the 9 decoder blocks.

    That 9-in/1-mid/9-out shape is specifically SDXL's. SD 1.5's UNet is a different size (12 in, 1 mid, 12 out), which is why there's a separate SD1 MBW Layers node rather than one shared node - feed the wrong one into a merge for the wrong architecture and you get a block-count mismatch, not a working merge.

    Output

    A single MBW_LAYERS - the only thing that consumes it is SDNext Merge's optional_mbw_layers_alpha input, where it overrides the flat alpha and any mbw_preset_alpha selection with your per-block values.

    Installing it

    ComfyUI Manager: search TechNodes, install, restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/TechnoByteJS/ComfyUI-TechNodes --depth 1
    

    Nothing else to install - no model downloads, no dependency chasing.

    Where people get burned

    The obvious one: wiring this into a merge where model_a/model_b aren't actually SDXL checkpoints - the block count won't line up, and nothing good comes out. Second, hand-tuning 19 sliders from a blank slate is genuinely trial-and-error; even the original merge-block-weighted community treats it that way - you nudge one block, merge, generate, look, repeat. If you don't already know which block you're chasing, start with SDNext Merge's mbw_preset_alpha dropdown instead (39 named presets built for exactly this) and only reach for this node once you know which specific block you want to isolate. If you want a hard on/off per block rather than a blend, there's a SDXL MBW Layers Binary sibling node for that - useful for figuring out which block a trait lives in before you come back here to dial in how much of it you actually want.

    CategoryTechNodes/merging

    Inputs (19)

    NameTypeDefaultDescription
    input_blocks.0FLOAT0.500–1
    input_blocks.1FLOAT0.500–1
    input_blocks.2FLOAT0.500–1
    input_blocks.3FLOAT0.500–1
    input_blocks.4FLOAT0.500–1
    input_blocks.5FLOAT0.500–1
    input_blocks.6FLOAT0.500–1
    input_blocks.7FLOAT0.500–1
    input_blocks.8FLOAT0.500–1
    middle_blocksFLOAT0.500–1
    output_blocks.0FLOAT0.500–1
    output_blocks.1FLOAT0.500–1
    output_blocks.2FLOAT0.500–1
    output_blocks.3FLOAT0.500–1
    output_blocks.4FLOAT0.500–1
    output_blocks.5FLOAT0.500–1
    output_blocks.6FLOAT0.500–1
    output_blocks.7FLOAT0.500–1
    output_blocks.8FLOAT0.500–1

    Outputs (1)

    NameTypeDescription
    MBW_LAYERSMBW_LAYERS