Implement LoRA on a Linear Layer in PyTorch

Mediumalignment-trainingauto-graded

Inject trainable low-rank decomposition matrices (A, B) into a frozen linear layer for parameter-efficient fine-tuning.

Solve it

Check your answer

The grader verifies properties of your implementation, so a correct solution written differently from ours still passes.

pip install torchleet

from torchleet import check
check("lora", LoRALinear, apply_lora, merge_lora)

Company tags

How these tags are sourced