CARMA: Enhanced Compositionality in LLMs via Advanced Regularisation and Mutual Information Alignment
Nura Aljaafari, Danilo S. Carvalho, André Freitas
TL;DR
CARMA addresses compositional generalisation (CG) limitations in LLMs by introducing two non-architectural regularisers: mutual information regularisation across layers ($\mathcal{L}_{MI}$) and layer-wise stability regularisation ($\mathcal{L}_{Stability}$). The losses combine into $\mathcal{L}_{CARMA}=\gamma\mathcal{L}_{MI}+\eta\mathcal{L}_{Stability}$ and are integrated with the task objective as $\mathcal{L}_{total}=(1-\lambda)\mathcal{L}_{task}+\lambda\mathcal{L}_{CARMA}$, enabling improved structured representations without architectural changes. CARMA improves semantic consistency and stability on Inverse Dictionary Modelling and Sentiment Classification, though effects vary with model architecture and tokenisation. It introduces training-time overhead due to auxiliary losses but preserves inference costs and downstream task performance, making it a scalable tool for enhancing CG in real-world settings. Overall, CARMA demonstrates that reinforcing learned structures through regularisation can substantially improve compositional reasoning in LLMs, with practical implications for robust language understanding.
Abstract
Large language models (LLMs) struggle with compositional generalisation, limiting their ability to systematically combine learned components to interpret novel inputs. While architectural modifications, fine-tuning, and data augmentation improve compositionality, they often have limited adaptability, face scalability constraints, or yield diminishing returns on real data. To address this, we propose CARMA, an intervention that enhances the stability and robustness of compositional reasoning in LLMs while preserving fine-tuned performance. CARMA employs mutual information regularisation and layer-wise stability constraints to mitigate feature fragmentation, ensuring structured representations persist across and within layers. We evaluate CARMA on inverse dictionary modelling and sentiment classification, measuring its impact on semantic consistency, performance stability, and robustness to lexical perturbations. Results show that CARMA reduces the variability introduced by fine-tuning, stabilises token representations, and improves compositional reasoning. While its effectiveness varies across architectures, CARMA's key strength lies in reinforcing learned structures rather than introducing new capabilities, making it a scalable auxiliary method. These findings suggest that integrating CARMA with fine-tuning can improve compositional generalisation while maintaining task-specific performance in LLMs.
