Nodes/Realtime LoRA Trainer/FLUX Model Layer Editor
ComfyUI Node

FLUX Model Layer Editor

Scale the base model's blocks before any LoRA touches it

By shootthesound·Created 8 months ago·Updated 2 months ago· 538
FLUX Model Layer Editor
  • model
  • model
  • analysis
  • analysis_json
presetDefault
double_0true
double_0_str1.00
double_1true
double_1_str1.00
double_2true
double_2_str1.00
double_3true
double_3_str1.00
double_4true
double_4_str1.00
double_5true
double_5_str1.00
double_6true
double_6_str1.00
double_7true
double_7_str1.00
double_8true
double_8_str1.00
double_9true
double_9_str1.00
double_10true
double_10_str1.00
double_11true
double_11_str1.00
double_12true
double_12_str1.00
double_13true
double_13_str1.00
double_14true
double_14_str1.00
double_15true
double_15_str1.00
double_16true
double_16_str1.00
double_17true
double_17_str1.00
double_18true
double_18_str1.00
single_0true
single_0_str1.00
single_1true
single_1_str1.00
single_2true
single_2_str1.00
single_3true
single_3_str1.00
single_4true
single_4_str1.00
single_5true
single_5_str1.00
single_6true
single_6_str1.00
single_7true
single_7_str1.00
single_8true
single_8_str1.00
single_9true
single_9_str1.00
single_10true
single_10_str1.00
single_11true
single_11_str1.00
single_12true
single_12_str1.00
single_13true
single_13_str1.00
single_14true
single_14_str1.00
single_15true
single_15_str1.00
single_16true
single_16_str1.00
single_17true
single_17_str1.00
single_18true
single_18_str1.00
single_19true
single_19_str1.00
single_20true
single_20_str1.00
single_21true
single_21_str1.00
single_22true
single_22_str1.00
single_23true
single_23_str1.00
single_24true
single_24_str1.00
single_25true
single_25_str1.00
single_26true
single_26_str1.00
single_27true
single_27_str1.00
single_28true
single_28_str1.00
single_29true
single_29_str1.00
single_30true
single_30_str1.00
single_31true
single_31_str1.00
single_32true
single_32_str1.00
single_33true
single_33_str1.00
single_34true
single_34_str1.00
single_35true
single_35_str1.00
single_36true
single_36_str1.00
single_37true
single_37_str1.00
othertrue
other_str1.00
save_preset_name
delete_preset_name
browser_presets_json{}
save_modelfalse
save_path
save_filename
source_model_path

What it is

This one's easy to confuse with this pack's LoRA-focused Selective Loaders, so the distinction up front: those edit a LoRA's per-block contribution. This node edits the base checkpoint itself - scaling FLUX's own transformer blocks up or down before any LoRA gets applied on top. It's a different lever entirely. If a base FLUX checkpoint has a bias baked into certain layers - too much saturation, a stubborn style tendency, a block that's overcorrecting something - this is where you'd go to dial that block down at the source, rather than fighting it downstream with prompting or a corrective LoRA.

This is genuinely unusual territory; nothing in the wider community's LoRA and model-editing writeups documents base-model block scaling as a mainstream technique the way LoRA training or block-level LoRA loading are. Treat it as a power-user tool for a specific problem (a checkpoint that's almost right except for one identifiable region) rather than a routine step in your workflow.

How it works

FLUX's transformer splits into 19 "double" blocks (the ones processing image and text streams jointly, generally higher-impact) and 38 "single" blocks (downstream, generally lower-impact) - the same split this pack's FLUX Selective Loader works with, applied here to the checkpoint's own weights instead of a LoRA's. You get an on/off toggle and a strength multiplier for each of the 57 blocks, applied to the base model before anything else touches it. The pack ships a related, more surgical tool - a Deep Debiaser suite that goes down to individual attention heads and MLPs within a block rather than whole blocks - and one community post used exactly that finer-grained tool on Klein to fix detail preservation by scaling a single problem sub-block down to 0.75. This node operates one level up from that: whole blocks, not sub-components, but the same underlying idea of surgically dialing down a specific region of the model rather than the whole thing.

Inputs and outputs that matter

  • model - the base checkpoint you're editing.
  • preset - Default (everything at 1.0), All Off, Half Strength, Double Only, Single Only, or Custom.
  • double_0double_18 and single_0single_37, each paired with a _str slider (range -2 to 2, tighter than the LoRA loaders' -5 to 5, since you're scaling the base model rather than a small adapter).
  • other / other_str - anything outside the 57 mapped blocks.
  • Optional save_preset_name / delete_preset_name - save your own block configuration for reuse, or remove one you saved earlier.
  • Optional save_model, save_path, save_filename, source_model_path - bake the edited checkpoint to disk as a new safetensors file instead of applying it live every run.

Outputs: model (the edited checkpoint, apply LoRAs on top of this as normal), analysis and analysis_json - a report of what got scaled.

Installing it

No external training backend needed - this node works the moment the pack is installed. ComfyUI Manager (search "Realtime LoRA Trainer") or:

cd ComfyUI/custom_nodes
git clone https://github.com/ShootTheSound/comfyUI-Realtime-Lora

Restart ComfyUI. The pack's workflows/Lora Analysis, Block and Model Editing/ folder includes a Model Layer Editor demo (built against Z-Image, but the same node exists per-architecture - search for "FLUX Model Layer Editor" specifically).

Common issues

Setting a block to 0 produces noise or garbage output. This is expected, not a bug - completely zeroing a transformer block removes structure the rest of the network depends on. Stick to the 0.5–1.5 range for meaningful adjustments; treat 0 as a diagnostic extreme, not a usable setting.

Not sure which block is responsible for a problem. There's no automated attribution here the way the LoRA analyzer gives you impact scores - this node is closer to a scalpel than a diagnostic tool, so expect to experiment iteratively rather than have the node point you at the culprit.

Edited model behaves inconsistently across different LoRAs. That's the nature of editing the base rather than a LoRA - every LoRA you apply afterward interacts with your edited blocks differently. If you're chasing a fix for one specific LoRA's interaction with the base model, it may be more direct to adjust that LoRA's own block strengths instead of the base checkpoint.

Forgot the _str range is narrower here than the LoRA loaders. -2 to 2, not -5 to 5 - a "5" typed by muscle memory from a Selective Loader will get clamped or rejected.

Categorymodel

Inputs (125)

NameTypeDefaultDescription
modelMODELModel from LoadCheckpoint or LoadDiffusionModel
presetCOMBODefaultQuick preset selection. Individual controls below override when changed.
double_0BOOLEANtrue
double_0_strFLOAT1.00-2–2
double_1BOOLEANtrue
double_1_strFLOAT1.00-2–2
double_2BOOLEANtrue
double_2_strFLOAT1.00-2–2
double_3BOOLEANtrue
double_3_strFLOAT1.00-2–2
double_4BOOLEANtrue
double_4_strFLOAT1.00-2–2
double_5BOOLEANtrue
double_5_strFLOAT1.00-2–2
double_6BOOLEANtrue
double_6_strFLOAT1.00-2–2
double_7BOOLEANtrue
double_7_strFLOAT1.00-2–2
double_8BOOLEANtrue
double_8_strFLOAT1.00-2–2
double_9BOOLEANtrue
double_9_strFLOAT1.00-2–2
double_10BOOLEANtrue
double_10_strFLOAT1.00-2–2
double_11BOOLEANtrue
double_11_strFLOAT1.00-2–2
double_12BOOLEANtrue
double_12_strFLOAT1.00-2–2
double_13BOOLEANtrue
double_13_strFLOAT1.00-2–2
double_14BOOLEANtrue
double_14_strFLOAT1.00-2–2
double_15BOOLEANtrue
double_15_strFLOAT1.00-2–2
double_16BOOLEANtrue
double_16_strFLOAT1.00-2–2
double_17BOOLEANtrue
double_17_strFLOAT1.00-2–2
double_18BOOLEANtrue
double_18_strFLOAT1.00-2–2
single_0BOOLEANtrue
single_0_strFLOAT1.00-2–2
single_1BOOLEANtrue
single_1_strFLOAT1.00-2–2
single_2BOOLEANtrue
single_2_strFLOAT1.00-2–2
single_3BOOLEANtrue
single_3_strFLOAT1.00-2–2
single_4BOOLEANtrue
single_4_strFLOAT1.00-2–2
single_5BOOLEANtrue
single_5_strFLOAT1.00-2–2
single_6BOOLEANtrue
single_6_strFLOAT1.00-2–2
single_7BOOLEANtrue
single_7_strFLOAT1.00-2–2
single_8BOOLEANtrue
single_8_strFLOAT1.00-2–2
single_9BOOLEANtrue
single_9_strFLOAT1.00-2–2
single_10BOOLEANtrue
single_10_strFLOAT1.00-2–2
single_11BOOLEANtrue
single_11_strFLOAT1.00-2–2
single_12BOOLEANtrue
single_12_strFLOAT1.00-2–2
single_13BOOLEANtrue
single_13_strFLOAT1.00-2–2
single_14BOOLEANtrue
single_14_strFLOAT1.00-2–2
single_15BOOLEANtrue
single_15_strFLOAT1.00-2–2
single_16BOOLEANtrue
single_16_strFLOAT1.00-2–2
single_17BOOLEANtrue
single_17_strFLOAT1.00-2–2
single_18BOOLEANtrue
single_18_strFLOAT1.00-2–2
single_19BOOLEANtrue
single_19_strFLOAT1.00-2–2
single_20BOOLEANtrue
single_20_strFLOAT1.00-2–2
single_21BOOLEANtrue
single_21_strFLOAT1.00-2–2
single_22BOOLEANtrue
single_22_strFLOAT1.00-2–2
single_23BOOLEANtrue
single_23_strFLOAT1.00-2–2
single_24BOOLEANtrue
single_24_strFLOAT1.00-2–2
single_25BOOLEANtrue
single_25_strFLOAT1.00-2–2
single_26BOOLEANtrue
single_26_strFLOAT1.00-2–2
single_27BOOLEANtrue
single_27_strFLOAT1.00-2–2
single_28BOOLEANtrue
single_28_strFLOAT1.00-2–2
single_29BOOLEANtrue
single_29_strFLOAT1.00-2–2
single_30BOOLEANtrue
single_30_strFLOAT1.00-2–2
single_31BOOLEANtrue
single_31_strFLOAT1.00-2–2
single_32BOOLEANtrue
single_32_strFLOAT1.00-2–2
single_33BOOLEANtrue
single_33_strFLOAT1.00-2–2
single_34BOOLEANtrue
single_34_strFLOAT1.00-2–2
single_35BOOLEANtrue
single_35_strFLOAT1.00-2–2
single_36BOOLEANtrue
single_36_strFLOAT1.00-2–2
single_37BOOLEANtrue
single_37_strFLOAT1.00-2–2
otherBOOLEANtrue
other_strFLOAT1.00-2–2
save_preset_nameoptSTRINGEnter preset name, then click Save Preset button (or leave for file sync on execute)
delete_preset_nameoptSTRINGPreset to delete (filled automatically by Delete button)
browser_presets_jsonoptSTRING{}JSON of all browser presets (auto-filled by JS for sync)
save_modeloptBOOLEANfalseSave modified model to disk (large files!)
save_pathoptSTRINGDirectory to save modified model
save_filenameoptSTRINGFilename for saved model (timestamp added)
source_model_pathoptSTRINGPath to original model file (for copying metadata). Required for saved model to load correctly.

Outputs (3)

NameTypeDescription
modelMODELModel with block modifications applied
analysisSTRINGText analysis of model structure
analysis_jsonSTRINGJSON analysis data