Implement LoRA adapters that inject trainable low-rank matrices into a frozen transformer, then train them on a classification task.
You're working with a pretrained transformer that you want to adapt to a new 3-class classification task. Full fine-tuning would update all 25K+ parameters, but you only have a small dataset and limited compute. LoRA lets you freeze the base model and train only a small pair of low-rank matrices (A and B) per weight, reducing trainable parameters to under 3% of the original while achieving competitive accuracy. The provided SimpleTransformer is a minimal 2-layer model with frozen weights. Your job is to implement the LoRAAdapter class, wire it into the forward pass, and build the training loop.
Ask me about the code, bugs, or concepts.
I'll guide you in plain English, no code output.
Budget: 50K tokens per lab