Skip to main content
AI / MLTraining & TuningDiagramIntermediate

LoRA

KO: LoRA·EN: LoRA·JA: LoRA·Low-Rank Adaptation

A parameter-efficient fine-tuning (PEFT) method that freezes pre-trained weights and trains small low-rank adapter matrices (A and B), drastically cutting VRAM and training cost

Table of Contents

Structure Diagram

Full Fine-Tuning vs LoRA / QLoRA
Full FTFull Fine-Tuning

Updates 100% of weights

  • VRAM (70B)Multi-node H100 cluster
  • Checkpoint SizeFull 140GB copy per task
  • RiskHigher catastrophic forgetting
LoRALoRA / QLoRA Adapter

Trains 0.1–1% low-rank weights

  • VRAMSingle GPU via 4-bit QLoRA
  • Checkpoint SizeTiny 20–200MB adapter files
  • ServingZero latency merged; hot-swap adapters
Quick Answer

What is LoRA?

A parameter-efficient fine-tuning (PEFT) method that freezes pre-trained weights and trains small low-rank adapter matrices (A and B), drastically cutting VRAM and training cost. It is a core concept in Training & Tuning within AI / ML.

Core Principles

LoRA (Low-Rank Adaptation) leverages the insight that weight updates ΔW during task adaptation occupy a low-rank subspace. Instead of updating all billion parameters of a frozen matrix W₀, LoRA trains two compact matrices A ∈ R^(r×k) and B ∈ R^(d×r) (r ≪ d, k) so that W = W₀ + (α/r) · BA.

At deployment time, BA can be merged directly into W₀ with zero inference latency overhead, or kept separate for dynamic multi-adapter serving.

Practical Takeaways

  • Target all linear layers, not just Q/V: Applying LoRA across both Attention and MLP projections matches Full Fine-Tuning much more closely than Attention-only adapters.
  • Start with r=16, alpha=32: Low ranks suffice for style and schema adherence; scale up to r=64 for denser domain reasoning tasks.
  • Use Multi-LoRA serving for multi-tenant AI: Serving one shared base model with hot-swapped per-customer adapters in vLLM dramatically reduces GPU fleet costs.

Notable Examples

  • QLoRA: Combines 4-bit NormalFloat base weights with LoRA adapters to fine-tune large LLMs on a single workstation GPU.
  • Multi-Tenant Enterprise LLMs: Hosts dozens of domain-specific LoRA adapters on one shared base model deployment.
  • Diffusion Style LoRAs: Packs brand aesthetics or character likenesses into 50MB adapters for Flux or Stable Diffusion.