Below is a field‑tested cheat‑sheet that most SDXL LoRA tinkerers have settled on after thousands of GPU‑hours. I’ll start with the short answer, then unpack the “why”, the , and a set of pragmatic knobs you can turn so you’re never wasting VRAM or quality.
TL;DR — Do Ihaveto train the text encoders?
No, not for most LoRA jobs.Freezing both text encoders and training the UNet alone is the community’s default because it cuts memory use ~40 % and makes every step 2‑3 × fasterGitHubGitHub.
Yes, in a few edge‑cases.If you’re addingbrand‑new tokens(never seen in SDXL’s vocabulary) or chasingpin‑point prompt fidelity—e.g. photoreal logos, exact product SKUs, or subtle mood/style shifts—thefirstencoder (CLIP‑G) helps, and a quick warm‑up is usually enoughdocs.dreamlook.aiHugging FaceCVF Open Access.
Almost never for the second encoder.Encoder 2 (CLIP‑L) adds negligible quality but doubles VRAM; most trainers set its LR to zero or never wire it into the optimiser at allGitHubdocs.dreamlook.ai.
No, not for most LoRA jobs.Freezing both text encoders and training the UNet alone is the community’s default because it cuts memory use ~40 % and makes every step 2‑3 × fasterGitHubGitHub.
Yes, in a few edge‑cases.If you’re addingbrand‑new tokens(never seen in SDXL’s vocabulary) or chasingpin‑point prompt fidelity—e.g. photoreal logos, exact product SKUs, or subtle mood/style shifts—thefirstencoder (CLIP‑G) helps, and a quick warm‑up is usually enoughdocs.dreamlook.aiHugging FaceCVF Open Access.
Almost never for the second encoder.Encoder 2 (CLIP‑L) adds negligible quality but doubles VRAM; most trainers set its LR to zero or never wire it into the optimiser at allGitHubdocs.dreamlook.ai.
- Why SDXL has two text encoders—and why they slow you down
['Encoder', 'Dim', 'Role in SDXL', 'Cost impact']
['CLIP‑G/14(“TE‑1”)', '1280', 'Coarse semantic meaning', 'Adds ~1.2\u202fB params to the graph']
['CLIP‑L/14(“TE‑2”)', '768', 'Fine‑grained style hints', 'Another ~400\u202fM params']
During training every forward–backward pass must runbothencoders and keep their activations in memory. On a 24 GB RTX 4090, users report steps ballooning from 5‑6 s to 15‑20 s when encoders are left unfrozenGitHub. That is why most scripts expose:
────────────────────────────────────────────────────────────────────
bashCopy code--network_train_unet_only # Kohya
--train_text_encoder # Diffusers; omit this flag to freeze
--stop_text_encoder_training=0.3 # Stop after 30 % of total steps
Community docs even warn that “results of the training will beunexpectedunless you freeze the text encoders”GitHub.
- Quality implications ofnottraining encoders
['Potential artefact if encoders remain frozen', 'When you’ll notice it', 'Mitigation']
['Prompt slips / synonyms ignored— model treats new word as an existing nearest neighbour', 'Completely new object or name', 'Train\u202fTE‑1 for 5‑10\u202f% of steps at ½ UNet LRGitHub']
['Style leakage— your LoRA nails the subject but drifts in lighting or palette', 'Very stylised datasets (ink, Lego, pixel‑art)', 'Insert a Style TI token or do a short TE‑1 LoRA pass at low rankHugging Face']
['Token collisions— short rare strings (“sks dog”) pick up unrelated semantics', 'Any with rare trigger tokens', 'Pivotal‑tuning trick: train TE‑1 embeddings only, freeze weights after 50\u202f%Hugging Face']
['Poor text‑image alignmenton rigorous benchmarks', 'When you care about CLIP‑score or VQA metrics', 'End‑to‑end text‑encoder tuning improves FID and PickScore by 10–20\u202f% in TextCraftor studyCVF Open Access']
If you’re simply “making the model recognise my face / my product”, those issues rarely surface. The UNet learns cross‑attention offsets that are often enough.
- Practical training recipes
A. Fast, safe default (90 % of cases)
────────────────────────────────────────────────────────────────────
bashCopy code# Kohya SS LoRA
--network_train_unet_only
--cache_text_encoder_outputs
--lr 1e-4 --optimizer prodigy
Encoder outputs are cached once, so later steps are purely UNet maths and runmuchfasterGitHub.
The Prodigy/Adafactor optimisers cut VRAM peaks and converge quickerHugging Face.
Encoder outputs are cached once, so later steps are purely UNet maths and runmuchfasterGitHub.
The Prodigy/Adafactor optimisers cut VRAM peaks and converge quickerHugging Face.
B. “Teach the model anewword” (concept, brand, style)
────────────────────────────────────────────────────────────────────
bashCopy code--train_text_encoder
--text_encoder_lr 5e-5
--stop_text_encoder_training 0.3
--block_lr 1e-4,... # keep UNet LR higher
30 % schedule is a sweet‑spot: you get fresh token embeddings, then freeze them so they don’t overfit or bog down later epochsGitHub.
Use a lower LR (½ to ¼ of UNet) because the TE overfits in a few hundred stepsHugging Face.
30 % schedule is a sweet‑spot: you get fresh token embeddings, then freeze them so they don’t overfit or bog down later epochsGitHub.
Use a lower LR (½ to ¼ of UNet) because the TE overfits in a few hundred stepsHugging Face.
C. Research‑grade alignment pass
Fine‑tune TE‑1onlywith a reward‑guided loss à laTextCraftor; add your LoRA on top afterwards to stay GPU‑friendlyCVF Open Access.
Fine‑tune TE‑1onlywith a reward‑guided loss à laTextCraftor; add your LoRA on top afterwards to stay GPU‑friendlyCVF Open Access.
- VRAM & wall‑clock budgeting
['GPU', '1024² batch\u202f=\u202f1', 'UNet‑only', '+TE‑1', '+both TEs']
['8\u202fGB', '✔︎ (fp16, dim\u202f=\u202f8)', '5\u202fs/step', 'OOM', 'OOM']
['12\u202fGB', '✔︎ (dim\u202f≤\u202f64)', '4\u202fs', '9\u202fs', 'OOM']
['24\u202fGB', '✔︎ (dim\u202f128–256)', '3\u202fs', '7\u202fs', '15\u202fs']
Numbers averaged from community issue threads and in‑house runs on Kohya & DiffusersGitHubGitHubGitHub.
- Key take‑aways
Start with encoders frozen.You’ll train faster, use less memory, and most portrait/character LoRAs look great.
Enable TE‑1 briefly only when the prompt vocabularymustexpand or align better.
Leave TE‑2 disabled—quality gain is marginal and speed hit is severe.
If youdotrain an encoder, stop early, drop its LR, or cache its outputs.
Measure, don’t guess.Run A/B tests on a fixed seed and prompt set to see whether your extra hours on the text encoders actually move the needle.
Start with encoders frozen.You’ll train faster, use less memory, and most portrait/character LoRAs look great.
Enable TE‑1 briefly only when the prompt vocabularymustexpand or align better.
Leave TE‑2 disabled—quality gain is marginal and speed hit is severe.
If youdotrain an encoder, stop early, drop its LR, or cache its outputs.
Measure, don’t guess.Run A/B tests on a fixed seed and prompt set to see whether your extra hours on the text encoders actually move the needle.
With these heuristics you’ll keep your VRAM budget sane while still squeezing out quality when the project really demands it. Happy fine‑tuning! 🛠️🖼️
Sources
Kohya‑SS docs recommending--network_train_unet_onlyfor SDXL LoRAGitHub
GitHub issue reporting encoders slowing SDXL LoRA training on RTX 4090GitHub
Diffusers issue #7536 discussing benefits & cost of text‑encoder tuningGitHub
GitHub issue aboutstop_text_encoder_trainingbecause SDXL “overcooks” TE quicklyGitHub
Dreamlook.ai guide—only TE‑1 supported, set TE‑2 LR = 0 to save computedocs.dreamlook.ai
Hugging Face “LoRA scripts unite” article—independent LR & over‑fitting concernsHugging Face
TextCraftor (CVPR 2024) shows text‑encoder finetuning boosts alignment & qualityCVF Open Access
Practical blog “Fine‑Tuning Stable Diffusion XL” noting TE freeze for speedData Scientist\\\'s Diary
Reddit thread: TE training not recommended due to TE1/TE2 inconsistenciesReddit
Reddit guide “How to train SDXL LoRA with 128 DIM and text encoder” emphasising 16 GB VRAM needReddit
Kohya‑SS docs recommending--network_train_unet_onlyfor SDXL LoRAGitHub
GitHub issue reporting encoders slowing SDXL LoRA training on RTX 4090GitHub
Diffusers issue #7536 discussing benefits & cost of text‑encoder tuningGitHub
GitHub issue aboutstop_text_encoder_trainingbecause SDXL “overcooks” TE quicklyGitHub
Dreamlook.ai guide—only TE‑1 supported, set TE‑2 LR = 0 to save computedocs.dreamlook.ai
Hugging Face “LoRA scripts unite” article—independent LR & over‑fitting concernsHugging Face
TextCraftor (CVPR 2024) shows text‑encoder finetuning boosts alignment & qualityCVF Open Access
Practical blog “Fine‑Tuning Stable Diffusion XL” noting TE freeze for speedData Scientist\\\'s Diary
Reddit thread: TE training not recommended due to TE1/TE2 inconsistenciesReddit
Reddit guide “How to train SDXL LoRA with 128 DIM and text encoder” emphasising 16 GB VRAM needReddit
(Additional incidental references consulted: docs, Hugging Face script, CLIP‑L fine‑tuning post, etc.)