ComfyUI Node

Quad Masker

Four masks, one model — merge different things into each slice

By 54rt1n·Created 3 years ago·Updated about a year ago· 98
Quad Masker
  • model
  • MODEL_MASK
  • MODEL_MASK
  • MODEL_MASK
  • MODEL_MASK
seed1

Most merge masks are a binary: "these parameters are fair game, those aren't." DM_QuadMasker is the node that says why settle for two answers. Feed it a model and a seed, and it hands you four MODEL_MASK outputs that split the model's parameters into four random, non-overlapping sets. If you've ever wanted to merge a different model into each quarter of your checkpoint - or stack styles without them stepping on each other - this is the tool.

How it works

Under the hood it's simple: for every parameter tensor in the model, the node randomly divides the tensor's elements into four buckets and produces a boolean mask per bucket (sets == j). Because the four masks partition the whole model, a parameter that's selected in mask one is not selected in masks two through four. The seed input is the only real control, and it matters: the split is random per layer, so different seeds give you different parameter neighborhoods in each mask.

The README half-jokes about the obvious application: "bin the parameters of a model up with some fancy set thresholding, and then merge a different model in to each slice." That's exactly what the four outputs enable. Wire each mask into a merge node with a different source model - say, one finetune feeding a quarter of the weights and another feeding a different quarter - and the packs don't fight over the same parameters.

What actually matters when you use it

  • Check the split before you trust it. Random is random: with four masks you'd expect each to be ~25% of the parameters, but a given seed can land lopsided on some layers. Run each mask output through Mask Reporting and glance at the percentages before committing to a merge.
  • Seed = reproducibility. This is random sampling, and the pack's own README warns you: don't assume the first seed is the best, and if you leave the seed floating, the merge will change every run. When you find a split you like, fix the seed and keep it.
  • They're meant to be combined, not used alone. A single Quad Masker output on its own is just "randomly pick a quarter of the params." The power comes from using two or more outputs together - or feeding them into Mask Operations (union, intersect, difference, xor) to build derived masks.

The cost nobody mentions

Masks in this pack are stored as dense CPU tensors - the source code itself comments that sparse or boolean-compressed masks would be better. Quad Masker is the worst case, because it builds four full-size masks at once. On SD1.5 it's manageable, but if you're on a RAM-constrained machine and start stacking multiple Quad Maskers, you'll feel it. Budget for it rather than discovering it mid-workflow.

Installing it

One node in the 54rt1n/ComfyUI-DareMerge pack - install the pack once, get all ~25 nodes. ComfyUI Manager (search "ComfyUI-DareMerge") is the easy path:

cd ComfyUI/custom_nodes
git clone https://github.com/54rt1n/ComfyUI-DareMerge

…or the git clone above into custom_nodes, then restart. Dependencies are matplotlib, numpy, torch, pillow - standard ComfyUI stuff, nothing to download.

The honest verdict: Quad Masker is a specialist's tool. Casual merging doesn't need random parameter partitioning, and most people will be perfectly happy with a magnitude mask or a block merge. But if you're trying to fuse two styles into one model without the classic "this merge is good at nothing because everything averaged together" outcome, the four-way split is one of the more interesting ideas in the pack - and it costs you a few minutes to try.

CategoryDareMerge/mask

Inputs (2)

NameTypeDefaultDescription
modelMODEL
seedINT10–99999999999

Outputs (4)

NameTypeDescription
MODEL_MASKMODEL_MASK
MODEL_MASKMODEL_MASK
MODEL_MASKMODEL_MASK
MODEL_MASKMODEL_MASK