Skip to content

Training, adaptation, compression, and systems techniques · Training, fine-tuning, adaptation, compression, and systems techniques · TRN021 · Training method

DoRA weight-decomposed adaptation

Separates weight magnitude from direction and adapts direction with a low-rank update.

Runs in CodeSplash Component demo, not a trained model CodeSplash's run and the reference's record

In CodeSplash

A CodeSplash method runs this entry in Python and R. Set it up from the method's page.

Do it in CodeSplash Run it on your own data, in Python or R.

Availability
Runs in CodeSplash
Code example
Component demo, not a trained model
Who ran it
CodeSplash's run and the reference's record
CodeSplash's run
Verified in Python and R through learn.cnn, learn.ft_transformer, learn.tabm, learn.torch_mlp. The reference's example ran in Python and R here, and they agree.
The reference's record
Python: Ran in the reference's review. The report doesn't record which version of the code ran. R: Reviewed but not run: R wasn't available to the reference's authors.

Purpose

Separates weight magnitude from direction and adapts direction with a low-rank update.

Question / hypotheses

Does this intervention improve the intended quality, adaptation, resource, or reliability objective under a controlled comparison? It defines a method, not an intrinsic null-hypothesis test.

Architecture / computational structure

A frozen pretrained weight receives a low-rank direction update and trainable magnitude vector; normalization is applied along the specified weight axis.

Assumptions

The base checkpoint and target modules must be compatible. Low rank restricts directional changes; normalization introduces additional computational details.

Formula / computational definition

W′=m⊙W0+BA∥W0+BA∥column.W^\prime=m\odot\frac{W_0+BA}{\|W_0+BA\|_{column}}.

Parameters and notation

Learned: low-rank factors A,B and magnitudes m. Frozen: W0. Hyperparameters: rank, module selection, learning rate, dropout, scaling, axis convention.

Fitting, fine-tuning, and adaptation

Initialize to reproduce the base model, train only adaptation parameters, and verify merge/unmerge equivalence. Compare with LoRA and full fine-tuning using equal data and compute budgets.

How to use and calibrate

Monitor task retention, update norms, and adaptation memory. Example: specialize a language or image transformer with limited trainable weights.

Example application

specialize a language or image transformer with limited trainable weights.

Interpretation / pitfalls

Watch out

DoRA is not merely LoRA with a different rank. Incorrect normalization axis changes the method; PEFT reduces training state but not necessarily all inference memory.

Python and R code examples

Scope: numerical mechanism demonstration. Validation: Python executed successfully on the supplied synthetic inputs; R reviewed but not executed (Rscript unavailable).

Python and R

The reference's own programs, shown as written. A component demo shows one central piece of the method; it doesn't train a full model.

Python

Component demo, not a trained model — numerical mechanism demonstration. · needs numpy

import numpy as np
V=np.array([[1.,2.],[2.,1.]]); magnitude=np.array([3.,2.])
print(V/np.linalg.norm(V,axis=0)*magnitude)
R

Component demo, not a trained model — numerical mechanism demonstration.

V <- rbind(c(1,2),c(2,1)); magnitude <- c(3,2)
print(sweep(sweep(V,2,sqrt(colSums(V^2)),"/"),2,magnitude,"*"))

Sources

From the CodeSplash reference, entry TRN021.