#2335·litgpt

Configurable per-layer LoRA ranks

Author: kor80Created Sep 25, 2026Updated Sep 25, 2026
Labelsenhancement

Currently, LitGPT uses a global LoRA rank across all transformer blocks, but this limits the ability to experiment with non-uniform rank allocation, where different blocks receive different adaptation capacities.

A possible solution would be to introduce an optional parameter that maps transformer block indices to their corresponding LoRA ranks. The proposed behaviour is:

  • apply block-specific ranks to enabled attention and MLP LoRA adapters;
  • keep the global rank as a fallback for unspecified blocks and for the language modeling head;
  • expose the new option through the existing fine-tuning CLI.

For example: lora_r = 8 lora_r_by_layer = {0: 2, 2: 4} With this example configuration, blocks 0 and 2 use ranks 2 and 4 respectively, while all other blocks retain the global rank of 8.