# LoRA Rank Collapse Is a Routing Problem, Not Just Rank

> Attention-only adapters can miss domain reasoning paths, while target choice, scaling, precision, and optimizer state set the real training budget.

- **Author:** Gökçe Akçıl (https://softwaredeveloper.biz/author/gokce-akcil)
- **Topic:** systems-architecture
- **Published:** 2025-08-29T13:18:10+00:00
- **Canonical URL:** https://softwaredeveloper.biz/p/lora-rank-collapse-is-a-routing-problem-not-just-rank

## Key Thesis

LoRA’s rank limits each adapted projection, not the whole model’s ability to represent a task. On a 32-layer, 4096-hidden model, rank-16 adapters on attention and MLP projections add about 42 million trainable parameters and 42 million adapter MACs per token, before activation and kernel overhead. Start with MLP gate/up/down plus attention, alpha=2r as a testable scaling choice, frozen base weights, and BF16 compute. Validate against attention-only adapters at matched budgets.

---

## The adapter is a path through the model

LoRA freezes a pretrained weight matrix \(W\) and learns a low-rank update: \(W' = W + (\alpha/r)BA\). For a projection with input width \(d_{in}\) and output width \(d_{out}\), \(A\) and \(B\) contain \(r(d_{in}+d_{out})\) parameters, rather than \(d_{in}d_{out}\) for a full update. This is the core memory bargain: store and optimize the small factors, then apply their product during inference. [E1]

The bargain can conceal a routing mistake. Attention projections affect how tokens mix information. MLP projections transform each token’s representation through learned nonlinear features. An adapter on attention alone may change what the model retrieves from its context without sufficiently changing the features it uses to reason over that context. That is a mechanistic explanation, not a rule that every domain task needs MLP adapters. [E4]

“Rank collapse” also needs a precise meaning. A configured rank of 16 does not guarantee 16 useful update directions: the learned product \(BA\) can have a rapidly decaying singular-value spectrum, leaving most of its capacity effectively unused. Conversely, a low benchmark score with rank 8 does not prove collapse. The task may need different modules, better examples, or less aggressive optimization. [E4]

The useful debugging unit is therefore not rank in isolation. It is the combination of target modules, rank, scaling, learning rate, and data distribution. If domain reasoning depends on transformations inside the MLP, adding rank to attention may spend parameters on the wrong route.

## Trace the data path and memory bill

For a LLaMA-like 7B model, assume 32 layers, hidden width 4096, and MLP width 11,008. A rank-\(r\) adapter on four attention projections, query, key, value, and output, has about \(32 \times 4 \times (4096+4096) \times r\) trainable parameters. Adding gate, up, and down MLP projections contributes about \(32 \times (2 \times 4096 + 4 \times 11008) \times r\).

```text
Token IDs
   |
   v
Frozen embedding and transformer weights
   |
   +--> Attention projections: W + (alpha/r)BA
   |          |
   |          v
   |     attention and residual stream
   |
   +--> MLP gate/up/down: W + (alpha/r)BA
              |
              v
       nonlinear features and residual stream
              |
              v
       loss -> adapter gradients -> optimizer state
```

At rank 16, attention adapters contain about 16.8 million parameters; MLP adapters contain about 26.2 million. Together they total about 42.0 million, or roughly 0.6% of a 7B parameter count. At rank 8 on attention alone, the count is about 8.4 million. These counts exclude embeddings, biases, and any additional target modules.

| Metric / Approach | Attention only, r=8 | Attention plus MLP, r=16 |
|---|---:|---:|
| Trainable parameters, model above | 8.4M | 42.0M |
| Adapter MACs per token, forward pass | 8.4M | 42.0M |
| Adapter weights at BF16, lower bound | 16.8 MB | 84.0 MB |
| Adam states plus gradients and weights, rough estimate | 0.10 to 0.13 GB | 0.50 to 0.67 GB |
| Latency implication | Fewer adapter operations | More operations and adapter kernels |

The MAC count is an arithmetic estimate, not a wall-clock promise. Real latency depends on sequence length, batch size, kernel fusion, GPU, and whether adapter operations become bandwidth-bound. Benchmark p50 and p95 on the intended serving path. The memory estimate assumes two FP32 Adam moments, BF16 gradients and weights, and excludes activations, frozen weights, temporary buffers, and allocator fragmentation. [E4]

Training also moves more than adapter weights. Activations must be retained or recomputed for backpropagation through the frozen network, while gradients flow into the adapter factors. Thus, broadening targets often costs more in optimizer state and kernel launches than in the frozen model footprint. Long sequences can make activation memory the binding constraint before adapter memory does.

## Alpha and precision change the optimization

With the classic scaling \(\alpha/r\), setting \(\alpha=2r\) makes the multiplier 2. That is a useful controlled experiment, not a universal optimum: it changes the magnitude of the adapter contribution at initialization and can alter gradient scale. Rank-stabilized LoRA uses a different scaling convention, so “alpha equals twice rank” cannot be copied across implementations without checking the actual formula. [E1]

Initialization matters too. A common setup initializes one factor randomly and the other to zero, making the initial update zero. On the first backward pass, the zero factor receives a gradient while the other factor’s gradient is initially zero. This asymmetry is one reason to monitor factor norms and update norms rather than infer health from the configured rank alone. [E1]

BF16 compute is often a practical choice because its exponent range matches FP32, while its significand is less precise. That helps avoid some overflow and underflow problems relative to narrower formats, but does not preserve calibration by magic. Calibration is more plausibly retained because base weights remain frozen. Quantization, data mismatch, and an oversized adapter update can still shift model outputs. [E4]

Separate learning rates for adapter factors or module groups are hypotheses to test, not default laws. A stable first run can use one adapter learning rate, a warmup, and gradient clipping. Then compare a lower or higher rate for MLP factors only. Track validation loss, task metrics, update-to-base activation norms, and calibration metrics such as expected calibration error where labels support them.

## Failure under load, and a falsifiable test

The serving path has its own traps. Unmerged adapters add matrix operations to each targeted projection, and

## References

- [Editorial Research Agenda: LoRA Rank Collapse in Domain Adaptation: Choosing Alpha, Target Modules and Learning-...](https://gokce.ai/blog/llm-fine-tuning-lora-and-qlora-explained-simply)
- [Gokce Akcil — Executive & Research Profile](https://gokce.ai)

---

## Discussion (2 notes)

- **Hannah Goldstein** (Quantitative Researcher · Manhattan, NY · 2025-08-29): The 42 million MACs figure ignores that the B and A matrices are applied sequentially. For MLP projections, `B @ (input @ A)` becomes `(B @ input) @ A` only if you factor the input through A first, that’s an extra 4096×r×11008 ops, not just 42M. Your memory bill misses that compute reshuffle cost.
  - **Gokce Akcil** (Tech Executive · AI & ML Systems Engineer · ORZED · 2025-08-29): You're right: the sequential order matters for MACs when the adapter is integrated into the layer's actual data flow. My figure was for the combined rank-\(r\) update product \(BA\) applied to the projection's input, ignoring the intermediate activation size. The reshuffle cost for an MLP gate/up/down adapter is indeed that extra \(d_{\text{hidden}} \times r \times d_{\text{ffn}}\) operation. Good catch. The compute overhead is higher than the parameter-count shortcut suggests.
