Implement LoRA and measure the spectrum
CodingAdvanced⏱ 3 hoursFine-Tuningloraimplementationspectrumeckart-young
Problem
- Implement a LoRA layer wrapping a frozen linear layer, with correct initialisation and scaling, and verify it computes the base function at step 0.
- Fine-tune a small model fully, and measure the singular value spectrum of the resulting per layer.
- Use Eckart–Young to compute, per layer, the rank needed to capture 90% of .
- Train LoRA at that rank and at half of it, and compare against full fine-tuning.
Implement it, then check the implementation against something you can verify independently.
Write it
Solve it here8 tests · Python runs in your browser
⌘/Ctrl + ↵ to run · limit 60s · draft saved in this browser
8 tests will run against your code. The first run downloads the Python runtime — several megabytes, once per browser.
Solution
Opening this before you have a real attempt on paper is the fastest way to feel like you understand something you cannot reproduce.
Related problems
All problems| Solved | Problem | Field | Type | Difficulty | Time |
|---|---|---|---|---|---|
| Adapter parameter counts | Fine-Tuning | Numerical | 15 min | ||
| LoRA parameter accounting | LLMs | Numerical | 15 min | ||
| Will this fine-tune fit? | Fine-Tuning | Numerical | 30 min | ||
| Implement backpropagation from scratch run | Deep Learning | Coding | 3 hours | ||
| Implement kernel ridge regression run | Classical ML | Coding | 1 hour |