Source-linked AI summary
Tailor: A Prompt-Based Approach to Attribute-Based Controlled Text Generation
Kexin Yang, Dayiheng Liu, Wenqiang Lei, Baosong Yang, Mingfeng Xue, Boxing Chen, Jun Xie
TL;DR
Attribute-based CTG must generate text with specified attributes, while existing fine-tuning and classifier approaches can incur storage or inference-time costs. Tailor uses continuous prompts with a fixed PLM and adds methods for combining them; it reports strong performance on multi-attribute tasks, including unseen combinations.
Problem
Existing attribute-based CTG approaches can require storing a PLM copy per attribute or add inference-time costs through attribute classifiers.
Source: §1 · p. 1Method
Tailor represents attributes as continuous prompts for a fixed GPT-2 and combines prompts using masking, position re-indexing, or a trainable connector.
Source: §1 · pp. 1–2Results
Tailor’s MAP connector achieves strong performance on six multi-attribute generation tasks, including combinations unseen during connector training.
Source: §1 · p. 2Takeaways & Limitations
Tailor adds an attribute by training its prompt without retraining the whole PLM.
Source: §1 · p. 1The paper identifies generation with more than two attributes as an open direction for future work.
Source: §5 · p. 9
Abstract
from arXiv · showhide
Attribute-based Controlled Text Generation (CTG) refers to generating sentences that satisfy desirable attributes (e.g., emotions and topics). Existing works often utilize fine-tuning or resort to extra attribute classifiers, yet suffer from storage and inference time increases. To address these concerns, we explore attribute-based CTG in a prompt-based manner. In short, the proposed Tailor represents each attribute as a pre-trained continuous vector (i.e., single-attribute prompt) and guides the generation of a fixed PLM switch to a pre-specified attribute. We experimentally find that these prompts can be simply concatenated as a whole to multi-attribute CTG without any re-training, yet raises problems of fluency decrease and position sensitivity. To this end, Tailor provides a multi-attribute prompt mask and a re-indexing position-ids sequence to bridge the gap between the training (one prompt for each task) and testing stage (concatenating more than one prompt). To further enhance such single-attribute prompt combinations, Tailor also introduces a trainable prompt connector, which can be concatenated with any two single-attribute prompts to multi-attribute text generation. Experiments on 11 attribute-specific generation tasks demonstrate strong performances of Tailor on both single-attribute and multi-attribute CTG, with 0.08\% training parameters of a GPT-2.
1 Introduction
Attribute-based CTG seeks sentences that satisfy specified attributes, but existing approaches face storage, inference-time, or text-fluency costs. Tailor composes continuous attribute prompts for a fixed GPT-2, using prompt masking, position re-indexing, and a trainable connector to improve multi-attribute generation.
1 Introduction
- Fine-tuning can require a full PLM copy per attribute, while classifier-guided generation can reduce fluency and increase inference time.Control codes can reduce storage needs but require retraining and rarely address multi-attribute CTG.Source: §1 · p. 1
- Tailor represents each attribute as a pre-trained continuous prompt that guides a fixed GPT-2 and can be concatenated for multi-attribute generation.A new attribute can be added by training its prompt without retraining the whole PLM.Source: §1 · pp. 1–2
- Simply concatenating single-attribute prompts can lower fluency and create position sensitivity, with the prompt nearest the input prefix receiving more focus.Training each prompt alone but allowing prompts to interact at test time creates a training–testing gap.Source: §1 · pp. 1–2
- MAP masking blocks cross-attention between distinct prompts, while re-indexed position IDs preserve stable positions when prompts are swapped.These non-training measures partly address the combination issues; the connector adds training so prompts can work together.Source: §1 · p. 2
- Tailor’s MAP connector achieves strong performance on six multi-attribute generation tasks, including combinations unseen during connector training.The connector is trained with a pseudo-prompt strategy for unsupervised settings.Source: §1 · p. 2
2 Related Work
Prior attribute-based generation work uses fine-tuning, control codes, or attribute classifiers, while continuous prompt composition remains relatively unexplored. Tailor investigates combining continuous prompts for multi-attribute CTG and introduces a connector to improve that combination.
2 Related Work
- Fine-tuning attribute-specific PLMs can require storing a full model copy per attribute, while classifier-guided generation can add inference time and reduce fluency.CTRL (Keskar et al., 2019) and StylePTB (Lyu et al., 2021) use control codes or tokens to guide one PLM across styles.Source: §2 · pp. 2–3
- Continuous prompts are task-specific vectors, but their composition has been rarely explored; PTR composes manual sub-prompts with logic rules for relation extraction.The discussion identifies continuous prompt composition as a relatively unexplored direction.Source: §2 · p. 3
- Tailor experimentally investigates continuous-prompt combination for multi-attribute CTG and proposes MAP connector to enhance it.The paper reports experiments on attribute controllability and text quality.Source: §2 · p. 3
3 Methodology
Tailor trains continuous prompts for individual attributes while keeping GPT-2 fixed, then combines those prompts for multi-attribute generation. It addresses combination mismatch with a non-training mask and position scheme, and a trainable connector.
3.1 Tailor for Single-Attribute CTG
- Each attribute is represented by a continuous prompt prepended to sentence embeddings and trained with a fixed GPT-2 for attribute-specific generation.The method can add a new attribute by training its prompt rather than retraining the full language model.Source: §3.1 · p. 3
3.2 Tailor for Multi-Attribute CTG
- Simply concatenating single-attribute prompts can generate multi-attribute sentences without training, but reduces fluency and is sensitive to prompt order.The language model tends to focus more on the prompt closer to the input prefix.Source: §3.2 · p. 4
3.2.1 Non-Training Method
- MAP masking prevents cross-attention between prompts, while RP re-indexes their positions so swapping prompts does not change their assigned positions.The mask and position scheme aim to bridge the difference between individually trained prompts and concatenated prompts at inference.Source: §3.2.1 · pp. 4–5
3.2.2 Training Method
- The MAP connector is trained to combine two single-attribute prompts, using an extra pseudo-attribute prompt to train on single-attribute sentences.Pseudo-prompts are selected using a predicted class or formed by weighting prompts with class probabilities.Source: §3.2.2 · pp. 5–6
- During connector training, the input combines two attribute prompts, the connector, and the sentence; only connector parameters are updated, and inference concatenates the connector with the prompts.The connector is trained with GPT-2 and the single-attribute prompts held fixed.Source: §3.2.2 · p. 6
4 Experiments
Across single- and multi-attribute CTG experiments, Tailor variants generally improve correctness against baselines with limited additional training parameters. Further analyses examine few-shot performance, prompt length, order sensitivity, component ablations, and unseen attribute combinations.
4.1 Experimental Setup
- Experiments use Yelp reviews with sentiment and food-topic attributes, evaluate correctness, text quality, and diversity, and compare Tailor against fine-tuning, Adapter, GeDi, and PPLM.Each attribute has 30,000 training and 3,000 validation sentences; evaluation uses 15 attribute-unrelated prefixes.Source: §4.1 · p. 6
4.2 Main Results
- Tailor-S improves correctness and diversity over Adapter at similar training scale, while using 0.08% of GPT-2 training parameters and narrowing its Food correctness gap to FT at length 256.The reported Food correctness gap falls from 4.14% to 0.33%.Source: Table 1 · p. 7, §4.2 · p. 7
- Tailor-C improves correctness over fine-tuning by 13.51% for Sentiment and 4.53% for Food, but text quality decreases; trained Tailor-W and Tailor-A improve all scores over Tailor-C.Tailor-W and Tailor-A report +4.58% / +11.22% correctness on the food-type topic.Source: Table 2 · p. 7, §4.2 · p. 7
4.3 Further Discussions
- In few-shot learning, all three Tailor types outperform other baselines on correctness with 0.00% / 0.08% extra GPT-2 training parameters after single-attribute CTG.The few-shot training, validation, and testing sets contain 150, 20, and 20 examples, respectively; scores average three sampled datasets.Source: §4.3 · pp. 7–8, Table 3 · p. 8
- Tailor-S correctness rises with prompt length, while Tailor-A performs best at length 128 and drops slightly at greater lengths.Figure 4 plots prompt length against averaging correctness score.Source: Figure 4 · p. 8, §4.3 · p. 8
- With simple concatenation, the prompt nearer the input prefix receives greater focus; moving NE nearer raises its correctness by 3.14% while AM correctness decreases by 3.4%.Tailor-C keeps the same performance after swapping prompt order.Source: Table 4 · p. 8, §4.3 · p. 8
- The MAP mask and RP sequence are both important to Tailor-C and complementary: using them together improves performance while avoiding position sensitivity.Table 5 averages results across two prompt orders for six attribute combinations.Source: Table 5 · p. 8, §4.3 · p. 8
- Tailor-A works on the unseen PO-ME combination and outperforms the non-training Tailor-C by 2.35%.The combination's data is removed from the MAP connector training set before evaluation.Source: §4.3 · pp. 8–9, Table 6 · p. 9
5 Conclusions
Tailor represents attributes as continuous prompts and combines them for multi-attribute controlled text generation. It offers non-training and training approaches to improve prompt combinations, while identifying wider attribute combinations and other text-to-text tasks as future work.
5 Conclusions
- Tailor represents each attribute as a continuous prompt and combines prompts into a multi-attribute prompt.Source: §5 · p. 9
- Tailor offers non-training MAP mask and RP sequence strategies, as well as a training-based MAP connector, to enhance prompt combinations.Source: §5 · p. 9
- Combining more than two attributes remains to be discussed; future work will extend Tailor to wider attribute ranges and other text-to-text tasks.Source: §5 · p. 9
A Implement Details
The implementation settings specify Tailor prompt lengths and training choices, baseline configurations, and shared inference sampling parameters.
A Implement Details
- Tailor-C and the MAP connectors for Tailor-A and Tailor-W use length 128; Tailor-S, Tailor-A, and Tailor-W use learning rate 5e-5 and zero warm-up steps.A RoBERTaLarge classifier supplies pseudo labels for the MAP connector on sentiment and food-topic attributes.Source: A Implement Details · p. 10
- FT6 uses GPT-2Base with learning rate 5e-3, while Adapter uses bottleneck size 5 and learning rate 5e-5; both use zero warm-up steps.Source: A Implement Details · p. 10
- GeDi inference uses ω = 30, ρ = 0.8, and τ = 0.8, while PPLM uses γ = 1.5, γgm = 0.9, λkl = 0.01, three iterations, and step size 0.02.Source: A Implement Details · pp. 10–11
- All models use top-k sampling with k=10, random seed 42, and maximum generation length 128 for final results.Source: A Implement Details · p. 11
B Yelp Dataset
The Yelp dataset section describes how restaurant reviews were filtered and sampled for training and validation, and identifies a table of review counts by attribute.
B Yelp Dataset
- The dataset starts from Yelp restaurant reviews, filtered for English text and excluding three-star reviews that could be neutral in sentiment.The filtering scripts use a fastText classifier.Source: B Yelp Dataset · p. 11
- For training Tailor and baselines, 30,000 training and 3,000 validation sentences are randomly sampled for each attribute.Source: B Yelp Dataset · p. 11
- Table 8 presents the number of Yelp reviews for each attribute.Source: Table 7 · p. 11
C Classifiers For Correctness Evaluation
The correctness-evaluation classifiers are RoBERTaLarge models trained on oversampled attribute data, with their test performance reported separately.
C Classifiers For Correctness Evaluation
- Two RoBERTaLarge classifiers are trained for sentiment and food-topic attributes, using random oversampling to balance the dataset.Source: C Classifiers For Correctness Evaluation · p. 11
- Classifier training uses 1,500k/15k/15k topic-specific sentences and 1,380k/1k/1k sentiment-specific sentences for training, validation, and testing, respectively.Source: C Classifiers For Correctness Evaluation · p. 11
- Classifier learning rate is 5e-5 with 200 warm-up steps, and their test-set performances are reported in Table 7.Source: C Classifiers For Correctness Evaluation · p. 11
D Case Study
The case study presents generation samples to illustrate single-attribute and multi-attribute controlled text generation.
- Generation samples are shown to illustrate the effects of different attributes in single-attribute and multi-attribute CTG.Source: D Case Study · p. 11
- Table 9 shows single-attribute samples using the prefix ‘Once upon a time’, with NE and AS denoting negative sentiment and Asian-food topic.Source: Table 9 · p. 12
- Table 10 shows multi-attribute samples using the prefix ‘Once upon a time’; NE-AS denotes negative sentiment with an Asian-food topic.The caption also identifies Adapter (P) as using the same argmax-pseudo labeled sentences (§ 3.2.2) to train the Adapter.Source: Table 10 · p. 12