Controlled Text Generation with Adversarial Learning
Paper · 2020 · Federico Betti, Giorgia Ramponi and Massimo Piccardi
Summary
A sentence can read naturally and still miss the point of a request. In controlled text generation, the request might specify a subject to write about or a sentiment to express. Betti and colleagues ask whether an adversarial generator can learn to follow either kind of instruction while retaining the qualities of sentences drawn from its training data. Their system, CTERM-GAN, gives the generator access to the requested condition throughout sentence construction and gives it separate feedback about sentence quality and agreement with that condition.
The generator uses a relational memory, which lets it select among stored features as it composes a sentence. At each step, it updates that memory using the condition and the preceding output. One discriminator learns to distinguish generated sentences from real ones by inspecting the text alone. The other sees the text together with the condition and supplies feedback about their compatibility. The balance between these signals matters because a recognizable topic or sentiment can come through even when the sentence itself is poor, and a natural-looking sentence can give little indication that the generator used the condition.
For topic control, the authors derive the condition from the words associated with a topic in an input sentence. CTERM-GAN moves closer to the requested topic distribution than RelGAN on every topic dataset in the comparison. It also obtains a higher shorter-phrase BLEU score than RelGAN across those datasets, although the longer-phrase scores are mixed. On COCO, CTERM-GAN obtains a B-4 score of 0.404 and a topic divergence of 0.053, compared with RelGAN’s 0.339 and 0.468. The simpler topic-conditioned LSTM obtains lower divergence than CTERM-GAN on some datasets, with lower BLEU scores.
For sentiment control, the generator receives a positive or negative label. Its outputs achieve the highest sentiment-classification accuracy on Customer Reviews, at 0.869, and match the strongest reported SentiGAN setting on Movie Reviews, at 0.885. The Movie Reviews outputs score lower than that SentiGAN setting on novelty and diversity. The experiments thus show that the same design can support both kinds of control after task-specific training. They evaluate topic agreement through inferred word distributions and sentiment through a classifier, which bounds what the results establish about meaning and sentence quality.
Deep dive: Controlled Text Generation with Adversarial Learning
CTERM-GAN uses separate training signals for fluency and relevance to generate sentences guided by a requested topic or sentiment. · about 34 minutes to read
The problem and its context
Giving a generator something to write about
A generator trained on a collection of sentences can learn recurring patterns of wording and sentence construction. Controlled generation adds a requirement that varies from request to request. The generator needs to let a particular input influence the sentence it produces. In the topic task, the input represents subject matter extracted from a sentence. In the sentiment task, it specifies which of the available attitudes the new sentence should express. In either case, the condition contributes information that the generator could easily omit while still producing text that resembles examples from the corpus.
This distinction also affects evaluation. If a sentence is judged in isolation, its construction may look perfectly acceptable even when it disregards the request. A sentence that uses words strongly associated with the request can have the opposite problem. It can satisfy a narrow test of relevance while sounding unlike the examples people actually write. The authors describe these concerns as syntactic correctness and semantic coherence. In the experiments, coherence has a specific meaning. It concerns the generated sentence’s agreement with an external signal, represented through a topic distribution or a sentiment label.
The topic setup makes clear what kind of instruction the system receives. The authors use a sentence to obtain the condition, but the generator sees a numerical representation of its topic. It is free to produce a different sentence on that topic. The source sentence therefore provides evidence about subject matter without becoming a target that the output must reproduce. The sentiment task makes the condition narrower still. The label constrains the attitude that should be detectable in the output and leaves the content of the sentence open.
This is the gap the paper identifies in adversarial text generation. Earlier systems had shown that adversarial training could produce sentences that compare favorably with those obtained through maximum-likelihood approaches. The authors argue that work on training and evaluation had paid less attention to whether the result remained coherent with a requested meaning. Their proposal makes that requirement visible to the generator as it writes and to the discriminator that supplies feedback about what it writes.
The obstacle posed by discrete words
In a generative adversarial network, the generator produces examples and a discriminator tries to tell them apart from examples in the training data. The generator learns from the discriminator’s judgments. If the discriminator can reliably identify a generated sentence, its score supplies a training signal that encourages the generator to make outputs more like the real examples. The discriminator also changes during training as the generated examples change. This is the adversarial setup introduced in Generative Adversarial Nets.
Applying the arrangement to text raises a problem at the point where the generator chooses a word. The generator can compute scores over a vocabulary, and those scores can change gradually. The result of selecting a particular word is a discrete choice. A small change in the scores can leave that choice exactly as it was, or it can switch the selected word abruptly. Ordinary differentiation through that choice therefore fails to give the generator the kind of feedback that the adversarial update needs. The paper calls this the non-differentiability problem.
The related work groups responses to that obstacle into reinforcement learning and continuous reparameterization. SeqGAN exemplifies the reinforcement-learning route. Its generation decisions are treated as actions that can be trained using feedback about the resulting sequence. The reparameterization route supplies a soft approximation to the discrete draw. It allows the representation sent onward during training to change with the generator’s scores, which provides a path for the discriminator’s feedback. Both routes address how the generator learns from an evaluation of its output. A separate decision determines whether that evaluation gives the generator any reason to follow an external condition.
RelGAN is the most direct architectural predecessor discussed in the paper. Its approach uses Gumbel-softmax to make word selection differentiable in the relaxed computation and draws on multiple discriminators to extract features of sentences. The authors describe RelGAN as having performed well against the other adversarial generators compared in its own work. CTERM-GAN builds on the use of relational memory and the continuous approximation. It assigns distinct jobs to its discriminators and makes information about the requested condition available to the one responsible for agreement.
How earlier systems used a control signal
External control had already been explored through several designs. TopicRNN increases the probability of words associated with a controlling topic during generation. TCNLM first infers a topic and uses it to direct generation through a mixture of specialized components. In the authors’ account, each expert in that mixture is a language model specialized for an individual topic. These approaches illustrate how an inferred subject can influence what vocabulary or generation behavior is favored.
The paper describes SentiGAN as taking a different route to sentiment control. It uses generators specialized by sentiment and a discriminator that can handle multiple labels. The separation by sentiment gives the system a way to express differences between its output categories. It also ties the organization of the generator collection to those categories. In CTERM-GAN, the label is supplied to a shared generator as an input. The topic variant uses the same basic arrangement with a topic-derived vector in place of the sentiment label.
The authors present that shared design as a way to accommodate different sources of conditioning. A component that handles a numerical vector can, in principle, be trained to work with representations drawn from different tasks. Its input still has to be defined consistently for each training run. The word distributions used for one task and the label encodings used for the other have meanings established by their respective data procedures. Changing the representation changes what the generator and the compatibility discriminator have to learn. The new contribution is an architecture in which those representations can play the same functional role.
The method, step by step
From a request to a candidate sentence
CTERM-GAN has a generator and two discriminators. The generator turns a condition into part of the information it uses to produce a sequence. The syntax discriminator receives the sequence without the condition. The semantic discriminator receives the sequence together with the condition. Their scores influence the generator during adversarial training. The system can then generate an output by supplying a condition to the generator and letting it make successive word choices.
The condition enters the generator through a learned transformation. A distribution over vocabulary words and a short label vector have different forms, but the generator can use the same kind of transformation to turn either into a representation suitable for its memory. During a training run the input representation is consistent. A vector associated with an inferred topic has the same interpretation for the generator as it does for the semantic discriminator. Similarly, the positive and negative labels retain their meanings across examples in the sentiment task.
Once the condition has been projected into memory, it is available when the generator makes successive decisions. A word choice depends on memory state and preceding output as well as on the condition. This matters because a sentence has to develop from what has already been said. The condition indicates a property the completed text should express, while the state carries information about how far the sentence has progressed and what has already been generated. The architecture gives both sources a route into the next vocabulary prediction.
During training, the two discriminators examine the outcome from different perspectives. The syntax discriminator can reward features that distinguish corpus sentences from generated ones, regardless of the instruction. The semantic discriminator can use the instruction when rating the candidate. For example, a sentence could contain the kinds of constructions found in review data and still be an unsuitable response to the requested sentiment. Giving the condition to the semantic branch makes the difference between those judgments representable in the training procedure.
How CTERM-GAN generates and evaluates a conditioned sentence
The steps in order.
Encoding the condition
For topic control, the authors first fit latent Dirichlet allocation, abbreviated LDA, on a starting corpus. The LDA procedure identifies topics through distributions over the vocabulary. Given a sentence, the topic processing supplies a word distribution that represents the subject as it will be used for conditioning. The authors obtain these source sentences from the dataset in their experiments. They also describe user-supplied text as a possible source of the same kind of condition. The generator receives the resulting vector. It does not require the source sentence itself as part of its word-by-word input. This is the role of topic modeling in the system.
The distinction between a topic and its vocabulary representation matters for the later evaluation. A topic is represented here by how much weight it gives different words. It can suggest a subject without specifying an exact phrase or a set of words that have to appear. Two sentences can therefore express conditions that are similar in this representation even if they share little wording. The generated text can be put through topic inference too, creating a distribution that can be compared with the original condition in the same space.
For sentiment control, the authors use a one-hot vector. Its active entry identifies the requested polarity, positive or negative. The annotation on a real training sentence supplies the polarity associated with it. A generated sentence receives its condition before any words are produced. This gives the generator a training problem with a discrete input category and many possible acceptable realizations, in place of a vocabulary distribution that varies with the source sentence.
The authors write the transformation of the condition as follows. The notation below uses τ for the embedded condition so that it remains visually distinct from the time index in the subsequent equations.
τ = fθ(c)
Here c is the numerical condition, fθ is the learned transformation, and θ is the collection of parameters of that transformation. The function applied to c returns τ, the representation passed to the generator’s memory. The input has d coordinates and the representation has m coordinates, with m smaller than d in the paper’s description of this projection. The authors implement fθ using a feed-forward network with a self-attention layer.
This stage is a learned interface between the task and the generator. The projection can change how the entries of the original condition are represented before the memory sees them. The training procedure determines which transformed features are useful for generation. In particular, the authors describe c as the channel through which the conditioning information reaches the generator. The generator’s prior words and recurrent state can then carry effects of that information forward, while the projected condition remains available to the update itself.
Updating relational memory and choosing words
The generator uses a relational memory with self-attention. The memory holds internal features in cells, and the attention mechanism helps select among those features when the state is updated and an output is produced. In this setting, attention provides a way to make the contribution of stored information depend on the current computation. The state can keep features across successive positions, while the output from a particular position can emphasize the features useful for making the next word choice.
The authors describe a sequential update in which the embedded condition and the preceding output are used to develop the memory state at the current step. Their equation summarizes the update in terms of its inputs and outputs.
oₜ, hₜ = fRM(hₜ₋₁, τ, yₜ₋₁)
The subscript t is the current sequence position, and t − 1 denotes the preceding position. The function fRM is the relational-memory update. It receives hₜ₋₁, the preceding memory state, τ, the projected condition, and yₜ₋₁, the preceding output supplied to the update. It returns oₜ, the memory output used to score the next word, and hₜ, the state passed forward. The comma on the left indicates that these are distinct outputs of the same update.
The two outputs serve different purposes. The state is a representation the next step can build on. The output is read immediately by the layer that assigns scores to words. The condition can thus affect the current prediction through its role in the update and can also affect later predictions through the state and the words already chosen. This arrangement puts conditioning inside the recurrent generation process. An experiment asking whether the condition should enter at every step would still need a matched version of the generator in which it enters only at the beginning.
The next operation takes the memory’s output into the vocabulary space.
ȳₜ = fα(oₜ)
Here oₜ is the output of the relational memory at position t. The function fα is the feed-forward projection to the vocabulary, and α refers to its learned parameters. The resulting vector ȳₜ gives the vocabulary scores used to produce the next word. Its entries refer to vocabulary candidates, whereas the entries of oₜ are internal features from the memory.
To preserve a differentiable path through word selection, the authors use a soft sample during training.
ŷₜ ∼ Gumbel-softmax(ȳₜ, T)
The symbol ∼ indicates that ŷₜ, the soft representation of the word at position t, is sampled by the indicated procedure. The input ȳₜ is the vocabulary score vector. The parameter T is the temperature, which controls how sharply the sample concentrates on one entry. The authors take this relaxation from Categorical Reparameterization with Gumbel-Softmax.
A concentrated sample behaves more like a single selected word. A softer sample retains weight across alternatives, so changes in the vocabulary scores can affect the representation seen by the discriminator. This is the reason for inserting the relaxation at the word-selection stage. The adversarial loss depends on the discriminator’s response to the generated sequence, and the generator needs a route by which changes to that response can influence its word-scoring parameters. The paper also associates temperature with the quality–diversity tradeoff. Its experiments do not present a separate temperature comparison.
What each discriminator sees
The syntax discriminator can receive a sequence from the corpus or a sequence from the generator. The authors designate these sequences r and g. They use r₁ through rₙ for the positions in the real sequence and g₁ through gₙ for those in the generated sequence, with n denoting sequence length in that description. The first stage turns the input into an embedding matrix, so the convolutional layers work with learned representations of the positions.
The architecture then applies two convolutional layers with rectified linear activations, a self-attention layer, and two more convolutional layers with the same kind of activation. Convolutions let the discriminator extract features from neighboring positions. Attention acts on the representations already produced by the earlier layers and lets the discriminator emphasize useful features before further processing. The final layers turn the result into a decision score.
The training role of this branch explains what the authors mean by a syntax discriminator. It can learn whether the generated sequences exhibit patterns typical of real corpus sentences. The distinction between real and generated sentences provides its supervision. The paper does not give it explicit grammatical parses or a list of permitted constructions. Its discriminator score can therefore reflect whichever features of the text help with the training decision. Calling the branch syntactic identifies the quality it is meant to encourage and the fact that it judges the sentence on its own.
The semantic discriminator has a sentence branch and a condition branch. The sentence branch first uses a feed-forward embedding. Convolution and self-attention, with rectified linear activations in the feature extractor, then yield a vector intended to represent relevant properties of the sentence. The condition branch applies a linear layer to the original conditioning vector c so that its output matches the size of the sentence representation. A feed-forward stage combines the branches for the final decision.
Matching the sizes makes it possible to bring the representations together for scoring. The decision stage can use features of the sentence in relation to features of the request. In a sentiment run, the same wording can in principle receive a different response under a positive condition and a negative one. In a topic run, the vector can indicate distinctions among subjects even where part of the vocabulary overlaps. The paper’s account gives the semantic discriminator the task of recognizing compatibility. The published adversarial loss spells out the contributions from real and generated examples and does not describe a separate term for deliberately mismatched real sentence–condition pairs.
These architecture choices also clarify where the control signal operates. The generator’s projection prepares it for recurrent memory. The discriminator’s linear transformation prepares it for comparison with the features extracted from a complete sentence. They are separate learned transformations because the generator and discriminator use the condition to do different work. The former needs information that can influence vocabulary choices as the sentence develops. The latter needs information that can influence the judgment of a sentence already produced.
The objectives and training schedule
The paper extends a non-saturating GAN objective to use both discriminator scores. The equations below write the objectives as losses to minimize and show the condition explicitly as an argument of the semantic discriminator. The syntax discriminator still receives only the sentence. Batch indices make clear which conditions and sentences belong to each term.
ℓᴅ = −(1/m) Σᵢ [log Dₛ(rᵢ) + log(1 − Dₛ(G(zᵢ; cᵢ))) + log Dₜ(rᵢ, cᵢ) + log(1 − Dₜ(G(zᵢ; cᵢ), cᵢ))]
Here ℓᴅ is the discriminator loss. The summation, Σᵢ, runs over the examples indexed by i in the batch, and m is the batch size in this equation. This use of m is distinct from the dimension of the embedded condition. The factor 1/m gives the average across the batch. The function log is the logarithm. Dₛ is the syntax discriminator and Dₜ is the semantic discriminator. The subscript naming the semantic discriminator is distinct from the time index in the generator equations and from the Gumbel-softmax temperature.
The symbol rᵢ denotes a real sentence in the batch, and cᵢ is the condition used in the corresponding scoring terms. G is the generator. The expression G(zᵢ; cᵢ) denotes its generated sentence under condition cᵢ, with zᵢ denoting the generation input represented by the paper’s z notation. The semicolon inside G separates the generation input from the explicit condition. The real-sentence terms favor high discriminator scores for real examples. In the generated-sentence terms, 1 minus the score is the complement used to favor low scores for generated examples. The minus sign makes maximizing the sum of favorable log scores equivalent to minimizing the written loss.
The generator receives its own objective built from the responses to its generated sentences.
ℓɢ = −(1/m) Σᵢ [log Dₛ(G(zᵢ; cᵢ)) + λ log Dₜ(G(zᵢ; cᵢ), cᵢ)]
Here ℓɢ is the generator loss. The mean again uses 1/m and Σᵢ, with m the batch size and i the example index. The function log is the logarithm. G produces a sentence from generation input zᵢ under condition cᵢ. The syntax score Dₛ uses that sentence, and the semantic score Dₜ uses both the sentence and its condition. The coefficient λ is the weight assigned to the semantic term. The leading minus sign means that lower generator loss corresponds to higher log scores on the generated sentences.
The generator is trained to raise both scores. Raising the syntax score encourages outputs that resemble the sentences the syntax discriminator has learned to accept. Raising the semantic score encourages outputs that pass a judgment made with the condition visible. The same generated sequence participates in both terms. Any change to its word choices can affect both scores, and the coefficient sets how strongly the semantic response counts relative to the syntax response.
The authors explain the coefficient in terms of the behavior it can encourage. If the semantic term carries too little weight, disregarding the instruction may incur too little penalty. Increasing its weight gives the generator a stronger reason to express the condition. A weight that is too high can favor this part of the decision at a cost to sentence quality. The authors report trying several values and selecting 0.1 for the semantic weight. That is the value chosen for these experiments. They give no scores for the other choices.
Training begins with separate preparation of the generator and the semantic discriminator. The generator is trained for 150 epochs before adversarial training, and the semantic discriminator is trained for 300 epochs. This schedule means that the adversarial phase starts after both components have had a separate opportunity to learn their tasks. The paper states that in every adversarial epoch, the generator is trained on 2 batches and the discriminators are trained on 3. These are counts for the updates in each adversarial epoch, distinct from the epoch counts used in the separate preparation.
The architecture and loss describe the responsibilities of the components, while the schedule describes how the authors organized their updates. These are important distinctions for interpretation. The results belong to the configured system, including its preparation and update schedule. They do not isolate the role of initial generator training, initial semantic training, or the balance of batches in producing the reported outcomes. The paper says that the authors planned to release the code publicly after the anonymity period.
Experiments and results
The topic datasets and comparison systems
The authors test topic conditioning on image captions, news text, and a broader sample of written material. The corpora vary in what a typical sentence describes and in the range of topics they cover. The common procedure is to derive a condition from text, generate under that condition, and assess the resulting sentences for corpus resemblance and topic agreement. Although one corpus consists of captions for images, this experiment uses the captions as text. The generator does not receive the associated image.
The caption dataset, labeled Image COCO in the dataset statistics, has a training size of 10,000 and a test size of 10,000. Its reported training vocabulary is 6612, and its topic vocabulary is 3872. The authors preprocess the captions according to the benchmarking procedure they also use for the news dataset. The caption collection itself is described in Microsoft COCO Captions.
EMNLP2017 WMT News supplies sentences that the authors describe as longer than the COCO captions. Its topic experiment has a training size of 270,000, a test size of 10,000, a training vocabulary of 5230, and a topic vocabulary of 4265. The dataset and COCO therefore give the authors two settings with different types of writing under the same cited preprocessing approach. The reported vocabulary counts describe the populations of terms available for the training and topic procedures. They are distinct from the split sizes, which describe the scale of the data.
The APNews dataset comprises articles published by the Associated Press between 2009 and 2016. The training size is 54,000 and the test size is 2000. The table reports a training vocabulary of 32,430 and a topic vocabulary of 8564. For the BNC experiment, the researchers draw on the British National Corpus’s written material. It has a training size of 15,000 and a test size of 1000, with a training vocabulary of 41,496 and a topic vocabulary of 10,345. The paper describes the material in these corpora as covering several kinds of writing, including books, essays, journals, and news.
The comparison includes an autoregressive LSTM that receives an initial topic condition. Autoregressive generation uses the preceding sequence to make the next vocabulary prediction. Here the baseline gives the authors a way to ask what happens when a conventional recurrent predictor is given topical information at the start. It differs from CTERM-GAN in several respects, including the way the condition enters generation and the use of adversarial feedback. Its scores assess a simpler system as a whole.
RelGAN provides a comparison with a related adversarial architecture. TGVAE supplies results from an explicitly topic-guided approach. The authors replicate TGVAE’s results with 10 topics, the same count used for CTERM-GAN, and with its best reported setting, marked T=50 in their table. That table label concerns the number of topics. It has a different meaning from T in the Gumbel-softmax equation. The topic comparison also names SeqGAN in the experimental discussion, but the reported topic results table has no separate SeqGAN row.
What the topic metrics capture
The first evaluation uses corpus BLEU, an overlap measure based on n-grams, or consecutive sequences of vocabulary items. The paper reports B-2 and B-4. These scores incorporate word sequences up to the orders indicated by their names. The longer-order result is more demanding about preserving longer stretches of wording found in the references. The original metric is described in Bleu: a Method for Automatic Evaluation of Machine Translation.
BLEU gives the paper an aggregate measure of how much the generated text resembles the corpus in its local sequences. The authors use it as a proxy for syntactic quality. A plausible sentence can use expressions absent from the reference material, and recurring sequences can contribute to an overlap score without supplying a complete judgment of grammar. The B-2 and B-4 results are therefore most informative when read as evidence at different lengths of overlap. A comparison can favor a system on one and favor its competitor on the other.
The second evaluation uses Kullback–Leibler divergence, abbreviated KL. The topic condition is a distribution over words. A topic can also be inferred from the generated sentence, producing a distribution with the same kind of representation. KL compares those distributions. Smaller values indicate closer agreement by this measure. The divergence evaluates topical control as seen through the topic inference procedure. It leaves room for two sentences to express different propositions or use different wording while receiving similar assessments of subject matter.
The BLEU and KL columns answer different questions. BLEU looks at the output’s overlap with reference text. KL links the output back to the specific condition for generation. A generator can obtain strong topic agreement by favoring vocabulary that identifies the subject, while another can reproduce more familiar phrases that are less tightly tied to it. Reporting both metrics makes that tradeoff visible when the systems rank differently depending on the column. TGVAE’s reproduced results give BLEU comparisons where available, with no corresponding KL values.
Topic results by corpus
On COCO, the topic-conditioned LSTM obtains B-2 of 0.734 and B-4 of 0.315. RelGAN obtains 0.752 and 0.339 on the same measures. CTERM-GAN obtains 0.782 and 0.404. The proposed system leads the displayed comparisons at both overlap orders, and it also has the lowest reported topic divergence on this corpus. The COCO experiment consequently gives the clearest case in the table where both types of evaluation favor CTERM-GAN across the systems for which all measures are available.
Topic-conditioned systems on COCO by KL divergence
CTERM-GAN produces the closest topic distributions among the systems with reported divergence.
The numbers
| System or setting | KL divergence |
|---|---|
| Topic LSTM | 0.104 |
| RelGAN | 0.468 |
| CTERM-GAN (this paper) | 0.053 |
On EMNLP News, the topic-conditioned LSTM obtains 0.532 on B-2 and 0.107 on B-4, with a KL divergence of 0.155. RelGAN obtains 0.675 on B-2 and 0.339 on B-4, with a divergence of 0.941. CTERM-GAN obtains 0.738 on B-2 and 0.326 on B-4, with a divergence of 0.447. These figures show why the two orders of BLEU and the condition measure all matter. CTERM-GAN leads on B-2 and improves topic agreement relative to RelGAN. RelGAN has the highest B-4, and the topic-conditioned LSTM has the lowest KL.
EMNLP News therefore qualifies the paper’s broad characterization of preserving or improving syntactic quality. The proposed system makes stronger short-sequence matches than either reported competitor. Some of that advantage does not carry through to the longer-order comparison with RelGAN. Conversely, the LSTM’s better agreement with the inferred topic comes with weaker overlap scores in this setting. The data allow readers to see what performance is being exchanged when they prioritize topic adherence or a particular order of overlap.
On APNews, CTERM-GAN obtains 0.794 on B-2 and 0.341 on B-4. RelGAN obtains 0.738 and 0.258, while the topic-conditioned LSTM obtains 0.689 and 0.196. TGVAE’s T=10 configuration obtains 0.584 and 0.202, and its T=50 configuration obtains 0.629 and 0.210. CTERM-GAN has the highest BLEU at both reported orders. On KL, the LSTM obtains 0.060, CTERM-GAN obtains 0.194, and RelGAN obtains 0.291. This is another case in which the LSTM gives the strongest distributional agreement and CTERM-GAN gives the strongest overlap.
On the BNC written texts, CTERM-GAN obtains 0.761 on B-2 and 0.242 on B-4. RelGAN obtains 0.760 and 0.282, and the topic-conditioned LSTM obtains 0.688 and 0.203. TGVAE at T=10 obtains 0.518 and 0.173. At T=50 it obtains 0.535 and 0.188. CTERM-GAN leads on B-2, with RelGAN close to it on that score and ahead on B-4. For topic divergence, the LSTM obtains 6.69e-4, CTERM-GAN obtains 7.62e-4, and RelGAN obtains 8.89e-4. Those values should be read as the results for this corpus and its topic representation.
Looking across the topic experiments, CTERM-GAN’s divergence is lower than RelGAN’s on each corpus. B-2 also favors CTERM-GAN in every direct comparison with RelGAN. B-4 divides between them, favoring CTERM-GAN on COCO and APNews and favoring RelGAN on EMNLP News and the BNC. The LSTM repeatedly shows that a generator given an initial condition can obtain a strong topic score. Its lower BLEU makes clear why the authors assess control alongside corpus resemblance. Because the topic representations are estimated for their settings, the clearest comparisons of KL are between systems on the same corpus.
How sentiment generation was evaluated
The sentiment experiments use Movie Reviews, abbreviated MR, and Customer Reviews, abbreviated CR. In Movie Reviews, the paper reports 2, 133 positive sentences and 2, 370 negative sentences from movie reviews. Customer Reviews consists of 1, 500 online product reviews, with annotations indicating polarity at the sentence level. The review count for CR and the labeled sentence counts for MR refer to different units. For compatibility with SentiGAN’s preprocessing, the authors retain sentences shorter than 15 words for this task.
Each generated sentence is associated with a desired polarity. The authors use a bidirectional LSTM classifier to decide which sentiment the sentence expresses. Bidirectional processing uses information from both directions through the sentence for this prediction. The proportion of generated sentences whose classifier assignment agrees with the requested condition is reported as the sentiment score. The score therefore asks whether the intended category is recognizable to this classifier from the generated wording.
The comparison uses RNNLM, SeqGAN, and SentiGAN in two configurations. RNNLM and SeqGAN are trained separately for the positive and negative subsets. For a given requested polarity, the relevant separately trained system generates the sentence. SentiGAN and CTERM-GAN are trained jointly across the sentiments in the comparison. Joint training for SentiGAN still involves its specialized generators. With CTERM-GAN, the condition tells the shared generator which category to express. The baseline scores in the sentiment table come from the SentiGAN paper.
The authors also measure how much outputs resemble the training sentences and each other. For both questions, they use Jaccard similarity, which compares the overlap of the items represented in two sentences with the items found in either. In its role here, a higher similarity indicates more shared material. The evaluation checks each output against all eligible sentences in the relevant comparison collection and bases the score on the closest match. This makes a single very similar neighbor consequential even if the other sentences in the collection are quite different.
The novelty equation uses sentences from the training corpus for that comparison.
Novelty(Sᵢ) = 1 − maxⱼ∈C JS(Sᵢ, Cⱼ)
Here Sᵢ is the generated sentence indexed by i. C denotes the training collection, and maxⱼ∈C indicates the maximum over the indices j of its sentences. Cⱼ is the training sentence indexed by j. JS is the Jaccard similarity between the two sentence arguments. The expression subtracts the largest similarity from 1, so a generated sentence’s novelty decreases as its closest training neighbor becomes more similar.
This measure is sensitive to copying or close reuse of individual training sentences. It can also respond to choices of phrasing that are ordinary for the corpus. In short reviews, conventional ways of expressing an opinion may resemble nearby examples even when the generator creates them through a learned pattern. A higher novelty score means the output is farther from its nearest training example under the specified comparison. Broader claims about originality or the information expressed by the output would require a different assessment.
The diversity equation changes the collection searched for the nearest neighbor.
Diversity(Sᵢ) = 1 − maxⱼ∈S, j≠i JS(Sᵢ, Sⱼ)
Here S is the generated collection, Sᵢ is the sentence being scored, and Sⱼ is another generated sentence indexed by j. The maximum searches indices in S subject to j ≠ i, which excludes comparison with the sentence itself. JS again means Jaccard similarity. Subtracting the maximum from 1 gives a lower diversity score when an output has a close neighbor elsewhere in the generated collection.
The diversity measure addresses a concern in adversarial generation called mode collapse. A generator can find a narrow class of outputs that receive favorable discriminator judgments and produce variations of those outputs frequently. Comparing generated sentences with each other can reveal that pattern through near repetition. Novelty addresses a different relationship, between the outputs and their training material. A generator could produce phrases absent from training while recycling them among its own outputs, or it could generate a varied collection of sentences that individually resemble different training examples.
Sentiment results by corpus
On Customer Reviews, classifier agreement with the requested polarity is highest for CTERM-GAN. The chart shows the full comparison for that metric. The paper reports scores as proportions, so the values retain the scale used in its table.
Sentiment-control systems on Customer Reviews by classifier accuracy
CTERM-GAN has the highest agreement between classified and requested sentiment.
The numbers
| System or setting | sentiment classification accuracy |
|---|---|
| RNNLM | 0.552 |
| SeqGAN | 0.632 |
| SentiGAN (k=1) | 0.731 |
| SentiGAN (k=2) | 0.803 |
| CTERM-GAN (this paper) | 0.869 |
For Customer Reviews novelty, CTERM-GAN obtains 0.539. SentiGAN obtains 0.549 at k=2 and 0.479 at k=1. SeqGAN obtains 0.437 and RNNLM obtains 0.399. The strongest SentiGAN setting therefore gives the generated text a higher nearest-training-sentence distance by this measure. CTERM-GAN’s stronger polarity score comes with novelty close to that setting’s result and ahead of the other reported comparisons.
For Customer Reviews diversity, CTERM-GAN obtains 0.746. SentiGAN obtains 0.741 at k=2 and 0.668 at k=1, while RNNLM obtains 0.663 and SeqGAN obtains 0.619. CTERM-GAN leads on this measure as well as on polarity accuracy. Since diversity is computed against other generated sentences, this result concerns variety within the output collection. The novelty result separately shows how close its outputs are to training material. The rankings can therefore differ without giving conflicting accounts of the same statistic.
On Movie Reviews, CTERM-GAN and SentiGAN at k=2 both obtain sentiment accuracy of 0.885. The other reported results are 0.803 for SentiGAN at k=1, 0.717 for SeqGAN, and 0.662 for RNNLM. This tie on the control metric leaves the comparison open to the other qualities the authors measure. In particular, matching classifier accuracy can come from output collections with different degrees of variety or reliance on familiar phrases.
Sentiment-control systems on Movie Reviews by novelty
The stronger SentiGAN setting produces sentences farther from their closest training examples than CTERM-GAN does.
The numbers
| System or setting | novelty |
|---|---|
| RNNLM | 0.267 |
| SeqGAN | 0.298 |
| SentiGAN (k=1) | 0.344 |
| SentiGAN (k=2) | 0.395 |
| CTERM-GAN (this paper) | 0.270 |
Movie Reviews diversity is 0.700 for CTERM-GAN. The SentiGAN settings obtain 0.711 at k=1 and 0.741 at k=2. RNNLM obtains 0.691 and SeqGAN obtains 0.641. The stronger SentiGAN configuration consequently combines the same sentiment accuracy with stronger values on both output comparison metrics. The CTERM-GAN result establishes that the shared generator can express the requested polarity at the reported rate. The other columns show the limits of using that rate alone to describe its outputs.
The difference between Customer Reviews and Movie Reviews is important to the authors’ assessment of the design. Customer Reviews gives CTERM-GAN the lead on sentiment accuracy and diversity. Movie Reviews gives a tie on accuracy with the strongest comparator and lower novelty and diversity. The shared design’s flexibility comes from how it takes its condition. The experiments show that this flexibility can coexist with competitive results, while the relative output qualities still depend on the corpus and measure.
What the ablations show
The paper reports no component-removal ablation, and its analyses instead compare complete systems, alternative benchmark configurations, and the tradeoffs among their evaluation measures.
The comparison with RelGAN is informative because it puts CTERM-GAN alongside a design that shares the use of relational generation and continuous sampling. Across the topic experiments, the added control scheme accompanies closer agreement with the requested topic under KL, along with consistently stronger B-2. The B-4 results show that the shorter-order improvements do not extend uniformly to longer strings. As a comparison between complete architectures, this establishes an outcome for the combined design. The changes to generator conditioning, discriminator inputs, and objectives enter together, so the experiment gives no individual estimate for any one of them.
The topic-conditioned LSTM helps distinguish access to a condition from the score attributed to the full adversarial architecture. It has access to topical information from the start of generation and can achieve a lower KL than CTERM-GAN. At the same time, CTERM-GAN maintains stronger BLEU results against that comparator on the topic datasets. This establishes that the harder comparison is obtaining topic agreement and corpus resemblance together. The LSTM differs in its generation architecture and training procedure as well as when it sees the condition. Its performance therefore leaves the effect of repeated conditioning within the same generator unresolved.
The TGVAE configurations show how its BLEU results change when the topic count changes between the reported settings. In the APNews and BNC rows, the T=50 result is higher than the T=10 result at both BLEU orders. Reporting T=10 makes a comparison at the same configured topic count as CTERM-GAN possible. Reporting T=50 also exposes the stronger results from the other system. This is a configuration comparison for TGVAE, and the table supplies no associated divergence scores or estimates of what a different topic count would do inside CTERM-GAN.
The sentiment experiments offer a useful check on what happens when accuracy is held equal in the reported scores. CTERM-GAN and the stronger SentiGAN configuration reach the same accuracy on Movie Reviews, while the novelty and diversity results favor SentiGAN. Thus agreement with the requested sentiment leaves substantial scope for a difference in how repetitive the outputs are and how closely they resemble training sentences. On Customer Reviews, CTERM-GAN has the higher accuracy and diversity, while SentiGAN retains a novelty lead. Changing corpus changes the comparison of the full systems even though the desired sentiment still has the same categories.
The SentiGAN rows also show that its k=2 configuration scores higher than its k=1 configuration on the reported sentiment measures in both corpora. That result gives context to the choice of comparator. CTERM-GAN’s lead on Customer Reviews accuracy holds against the stronger setting. On Movie Reviews the same setting ties CTERM-GAN on accuracy and leads on the other measures. The k comparison is evidence about the reported SentiGAN configurations. It does not identify the contribution of a shared generator or a discriminator in CTERM-GAN.
The authors describe trying different weights for the semantic loss and give a rationale for the selected value of 0.1. Their explanation identifies the expected tradeoff between responsiveness to the condition and sentence quality. The paper does not report the corresponding outcomes for the other weights. The tuning establishes the setting used in the benchmark results, while leaving the shape of that tradeoff and the range of workable values open. A weight comparison with scores for each objective would be needed to establish how performance changes as the semantic contribution rises or falls.
Taken together, the comparisons establish where the configured system works well and where stronger controllability comes with a measurable cost. They leave open the separate contributions of the semantic discriminator, the syntax discriminator, repeated access to the conditioning vector, and the preparation schedule. The paper’s strongest evidence is at the level of the full training and generation procedure under its chosen evaluation.
Limitations
Limits the authors identify
The authors test topic and sentiment as instances of external control. They propose writer style and images as future tests of the same architecture. Those conditions would require their own representations, training data, and compatibility signals. The presence of COCO in the experiments only establishes performance on topic distributions extracted from captions. It leaves open how a visual condition would be encoded and whether the resulting output would describe an image accurately.
For topic control, the authors point to topic extraction as a potential source of error and suggest that better extraction could improve generation. The condition carries the information obtained by the LDA procedure. If that procedure emphasizes incidental vocabulary or suppresses an important aspect of the intended subject, the generator receives a condition with those same properties. The result can follow the vector well while reflecting shortcomings in what the vector represents. The authors’ suggestion concerns a possible improvement that their comparison does not measure directly.
The discussion also acknowledges the weaker novelty and diversity on Movie Reviews relative to the strongest SentiGAN setting. That qualification matters to the claim about performance across conditioning tasks. Generality of the architecture refers to the kinds of input it can be trained to use. Quality on a specific corpus still involves competing measures, and the Movie Reviews experiment gives a clear example of a system matching the desired sentiment at the reported rate while trailing its comparator on the other output metrics.
The authors identify temperature and semantic-loss weighting as consequential training choices. The temperature shapes the soft word representation involved in adversarial learning, and the loss weight determines the influence of the semantic score on the generator. The paper offers a rationale for both and identifies the semantic weight used in the reported runs. Readers are left without a quantitative sensitivity analysis showing how the findings hold up under changes to those choices.
Limits apparent in the evaluation
BLEU provides evidence about the resemblance of generated text to reference material at the level of recurring sequences. The paper uses it to measure syntactic quality, but the evaluation does not contain a separate account of which grammatical constructions the system handles well, which errors it makes, or how frequently people would judge its sentences acceptable. The topic conclusions are firmer when expressed in terms of the measured overlap and divergence. A stronger B-4 score can make a case for better longer-sequence resemblance, while a claim about syntactic correctness requires judgments that examine the construction of individual outputs.
The KL comparison inherits assumptions from the topic representation. The input is reduced to a word distribution, and the output is assessed by extracting a distribution from it. A low divergence establishes agreement in that representation. It cannot by itself show that the generator preserved a specific fact, maintained a particular relation between entities, or produced a logically coherent contribution about the subject. Those qualities can matter even in short texts on a well-defined topic, and the LDA-based comparison does not directly examine them.
The sentiment accuracy similarly depends on the bidirectional classifier. The result measures how frequently it recognizes the desired polarity in the output, which is pertinent to the task the authors set. The experiment does not separately measure whether people agree with the classifier, whether the same output controls finer distinctions in attitude, or whether it uses polarity consistently across a longer passage. The restrictions to positive and negative labels and to sentences shorter than 15 words make the scope of the result particularly clear.
Novelty and diversity are also specific to their operational definitions. They treat a close neighbor under Jaccard similarity as evidence of lower novelty or lower diversity. This can detect near repetition at the level of wording. The same procedure may score two different phrasings as far apart even if they express much the same content. It can also give conventional but appropriate expressions a low distance from material elsewhere in the corpus. The scores should therefore be read as properties of overlap in the collections compared, with only an indirect connection to variation in meaning.
The sentiment baseline numbers are reproduced from earlier work, and the TGVAE results are likewise taken from its earlier report. The authors align parts of the setups, including the sentiment preprocessing and one topic-count setting, which gives the comparisons a stated basis. The results still do not amount to a matched retraining study in which all systems are varied under the same implementation and tuning procedure. Where the paper gives a point score, it does not report variation across runs or an uncertainty interval. Close standings, especially the B-2 scores of 0.761 and 0.760 for CTERM-GAN and RelGAN on the BNC, describe the recorded comparison without showing how stable the order would be.
Finally, the experiments demonstrate a shared architectural approach across tasks with different conditioning inputs. The authors train on a consistent representation for each task. The topic runs and the sentiment runs thus support reuse of the design with task-specific training. They leave open whether a single trained generator could move among several unrelated forms of conditioning, whether it could follow them simultaneously, and how successfully the method would transfer to output longer than the sentences assessed here.
What came after
The paper closes by proposing writer style and images as further tests of its conditioning design. Either would extend the question the experiments pose. A style condition would have to guide how a sentence is expressed, and an image condition would have to convey subject matter from a different input type. These were proposed directions. No subsequent study is identified that establishes how either test was carried out or how later work adopted CTERM-GAN.
Cite
Cite as Federico Betti, Giorgia Ramponi and Massimo Piccardi. 2020. Controlled Text Generation with Adversarial Learning. Proceedings of the 13th International Conference on Natural Language Generation.
@inproceedings{betti2020controlled,
title = {{Controlled Text Generation with Adversarial Learning}},
author = {Federico Betti, Giorgia Ramponi and Massimo Piccardi},
booktitle = {Proceedings of the 13th International Conference on Natural Language Generation},
year = {2020},
doi = {10.18653/v1/2020.inlg-1.5},
url = {https://doi.org/10.18653/v1/2020.inlg-1.5}
}This page in Markdown https://md.research.elamur.ai/free/en/papers/betti-2020-controlled-text-generation-adversarial-learning/