Tailor: A Prompt-Based Approach to Attribute-Based Controlled Text Generation

Kexin Yang, Dayiheng Liu, Wenqiang Lei, Baosong Yang, Mingfeng Xue, Boxing Chen, Jun XiearXiv 2022 · DOI

Introduction

Controlled Text Generation (CTG) aims to produce text that adheres to specific constraints, such as a particular sentiment or topic. Traditionally, researchers have faced a "trilemma" between storage, speed, and quality. Full model fine-tuning offers high quality but creates massive storage overhead. Conversely, external classifier methods like PPLM provide flexibility but are often slow and can degrade text fluency.

Furthermore, multi-attribute CTG (e.g., generating a review that is both "Positive" and about "Mexican Food") is notoriously difficult because multi-attribute datasets are rare, making supervised training nearly impossible. This paper introduces Tailor, a lightweight framework that addresses these challenges by representing attributes as continuous vectors.

The Tailor Framework

Tailor treats attributes as continuous prompts—trainable vectors concatenated to the input of a frozen GPT-2 model. By keeping the underlying language model fixed and only updating the small prompt vectors, Tailor requires only 0.08% of the parameters needed for full fine-tuning.

Single and Multi-Attribute Control

For single-attribute control, Tailor trains a specific continuous vector for each attribute. The real innovation, however, lies in how these prompts are "stitched" together for multi-attribute tasks. Simply concatenating prompts often fails because models suffer from "position sensitivity," favoring the prompt closest to the text prefix. Tailor solves this using three key strategies:

  1. MAP Mask (Multi-Attribute Prompt mask): An attention mask that prevents prompts from "seeing" each other, mimicking the isolated environment they were originally trained in.
  2. RP Sequence (Re-indexing Position-ids): A strategy that resets position indices so every prompt starts at "index 1," ensuring the model treats them with equal structural importance.
  3. MAP Connector: A trainable vector that facilitates the combination of prompts. To train this without multi-attribute data, Tailor uses a pseudo-prompt strategy, where a classifier generates synthetic multi-attribute training environments from single-attribute data.
Overview of Tailor's framework for single and multi-attribute controlled text generation, illustrating the training and testing workflows.

Experimental Results

The researchers evaluated Tailor using the YELP dataset, focusing on sentiments (Positive/Negative) and food types (Mexican, American, Asian).

Efficiency and Performance

Tailor-S (the single-attribute variant) significantly outperformed established baselines like PPLM and GeDi in both correctness and text fluency (measured by Perplexity). As shown in the results, Tailor maintains high text quality (low PPL) while achieving high correctness scores with a fraction of the parameters used by fine-tuned models.

Performance comparison of Tailor-S against various baselines on the YELP dataset, highlighting its efficiency and quality.

Multi-Attribute Success and Generalization

In multi-attribute tasks, Tailor-A (the version utilizing the MAP connector) achieved an average correctness of 87.15%, outperforming standard fine-tuning (69.80%) and simple concatenation (76.20%). Notably, Tailor demonstrated strong zero-shot generalization, successfully generating reviews for "unseen" attribute combinations that were never paired during the training of the MAP connector.

Conclusion

Tailor provides a highly efficient and effective solution for multi-attribute controlled text generation. By utilizing continuous prompts and structural adjustments like the MAP mask and RP sequence, it bypasses the need for expensive multi-attribute datasets while maintaining the fluency of large-scale language models. Future work will focus on scaling this approach to handle three or more simultaneous attributes.

Summary updated

BibTeX
@misc{yang2022tailor,
  author = {Kexin Yang and Dayiheng Liu and Wenqiang Lei and Baosong Yang and Mingfeng Xue and Boxing Chen and Jun Xie},
  title = {{Tailor: A Prompt-Based Approach to Attribute-Based Controlled Text Generation}},
  year = {2022},
  eprint = {2204.13362},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2204.13362},
}
Figure