Nodes/Model Utility Toolkit/Merge Embeddings (2 Models)
ComfyUI Node

Merge Embeddings (2 Models)

Merge Embeddings (2 Models) — blend two .safetensors embeddings into one

By silveroxides·Created about a year ago·Updated 4 days ago· 14
Merge Embeddings (2 Models)
    • output_filename
    • documentation
    execution_mode
    model_a
    model_b
    calc_mode
    mismatch_modeskip
    alignment_modepad/crop
    alpha0.50
    beta0.50
    gamma0.990
    delta2.00
    epsilon0.01
    zeta0.00
    seed0
    output_filenamemerged_2_embedding
    save_dtype
    process_device
    exclude_patterns
    discard_patterns
    glob_patternsfalse
    lazy_loadtrue
    force_clear_cachetrue
    override_dtypefalse

    Takes two embeddings and blends their learned vectors into a single new file. It's the merging node in silveroxides' ComfyUI-ModelUtils - a pack better known for its LoRA extraction and key-editing tools, but this one applies the same "combine two model files mathematically, no training" idea that the community has been doing to full checkpoints for years, scaled down to embedding size.

    Why merge embeddings. Checkpoint merging is how a huge chunk of CivitAI's catalog gets made - it's fast, needs no GPU training run, and just interpolates weights. Embedding merging is the same trick at a tiny scale: if you've got two compatible embeddings that each capture part of what you want (say, two related style vectors), blending them can land somewhere in between without retraining either one from scratch.

    How it works, and what to actually touch. This node exposes a lot of knobs - execution_mode, calc_mode, six greek-letter floats (alpha through zeta), mismatch_mode, alignment_mode - but most of them exist for edge cases you won't hit on your first run. calc_mode picks the blend formula; alpha and beta both default to 0.5, which reads as a straightforward 50/50 split between model_a and model_b, and that's the pair worth adjusting first if you want one embedding to dominate. gamma through zeta feed whichever formula calc_mode is set to - leave them at their defaults unless you already know why you're changing them.

    The pair that actually matters more than the greek letters: mismatch_mode (default skip) and alignment_mode (default pad/crop). They exist because two embeddings don't automatically have matching shapes - different vector counts, or worse, different text encoders entirely - and the node needs a policy for what to do when model_a and model_b don't line up cleanly. skip drops keys that don't match rather than crashing the merge.

    Inputs and outputs worth knowing. model_a/model_b are your two source embeddings. output_filename (default merged_2_embedding) names the result. seed matters if calc_mode involves any randomization. save_dtype and process_device control output precision and where the math runs. exclude_patterns/discard_patterns (with glob_patterns toggling glob vs regex syntax) let you skip specific keys from the merge entirely. Two outputs come back: output_filename and documentation - the latter is a text explanation of what the merge actually did, worth piping to a Show Text node if you want to sanity-check the run.

    Installing it. ComfyUI Manager, search "Model Utility Toolkit" - or cd ComfyUI/custom_nodes && git clone https://github.com/silveroxides/ComfyUI-ModelUtils, then restart. No extra dependencies in the README, nothing to download.

    Where the effort is actually worth spending, and where it isn't. lazy_load and force_clear_cache are there because this pack's LoRA and model merge nodes deal with files that can be gigabytes - but embeddings are 10-80KB. On a merge this small, those two toggles are functionally no-ops; don't spend time tuning them here the way you would on a full checkpoint or LoRA merge.

    The failure mode that actually bites. Merging two embeddings trained against different text encoders doesn't error out cleanly - it produces a file that loads without complaint and then does nothing useful, because the resulting vectors don't correspond to anything meaningful in either encoder's space. Embeddings are architecture-locked: an SD 1.5 vector and an SDXL vector aren't secretly compatible just because they're both .safetensors files. Check that model_a and model_b were actually trained on the same base model family before merging - mismatch_mode will save you from a hard crash, but it won't save you from a merge that's mathematically meaningless.

    CategoryModelUtils/Merging

    Inputs (22)

    NameTypeDefaultDescription
    execution_modeCOMBO2 options: MERGE, DOCUMENTATION ONLY
    model_aCOMBO1 options: None
    model_bCOMBO1 options: None
    calc_modeCOMBO10 options: Weight-Sum, Comparative-Interpolation, Power-Up (DARE), Power-Up (DARE+TIES), SVD LoRA Extraction, Enhanced Man Interp, +4
    mismatch_modeCOMBOskip3 options: skip, zeros, error
    alignment_modeCOMBOpad/crop2 options: pad/crop, interpolate
    alphaFLOAT0.50-10–10
    betaFLOAT0.50-10–10
    gammaFLOAT0.990-10–10
    deltaFLOAT2.00-10–10
    epsilonFLOAT0.01-10–10
    zetaFLOAT0.00-10–10
    seedINT00–18446744073709550000
    output_filenameSTRINGmerged_2_embedding
    save_dtypeCOMBO3 options: fp32, fp16, bf16
    process_deviceCOMBO2 options: cuda, cpu
    exclude_patternsSTRING
    discard_patternsSTRING
    glob_patternsBOOLEANfalseWhen True, exclude/discard patterns use glob syntax (* = any sequence, dots are literal). When False (default), patterns are Python regex matched as substrings.
    lazy_loadBOOLEANtrueLow memory mode: load tensors from disk on demand
    force_clear_cacheBOOLEANtrueClear CUDA cache after each layer
    override_dtypeBOOLEANfalseForce the entire model to be saved as the selected save_dtype. If False (default), higher precision dtypes are preserved.

    Outputs (2)

    NameTypeDescription
    output_filenameSTRING
    documentationSTRING