Glossary
LoRA
Low-rank adaptation: a fine-tuning method that freezes a model’s weights and trains small low-rank matrices alongside them, so a model can be adapted cheaply and the adapter stored as a small separate file.
LoRA, short for low-rank adaptation, is a way to fine-tune a large language model without updating its weights. The original weights stay frozen, and LoRA trains a pair of small matrices next to selected weight matrices, usually inside the attention layers. Their product is added to the frozen weights, so the model behaves as if it had been fully fine-tuned while only a tiny fraction of the parameters changed. Microsoft researchers introduced the method in 2021, and it has become the default way to fine-tune open weight models because it cuts GPU memory, training cost and storage by large factors. The result of a LoRA run is an adapter: a file of tens or hundreds of megabytes that can be loaded onto the base model, swapped for another adapter, or merged into the weights for serving. LoRA changes how a model behaves. It is a poor way to teach a model facts that change, which is where retrieval and memory come in.
How LoRA works
A transformer is mostly made of large weight matrices. Full fine-tuning computes an update for every value in every matrix, which means storing gradients and optimiser state for billions of parameters. LoRA starts from an observation in the original paper: the change a fine-tuning run makes to a weight matrix tends to have low intrinsic rank. Most of the useful adjustment can be expressed in far fewer dimensions than the matrix has.
So instead of learning the full update, LoRA learns it as the product of two thin matrices. For a weight matrix of size d by k, it adds a matrix B of size d by r and a matrix A of size r by k, where the rank r is small, often between 4 and 64. During training only A and B receive gradients. On the forward pass the layer computes the frozen weights applied to the input plus B times A applied to the input, scaled by a constant usually written as alpha divided by r. B starts at zero, so at the first step the model behaves exactly like the base model and training moves it gradually.
The savings are large. A 4,096 by 4,096 attention projection holds about 16.8 million values. A rank 8 LoRA on the same matrix trains two matrices with about 65,000 values between them, under half a percent of the original. Across a whole model the trainable share is commonly well below one percent. The LoRA paper reported that on GPT-3 175B it reduced trainable parameters by roughly 10,000 times and GPU memory during training by about three times, with quality comparable to full fine-tuning on the tasks tested.
Which matrices get adapters is a choice. The paper targeted the query and value projections in the attention mechanism. Current practice often adapts all the attention projections and the feed-forward layers too, which costs a little more and usually trains better on harder tasks.
A worked example
Suppose a team wants a 7-billion-parameter open model to write support replies in their house style and to return a fixed JSON envelope around every answer. Full fine-tuning would need several high-memory GPUs and would produce a new 14 GB checkpoint. With LoRA they freeze the base model, attach rank 16 adapters to the attention and feed-forward projections, and train on a few thousand example conversations. The run fits on a single GPU, finishes in hours, and produces an adapter of around 100 MB.
At serving time they have two options. They can merge the adapter into the base weights, which gives a normal model with no extra computation per token. Or they can keep the adapter separate and load it on demand, which lets one copy of the base model serve several adapters: one for support replies, one for internal summaries, one for a customer with unusual formatting rules. Serving stacks such as vLLM support loading multiple LoRA adapters against a shared base model for exactly this reason.
What the adapter will not do well is keep the support agent’s answers current. If the refund policy changes next month, the adapter still reflects whatever the training examples said. That part of the job belongs in retrieval over the current policy documents, as discussed below.
QLoRA and other variants
QLoRA, published in 2023, combines LoRA with model quantization. The frozen base model is stored in 4-bit precision using a format designed for normally distributed weights, and the LoRA matrices are trained in higher precision on top. Because the frozen weights take a quarter of the memory, QLoRA made it possible to fine-tune a 65-billion-parameter model on a single 48 GB GPU. It is now a common default when GPU memory is the constraint.
Other variants adjust the recipe. DoRA separates each weight into a magnitude and a direction and applies the low-rank update to the direction. LoRA+ uses different learning rates for the A and B matrices. Some methods vary the rank by layer, giving more capacity where it helps most. These are refinements: the core idea of training a small low-rank update beside frozen weights stays the same.
LoRA belongs to a wider family called parameter-efficient fine-tuning, alongside prompt tuning, prefix tuning and earlier adapter layers. LoRA became the most widely used of these largely because a merged LoRA adds no latency at inference, while earlier adapter layers added extra computation to every forward pass.
What LoRA is good at
LoRA is best at teaching a model a behaviour that should hold across many requests. Consistent tone and style, a specific output format, domain vocabulary, classification into a fixed set of labels, and following a house procedure are all good fits. It is also used in the later stages of model training: instruction tuning and preference methods related to RLHF are often run with LoRA on open models, because the savings make experiments cheap.
It also helps with cost. A smaller model with a well-trained adapter can sometimes match a larger general model on a narrow task, which lowers the price per request. Distillation pursues the same goal from another direction, training a small model on a large model’s outputs, and the two are often combined: distil the behaviour, then train it in with LoRA.
The adapter format makes versioning straightforward. Each adapter is a separate file tied to a known base model, so teams can keep several, roll back to an earlier one, and compare them against a golden dataset before switching. Normal LLM evaluation practice applies, with the base model as the baseline.
Where LoRA falls short
LoRA is a weak tool for knowledge. Training on documents can make a model reproduce their phrasing, but it does not reliably make the model recall specific facts on demand, and it gives no way to cite where a fact came from. Facts learned in the weights also go stale the moment the source changes, and correcting one means retraining. This is the main argument in RAG vs fine-tuning: behaviour goes in the weights, facts go in retrieval. Retrieval augmented generation keeps knowledge in documents that can be updated, searched and cited, and the model reads the relevant passage at request time.
LoRA is also a poor fit for anything specific to one user. Training an adapter per user is technically possible, but users change their minds, preferences pile up across weeks, and there is no practical way to retrain each time. That information belongs in agent memory, which stores and updates facts and preferences as they arrive. The same reasoning applies to personalisation more widely, and our blog post on memory vs fine-tuning covers the argument in more depth.
Two quieter risks are worth knowing. A narrow adapter can degrade general ability on tasks outside its training data, a mild form of catastrophic forgetting, though LoRA suffers less from this than full fine-tuning because the base weights are untouched. And small, low-quality training sets can teach the model to sound confident about things it does not know, which shows up as more hallucination.
LoRA compared with other ways to change a model
Approach | What changes | Good for | Cost to update |
|---|---|---|---|
Prompting | Nothing in the model | Instructions and examples per request | Edit the prompt |
LoRA | Small adapter beside frozen weights | Style, format, narrow skills | Retrain the adapter, hours |
Full fine-tuning | Every weight | Large shifts in behaviour | Retrain the model, days |
Retrieval | Context supplied at request time | Facts, documents, citations | Update the source document |
Memory | Stored facts and preferences per user | Personal context that changes | Write or update a memory |
Many production systems use several rows at once. Prompting and in-context learning handle the instructions for a request, a LoRA adapter handles house style, and retrieval plus memory supply the facts. Put each concern in the layer that can change at the speed that concern changes.
Where Exabase fits
Exabase does not train or host models, so it does not run LoRA. It covers the parts of the problem that LoRA handles badly. Exabase Memory extracts facts, preferences and events from conversations, resolves contradictions when they change, and returns the relevant ones in a few hundred tokens per request. Deep Search finds the passage inside a stored document that answers a question, with page numbers or timestamps for citation, so knowledge stays in documents rather than in weights. Each tenant or user can have its own Base, an isolated environment with its own memory and search index, which is usually a simpler unit of personalisation than an adapter per customer.
In practice a team might keep a LoRA adapter for their model’s output format and tone, and use Exabase for everything that varies by user or changes over time. The agent memory solution page covers that pattern, and the memory docs show how to write and search memories through the API. If the goal of fine-tuning was lower cost, the token cost solution describes how smaller, more precise context lets cheaper models perform better without training. For a survey of managed memory options, see our roundup of the best agent memory platforms.
Frequently asked questions
What does LoRA stand for?
Low-rank adaptation. It fine-tunes a model by training small low-rank matrices beside the frozen original weights.
Is LoRA the same as fine-tuning?
LoRA is a type of fine-tuning. Full fine-tuning updates every weight, while LoRA trains a small adapter and leaves the base model unchanged, which costs far less memory and storage.
Does LoRA slow down inference?
Not once the adapter is merged into the base weights. Kept separate, an adapter adds a small amount of computation, which is the price of swapping adapters on a shared base model.
What rank should I use for LoRA?
Ranks between 8 and 32 are common starting points. Higher ranks add capacity for harder tasks but cost more memory and can overfit small datasets, so compare a few on a held-out evaluation set.
What is the difference between LoRA and QLoRA?
QLoRA stores the frozen base model in 4-bit precision and trains LoRA adapters on top. It uses much less GPU memory, with a small cost in speed and sometimes quality.
Can LoRA teach a model new facts?
Not reliably. LoRA is good at style, format and narrow skills, but facts learned in weights are hard to recall precisely, cannot be cited and go stale. Use retrieval or Exabase Memory for facts.
Can I train a LoRA adapter for each user?
You can, but it rarely makes sense. Per-user preferences change often, and retraining for each change is impractical. Storing them in per-user memory scoped to a Base is simpler and stays current.
Related pages: fine-tuning, model quantization, distillation, open weight models, instruction tuning, RAG vs fine-tuning, embeddings vs fine-tuning, agent memory solution, coding assistants, Catastrophic forgetting