What LECO can do
Concept erasing
Remove a specific style or concept from generated images. Example: erase the “van gogh” painting style so the model stops producing Van Gogh-like outputs.
Concept enhancing
Strengthen a specific attribute. Example: make “detailed” more pronounced so the model consistently produces higher-detail outputs when prompted.
Slider LoRA
Create a bidirectional attribute slider. Example: a LoRA where positive weights produce “long hair” and negative weights produce “short hair”.
LECO vs standard LoRA
Scripts
Prompt TOML configuration
Instead of a dataset TOML, LECO uses a prompt TOML file that defines the concepts and directions to train. Two formats are supported.Format 1: Original LECO format
Use[[prompts]] sections for direct control over each training pair:
Format 2: Slider target format (ai-toolkit style)
Use[[targets]] sections to define slider-style LoRAs. Each target automatically expands into bidirectional training pairs:
guidance_scale, resolution, neutral, batch_size) serve as defaults for all targets.
* At least one of
positive or negative must be provided.
Multiple neutral prompts
You can specify multiple neutral prompts to improve generalization across different contexts:Three use case examples
1. Concept erasing — remove Van Gogh style
1. Concept erasing — remove Van Gogh style
Erase a specific artistic style from the model’s outputs by training against its own predictions of that style.After training, applying this LoRA reduces the model’s tendency to produce Van Gogh-like brushwork and color palettes even when prompted.
2. Concept enhancing — strengthen 'detailed'
2. Concept enhancing — strengthen 'detailed'
Strengthen an attribute so the model more consistently applies it.After training, applying this LoRA with a positive weight makes the model produce more detailed outputs.
3. Slider LoRA — short hair ↔ long hair
3. Slider LoRA — short hair ↔ long hair
Create a bidirectional slider between two attributes. Apply positive weights to go one direction, negative weights to go the other.At inference, use weight
1.0 for long hair and weight -1.0 for short hair.Key arguments
LECO-specific arguments
LECO-specific arguments
Understanding the two guidance_scale parameters
Understanding the two guidance_scale parameters
LECO has two separate guidance scale controls:
-
--leco_denoise_guidance_scale(command-line): Controls CFG strength during the partial denoising pass that generates intermediate latents. Higher values produce more prompt-adherent latents for the training signal. -
guidance_scale(in the TOML file): Controls the magnitude of the concept offset when constructing the training target. Higher values produce a stronger erase/enhance effect. This can be set per-prompt or per-target.
guidance_scale (try 1.5 to 3.0).LoRA network arguments
LoRA network arguments
Training parameters
Training parameters
Recommended starting settings
Training commands
- SD 1.x / 2.x
- SDXL
Using the trained model
The trained LoRA.safetensors file is saved to --output_dir. Load it in AUTOMATIC1111, ComfyUI, or any Diffusers-based tool just like a standard LoRA.
For slider LoRAs:
- Apply a positive weight (e.g.,
0.5to1.5) to move in the positive direction. - Apply a negative weight (e.g.,
-0.5to-1.5) to move in the negative direction.
Tuning the effect strength
If the trained LoRA has a weak or unnoticeable effect:- Increase
guidance_scalein the TOML (e.g., from1.0to2.0). This is the most direct adjustment. - Increase
multiplierin the TOML (e.g., from1.0to2.0). - Increase
--max_denoising_stepsfor more refined intermediate latents. - Increase
--max_train_stepsto train longer. - Apply the LoRA with a higher weight at inference time.
