Abstract
This paper presents a novel framework for multi-aspect controllable text generation using Large Language Models (LLMs). By integrating multiple Low-Rank Adaptation (LoRA) modules with a dynamic gating mechanism and specialized loss functions, the proposed method achieves state-of-the-art control over diverse text attributes such as sentiment, topic, and length. The approach is computationally efficient, adding only ~4% trainable parameters, and demonstrates significant robustness to imbalanced training data, outperforming both full fine-tuning and standard LoRA across various benchmarks.
Introduction
Multi-aspect controllable text generation requires an LLM to simultaneously satisfy constraints across different dimensions—for example, writing a positive review about sports that is exactly 50 words long and avoids toxic language. Standard approaches face significant trade-offs: Full Fine-Tuning (FFT) is computationally expensive and prone to overfitting, while standard LoRA often struggles with nuanced control across multiple conflicting attributes.
Furthermore, models are typically trained on datasets where each sample has only a single attribute annotated. This creates a distribution gap when the model is asked to generate text combining multiple attributes at inference time. This research introduces a parameter-efficient framework designed to dynamically adapt to multiple attributes and bridge the gap between single-aspect training and multi-aspect generation.
Methodology
The proposed framework is built on top of the LoRA architecture and introduces three key innovations:
- Multi-LoRA with Dynamic Gating: Multiple trainable LoRA modules are injected into the Transformer's Feed-Forward layers. A trainable gating function takes an "aspect identifier" as input and dynamically routes tokens through a weighted combination of these LoRAs.
- Aspect-Adaptive Loss ($\mathcal{L}_{ada}$): This loss penalizes the distance between the distribution centers of different aspects in the model's hidden states, forcing the model to find an intersection space where multi-aspect semantics can coexist.
- Attribute-Aware Loss ($\mathcal{L}_{awa}$): This ensures the model can distinguish between specific attributes within an aspect (e.g., "joy" vs. "fear"). It consists of an exclusion loss to push different attribute representations apart and a gap loss to pull similar ones closer together.
Experimental Results
The framework was evaluated using the CoDI-Eval Benchmark, covering six tasks: sentiment, topic, length, keyword, detoxification, and multi-task control. Training data was synthesized using GPT-4, resulting in approximately 71,000 instruction-following samples.
Performance and Efficiency
Across various models including Qwen2, Llama-3.1, and Gemma-2, the framework consistently outperformed standard LoRA and FFT. Notably, when applied to the Qwen2-72B model, the method achieved an average accuracy of 85.32%, surpassing the base GPT-4 (0613) score of 84.82%.
Key Insights
- Specialization via Routing: Visualization of LoRA weights reveals that modules naturally specialize in different domains (e.g., one for length, another for sentiment).
- Synergy in Multi-Tasking: Routing tokens through a weighted sum of all LoRA modules performs better than hard routing, suggesting that knowledge from one aspect helps others.
- Robustness: The framework is highly resilient to catastrophic forgetting and data discrepancy. Even with imbalanced training data, it maintains superior performance compared to baselines.
Discussion and Conclusion
While the framework shows state-of-the-art results, it currently relies on predefined attribute sets and can struggle with highly contradictory prompts (e.g., simultaneously positive and negative). Future work will explore more flexible benchmarks and dynamic attribute adaptation to handle real-world, unseen constraints. Overall, this Multi-LoRA approach provides a powerful, efficient path toward fine-grained control in large-scale language modeling.
Summary updated