Nodes/ComfyUI-bleh/BlehBlockCFG
ComfyUI Node

BlehBlockCFG

An experimental, block-level take on CFG

By blepping·Created 3 years ago·Updated 2 months ago· 142
BlehBlockCFG
  • model
  • MODEL
commasep_block_numbersi4,m0,o4
scale0.250
start_percent0.200
end_percent0.800
skip_modefalse
apply_touncond

Normal CFG scale is a single number applied at the very end of a sampling step: take the difference between the conditioned and unconditioned prediction and amplify it. BlockCFG works differently - it nudges specific blocks inside the model, during the forward pass itself, toward or away from what their counterpart (cond or uncond) is doing. It's a genuinely different lever for the same broad goal CFG chases, just applied deeper inside the model instead of at the final math step.

The author's own framing, straight from the README: applied to cond, it pushes the positive prediction further away from what uncond is doing; applied to uncond, it does the reverse. The effect is described as stronger when applied to cond or to output blocks specifically. And in the same breath, the author is refreshingly honest about how settled any of this is: "Is it good, or even doing what I think? Who knows! Both positive and negative scales seem to have positive effect on the generation." That's not confidence-inspiring marketing copy - it's an accurate description of an experimental node, and worth taking at face value rather than assuming there's a hidden best-practice you're missing.

Inputs: model (required). commasep_block_numbers (default "i4,m0,o4") is a comma list where each entry starts with i, m, or o for input/middle/output block, followed by a block number, or * to grab every block in that category - i*,o* hits every input and output block at once. scale (0.25 default, range -100 to 100) sets the effect strength; the README notes low negative scales applied to cond reportedly push output bright and colorful, for whatever that observation is worth. start_percent/end_percent (0.2 to 0.8 by default) scope it to a middle window of sampling rather than the whole run. skip_mode (default false) changes whether output-block patching hits the skip connection - it has no effect on middle blocks. apply_to (default uncond) picks which side - cond or uncond - is the one being pushed away from its opposite.

Output is a patched MODEL, same as any of bleh's model-patch nodes.

Before building anything real around this, know the limitations the README states outright. It's "probably only" going to do anything on SD 1.x and SDXL. Middle-block patching (m0, m*, etc.) needs the separate FreeU_Advanced node pack installed to have any effect at all - without it, those entries are silently inert. And it explicitly does not work correctly with Tiled Diffusion when the tile batch size is set above 1. None of that is documented as a bug to be fixed; it's the stated scope of an experimental node.

Install is the standard route for the pack - ComfyUI Manager, or git clone https://github.com/blepping/ComfyUI-bleh into custom_nodes and restart. If FreeU_Advanced is something you want middle-block entries to actually affect, that's a separate install on top. The most common trap here isn't a bug at all: setting m0 or m* in your block list and seeing zero change almost always means FreeU_Advanced isn't installed, not that BlockCFG is broken.

Categorybleh/model_patches

Inputs (7)

NameTypeDefaultDescription
modelMODELModel to patch
commasep_block_numbersSTRINGi4,m0,o4Comma separated list of block numbers, each should start with one of i(input), m(iddle), o(utput). You may also use * instead of a block number to select all blocks in the category.
scaleFLOAT0.250-100–100Effect strength
start_percentFLOAT0.2000–1Start time as sampling percentage (not percentage of steps). Percentages are inclusive.
end_percentFLOAT0.8000–1End time as sampling percentage (not percentage of steps). Percentages are inclusive.
skip_modeBOOLEANfalseFor output blocks, this causes the effect to apply to the skip connection. For input blocks it patches after the skip connection. No effect for middle blocks.
apply_toCOMBOuncondGuides the specified target away from its opposite. cond=positive prompt, uncond=negative prompt.

Outputs (1)

NameTypeDescription
MODELMODEL