LoRA vs QLoRA: Parameter-Efficient Fine-Tuning Explained
On this page
What is LoRA
LoRA, which stands for Low-Rank Adaptation, is a parameter-efficient fine-tuning method that enables high-quality model adaptation without updating all of a model's parameters. LoRA was introduced in the paper "LoRA: Low-Rank Adaptation of Large Language Models" and has since become the dominant approach for fine-tuning large language models in production settings, largely because it achieves results close to full fine-tuning while requiring a fraction of the compute and memory.
The key insight behind LoRA is that the weight updates that occur during fine-tuning tend to have low intrinsic rank, meaning they can be well-approximated by a product of two small matrices rather than a full-sized weight update matrix. By exploiting this structure, LoRA can represent meaningful weight updates with far fewer parameters. A weight matrix that might have millions of entries can be updated effectively by a pair of matrices with a few hundred entries each, and the quality degradation relative to full fine-tuning is often minimal.
In practice, LoRA adapters are typically much smaller than the base model, often less than one percent of the total parameter count. This makes them cheap to store, quick to switch between, and easy to version. You can maintain multiple LoRA adapters for different tasks or domains and load the appropriate one at inference time without keeping multiple copies of the full base model.
How LoRA Works
To understand LoRA mechanically, consider a weight matrix W with dimensions d by k, say, an attention projection matrix in a transformer. During normal training, updating W requires storing a gradient of the same size d by k, which is expensive for large models. LoRA instead introduces two smaller matrices: A with dimensions r by k and B with dimensions d by r, where r is the rank and is typically much smaller than both d and k (common values are 8, 16, 32, or 64).
During the LoRA forward pass, the effective weight is W plus the product BA, where BA has the same shape as W but is parameterized by far fewer values: d times r plus r times k instead of d times k. The matrix A is initialized randomly (using a normal distribution) and B is initialized to zero, so the initial contribution of the LoRA update is zero. Training starts from the pre-trained behavior and learns from there.
The rank r is the primary hyperparameter controlling LoRA capacity. Higher rank means more parameters and more representational capacity, approaching full fine-tuning at the limit. Lower rank means fewer parameters, faster training, and smaller adapters, but may not capture all the necessary fine-tuning signal for complex tasks. Alongside rank, the alpha parameter scales the LoRA update: the actual update applied is (alpha/r) times BA. A common convention is to set alpha equal to twice the rank. The target_modules parameter specifies which weight matrices receive LoRA adapters, typically the attention query, key, value, and output projection matrices, and sometimes the feed-forward layers as well.
What is QLoRA
QLoRA extends LoRA with quantization of the base model to reduce memory requirements further. The name stands for Quantized LoRA. In a standard LoRA setup, the base model is loaded in its full precision, typically bfloat16 or float16. In QLoRA, the base model weights are quantized to 4-bit precision using a technique called NF4 (NormalFloat4) quantization before the LoRA adapters are added.
The reason NF4 quantization specifically is used (rather than integer quantization) is that it is designed to be information-theoretically optimal for normally distributed weights, which is what you get in well-trained neural networks. The quantization maps the weight values to the nearest of 16 possible quantized values arranged to minimize expected quantization error across a normal distribution. This preserves more information than uniform quantization for the same bit budget.
The LoRA adapters themselves are trained and stored in higher precision, typically bfloat16, even though the base model is in 4-bit. This asymmetry is important: the base model, which is frozen, benefits from quantization without quality loss because it is not being updated. The adapters, which are small and actively being trained, need higher precision for stable gradient updates. The combined effect is that QLoRA reduces memory consumption by roughly 50 to 70 percent compared to standard LoRA while typically achieving quality within a few percent of LoRA and often indistinguishable from it.
Memory Comparison
Memory requirements scale with model size and training method, and the differences between approaches are substantial enough to determine what is feasible on a given hardware configuration. For a 7 billion parameter model, the approximate memory footprints are as follows: Full fine-tuning in bfloat16 requires roughly 56 GB of memory just for the model weights, gradients, and optimizer states. Standard LoRA with rank 16 on a 7B model requires approximately 24 GB, a significant reduction because gradients and optimizer states are only needed for the small adapter matrices, not the full model. QLoRA on the same 7B model brings memory consumption down to approximately 12 to 14 GB by loading the base model in 4-bit.
For a 13 billion parameter model, these numbers roughly double: full fine-tuning around 104 GB, LoRA around 48 GB, QLoRA around 24 GB. For a 70 billion parameter model, full fine-tuning becomes impractical on most single-node configurations at around 560 GB, LoRA requires approximately 240 GB, and QLoRA brings this down to a more feasible 120 GB. These figures are approximate and depend on sequence length, batch size, and gradient checkpointing configuration, but they illustrate the scale of the difference.
Gradient checkpointing is a complementary technique that trades compute for memory by recomputing activations during the backward pass rather than storing them. Enabling gradient checkpointing typically reduces memory by 30 to 40 percent at the cost of 20 to 30 percent slower training. BIOS allows you to enable gradient checkpointing independently of adapter choice.
The BIOS training wizard lets you select your adapter type and see memory estimates before launching your job:
When to Choose LoRA vs QLoRA
The choice between LoRA and QLoRA comes down primarily to memory constraints and quality requirements. If memory is not the limiting factor, meaning you can fit your model and training state comfortably within available memory, standard LoRA is generally preferable. It trains faster (no quantization overhead), achieves slightly higher quality on average, and produces adapters that are easier to use at inference time because they do not require the base model to be quantized.
QLoRA is the right choice when memory is the primary constraint. The most common scenario is fine-tuning a model that is too large for standard LoRA to fit in available memory. If you are working with a 70B parameter model and have limited memory, QLoRA may be the only feasible option. QLoRA is also useful when you want to run multiple training experiments in parallel on a single machine, since its lower memory footprint allows more concurrent jobs.
Quality differences between LoRA and QLoRA are generally small and task-dependent. On many tasks, QLoRA achieves quality indistinguishable from LoRA. On tasks requiring very precise numeric computation, very long-range dependencies, or subtle stylistic control, standard LoRA may have an edge. The practical recommendation is to prototype with QLoRA (lower cost, smaller memory footprint) and if you observe a quality gap on your specific task, run an A/B comparison with standard LoRA to see whether the difference is meaningful for your use case.
BIOS Configuration
Configuring LoRA or QLoRA on BIOS is done through the training run configuration form. The key parameters you will set are:
- Adapter type: select "LoRA" for standard low-rank adaptation with the base model in bfloat16, or "QLoRA" for the quantized variant with the base model in 4-bit NF4.
- Rank (r): controls the dimensionality of the low-rank decomposition. Common starting values are 8 for smaller budgets (fewer parameters, faster training), 16 for a good general-purpose baseline, or 32 to 64 when you need more capacity for complex tasks or larger datasets.
- Alpha: scales the magnitude of the LoRA update. A common convention is to set alpha to twice the rank: if r is 16, set alpha to 32. This gives the LoRA update an effective scale factor of 2.0, which has empirically been found to work well across many tasks. You can tune this as a hyperparameter, but starting at 2x rank is a reliable default.
- Target modules: specifies which weight matrices in the model receive LoRA adapters. At minimum, include the attention query, key, value, and output projections, typically named
q_proj,k_proj,v_proj, ando_proj. Including the feed-forward layers (gate_proj,up_proj,down_projfor LLaMA-family models) can improve quality at the cost of more adapter parameters. - LoRA dropout: adds regularization by randomly zeroing adapter weights during training. A value of 0.05 to 0.1 is typical.
You can monitor your LoRA or QLoRA training run in real time on the BIOS training detail page, which shows loss curves, learning rate schedules, and checkpoint history:
Best Practices
A few habits go a long way with LoRA and QLoRA. Start with a rank of 16 and alpha of 32 as your baseline. This is a middle-ground configuration that works well across a wide range of tasks. If your loss curves look good and evaluation metrics are close to what you need, stay with these values. If quality is falling short, try increasing rank to 32 or 64. If you need to reduce memory or training time, try rank 8.
Always include the attention projection matrices in your target modules. The attention mechanism is where most of the model's contextual computation happens, and it is where LoRA has the highest impact. Feed-forward layers are worth including for tasks requiring significant knowledge injection or behavioral change but can be omitted if you are doing lighter-touch style adaptation.
For learning rate, standard LoRA training typically works well with rates between 1e-4 and 2e-4. For QLoRA, use rates in the range 1e-4 to 3e-4. The quantization slightly changes the gradient dynamics and often benefits from a marginally higher learning rate compared to standard LoRA. Enable gradient checkpointing to reduce memory usage at a modest compute cost. This is especially valuable with QLoRA where you are already working near memory limits.
Run at least a short evaluation sweep before committing to a long training run. Launch a quick 100-step run with your full configuration and check that the loss is decreasing and the training is stable. This catches configuration errors before they waste compute on a full multi-hour training run. When you have a checkpoint you are happy with, merge the LoRA adapter into the base model weights using BIOS's merge functionality to get a clean single-file model for inference. Merging eliminates the adapter overhead at inference time.
Running LoRA and QLoRA on BIOS
You can run LoRA and QLoRA side by side on any of the 250+ supported models. Start by uploading your dataset in the Datasets section. BIOS validates the format immediately and lets you preview samples before training. Navigate to Training and click New Training Run to open the seven-step configuration wizard.
In the adapter selection step, choose either LoRA or QLoRA. The wizard automatically adjusts the available hyperparameters based on your selection. For LoRA, you will configure rank, alpha, target modules, and dropout. For QLoRA, the same parameters are available plus the quantization is handled automatically. BIOS loads the base model in 4-bit NF4 precision without any additional configuration on your part.
After launching the job, the training list view shows all your active and completed runs with their current status, progress, and key metrics. Comparing multiple LoRA and QLoRA experiments side by side takes no extra work. Click into any run to see the detailed loss curves, learning rate schedule, and checkpoint history. Short comparison runs are cheap because billing is per second, so try LoRA rank 8, 16, and 32 in quick succession to find the best configuration for your task.
Troubleshooting Common Issues
Several issues commonly arise when training with LoRA or QLoRA, and knowing how to diagnose them saves significant time and compute. If your training loss is not decreasing after the first few hundred steps, the most likely cause is a learning rate that is too low. Try increasing the learning rate by a factor of 2 to 5. If the loss is oscillating wildly or spiking, the learning rate is too high. Reduce it by half and restart.
If you see out-of-memory errors during training, you have several options depending on your adapter type. If using standard LoRA, switch to QLoRA to reduce the base model memory footprint. If already using QLoRA, reduce the batch size, enable gradient checkpointing, or reduce the sequence length. Reducing the LoRA rank also lowers memory consumption but may affect quality.
If your fine-tuned model produces outputs that are noticeably worse than the base model, the most common causes are overfitting (too many epochs on a small dataset), a learning rate that was too high (partially overwriting pre-trained knowledge), or poor data quality. Check your validation loss curve for signs of overfitting. If validation loss increased while training loss decreased, reduce epochs or increase regularization. Review a sample of your training data to ensure the outputs are actually the quality you want the model to produce.
For QLoRA specifically, if you notice quality degradation compared to LoRA on the same task, try increasing the rank parameter. The quantization of the base model slightly reduces the model capacity available for fine-tuning, and a higher rank can compensate for this. Increasing rank from 16 to 32 often closes the quality gap between QLoRA and standard LoRA.
Related Articles
Complete Guide to Supervised Fine-Tuning (SFT) for LLMs
Learn supervised fine-tuning (SFT) for LLMs from scratch. Covers dataset format, adapter selection, hyperparameter tuning, and training on BIOS with real-time metric monitoring.
Full Fine-Tuning: When and Why to Train Every Parameter
Understand when full fine-tuning outperforms LoRA and QLoRA. Learn VRAM requirements, dataset size thresholds, cost optimization strategies, and how to configure full fine-tuning on BIOS.
Adapter Types Compared: LoRA, QLoRA, Full Fine-Tune and Beyond
Compare all adapter types for LLM fine-tuning: LoRA, QLoRA, full fine-tune, AdaLoRA, LoHa, BOFT, and ReFT. Learn which adapter fits your use case and budget.