We can't find the internet
Attempting to reconnect
Something went wrong!
Attempting to reconnect
← Parameter-Efficient FT step 1 of 4
Medium
Research
LoRA Update
Implement LoRA (Low-Rank Adaptation) from “LoRA: Low-Rank Adaptation of Large Language Models” (Hu et al., 2021).
LoRA freezes the pre-trained weight matrix W and adds a low-rank update: $$h = (W + \frac{\alpha}{r} B \cdot A) \cdot x$$
Where:
-
W: shape(d_out, d_in)— frozen pre-trained weights -
A: shape(r, d_in)— low-rank down-projection (trainable) -
B: shape(d_out, r)— low-rank up-projection (trainable) -
alpha: scaling factor -
r: rank of the adaptation -
x: shape(d_in,)— input
Output: Tensor of shape (d_out,).
Nothing accepted yet. When a submission passes, the code that passed shows up
here, one entry per mode.
Stuck?
PyTorch reference solution
Sign in to attempt this problem and reveal the reference solution.