Multi-Aspect Controllable Text Generation with Disentangled Counterfactual Augmentation

Yi Liu, Xiangyu Liu, Xiangrong Zhu, Wei Hu · DOI

Abstract

Multi-aspect controllable text generation (MCTG) aims to steer large language models to produce text satisfying multiple constraints simultaneously. However, models often struggle with "attribute correlation imbalance"—stereotypes in training data where certain attribute combinations are rare. We present MAGIC, a framework that utilizes disentangled counterfactual augmentation in the latent space to de-bias generation. MAGIC explicitly decouples attribute representations and synthetically generates rare attribute combinations during training and inference. Experimental results on standard benchmarks show that MAGIC significantly outperforms existing methods, particularly in imbalanced scenarios, achieving a 7.4% absolute improvement in attribute relevance.

Introduction

In the field of Generative AI, Multi-Aspect Controllable Text Generation (MCTG) is the task of guiding models to satisfy multiple constraints, such as writing a positive story about sports that is also non-toxic. A significant challenge in this field is "attribute correlation imbalance." Large Language Models (LLMs) often inherit biases from their training data; for example, news about "World Politics" is frequently negative in common datasets. Consequently, when asked for a positive world news story, models struggle because they have not encountered sufficient examples of that specific attribute combination. This "stereotype" effect leads to high performance on common combinations but failure on rare ones.

The MAGIC Framework

To address these biases, we introduce MAGIC (Multi-aspect controllable text generation with Attribute Generative Intervention and Counterfactual augmentation). MAGIC focuses on balancing the model's internal "latent space" rather than the raw text.

The MAGIC framework overview, illustrating training with counterfactual latent vectors and target-guided inference.

The framework is built on an encoder-decoder architecture using prefix-tuning. Instead of fine-tuning the entire LLM, MAGIC trains small "prefix" vectors to steer the model. The core innovation consists of two main components:

  1. Attribute Disentanglement Module: An encoder projects sentences into a latent space, which is then explicitly decoupled into separate factors for different aspects (e.g., Topic and Sentiment). Intervention losses ($L^{intv}_R$ and $L^{intv}_D$) ensure that modifying one attribute factor does not affect others.
  2. Counterfactual Augmentation: During training, MAGIC creates "what-if" scenarios. For a "Negative World News" sample, it generates a counterfactual latent vector by swapping the negative component for a positive one. This teaches the model the representation of rare combinations. During inference, a target-guided strategy searches the latent space for vectors that satisfy all target attributes.

Experimental Evaluation

MAGIC was evaluated against eight strong baselines, including GeDi, PPLM, and PriorControl, using datasets like AGNews (topic/sentiment), IMDb (sentiment), and Jigsaw (toxicity).

Comparison of MAGIC against baselines (GeDi, Tailor, Discrete) across different topics and sentiments in balanced and imbalanced settings.

Key Results

  • Imbalanced Scenarios: MAGIC achieved a massive improvement, with an average attribute relevance of 92.6%, representing a 7.4% absolute gain over the previous state-of-the-art. In biased settings, topic relevance improved by 12.8% and sentiment by 7.2%.
  • Balanced Scenarios: Even with balanced data, MAGIC remained the top performer (92.9% relevance), indicating that its structured latent space is fundamentally superior for control.
  • Human Evaluation: Human graders rated MAGIC higher in both attribute relevance and fluency, confirming that automatic metrics align with text quality.

Conclusion

MAGIC successfully mitigates attribute correlation imbalance by operating in a disentangled latent space. By leveraging counterfactual augmentation, it enables robust control even for rare attribute combinations. Future work will explore scaling MAGIC to larger LLMs and reducing reliance on external classifiers for attribute labeling.

Summary updated

BibTeX
@inproceedings{liu2024multi,
  author = {Yi Liu and Xiangyu Liu and Xiangrong Zhu and Wei Hu},
  title = {{Multi-Aspect Controllable Text Generation with Disentangled Counterfactual Augmentation}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2024},
  doi = {10.18653/v1/2024.acl-long.500},
}
Figure