Skip to main content

Overview

LoRA (Low-Rank Adaptation) enables efficient fine-tuning of large language models by training small adapter matrices instead of all model parameters. This dramatically reduces memory requirements and training time while maintaining performance.

LoraArguments

Configure LoRA training with these parameters:

Core Parameters

LoRA Rank

int
default:"64"
Rank of the LoRA update matrices. Controls the size of adapter weights:
  • Lower (8-16): Fewer parameters, faster training, may underfit
  • Medium (32-64): Balanced performance and efficiency (recommended)
  • Higher (128+): More expressive, closer to full fine-tuning

LoRA Alpha

int
default:"16"
Scaling factor for LoRA updates. The effective learning rate multiplier is lora_alpha / lora_r:
  • Typical values: 16, 32, 64
  • Higher values increase the influence of LoRA updates
  • Usually set to lora_r or lora_r / 2

LoRA Dropout

float
default:"0.05"
Dropout probability for LoRA layers:
  • 0.0: No dropout
  • 0.05-0.1: Light regularization (recommended)
  • 0.1-0.3: Stronger regularization

Target Modules

list[str]
default:"[\"c_attn\", \"c_proj\", \"w1\", \"w2\"]"
List of module names to apply LoRA to. For Qwen models:
  • c_attn: Attention query/key/value projections
  • c_proj: Attention output projection
  • w1, w2: FFN layers

Common Configurations

Attention only (fastest, least parameters):
Attention + output (balanced):
Full coverage (best performance):

Bias Training

str
default:"none"
Which bias parameters to train:
  • "none": No bias training (fastest)
  • "all": Train all bias parameters
  • "lora_only": Train only biases of LoRA modules

Quantized LoRA (QLoRA)

bool
default:"False"
Enable QLoRA for 4-bit quantized fine-tuning:
  • Reduces memory usage by ~75%
  • Enables fine-tuning large models on consumer GPUs
  • Slight performance trade-off

QLoRA Configuration

When using QLoRA, the model is automatically loaded with 4-bit quantization:

Loading Pretrained LoRA

str
default:""
Path to pretrained LoRA weights to continue training:

Complete Examples

Standard LoRA Training

QLoRA Training (Memory Efficient)

Minimal LoRA (Fastest)

LoRA Implementation

The LoRA configuration is applied using PEFT library:

Trainable Parameters

LoRA dramatically reduces trainable parameters:

Hyperparameter Guidelines

Task-Based Recommendations

Instruction Following / Chat:
Domain Adaptation:
Task-Specific (Classification, etc.):

Memory Constraints

24GB GPU (e.g., RTX 3090):
40GB GPU (e.g., A100):
80GB GPU (e.g., A100 80GB):

Merging LoRA Weights

After training, merge LoRA adapters into base model: