target_modules in a PEFT config: what does this list control?
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
target_modules picks which linear submodules inside the transformer get a LoRA adapter wrapped around them. Everything not named stays frozen at base weights.
Think of the base model as a long row of doors. Behind each door is a giant grid of numbers the model uses for one specific job, like routing queries or expanding the hidden state. LoRA does not knock on every door. It only wraps adapters around the doors you point at. The target_modules argument is the list of door labels you hand over. Name two doors and only those two get an adapter; the rest stay locked and unchanged. Name all the doors and you wrap every one, which costs more compute but gives the adapter more places to learn. The list controls reach, and reach controls both quality and cost.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
3 min: define the argument, walk through the three forms it accepts, show the q-v versus all-linear tradeoff, and end with the cost and architecture-portability traps.
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Defaulting to q_proj and v_proj only on every project, regardless of difficulty. For complex domain shifts that under-targets the MLP path, where most of the model's capacity actually lives.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.