Selected work

LoRA vs full fine-tuning

Vision Transformers

How much of a model needs to learn?

A direct PyTorch implementation of low-rank adaptation, compared with full fine-tuning on EuroSAT RGB. A focused experiment in parameter efficiency and the mechanics beneath adapter libraries.

View source
My role
Manual LoRA implementation & experiment framework
Project context
Single-run validation study
Evidence reviewed
3 November 2026

The problem

A smaller update. A testable question.

Full fine-tuning updates every model parameter. That can be an expensive way to adapt a pretrained transformer to a smaller downstream task. This experiment asks how a small trainable update compares with full adaptation under a shared training setup.

Freeze the backbone and replace selected query/value projections with a custom LoRALinear layer. Train low-rank A and B matrices plus the classifier, then compare ranks 16, 32 and 64 against a full-fine-tuning baseline. Typed configuration and separate data, model and training modules keep the runs reproducible.

Context & contribution

An individual deep-learning experiment using google/vit-base-patch16-224 on ten land-use classes. The same stratified split is reused across the four configurations.

The mechanism

Freeze the backbone. Learn the update.

A direct PyTorch implementation.

Wnew = W + (α / r) BA

The frozen weight keeps its pretrained representation. B and A learn a low-rank correction scaled by α/r. The implementation adapts query/value projections in the final three transformer blocks and also trains the classifier.

Engineering challenges

Where the difficult work lives.

Understand the update instead of hiding it

The custom layer retains the pretrained weight, initializes A with Kaiming uniform and B with zeros, and adds the scaled low-rank output in forward(). This makes the starting update zero and the adaptation mechanism directly inspectable.

Compare like with like

The default data path creates one seed-42 stratified 80/20 split reused across all configurations. Five epochs and batch size 16 define the reported run budget. Configuration-specific checkpoints and result records keep experiments separate.

Support transformer implementation variants

Model construction supports both encoder.layer attention query/value paths and vit.layers q_proj/v_proj paths. The target remains the query and value projections in the final three transformer blocks.

Implementation & trade-offs

Every choice has a boundary.

Adapt the last three blocks

LoRA targets Q/V projections in blocks 9, 10 and 11. The classifier also remains trainable, and reported trainable parameter counts include it.

Trade-offThis keeps the adapter small. Applying LoRA to embeddings, MLPs or more layers could change the tradeoff and was not ablated in the reported comparison.

Compare three ranks

Ranks 16, 32 and 64 vary the capacity of the low-rank update. All three retain less than 1% trainable parameters in the reported table.

Trade-offThe validation scores are not monotonic with rank. A single run cannot distinguish seed variation from a reliable difference between configurations.

Keep metrics scoped to validation

Report validation accuracy, trainable counts and the shared experimental setup alongside the original repository figure.

Trade-offThe dataset and single seed limit generalization. Trainable-parameter savings alone do not establish proportional wall-clock speed, memory or inference-latency gains.

Built with

  • Python
  • PyTorch
  • Hugging Face Transformers
  • torchvision
  • scikit-learn
  • PyYAML
  • EuroSAT RGB

Results & evaluation

The evidence, with its scope.

Historical repository results.
Methods and limitations travel with the numbers.

Full-tuning accuracy
98.74%
Validation · all model parameters trainable
LoRA r=64 accuracy
98.13%
Validation · approximately 0.69% trainable parameters
Compared configurations
4
One full-tuning run and LoRA ranks 16, 32 and 64

Accuracy and parameter efficiency

Select a run below to inspect its trade-off. The horizontal axis uses a logarithmic scale.

Validation accuracy versus trainable parametersFull fine-tuning has 98.74 percent accuracy at 100 percent trainable parameters. LoRA rank 16 has 97.98 at 0.18 percent, rank 32 has 97.94 at 0.35 percent, and rank 64 has 98.13 at 0.69 percent. All values are available in the table below.97%98%99%100%0.1%1%10%100%Validation accuracyTrainable parameters · log scaleFull tuningLoRA runs
Selected runLoRA r=64
Trainable parameters597,514
Gap from full tuning0.61 percentage points
Repository-reported results · one run per configuration
Select a runTrainableAccuracy
100.00%98.74%
0.18%97.98%
0.35%97.94%
0.69%98.13%

5 epochs · batch size 16 · seed 42 · stratified 80/20 train/validation split. Counts include the trainable classifier. Single-run values have no confidence intervals.

Inspect the original results figure
Original repository figure comparing full fine-tuning and LoRA ranks 16, 32 and 64 by validation accuracy and trainable parameter percentage.
Original repository asset. Single run per configuration, with the same limitations as the table above.

Limits & lessons

What the work establishes.
What needs more evidence.

  • One run per configuration and one dataset. There are no multi-seed confidence intervals or statistically conclusive superiority claims.
  • Reported numbers are validation results on EuroSAT RGB. They are not an independent held-out test evaluation across domains.
  • Only Q/V projections in the last three blocks were adapted. Wider target sets and alternate training budgets need separate experiments.
  • The supplied CV’s 98.9% figure differs from the current repository table. This case study uses the repository values with their stated configuration and scope.

Engineering takeaway

Parameter efficiency is a measurable engineering tradeoff. Implementing the update directly makes it possible to explain which weights change, count them correctly and separate an encouraging point estimate from a reproducible empirical conclusion.

Inspect the work

Go to the source.

Selected implementation and documentation reviewed for this case study.

All selected workNext case studyNEXUS EDI