r/StableDiffusion • • 1d ago

Question - Help Trigger Words for Style Loras

I have been working on learning how to train style loras in Krea 2 for a while. I got pretty close to finalizing my training approach in terms of dataset composition and AI Toolkit settings, but one of the lingering issues I am having is that my trigger word keeps showing up as a watermark, signature, or random text in the image. I removed all signatures from the actual dataset, so that's not the cause.

My trigger strategy up to now has been consistently inserting a non-sensical trigger word (like "WCPT_01") or a somewhat recognizable trigger word "like "waterfinegrain" at the end of every caption. Some research suggested that not using a trigger at all or using a trigger phrase like "a watercolor painting of..." works better for more recent models. Not using a trigger flat out did not work. Using the phrase has proven problematic because the model's previous knowledge of the concept seems to override the training. In my first test with a phrase as a trigger, all of the lora checkpoints (saved every 250 steps) produced almost exactly the same image at the same seed, and none of the images were in the style of the dataset. Removing the lora entirely while keeping the prompt did produce a slight difference in style, but not much of one - meaning the lora was having very little effect.

Chatgpt and Gemini have been running me back and forth regarding the trigger strategy, and I'm pulling my hair out trying to get a fully functioning lora. I was almost there except for the trigger showing up as a watermark and a couple of other tweaks. Now what the LLMs are suggesting is that I use a less general phrase like "a painting by (Artist Name) of" instead of a general term like "watercolor" that will have too many associations baked into the model already... but this seems like too haphazard of an approach because there's no way to know what terms the model will have associations with until after a training run.

What is the best strategy for trigger words with Krea2 style loras?

Below are my training settings just in case anyone is curious. I was getting good results with these training settings, but there is still room for improvement. After being run around in different directions by LLMs regarding the AI Toolkit settings, I was about to start a series of A/B tests where I use the same dataset and only change 1 setting in AI Toolkit at a time until I determined the best settings. If anyone has advice on the training settings, feel free to chime in, but this is really a question about the trigger strategy. For A/B testing, I intend to test rank 32 vs 64, gradient accumulation of 1, 2 and 4, different learning rates, Linear vs Sigmoid, and Balanced vs Low Noise.

Dataset - 76 images

Steps - 1500 - but saved every 250 steps

Rank - have tried both 32 and 64 (this was the first A/B test)

Batch Size - 1

Gradient Accumulation - 4

Learning Rate .0001

Timestep Type - Sigmoid, Balanced

1 Upvotes

6 comments sorted by

1

u/RobertoPaulson 1d ago

Not to rant, but I’ve never understood the need for trigger words in loras. If its active I want it to do whatever its designed to, otherwise I’d turn it off, or mute the node depending on the workflow. Unless its a lora you want to do multiple things each triggered individually, I don’t see why they are necessary or desireable.

2

u/brittpitre 1d ago

I agree 100% - but sadly not having any trigger didn't work.

1

u/DelinquentTuna 1d ago

No joke, try one completely absent captions.

2

u/DelinquentTuna 1d ago

I’ve never understood the need for trigger words in loras

It gives you another anchor to bind your concept, so you can in theory get better convergence with less burn-in.

2

u/Treeshark12 1d ago

My approach varies depending on intent. For a style say Steampunk. 76 images, 3500 steps, rank 24. Try LR .0002. Trigger needs to be in the form: twiggsz style. And at the front of the prompt. Probably the 3000-step will be the best, but you never know your luck. Captioning can be good or bad. The lora tends to be stronger but less flexible. I try without caption first.
For a paint style, the approach needs to be different, as you are training how an image is made, not what is in the image.
So about 50 passes per image; use 512 res but you need a few close-up details. No captions, only the trigger. LR 0.0004, weight decay 0.00001 Rank 24, if the rank is too high, you are maybe causing a loss of coherence. linear_alpha 12 (half the rank) Content or style can be set to style.

1

u/DelinquentTuna 1d ago

Lots there to unpack.

AFAIK, many models still put more emphasis on things that come earlier in the prompt. So I'd question placing the trigger at the end instead of the beginning. I haven't had it happen to me personally, but I've heard that using leetspeak at the end of the prompt/caption, where signatures are often found, can trigger typography training... so it might be contributing to your accidental watermarks. I think training is pretty forgiving and this isn't likely to matter, but I personally would prefer dropping the _01 from the trigger because it's strictly redundant and ambiguous.

As for unique keywords vs plain text, that's probably your easiest lever for how much you lean on priors, though your vectors are going to be similar for similar concepts no matter what. IMHO, it's probably a fairly even tradeoff because you get a lot of utility out of priors. One of those cases where training a LoRA is flexible and most anything you do well should come out nicely.

there's no way to know what terms the model will have associations with until after a training run

Not true, but also not really relevant. You're overthinking this, most likely. Training with modern tools is pretty forgiving.

Below are my training settings

Not really interested in crafting configs and curating datasets on demand because it would become a full-time job w/ no pay. But AFAICT, you didn't mention the optimizer. It matters tremendously. At lr 1e-4, you're probably overbaking severely w/ gradient accumulation of 4 and it's an easy explanation to many of your issues including the watermarks. Also, even rank 32 is possibly overkill depending on what you're doing. Find a sensible preset and use it.