Flexi-LoRA: Efficient LoRA Finetuning with Input-Adaptive Dynamic Ranks

Zongqian Li, Yixuan Su, Han Zhou, Zihao Fu, Nigel Collier

TL;DR

This paper introduces Flexi-LoRA, a novel parameter-efficient fine-tuning method for large language models that dynamically adjusts the "rank" of LoRA adapters based on input complexity. This input-adaptive approach significantly improves performance and efficiency, especially for complex reasoning tasks, by better matching model capacity to the demands of each input.

What Problem Does This Paper Address?

Deploying large language models (LLMs) often involves fine-tuning them for specific tasks. Parameter-efficient fine-tuning (PEFT) methods like LoRA (Low-Rank Adaptation) are crucial for this, as they allow adaptation without retraining the entire massive model. LoRA works by injecting small, trainable low-rank matrices into the LLM's layers. However, standard LoRA uses a static rank for all inputs, regardless of their difficulty. This is suboptimal because simple questions might not need a high rank (and thus many parameters), while complex questions might benefit from a higher rank. This static allocation can lead to either wasted parameters or insufficient capacity, hindering both performance and efficiency. The paper addresses this gap by proposing an input-adaptive approach to LoRA rank selection.

Methods

The core innovation is Flexi-LoRA, a framework that dynamically adjusts LoRA ranks during both training and inference. It consists of two main components:

  1. Difficulty-Aware Router: This component takes an input sequence, processes its embeddings, and predicts an appropriate rank assignment. It's trained using a cross-entropy objective on difficulty labels derived from task-specific metrics.
  2. Flexible-Rank LoRA Training: This part of the framework allows LoRA matrices to have different ranks for different inputs within the same batch. Crucially, it maintains consistency between the rank selection strategy used during training and inference. This means if an input is deemed "difficult" during training and assigned a higher rank, it will be treated similarly during inference.

The paper also introduces DyLoRA+, an enhanced version of a prior dynamic LoRA method (DyLoRA), which ensures consistent rank dynamics between training and inference by using random batch-level rank selection. This serves as a strong baseline for comparison.

Datasets

The authors evaluate Flexi-LoRA on a variety of datasets for two main task categories:

  • Question Answering (QA):
    • Training: MRQA training set (which includes samples from SQuAD, TriviaQA, NewsQA, SearchQA, HotpotQA, and NaturalQuestions).
  • Evaluation: MRQA test set, including BioASQ, DROP, DuoRC, RACE, RelationExtraction, and TextbookQA.
  • Mathematical Reasoning:
    • Training: GSM8K (a subset of MetaMathQA).
  • Evaluation: GSM8K, SVAMP, MultiArith, and MAWPS.

Key Insights and Ideas

  • Training-Inference Consistency is Key: The paper strongly emphasizes that maintaining consistent rank dynamics (how ranks change) between training and inference is crucial for effective adaptation, especially for sequential reasoning tasks. Inconsistent dynamics lead to performance degradation.
  • Input Complexity Matters: Dynamically allocating parameters based on input complexity leads to superior performance with fewer parameters. This is because it allows the model to "spend" its capacity more wisely, matching rank configurations to question difficulty.
  • Task Sensitivity Varies: Mathematical reasoning tasks are significantly more sensitive to rank dynamics than QA tasks. This suggests that tasks requiring intricate, multi-step logical chains benefit more from adaptive capacity.
  • Beyond Correctness: Successful adaptation isn't just about getting the right answer; it also involves improved reasoning quality and better adherence to instructions.
  • Streamlined Mixture-of-Experts: Flexi-LoRA achieves benefits similar to mixture-of-experts (MoE) frameworks (where different parts of the model handle different inputs) but with a simpler, more integrated implementation.

Key Results

  • Performance Gains: Flexi-LoRA consistently outperforms static LoRA and other dynamic methods like DyLoRA+ across both QA and mathematical reasoning tasks. For instance, on QA tasks, Flexi-LoRA (with ranks 2 and 8) achieves the highest average F1 score (52.37%) and EM score (37.41%) using only 504K trainable parameters, which is a 70.40% reduction compared to LoRA-8.
  • Parameter Efficiency: Flexi-LoRA uses significantly fewer parameters than static LoRA while achieving better or comparable performance. On mathematical tasks, it achieves the highest average accuracy (66.56% for 1B model, 84.00% for 3B model) using only about 31-33% of the parameters of LoRA-8.
  • Approaching Full Fine-tuning: Flexi-LoRA's performance is remarkably close to full model fine-tuning, especially on larger models, while maintaining extreme parameter efficiency.
  • Robustness: Flexi-LoRA demonstrates strong generalization capabilities across different datasets, even out-of-domain ones, suggesting its input-adaptive approach learns more generalized knowledge.
  • Qualitative Improvements: Case studies show that Flexi-LoRA produces more detailed, step-by-step solutions and better adheres to output formatting instructions compared to baselines.

Limitations and Future Work

  • Limitations: The paper notes that while Flexi-LoRA shows significant improvements, the performance gains are not uniform across all tasks. Tasks with more pronounced complexity variations and stricter evaluation criteria benefit more.
  • Future Work: The authors suggest several promising directions:
  • Layer-Specific Dynamic Ranks: Optimizing parameter utilization by allowing ranks to vary not just per input but also per layer.
  • Hierarchical Complexity Learning: Developing router frameworks that can learn more sophisticated hierarchical aspects of input complexity.
  • Integration with Other Techniques: Combining Flexi-LoRA with other parameter-efficient methods, such as sparse fine-tuning, for further gains.

Summary updated

BibTeX
@inproceedings{li2025flexi,
  author = {Zongqian Li and Yixuan Su and Han Zhou and Zihao Fu and Nigel Collier},
  title = {{Flexi-LoRA: Efficient LoRA Finetuning with Input-Adaptive Dynamic Ranks}},
  booktitle = {ES-FoMo-III @ ICML},
  year = {2025},
  url = {https://openreview.net/forum?id=c3LXnK49aa},
}
Figure