In Low-Rank Adaptation (LoRA), target modules are the pre-defined linear layers or projection matrices within a frozen base model where the low-rank adapter matrices (A and B) are inserted. Common examples in transformer architectures include the query (q_proj), key (k_proj), value (v_proj), and output projection (o_proj) layers within attention blocks, as well as the feed-forward network's dense layers. Selecting these modules is a critical architectural decision that determines which parts of the model are adapted for the new task.
Glossary
Target Modules

What are Target Modules?
Target modules are the specific layers within a neural network where a parameter-efficient fine-tuning (PEFT) method, such as Low-Rank Adaptation (LoRA), injects its trainable adapter components.
The choice of target modules directly impacts the adaptation capacity, parameter efficiency, and final performance of the fine-tuned model. Injecting adapters into all linear layers offers maximum flexibility but increases trainable parameters, while a selective strategy (e.g., only the value projections) can maintain high efficiency. This configuration is a key hyperparameter specified when applying LoRA through libraries like Hugging Face PEFT, balancing the granularity of the update against computational cost.
Common Target Modules in Transformer Models
Target modules are the specific layers within a neural network where Low-Rank Adaptation (LoRA) injects its trainable adapter matrices. Selecting the right modules is critical for balancing adaptation effectiveness with parameter efficiency.
Attention Projections (Q, K, V, O)
The most common and effective target modules for LoRA in transformer architectures. These linear layers project the input into query (Q), key (K), value (V), and output (O) representations within the multi-head self-attention mechanism.
- Why they are targeted: These projections are dense, parameter-rich layers directly responsible for modeling contextual relationships. Adapting them efficiently captures task-specific attention patterns.
- Typical Practice: Applying LoRA to just the query (Q) and value (V) projections is a standard, highly effective configuration, as popularized by the original LoRA paper for GPT models.
Feed-Forward Network (FFN) Layers
The two linear layers (often called the "up" and "down" projections) within the transformer's feed-forward network block. This module applies a position-wise non-linear transformation to each token's representation.
- Why they are targeted: The FFN layers contain a significant portion of a transformer's parameters and are hypothesized to function as key-value memory networks. Adapting them allows the model to adjust its internal "fact" storage and retrieval for a new domain.
- Consideration: Applying LoRA to FFN layers often yields substantial gains for knowledge-intensive tasks but increases the number of trainable parameters compared to targeting only attention projections.
Embedding & Output Projection Layers
The input token embedding matrix and the final language modeling head (output projection), which are often tied (share weights) in decoder-only LLMs.
- Why they are targeted: Adapting these layers allows the model to adjust the semantic meaning of tokens for the target domain, which is crucial for specialized vocabulary or terminology.
- Caveat: Fine-tuning these very large matrices (vocab_size × hidden_dim) with LoRA can be highly parameter-efficient but may have a smaller impact per parameter compared to adapting intermediate layers. It is often used in combination with other modules.
Cross-Attention Modules (Encoder-Decoder)
The query (Q) projection within the cross-attention layers of encoder-decoder models (e.g., T5, BART). This layer allows the decoder to attend to the encoder's output representations.
- Why they are targeted: For sequence-to-sequence tasks like translation or summarization, adapting the cross-attention mechanism is critical for learning task-specific alignment between source and target sequences.
- Application: In models like T5, applying LoRA to the cross-attention Q projection and the decoder's self-attention projections is a standard and effective strategy.
LayerNorm & Bias Terms
The gain and bias parameters of Layer Normalization (LayerNorm) layers. While not a traditional "projection," these are small, per-layer sets of parameters that control feature scaling and shifting.
- Why they are targeted: Fine-tuning LayerNorm parameters (sometimes called "LN tuning") is an extremely parameter-efficient PEFT method on its own. When combined with LoRA on linear layers, it provides a complementary adaptation mechanism for feature distribution.
- Efficiency: This adds only
2 × hidden_dimtrainable parameters per adapted layer, making it a common supplement to LoRA for marginal cost.
Module Selection Strategy
The process of determining which layers to apply LoRA to, balancing performance, efficiency, and task needs.
- Rule-based Selection: Common heuristics include targeting all attention projections (Q, K, V, O) in specified transformer blocks (e.g., the last N layers).
- Automated Search: Methods like LoRAHub or Laplacian Singular Value analysis can be used to identify the most impactful layers for adaptation, moving beyond heuristic selection.
- Performance Trade-off: More target modules generally lead to better task performance but increase the number of trainable parameters and memory overhead. The optimal set is task- and model-dependent.
How to Select Target Modules
Selecting target modules is the strategic process of identifying which specific layers within a pre-trained neural network to adapt using a parameter-efficient fine-tuning (PEFT) method like Low-Rank Adaptation (LoRA).
The selection is guided by the network's architecture and the target task. For transformer-based models, the attention mechanism's query (q_proj), key (k_proj), value (v_proj), and output (o_proj) projection matrices are common targets, as they capture task-specific contextual relationships. In feed-forward networks, the dense or fc layers are often selected. The goal is to inject adapters into modules that are most relevant for the new domain while leaving the majority of the model's foundational knowledge frozen and intact.
Empirical analysis and architectural understanding drive the choice. Applying LoRA to all linear layers can be effective but increases parameters. A more efficient strategy is to target only the attention projections or specific blocks, balancing performance gains with parameter efficiency. The selection directly influences the adapter's capacity to learn the task delta, its compute and memory footprint, and the final quality of the fine-tuned model.
Targeting Strategy Comparison
A comparison of strategies for selecting which neural network modules to target when applying Low-Rank Adaptation (LoRA), based on architectural impact, parameter efficiency, and task performance.
| Targeting Strategy | Target Modules (Transformer Example) | Parameter Efficiency | Task Performance | Common Use Case |
|---|---|---|---|---|
Attention-Only | Query (Q), Key (K), Value (V), Output (O) projections | High | Strong for language tasks | General instruction tuning of LLMs |
Feed-Forward-Only | Up- and down-projection layers in MLP blocks | High | Strong for domain-specific knowledge | Specialized factual adaptation |
Attention + MLP | All Q, K, V, O, and MLP projections | Medium | Very Strong | Comprehensive fine-tuning for high-stakes tasks |
All Linear Layers | Every linear layer in the transformer (including embeddings) | Low | Strongest (approaches full fine-tuning) | Maximum performance when resources allow |
Layer-Specific (e.g., Last N) | Modules in the final N transformer layers only | Very High | Task-dependent | Rapid prototyping or edge-focused adaptation |
Task-Specific Heuristic | Modules identified via saliency or gradient analysis | Variable | Optimized for specific task | Research-driven optimization for fixed deployments |
Default (Hugging Face PEFT) | Query and Value projections only | Highest | Good general performance | Standardized, low-configuration fine-tuning |
Frequently Asked Questions
Target modules are the specific layers within a neural network where parameter-efficient fine-tuning (PEFT) methods, such as LoRA, inject their trainable components. Selecting the right modules is critical for balancing adaptation effectiveness with parameter efficiency.
Target modules in Low-Rank Adaptation (LoRA) are the specific, pre-existing weight matrices within a neural network architecture where the trainable low-rank adapter matrices (A and B) are injected. Instead of fine-tuning the entire model, LoRA adds its small, trainable components only to these selected modules, which are typically the linear projection layers found in a transformer's attention mechanism. The original weights of these target modules remain frozen during training. Common examples in transformer-based Large Language Models (LLMs) include the query (q_proj), key (k_proj), value (v_proj), and output (o_proj) projection matrices within each attention block. The choice of which modules to target is a key hyperparameter that directly influences the performance, parameter efficiency, and computational cost of the fine-tuning process.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Target modules are a core configuration choice in LoRA. The following concepts are essential for understanding how and where these low-rank adapters are applied within a neural network architecture.
Attention Mechanism
The attention mechanism is a neural network component that allows a model to dynamically focus on different parts of the input sequence. In transformers, this is implemented via self-attention heads. LoRA commonly targets specific linear projections within these heads—namely the query (Q), key (K), and value (V) matrices—as they are primary sites for task-specific adaptation. Injecting low-rank updates here allows the model to efficiently learn new attention patterns for downstream tasks.
Feed-Forward Network
A feed-forward network (FFN) is a fully connected layer within a transformer block that applies a non-linear transformation to each token's representation independently. In many architectures, the FFN contains a significant portion of the model's parameters. Applying LoRA to the linear layers inside the FFN (e.g., the up-projection and down-projection in a SwiGLU block) is a common strategy to adapt the model's internal feature representations efficiently for new domains.
Linear Projection
A linear projection is a matrix multiplication operation that transforms an input vector from one dimension to another. In transformer architectures, these are ubiquitous:
- Query/Key/Value Projections in attention blocks.
- Output Projection in attention blocks.
- Up/Down Projections in feed-forward networks. These dense layers are the primary target modules for LoRA because their weight matrices are large and directly responsible for feature transformation. The low-rank update ΔW = BA is injected in parallel to these frozen projections.
Transformer Block
A transformer block is the fundamental repeating unit in transformer-based models, typically consisting of a multi-head self-attention mechanism and a feed-forward network, with residual connections and layer normalization. When configuring LoRA, engineers specify which components within these blocks are target modules. Common patterns include targeting all linear layers in the attention mechanism, the FFN, or both. The choice directly impacts the number of trainable parameters and the adaptation's effectiveness.
Parameter-Efficient Fine-Tuning (PEFT)
Parameter-Efficient Fine-Tuning (PEFT) is a family of techniques designed to adapt large pre-trained models by updating only a small subset of parameters. LoRA is a prominent PEFT method. The concept of target modules is central to all PEFT strategies, as each method (e.g., prefix tuning, adapters) must define which parts of the model architecture will be modified. The efficiency gains of PEFT are realized by selectively applying updates to these critical modules rather than the entire network.
Model Configuration
Model configuration in the context of LoRA refers to the hyperparameters and architectural choices that define how the adapters are integrated. Key configuration parameters include:
target_modules: A list specifying which module types to apply LoRA to (e.g.,['q_proj', 'v_proj']).r(rank): The intrinsic dimension of the low-rank matrices.lora_alpha: The scaling factor for the low-rank update.lora_dropout: The dropout probability for regularization. Precise configuration oftarget_modulesis essential for balancing performance, parameter efficiency, and training stability.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us