CivArchive
    [Guide] LoRA Block Weight - a way to finetune LoRAs - v1
    Preview 297115
    Preview 385310
    Preview 385308
    Preview 385307
    Preview 385305
    Preview 385306
    Preview 385309
    Preview 391263

    Reddit version of this guide: https://www.reddit.com/r/StableDiffusion/comments/11izvoj

    LoRAs used as example: https://civarchive.com/models/7649, https://civarchive.com/models/9850

    For SDXL model check this guide: https://civarchive.com/models/22581?modelVersionId=26964

    In a nutshell

    Extension name: sd-webui-lora-block-weight

    Syntax: <lora:loraname:casyalweight:blockweights>

    What is it for?

    This extension allows you to connect not the entire LoRA, but only individual blocks. This allows you to use some overtrained models, find a fault in your model, or in some cases combine the best epochs.

    For example you can use it to take only initial blocks from LoRA, which have influence on the composition. The last blocks, which mostly determine the color hue. Or the middle blocks. color tone, or the middle blocks, which are responsible for a little bit of everything. This can make it easier to generate things that LoRA wasn't particularly intended, for example:

    1. Lowering the weight of the initial blocks can give you your favorite Anime character with normal proportions.

    2. Lowering the weight of the end blocks allows you to get the same character with eyes half a face, but in a normal color scheme.

    3. Adding end blocks from extraneous LoRAs can enhance stroke, reflections, skin texture, lighten or darken the image

    4. A style that sees everything as homes will slightly reduce its enthusiasm and start drawing characters.

    5. And add all sorts of freaks, artifacts, extra eyes and fingers and stuff. After all, we're going to break the normal workings of the model, by cutting off the pieces you don't like.

    Installation

    To install, find sd-webui-lora-block-weight in the add-on list and install it.

    After restarting the UI, the txt2img and img2img you will see new element: LoRA Block Weight.

    Please note: There is currently a conflict with Composable Lora and Additional Networks. Additional Networks right now just broke this extension. Composable Lora can be installed at the same time, only one of them must be Enabled /Activate at a time. Otherwise the effect of the LoRA can be applied twice (if not more), creating a scorched image or a mishmash of colors. This is most likely a Webui problem because prompt scheduling shows similar problems in some conditions.

    Off topic, but let me explain. Prompt scheduling is changing a request at a certain step, for example, [cat:dog:0,4] will start drawing the cat, but when 40% of all steps have passed it will remove the cat from the prompt and put a dog in the same place. This can result in an animal that has features of both, as well as and a separately standing badly drawn cat and dog.

    Usage

    I'll give you a good starting point to start experimenting with block weights:

    1. In the prompt after the name of the LoRA model and weight write another colon and the word XYZ, in the example of the popular model it would be <lora:yaeMikoRealistic_yaemikoMixed:1:XYZ> , or if you check screenshot <lora:HuaqiangLora_futaallColortest:1:XYZ>

    2. After this, make sure that the addon is enabled (Active), expand the XYZ plot of the addon (do not confuse with the X/Y/Z plot in the scripts section) check the XYZ plot option.

    3. Select X Types Original Weights, in the X field enter:

    INS,IND,INALL,MIDD,OUTD,OUTS,OUTALL

    Preparation is finished, you will see a table like the one attached.

    If you like any of the results, replace XYZ in the prompt to the tag, that was at the top of the image, like MIDD:

    <lora:HuaqiangLora_futaallColortest:1:MIDD>

    If you don't like any of the options, you can try inverting query, all weights will turn into their opposites. To do this instead of XYZ write ZYX and run generation again. There is one small bug: At this point in the article, you need to add one more LoRA with weight 0 and tag XYZ. For example, I took Paimon. I think Paimon was happy that she has weight 0 no matter what. Maybe this will be fixed, maybe it won't. As the author of the add-on explained, this will require a change in the logic of the of the extension.

    So example: <lora:HuaqiangLora_futaallColortest:1:ZYX> <lora:paimonGenshinImpact_v10:1:XYZ>

    If you like one of the inverted options, You will need to expand below Weights setting list, find in the list the corresponding line, for example MIDD, copy it into notepad/Excel/Word and replace all 1's with any character, all 0's with 1 and the previously specified character to 0, then paste it directly into prompt instead of ZXY. Or you can find ready weights in the comments. Do not forget to remove Paimon from prompt and disable XYZ plot.

    Description

    FAQ

    Comments (17)

    ditaApr 3, 2023· 1 reaction
    CivitAI

    I think Paimon was happy that she has weight 0 no matter what

    LOL, probably so.

    I've had the LBW extension installed for a while, but have only used it once. I haven't had a chance to read through your how-to yet, but I'm hoping it includes some best practices for which blocks to try/look at first, etc. It takes some time on my system to do an XYZ grid every time I have a different LoRA to try.

    Also, do you know whether this works on LoCon/LoHA/Lycoris as well?

    sabin
    Author
    Apr 3, 2023· 1 reaction

    Yes, it supports lycoris/loha, i'l add review

    ditaApr 3, 2023

    @sabin Thanks, good to know!

    rafikApr 3, 2023· 1 reaction
    CivitAI

    Nice, very useful! But I have a question, is it possible to save LoRa with edited block weights as a new model? (So that this new LoRa model has already adjusted block weights)

    sabin
    Author
    Apr 4, 2023· 2 reactions

    Yes. with sd-webui-supermerger. I'l add it to the guide later

    NotAPersonJustACatApr 4, 2023· 6 reactions
    CivitAI

    I wonder what does each block do/mean really. I've googled and found no relevent material discussing these knowledge.

    sabin
    Author
    Apr 12, 2023· 4 reactions

    The information is scattered all over the model. As far as I have found out experimentally, the initial IN blocks are responsible for the composition and understanding of the objects, the final OUT blocks are responsible for how exactly to draw a particular object. What exactly the middle ones do I don't understand.

    You can try to deal with this extension:

    https://github.com/hnmr293/stable-diffusion-webui-dumpunet

    NotAPersonJustACatApr 13, 2023

    @sabin thanks for this info 👍

    ouwei_wltdApr 8, 2023
    CivitAI

    图例里面那个是光头强吗

    natewilliamsMay 7, 2023· 1 reaction
    CivitAI

    Just a few pointers to improve this guide. What do you mean "combine the best epochs"? You mean the best block steps?

    "Or the middle blocks. color tone, or the middle blocks, which are responsible for a little bit of everything." This sentence could use some polish. "Or the middle blocks, which are responsible for a little bit of everything." is what I assume you mean to say?

    "the same character with eyes half a face" What does that even mean? eyes half a face? A corrupted image?

    extraneous? No idea what you mean by using that word in this sentence.

    "A style that sees everything as homes will slightly reduce its enthusiasm and start drawing characters." What does that mean? What does homes mean here? Reduce enthusiasm and start drawing characters? I am confused.

    "And add all sorts of freaks, artifacts, extra eyes and fingers and stuff. After all, we're going to break the normal workings of the model, by cutting off the pieces you don't like." I assume this is meant to be a part of 4.? Could still be clearer what you are trying to say with this point in the list of examples.

    "This can result in an animal that has features of both, as well as and a separately standing badly drawn cat and dog." Can probably remove the as well as in this sentence and make it and/or?

    You usage guide and shown examples are good, but maybe provide the ALL and NONE version of the images you are showing as well so people can see the image with the LORA set to 0 weight (basically turning it off) and with the LORA set to 1 (fully applied), alongside your provided example of the standard INS, IND, INALL, (...) images so that readers can see how the LORA you are talking about (which while you say it's popular I have no idea about) are affecting the original image. (Btw., the default ALL and NONE options feel so redundant when you can just make the LORA weight either 1 or 0 for the same exact output. Maybe I'm missing something.)

    Very useful guide, this got me to grab this extension and play around with it. Very fun, useful and interesting extension.

    j038Sep 18, 2023· 15 reactions
    CivitAI

    For XYZ plot in new AUTOMATIC1111, you now need to use the named format: <lora:YourLora:1:lbw=XYZ>

    Due to changes in lora syntax (webui now treats the first 2 parameters as unet weight and TEnc weight).

    Don't use the old way listed in this guide: <lora:YourLora:1:XYZ>

    sabin
    Author
    Sep 21, 2023

    Thanks, i've didn't tried new a1111 ui yet. Will test soon and update wtih mentioning

    MissEvelynSep 23, 2023· 5 reactions
    CivitAI

    I figured out the weights to use for SDXL LoRA, the defaults in the extension don't work right. I put my findings in a guide here: https://civitai.com/articles/2322

    _1_Nov 8, 2023
    CivitAI

    BTA:1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0

    BTB:1,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0

    BTC:1,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0

    BTD:1,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0

    BTE:1,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0

    BTF:1,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0

    BTG:1,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0

    Could be helpful

    _1_Nov 8, 2023

    For XYZ plot: ALL,BTA,BTB,BTC,BTD,BTE,BTF,BTG

    THX1139Dec 6, 2023
    CivitAI

    Failed to make this work myself. Tried the various tips here for SDXL and the linked side article but for me it does nothing. A single image appears as always. :/

    leirtesJan 17, 2024

    Hey there!

    Your post is a month old but I figure I'd lend a hand in the event anyone else wants to try my solution.

    I had the same exact issue you were having, then I noticed that there were two instances of LBW in my instance of A1111. It, apparently, occurs if you're using the --api argument when launching the web UI. The second one was hidden in the "Scripts" section of the main A1111 UI, and that was the one that works for me.

    Try it out. Make sure the plainly visible LBW is not set to active, and then activate the one you may find under "Scripts".

    Other
    SD 1.5

    Details

    Downloads
    1,163
    Platform
    CivitAI
    Platform Status
    Available
    Created
    3/21/2023
    Updated
    5/13/2026
    Deleted
    -

    Files

    GuideLoraBlockWeightA_v1.zip

    Available On (1 platform)

    Same model published on other platforms. May have additional downloads or version variants.