LoRA Best Practices: Fine-Tune LLMs on a Small Budget
LoRA fine-tuning works best with a small rank, the right layers, clean task data and a fixed test set. These practices keep a cheap adapter from getting worse.
On this page
Short answer
LoRA best practices start with a small rank, usually 8 to 16, applied to the attention layers first, trained on clean examples of the task you actually need. Keep a fixed test set, compare the adapter against the base model on real prompts, and only merge the adapter into the model once the checks pass. Small, measured steps beat large ranks and long training runs.
What is LoRA fine-tuning?
LoRA, or low-rank adaptation, is a fine-tuning method that trains a small adapter instead of changing the whole model. The base model stays frozen, and LoRA adds two small matrices to selected layers that learn the task. The adapter is a fraction of the size of the full model.
Because only the adapter trains, LoRA needs far less memory and compute than full fine-tuning. A team can fine-tune a large model on a single GPU, and the adapter can be swapped in and out without touching the base model.
LoRA suits tasks where the base model already knows the domain but needs to learn a format, a tone or a narrow skill. It does not suit teaching a model entirely new facts. For the basics, see what LoRA is.
How do you pick the rank and alpha?
You pick the rank by starting small and raising it only when the results demand it. Rank 8 or 16 is enough for most tasks, such as formatting, tone and classification. Higher ranks add capacity, but they also add training time and the risk of memorising the training data.
Alpha sets the scale of the adapter's effect. A common starting point is to set alpha to twice the rank, then adjust if the model underfits or overfits. Keep the two linked while you test, so a change in rank does not silently change the effective learning rate.
Test on a fixed set of real prompts, not on the training data. If a higher rank improves the test set, keep it. If it only improves training loss, it is memorising, and the smaller rank is better.
Which layers should you adapt?
You adapt the attention layers first, and add the feed-forward layers only when the task needs it. Attention layers carry most of the task behaviour for formatting, tone and style, and adapting them alone is often enough.
Adapting more layers adds capacity, but it also adds training time and makes the adapter larger. For a classification or formatting task, attention-only adaptation is the right start. For a task that needs new reasoning patterns, try adding the feed-forward layers and compare the results on the same test set.
Keep the choice fixed while you test other settings. Changing layers, rank and data at the same time makes it impossible to tell which change helped. One change at a time is slower, but it produces a result you can trust.
How do you prepare the data?
You prepare LoRA data by collecting clean examples of the exact task, in the exact format the model will see in production. A hundred clean examples beat a thousand noisy ones, because the adapter learns whatever pattern the data shows, including the mistakes.
Remove duplicates, fix inconsistent formatting, and check that the answers are correct. If the training data contains wrong answers, the adapter learns to give wrong answers with confidence. A human should read a sample of every batch before training starts.
Split the data before you train: a training set, a validation set and a held-out test set. The test set must never appear in training, or the scores will lie. For enterprise use, see LoRA fine-tuning for enterprise AI.
What training settings should you start with?
Start with conservative training settings and change one thing at a time. LoRA is forgiving, but a high learning rate or too many epochs can destroy the base model's behaviour on the task.
| Setting | Starting value | When to change it |
|---|---|---|
| Rank | 8 to 16 | Raise it if the test set underfits |
| Alpha | Twice the rank | Lower it if the adapter dominates the base model |
| Learning rate | 1e-4 to 2e-4 | Lower it if training loss jumps around |
| Epochs | 2 to 3 | Add one if the test set still improves |
| Batch size | 4 to 8 | Raise it if training is unstable |
| Dropout | 0.05 | Raise it if the model memorises training data |
Watch the validation loss, not just the training loss. When validation loss stops improving, stop training. Extra epochs after that point usually make the model worse on new prompts.
How do you evaluate a LoRA adapter before you ship it?
You evaluate a LoRA adapter by comparing it against the base model on the same fixed test set, using the prompts your users actually send. The adapter must beat the base model on the task, and it must not get worse on the things the base model already did well.
Test for regression, not just improvement. Run a set of general prompts through both models and compare the answers. An adapter that improves the task but breaks general answers is not ready to ship.
Have a person read a sample of the outputs. Automatic scores miss tone, formatting and subtle errors, and a person reading twenty outputs catches problems that no metric shows. For the wider field, see what fine-tuning is.
Example (hypothetical): fine-tuning a support drafting model
Example (hypothetical): a support team drafts 40 replies a day from a base model. A human reviews each draft, and 22 of 40 pass without changes. The team wants an adapter that matches the company's tone and format.
They collect 500 past replies, clean them, and hold out 50 as a test set. They train a rank 16 adapter on the attention layers for 3 epochs, with a learning rate of 1e-4. On the test set, the adapter passes 42 of 50 prompts without changes, against 31 of 50 for the base model.
Review time falls from 4 minutes per draft to 1 minute, a saving of 3 minutes on each of 40 drafts, or 120 minutes a day. The team ships the adapter, keeps the base model as a fallback, and re-tests it monthly on new prompts.
What are the common mistakes?
The most common LoRA mistakes are a rank that is too high, dirty training data, and shipping an adapter that was never compared against the base model.
- Rank too high. A large rank memorises the training data and trains slower. Start at 8 or 16 and raise it only on test-set evidence.
- Dirty data. Wrong answers in the training data become wrong answers in production. Read a sample of every batch before training.
- No held-out test set. Without one, you cannot tell if the adapter learned the task or memorised the examples.
- Too many epochs. Extra epochs after validation loss flattens usually make the model worse on new prompts.
- Skipping regression checks. An adapter that breaks general behaviour is not ready, however well it does the task.
If the fine-tuning needs to fit a wider plan, a partner for LLM fine-tuning can review the setup before training starts.
Key takeaways
- LoRA trains a small adapter, not the whole model, so it needs far less compute
- Start with rank 8 to 16 on the attention layers and raise it only on test evidence
- Clean task data in the production format matters more than data volume
- Compare the adapter against the base model on a fixed test set, and check for regression
- Stop training when validation loss flattens, and keep a person reading outputs
Frequently asked questions
What is the difference between LoRA and full fine-tuning?
Full fine-tuning changes every weight in the model and needs far more memory and compute. LoRA trains only a small adapter on selected layers, so it runs on a single GPU and the adapter can be swapped in and out without touching the base model.
What rank should I use for LoRA?
Start with rank 8 or 16 for most tasks, such as formatting, tone and classification. Raise the rank only if the fixed test set shows the model underfits. A higher rank adds capacity, but it also adds training time and the risk of memorising the data.
Can LoRA teach a model new facts?
No, not reliably. LoRA is good at teaching format, tone and narrow skills that the base model already has the knowledge for. New facts are better handled by retrieval, where the model reads the facts at run time.
Should I merge the LoRA adapter into the base model?
Merging is optional. Keeping the adapter separate lets you swap it in and out and run several adapters on one base model. Merge it only when you need a single file to deploy, and only after the checks pass.
How much data do I need for LoRA?
A hundred clean examples can be enough for a formatting or tone task. A narrow skill may need a few hundred. More data helps only if it is clean and in the exact format the model will see in production.
Does LoRA work for every model?
LoRA works with most transformer models, including the open models teams commonly fine-tune. The exact layers to adapt vary by model, so check the model card and test on a fixed set before shipping.