Manuscript Offprint

arXiv:2608.26052

How Much Rank Does LoRA Need? Rank-Error Bounds for Transformer Attention

Gerard Conangla Planes

Abstract

Choosing the rank of a low-rank adaptation (LoRA) update is usually an empirical task. In this paper, we provide a task-dependent theory of the approximation error achievable at each LoRA rank for Transformer attention. We fix a pretrained attention head, a target attention function, and a distribution over inputs from the downstream task, and bound the smallest expected Kullback–Leibler (KL) error achievable by a rank-r query LoRA update. When target attention probabilities are bounded away from zero, we prove a lower bound of the error proportional to ψ(∥d∥2)\psi(\|d\|_2), where dd is the difference between candidate and target attention scores and ψ(t)=min⁡{t2,t}\psi(t) = \min\{t^2, t\}. We also prove an unconditional upper bound min⁡{∥d∥22/4,2∥d∥2}\min\{\|d\|_2^2/4, \sqrt{2}\|d\|_2\}. Under explicit realizability, geometry, and moment conditions, we then bound the best rank-r error between an explicit multiple of ψ(Tr)\psi(\sqrt{T_r}) and min⁡{Tr/4,2Tr}\min\{T_r/4, \sqrt{2T_r}\}, where TrT_r is the downstream-weighted tail energy of the target update. We also provide target-Fisher bounds when candidate scores remain within a fixed range of the target scores, and an unrestricted lower bound when a subset of tokens carries most of the probability mass. These spectral bounds describe finite-score approximation. We then construct explicit families in which softmax saturation makes the rank required to match the attention function strictly smaller than the rank required to match the finite logits. Finally, we extend the analysis to fused multi-head LoRA and joint query/key updates, exposing the effects of rank sharing and query/key factorization constraints.

1 Introduction

LoRA [11] makes it cheaper to fine-tune a pretrained Transformer [22] by replacing a dense weight update with a low-rank one. Such a low rank is both an advantage and a restriction, reducing the number of trainable parameters and computation, but also limiting the representational power of the adapter. In practice, rank is commonly chosen using rules of thumb or by training several adapters of different rank and comparing their downstream performance [11, 27, 21]. Such a sweep reveals which rank worked in a particular run, but it doesn't tell us whether a smaller adapter lacked capacity or was simply harder to train.

To isolate the representation question, suppose a dense or high-rank target adapter has already been obtained. We then ask: for each rank budget r, how closely can an adapter reproduce the target on inputs from the downstream task? The answer cannot be read from the singular values of the target weight update ΔW\Delta W alone. For instance, a large singular direction may have no effect if inputs from the task never activate it, while a smaller direction may matter on nearly every input because it repeatedly changes which tokens receive attention. The softmax function in the attention mechanism introduces two further effects. First, adding the same constant to every score leaves the attention probabilities unchanged. Second, softmax saturates, so a score error

*Correspondence: gerardpc@gmail.com with large magnitude need not produce a proportionally large attention error. The rank needed to reproduce the target function can therefore differ from the rank suggested by the raw singular values of its weight update.

In this paper, we begin with a LoRA update to the query projection of a single attention head. That update changes the scores assigned to the available keys, which softmax converts into attention probabilities. We compare these probabilities with those of a dense or high-rank target adapter, ask for the smallest expected KL error achievable at rank r, and obtain bounds on the error, some unconditional and some conditional on explicit assumptions. Attention KL therefore measures how much the query update changes the attention distribution itself, before later layers can modify that change.

We stress that our results bound the attention KL described above, but we do not provide bounds on the head output or final task loss. To do so would require additional assumptions about the architecture, including the value and output projections, residual connections, feed-forward network, and later layers. These components determine how a difference in one head is propagated and may amplify, suppress, or cancel it. Without such architecture-specific assumptions, attention KL alone does not determine output or task error. Figure 1 shows the scope of our analysis within a Transformer block in more detail, including extensions to fused multi-head and joint query/key LoRA.

Overview of the results. For each rank budget r, let Er\mathcal{E}_r denote the smallest expected attention KL over all rank-r candidates; Section 2 defines this objective formally. Our analysis first connects attention KL to score approximation, then connects score approximation to LoRA rank.

Theorem 3.1 gives the first connection. If d is the difference between candidate and target scores after removing their common shift, define

ψ(t)=min⁡{t2,t},ψup(t)=min⁡{t2/4,2t}.(1)\psi(t)=\min\{t^{2},t\},\qquad\psi_{\mathrm{up}}(t)=\min\{t^{2}/4,\sqrt{2}t\}. \tag{1}

The theorem proves that the pointwise attention KL is comparable to ψ(∥d∥2)\psi(\|d\|_2) when the target probabilities are bounded away from zero, and is at most ψup(∥d∥2)\psi_{\mathrm{up}}(\|d\|_2) without this assumption. Thus the error is quadratic for small score differences and linear for large ones. Corollary 3.2 lifts this pointwise statement to the expected, rank-constrained objective Er\mathcal{E}_r.

Theorem 4.1 supplies the second connection. Under its realizability, geometry, probability-floor, and moment assumptions, it proves

cloψ(Tr)≤Er≤ψup(Tr).(2)c_{\mathrm{l o}}\psi(\sqrt{T_{r}})\leq\mathcal{E}_{r}\leq\psi_{\mathrm{u p}}(\sqrt{T_{r}}). \tag{2}

Here TrT_{r} is the residual tail energy after the target update has been weighted by the queries and keys occurring on the downstream task. Directions that the task never uses therefore do not contribute, and cloc_{lo} is the explicit assumption-dependent constant in Theorem 4.1. The upper bound constructs a candidate whose error does not exceed its curve; the lower bound applies to every candidate. Together they bracket the best achievable error at each rank. Section 9 explains how to estimate this rank-error curve from downstream data and compare it with a desired error tolerance.

When the probability floor in the main theorem is too small to give a useful lower bound, Section 5 provides two alternatives with different assumptions (Figure 2 shows a decision diagram to clarify the choices, and Table 2 gives an overview of the three laws of approximation). Theorem 5.1 gives target-Fisher upper and lower bounds for candidates whose scores remain within a fixed range of the target scores. Because that candidate class is restricted, its lower bound does not apply to the unrestricted Er\mathcal{E}_r. Theorem 5.2 instead gives a lower bound on the unrestricted Er\mathcal{E}_r by focusing on a subset of tokens carrying most of the target probability mass.

Transformer attention with LoRA: computation and theoretical scope

Figure

Figure 1: Transformer attention with LoRA and the scope of our analysis. Read from top to bottom, the diagram traces an input through the query, key, and value projections, attention scores, row-wise softmax, and multi-head aggregation. Our central question is how closely a rank-r LoRA update can reproduce a target attention function on inputs from the downstream task. The main theorem treats query-only adaptation in one head; later results cover a fused update shared across heads and simultaneous query/key updates. For an input uu, X(u)X(u) contains n(u)n(u) token representations of width dd. For each head index h∈{1,…,H}h \in \{1, \ldots, H\}, query/key width is pp and value width is pvp_v, with Qh(u),Kh(u)∈Rn(u)×pQ_h(u), K_h(u) \in \mathbb{R}^{n(u) \times p}, Vh(u)∈Rn(u)×pvV_h(u) \in \mathbb{R}^{n(u) \times p_v}, and Sh(u),Ph(u)∈Rn(u)×n(u)S_h(u), P_h(u) \in \mathbb{R}^{n(u) \times n(u)}. Here σrow\sigma_{\text{row}} applies softmax row-wise and β\beta is typically 1/p1/\sqrt{p}. The pretrained projections Q0,K0,V0Q_0, K_0, V_0 are fixed, while AhA_h and BhB_h are rank-r LoRA updates. The multi-head result bounds the sum of headwise attention KL errors before WOW_O; the remaining Transformer computation and the final model output are outside this guarantee.

The preceding results concern approximation at finite scores. Theorem 6.1 treats a different effect: after softmax saturates, a lower-rank sequence of logits can approach an attention function that requires higher rank to realize with finite logits. It constructs an explicit family with a constant-factor separation between these two ranks. Finally, Theorem 7.1 extends the rank–KL bounds to a fused update shared across attention heads, and Theorem 8.1 extends them to simultaneous query/key LoRA, where the score update must also satisfy a query/key factorization constraint.

References (26)