core-ai
Glossary ↗Low-Rank Adaptation (LoRA)
Low-Rank Adaptation (LoRA) is a parameter-efficient fine-tuning technique that dramatically reduces the cost and hardware requirements of customizing a large model. Instead of updating all of a model's billions of original weights during fine-tuning (which requires storing gradients and optimizer states for every parameter — extremely memory-intensive), LoRA freezes the entire original model and injects small, trainable "low-rank" matrices alongside specific layers (typically the attention layers); only these tiny added matrices are trained, while the vast majority of the original model stays completely untouched. Mathematically, the technique exploits the observation that the weight updates needed to adapt a model to a new task tend to have low "intrinsic rank" — meaning they can be well-approximated by the product of two much smaller matrices, reducing trainable parameters by 100-1000x compared to full fine-tuning while achieving comparable task performance. This matters enormously for SaaS builders and independent developers because it turns fine-tuning from a "needs a cluster of A100 GPUs and a dedicated ML team" problem into something feasible on a single consumer GPU or a modest cloud instance. A concrete worked example: fine-tuning a 7-billion-parameter open-weight model (like Mistral-7B) with full fine-tuning requires storing gradients and optimizer state for all 7 billion parameters — often 60-100+ GB of GPU memory. With LoRA, only a few million parameters (the injected low-rank matrices, often <1% of the original model size) are trained, fitting comfortably in under 16GB of VRAM — a single consumer GPU — while producing a small "adapter" file (often just tens of megabytes) that can be loaded on top of the frozen base model at inference time. This also enables a practical product pattern: a SaaS company can train dozens of lightweight LoRA adapters for different customers or use cases (one per brand voice, one per industry vertical) and swap them in and out at inference time on top of a single shared base model, instead of hosting dozens of full fine-tuned model copies. QLoRA extends this further by also quantizing the frozen base model, pushing fine-tuning accessibility even further down to modest hardware. LoRA adapters are also composable in ways full fine-tuning isn't: some frameworks support merging multiple LoRA adapters at inference time, or dynamically swapping which adapter is active per-request based on the calling customer or context, since each adapter is just a small set of additional matrices layered on the same frozen base model rather than an entirely separate model checkpoint. For a multi-tenant SaaS platform offering "customize the AI's tone/behavior for your brand" as a feature, this makes per-customer LoRA adapters a genuinely practical architecture — training a lightweight adapter per customer from their own examples, without the storage and serving cost of hosting dozens of full duplicate model copies.
Related terms