{"course":{"slug":"ai-images","title":"Image Generation, in Practice","url":"https://addaly.com/learn/ai-images","level":"beginner","track":"create"},"lesson":{"slug":"training-a-lora-in-practice","title":"Training a character LoRA on hardware you can borrow","url":"https://addaly.com/learn/ai-images/training-a-lora-in-practice","position":54,"of":69,"minutes":9,"answer":"A usable character LoRA trains from 15 to 30 images in under an hour on free cloud hardware, and the settings that matter are rank, learning rate and total steps.","keyIdea":"A usable character LoRA trains from 15 to 30 images in under an hour on free cloud hardware, and the settings that matter are rank, learning rate and total steps, with overfitting visible as the training images reappearing in the output."},"body":{"format":"markdown","text":"## What you are actually doing\n\nA LoRA adds small trainable matrices alongside the model's existing weights and trains only those. The base model is untouched. That is why the result is 20 to 150 MB rather than several gigabytes, and why it trains in minutes rather than weeks.\n\nFor a character, you are teaching the model to associate a rare token (`ohwx`, `sks`, or any string it does not already have a meaning for) with a specific face.\n\n## The recipe\n\nReasonable starting settings for an SDXL character LoRA:\n\n```text\nimages:            20  (15 minimum, 30 is plenty)\nresolution:        1024\nrepeats:           10\nepochs:            10\ntotal steps:       20 x 10 x 10 / batch 2  = 1000\nnetwork rank:      16      (8 for a simple style, 32 for a complex identity)\nnetwork alpha:     8       (half the rank is a common convention)\nlearning rate:     1e-4    (unet), 5e-5 (text encoder)\nscheduler:         cosine with 10% warmup\noptimiser:         AdamW8bit\nsave every epoch:  yes\n```\n\nSave every epoch. This is not optional advice: it is how you find the right amount of training. You will end up with ten files and the best one is usually not the last.\n\n## Running it free\n\n**Kaggle Notebooks** give about 30 GPU-hours a week, enough for many training runs. **Google Colab** free tier works for SD 1.5 comfortably and SDXL with care. Both have ready-made notebooks for the common trainers: Kohya's scripts and OneTrainer are the usual choices, both free and open source.\n\nExpect, for 1000 steps at 1024 resolution: roughly 25 to 40 minutes on a T4, 12 to 20 on a better card. Session limits are the real constraint, not capability. Upload the dataset to the session, train, and download the resulting files before the session ends, because it will end.\n\nLocally, 12 GB of VRAM trains SDXL LoRAs comfortably; 8 GB works with gradient checkpointing and a batch size of 1, slowly.\n\n## Finding the right epoch\n\nGenerate the same prompt and seed with each saved epoch and lay them out as a grid.\n\n- **Early epochs (1 to 3)**: identity weak, prompt followed well.\n- **Middle (4 to 7)**: identity present, prompt still working. **This is where the good one is.**\n- **Late (8 to 10)**: identity strong, prompt increasingly ignored, backgrounds from your training images appearing.\n\nThat last symptom is the definition of overfitting, and it is unmistakable once you know it: you ask for your character on a beach and get your character in front of the grey wall that was in twelve of your training photographs. The model has learned the wall as part of the concept.\n\nPick the middle epoch. Almost everyone's first LoRA is overtrained, because more training feels like more learning.\n\n## Captions\n\nEach training image gets a caption. The rule is counter-intuitive and worth stating clearly: **caption what should vary, not what should stay.**\n\n```text\nohwx woman, three-quarter view, grey background, neutral expression\nohwx woman, smiling, outdoors, blue jacket\n```\n\nThe token `ohwx` is constant, so the model attaches the invariant part (the face) to it. Everything you *do* caption becomes separable and controllable afterwards. If you caption the jacket, you can change the jacket later. If you do not, the jacket becomes part of the character.\n\nThis is the single most useful thing to understand about captioning, and it explains a whole class of \"my LoRA always puts her in the same shirt\" complaints.\n\n## Style LoRAs differ\n\nFor a style rather than a character: 30 to 100 images, lower rank (8 to 16), fewer steps, and captions that describe *content* thoroughly while never naming the style. The logic is the same: the style is the invariant, so leave it uncaptioned and it attaches to the trigger token.\n\n## The honest assessment\n\nA character LoRA takes about two hours end to end the first time: 30 minutes assembling and captioning, 30 training, 30 testing epochs, 30 tuning strength in real prompts. After a few, it is under an hour.\n\nIt gives you an identity that holds across dozens of images, works with any prompt, composes with controls, and is a file you own. For a campaign, a recurring character, or anything you will return to, it repays the hour many times.\n\nIt is the wrong answer for one image, and it is the wrong answer when you have not first checked that an adapter is good enough. And it has a specific failure worth knowing: a LoRA trained on 20 images of one face in similar conditions will reproduce those conditions, so the identity arrives carrying the lighting it was trained under. That is what the next lesson is about, and it is the difference between a LoRA that works and one that does not."},"check":{"question":"A character LoRA reproduces the grey wall from its training photographs no matter what environment the prompt asks for. What has happened?","options":[{"text":"The network rank is too high, giving the adapter more capacity than a single face requires and allowing it to memorise incidental detail.","correct":false,"tempting":"Excess rank can contribute, but the same symptom appears at rank 8 with too many steps, so rank is not the mechanism being described."},{"text":"The learning rate was set too high, so each update moved the weights far enough to capture the background alongside the subject.","correct":false,"tempting":"A high rate accelerates the same outcome without being the cause; the background is learned because it was never separated from the concept."},{"text":"Overfitting: the wall was constant across the training set and never captioned, so it became part of the concept attached to the trigger token.","correct":true},{"text":"The trigger token chosen was not sufficiently rare, so it carried a prior association with plain studio backgrounds from the base model's own training.","correct":false,"tempting":"A non-rare token causes contamination from the model's existing meaning, not reproduction of a specific wall from your own photographs."}]},"prev":{"slug":"the-character-sheet","title":"Build the reference before you build the images","url":"https://addaly.com/learn/ai-images/the-character-sheet"},"next":{"slug":"dataset-hygiene","title":"Four dataset faults, and the LoRA each one ruins","url":"https://addaly.com/learn/ai-images/dataset-hygiene"},"authorship":"Founder and series editor: Dr Mustafa Mun. Written by AI models to a written standard. Exam keys checked blind by a second model: 3,665 of 3,666 agreed. Academic review invited.","review":{"status":"Draft, open for academic review"},"cite":"Addaly (2026) 'Training a character LoRA on hardware you can borrow', in Image Generation, in Practice. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/ai-images/training-a-lora-in-practice (Accessed: 13 October 2026).","licence":{"name":"CC BY-NC-SA 4.0","url":"https://creativecommons.org/licenses/by-nc-sa/4.0/"},"reader":{"schema":1,"title":"Training a character LoRA on hardware you can borrow","courseTitle":"Image Generation, in Practice","module":{"index":6,"slug":"consistency","title":"The same thing, twelve times"},"answer":null,"keyIdea":"A usable character LoRA trains from 15 to 30 images in under an hour on free cloud hardware, and the settings that matter are rank, learning rate and total steps, with overfitting visible as the training images reappearing in the output.","hero":{"kind":"plate","image":null,"alt":null,"caption":null},"blocks":[{"t":"h2","id":"what-you-are-actually-doing","runs":[{"text":"What you are actually doing"}]},{"t":"p","runs":[{"text":"A LoRA adds small trainable matrices alongside the model’s existing weights and trains only those. The base model is untouched. That is why the result is 20 to 150 MB rather than several gigabytes, and why it trains in minutes rather than weeks."}]},{"t":"p","runs":[{"text":"For a character, you are teaching the model to associate a rare token ("},{"text":"ohwx","code":true},{"text":", "},{"text":"sks","code":true},{"text":", or any string it does not already have a meaning for) with a specific face."}]},{"t":"h2","id":"the-recipe","runs":[{"text":"The recipe"}]},{"t":"p","runs":[{"text":"Reasonable starting settings for an SDXL character LoRA:"}]},{"t":"code","lang":"text","label":"Text","text":"images:            20  (15 minimum, 30 is plenty)\nresolution:        1024\nrepeats:           10\nepochs:            10\ntotal steps:       20 x 10 x 10 / batch 2  = 1000\nnetwork rank:      16      (8 for a simple style, 32 for a complex identity)\nnetwork alpha:     8       (half the rank is a common convention)\nlearning rate:     1e-4    (unet), 5e-5 (text encoder)\nscheduler:         cosine with 10% warmup\noptimiser:         AdamW8bit\nsave every epoch:  yes"},{"t":"p","runs":[{"text":"Save every epoch. This is not optional advice: it is how you find the right amount of training. You will end up with ten files and the best one is usually not the last."}]},{"t":"h2","id":"running-it-free","runs":[{"text":"Running it free"}]},{"t":"p","runs":[{"text":"Kaggle Notebooks","b":true},{"text":" give about 30 GPU-hours a week, enough for many training runs. "},{"text":"Google Colab","b":true},{"text":" free tier works for SD 1.5 comfortably and SDXL with care. Both have ready-made notebooks for the common trainers: Kohya’s scripts and OneTrainer are the usual choices, both free and open source."}]},{"t":"p","runs":[{"text":"Expect, for 1000 steps at 1024 resolution: roughly 25 to 40 minutes on a T4, 12 to 20 on a better card. Session limits are the real constraint, not capability. Upload the dataset to the session, train, and download the resulting files before the session ends, because it will end."}]},{"t":"p","runs":[{"text":"Locally, 12 GB of VRAM trains SDXL LoRAs comfortably; 8 GB works with gradient checkpointing and a batch size of 1, slowly."}]},{"t":"h2","id":"finding-the-right-epoch","runs":[{"text":"Finding the right epoch"}]},{"t":"p","runs":[{"text":"Generate the same prompt and seed with each saved epoch and lay them out as a grid."}]},{"t":"ul","items":[[{"text":"Early epochs (1 to 3)","b":true},{"text":": identity weak, prompt followed well."}],[{"text":"Middle (4 to 7)","b":true},{"text":": identity present, prompt still working. "},{"text":"This is where the good one is.","b":true}],[{"text":"Late (8 to 10)","b":true},{"text":": identity strong, prompt increasingly ignored, backgrounds from your training images appearing."}]]},{"t":"p","runs":[{"text":"That last symptom is the definition of overfitting, and it is unmistakable once you know it: you ask for your character on a beach and get your character in front of the grey wall that was in twelve of your training photographs. The model has learned the wall as part of the concept."}]},{"t":"p","runs":[{"text":"Pick the middle epoch. Almost everyone’s first LoRA is overtrained, because more training feels like more learning."}]},{"t":"h2","id":"captions","runs":[{"text":"Captions"}]},{"t":"p","runs":[{"text":"Each training image gets a caption. The rule is counter-intuitive and worth stating clearly: "},{"text":"caption what should vary, not what should stay.","b":true}]},{"t":"code","lang":"text","label":"Text","text":"ohwx woman, three-quarter view, grey background, neutral expression\nohwx woman, smiling, outdoors, blue jacket"},{"t":"p","runs":[{"text":"The token "},{"text":"ohwx","code":true},{"text":" is constant, so the model attaches the invariant part (the face) to it. Everything you "},{"text":"do","i":true},{"text":" caption becomes separable and controllable afterwards. If you caption the jacket, you can change the jacket later. If you do not, the jacket becomes part of the character."}]},{"t":"p","runs":[{"text":"This is the single most useful thing to understand about captioning, and it explains a whole class of “my LoRA always puts her in the same shirt” complaints."}]},{"t":"h2","id":"style-loras-differ","runs":[{"text":"Style LoRAs differ"}]},{"t":"p","runs":[{"text":"For a style rather than a character: 30 to 100 images, lower rank (8 to 16), fewer steps, and captions that describe "},{"text":"content","i":true},{"text":" thoroughly while never naming the style. The logic is the same: the style is the invariant, so leave it uncaptioned and it attaches to the trigger token."}]},{"t":"h2","id":"the-honest-assessment","runs":[{"text":"The honest assessment"}]},{"t":"p","runs":[{"text":"A character LoRA takes about two hours end to end the first time: 30 minutes assembling and captioning, 30 training, 30 testing epochs, 30 tuning strength in real prompts. After a few, it is under an hour."}]},{"t":"p","runs":[{"text":"It gives you an identity that holds across dozens of images, works with any prompt, composes with controls, and is a file you own. For a campaign, a recurring character, or anything you will return to, it repays the hour many times."}]},{"t":"p","runs":[{"text":"It is the wrong answer for one image, and it is the wrong answer when you have not first checked that an adapter is good enough. And it has a specific failure worth knowing: a LoRA trained on 20 images of one face in similar conditions will reproduce those conditions, so the identity arrives carrying the lighting it was trained under. That is what the next lesson is about, and it is the difference between a LoRA that works and one that does not."}]}],"check":{"question":[{"text":"A character LoRA reproduces the grey wall from its training photographs no matter what environment the prompt asks for. What has happened?"}],"options":[{"text":[{"text":"The network rank is too high, giving the adapter more capacity than a single face requires and allowing it to memorise incidental detail."}],"correct":false,"tempting":[{"text":"Excess rank can contribute, but the same symptom appears at rank 8 with too many steps, so rank is not the mechanism being described."}]},{"text":[{"text":"The learning rate was set too high, so each update moved the weights far enough to capture the background alongside the subject."}],"correct":false,"tempting":[{"text":"A high rate accelerates the same outcome without being the cause; the background is learned because it was never separated from the concept."}]},{"text":[{"text":"Overfitting: the wall was constant across the training set and never captioned, so it became part of the concept attached to the trigger token."}],"correct":true,"tempting":null},{"text":[{"text":"The trigger token chosen was not sufficiently rare, so it carried a prior association with plain studio backgrounds from the base model’s own training."}],"correct":false,"tempting":[{"text":"A non-rare token causes contamination from the model’s existing meaning, not reproduction of a specific wall from your own photographs."}]}],"order":[0,2,1,3],"why":null},"prev":{"slug":"the-character-sheet","title":"Build the reference before you build the images","minutes":8},"next":{"slug":"dataset-hygiene","title":"Four dataset faults, and the LoRA each one ruins","minutes":8}}}