Source-linked AI summary
Delete, Retrieve, Generate: A Simple Approach to Sentiment and Style Transfer
Juncen Li, Robin Jia, He He, Percy Liang
TL;DR
Text attribute transfer must alter a sentence’s attribute while preserving its content, despite training data lacking parallel sentences with different attributes. The paper uses marker-based deletion, retrieval, and neural generation, achieving a 34% average human-rated success rate across three datasets, versus 12% for the best adversarial method.
Problem
Text attribute transfer requires changing attributes such as sentiment or style while preserving content, but training data contains labeled sentences without parallel attribute-matched pairs.
Method
The approach identifies attribute markers, deletes source-attribute markers to extract content, retrieves target-attribute material, and generates a fluent output conditioned on content and the target attribute.
Results
34% was the best neural system’s average human-rated success rate across Yelp, Amazon, and image-caption transfer, compared with 12% for the best adversarial method.
Takeaways & Limitations
The method’s main leverage is the inductive bias that attributes are often manifested in localized discriminative phrases.
Takeaways & Limitations
Human judgments depend on the other outputs and instructions presented together, so results across datasets are not directly comparable.
Abstract
from arXiv · showhide
We consider the task of text attribute transfer: transforming a sentence to alter a specific attribute (e.g., sentiment) while preserving its attribute-independent content (e.g., changing "screen is just the right size" to "screen is too small"). Our training data includes only sentences labeled with their attribute (e.g., positive or negative), but not pairs of sentences that differ only in their attributes, so we must learn to disentangle attributes from attribute-independent content in an unsupervised way. Previous work using adversarial methods has struggled to produce high-quality outputs. In this paper, we propose simpler methods motivated by the observation that text attributes are often marked by distinctive phrases (e.g., "too small"). Our strongest method extracts content words by deleting phrases associated with the sentence's original attribute value, retrieves new phrases associated with the target attribute, and uses a neural model to fluently combine these into a final output. On human evaluation, our best method generates grammatical and appropriate responses on 22% more inputs than the best previous system, averaged over three attribute transfer datasets: altering sentiment of reviews on Yelp, altering sentiment of reviews on Amazon, and altering image captions to be more romantic or humorous.
1 Introduction
Text attribute transfer aims to change attributes such as sentiment or style while preserving content, but unaligned data and weak adversarial outputs make the task difficult. The paper proposes simpler marker-based systems, including a neural generator, and reports stronger human-evaluated performance.
- Motivation: Text attribute transfer changes sentiment or style while preserving attribute-independent content, typically without aligned sentence pairs.Systems must disentangle attributes and content using only sentences labeled with attributes.
- Motivation: Previous adversarial approaches produce low-quality outputs and are difficult to train, motivating simpler systems.
- Approach: Attribute markers are localized words or phrases, so transfer can often change a few markers while leaving the rest of the sentence largely unchanged.The paper identifies markers from unaligned corpora using their distinctive frequency across attribute-labeled sentences.
- Approach: The baseline deletes source-attribute markers, retrieves a sentence with similar content and the target attribute, and generates the transferred output.
- Approach: The neural system extracts content similarly and uses an RNN decoder conditioned on that content and the target attribute.It can be trained as an auto-encoder after content and attribute are separated.
- Results: 34% was the neural system’s average human-rated success rate across Yelp, Amazon, and image-caption transfer tasks.The baseline achieved 23%, while the best adversarial method achieved 12%.
2 Problem Statement
The task assumes labeled but unaligned sentences and seeks to transfer a sentence to a target attribute without losing its original content.
- Data assumptions: The training corpus contains sentences paired with attribute labels, but no parallel sentences sharing content across different attributes.
- Task objective: Given a sentence and target attribute, the model should output a sentence that retains the input content while exhibiting the target attribute.
3 Approach
The approach treats attribute transfer as localized editing: delete source attribute markers, retrieve target-attribute material when useful, and generate a fluent sentence from content and target information.
- Motivation: Attribute transfer often changes a small set of attribute markers while leaving most sentence content unchanged.For example, sentiment can be altered by replacing “delicious” with an appropriate negative word while retaining the surrounding content.
- System overview: The four systems share deletion-based separation of source attribute markers and content, then differ in retrieval and target-sentence construction.RETRIEVEONLY, TEMPLATEBASED, DELETEANDRETRIEVE, and DELETEONLY use rule-based or neural generation variants.
- Retrieve: Three systems retrieve a target-attribute sentence with similar content, using a distance metric such as TF-IDF weighted word overlap or content-embedding distance.Retrieved target markers provide contextually appropriate material for insertion.
- Delete: Attribute markers are selected as n-grams with high smoothed relative frequency for one attribute, exceeding a threshold γ.The method uses marker salience and treats selected markers as discriminative features; source content is the sequence remaining after their deletion.
- Generate: DELETEANDRETRIEVE encodes source content and retrieved target markers separately, then uses an RNN decoder to generate a fluent output.Unlike template slot filling, it can choose insertion locations and adjust function words; unlike DELETEONLY, retrieval biases markers toward the current context.
- Training: Because target-attribute outputs are unavailable during training, DELETEONLY reconstructs original sentences, while DELETEANDRETRIEVE uses denoising to avoid trivial marker-content stitching.Training replaces markers with nearby same-attribute variants when available, creating a mismatch closer to test-time recombination.
4 Experiments
The experiments evaluate the systems across review sentiment and image-caption style transfer datasets, including an aligned caption corpus whose alignments are withheld from the models.
- Datasets: The evaluation covers Yelp sentiment transfer, Amazon sentiment transfer, and factual-to-romantic or humorous image-caption transfer.Each dataset is randomly divided into training, development, and test sets.
- Results: Both proposed baselines outperform all three previously published adversarial methods in human ratings, and DELETEANDRETRIEVE outperforms the other automatic approaches.The comparison includes human references and three adversarial systems across the three domains.
- Datasets: CAPTIONS contains aligned captions for the same images in different styles, but the systems do not use these alignments during training.The alignments serve as gold references for evaluation.
- Datasets: CAPTIONS differs from the review datasets because training reconstructs romantic and humorous sentences, while testing converts factual captions into those styles.The method assumes factual test captions contain only content and therefore inserts target-style markers without deleting factual markers.
4.2 Human References
Human reference outputs were collected for Yelp and Amazon sentiment-transfer test sentences, then analyzed to measure whether people preserve content words and change attribute-related words.
- Crowdworkers edited Yelp and Amazon test sentences to flip sentiment while preserving content.
- The analysis defines Sc as content-word preservation and Sa as attribute-related word change by humans.Higher values indicate behavior consistent with the model’s inductive bias.
- Sc was 0.61 on YELP, 0.71 on AMAZON, and 0.50 on CAPTIONS; Sa was 0.72 on YELP and 0.54 on AMAZON.Sa was not applicable to CAPTIONS.
- Among sampled Yelp deviations, 70% of changed content words were unimportant, 18% were paraphrases, and 12% reflected marker-labeling errors.
- Among preserved attribute-related words, 84% reflected contextual changes and 16% were mistagged by the system.
4.3 Previous Methods
Previous systems used adversarial training, while the paper’s evaluation compares them with simpler retrieval and neural approaches under shared implementation and retrieval settings.
- The comparison includes STYLEEMBEDDING, MULTIDECODER, and CROSSALIGNED, all of which use adversarial training.
- STYLEEMBEDDING uses an encoder, discriminator, and LSTM decoder, whereas MULTIDECODER uses a separate decoder for each attribute value.
- The authors use 128-dimensional word vectors and single-layer GRUs with 512 hidden units for their encoders and decoder.
- Attribute markers use spans up to 4 words, with thresholds set to 15 for YELP, 5.5 for AMAZON, and 5 for CAPTIONS.
- DELETEANDRETRIEVE selects among generated outputs using perplexity from a separately trained target-domain language model.
4.5 Human Evaluation
Human evaluation measures grammaticality, target-attribute match, and content preservation, with success requiring strong ratings on all three criteria; results also depend on evaluation context.
- Workers rated grammaticality, target-attribute similarity, and source-content preservation on a 1–5 Likert scale.
- A generated output counted as successful only when it received a 4 or 5 on all three criteria.
- Each dataset contributed 400 randomly sampled examples, with 200 examples for each target attribute.
- DELETEANDRETRIEVE achieved the best performance among all systems, and all four proposed methods outperformed previous work on all three datasets.
- Human raters strongly preferred human references to every system, indicating substantial room for improvement.
- Evaluator judgments were largely relative to other jointly evaluated sentences and the examples provided in each task’s instructions.
4.6 Analysis
The analysis finds trade-offs among adversarial and baseline systems, while DELETEANDRETRIEVE balances content preservation, attribute change, and grammaticality through retrieval-conditioned generation.
- CROSSALIGNED and MULTIDECODER often lose source content by generating frequent but weakly related target-attribute sentences.
- STYLEEMBEDDING usually paraphrases the input, suggesting its encoder retains some source-attribute information.
- RETRIEVEONLY scores well on grammaticality and target-attribute match but can change content when no perfectly aligned target sentence exists.
- TEMPLATEBASED preserves content because it keeps content words, but its unsmoothed word combinations cause grammatical mistakes.
- DELETEANDRETRIEVE and DELETEONLY balance grammaticality, content preservation, and attribute change through a strong marker-based inductive bias with smoothing flexibility.
- Retrieved attribute phrases help DELETEANDRETRIEVE generate longer, more specific descriptions when the target phrase set is diverse, such as in CAPTIONS.
4.7 Automatic Evaluation
The paper evaluates automatic metrics for target-attribute matching and content preservation, finding that their reliability varies across datasets and does not extend well to grammaticality.
- Metrics: The attribute classifier measures the fraction of outputs classified as having the target attribute.Each dataset uses a bidirectional-LSTM sentence encoder with average pooling, trained with logistic loss.
- Metrics: BLEU measures similarity between system outputs and human references, primarily reflecting content preservation through shared words.The authors expect BLEU’s correlation with fluency to be much weaker.
- Metric reliability: Automatic metrics sometimes correlate with human judgments, but their reliability varies significantly across datasets.On AMAZON, classifier scores do not correlate with human judgments of attribute transfer.
- Metric reliability: BLEU does not correlate well with human grammaticality ratings and can favor systems that make more grammatical mistakes.The paper concludes that automatic metrics are useful for model development but cannot replace human evaluation.
4.8 Trading off Content versus Attribute
The methods expose a controllable trade-off between matching the target attribute and preserving source content, adjustable at test time by changing the deletion threshold.
- Trade-off: The methods control the trade-off between target-attribute matching and source-content preservation.The curve uses classifier score for attribute matching and BLEU for content preservation.
- Control mechanism: Varying threshold γ at test time changes how many source attribute markers are deleted.Unlike prior methods, this does not require retraining with different hyperparameters.
- Evaluation: Figure 3 plots this trade-off for DELETEANDRETRIEVE, DELETEONLY, and TEMPLATEBASED on YELP.Larger points indicate settings used for training and official evaluation.
- Limitation: RETRIEVEONLY does not exhibit a clear content-attribute trade-off because it is less affected by which content words are preserved.This is especially the case when no good output sentence exists in the target corpus.
- Trade-off: The experiments show a clear trade-off between changing the attribute and retaining the content.The supplied examples and automatic-evaluation description contextualize the evaluated outputs and metrics.
5 Related Work and Discussion
The paper replaces adversarial disentanglement with explicit phrase-level separation of attributes and content, while noting that this inductive bias has scope limits.
- Related work: Prior work commonly uses adversarial training to separate attribute and content in unaligned text-transfer data.The content encoder attempts to remove attribute information by fooling an attribute discriminator.
- Discussion: The authors argue that discriminator fooling can occur without actually removing attribute information.Their method instead exploits prior knowledge that attributes are localized to parts of a sentence.
- Discussion: The method’s marker detection resembles Naive Bayes and deletes the most informative features, using a fixed rather than jointly trained classifier.This connects phrase deletion to attacking a Naive Bayes classifier.
- Conclusion: The conclusion reports that the simple method outperforms previous adversarial models.The paper identifies localized discriminative phrases as the main source of leverage.
- Limitations: The phrase-boundary assumption is limited because some problems do not permit clean separation of content and attribute along phrase boundaries.The authors propose developing attribute representations more general than n-grams but more biased than arbitrary latent vectors.
- Reproducibility: The paper makes its code, data, and experiments available on CodaLab for reproducibility.This is an implementation and dissemination detail rather than an evaluation result.