Controlled Text Generation with Adversarial Learning (2020)

Abstract: In recent years, generative adversarial networks (GANs) have started to attain promising results also in natural language generation. However, the existing models have paid limited attention to the semantic coherence of the generated sentences. For this reason, in this paper we propose a novel network – the Controlled TExt generation Relational Memory GAN (CTERM-GAN) – that uses an external input to influence the coherence of sentence generation. The network is composed of three main components: a generator based on a Relational Memory conditioned on the external input; a syntactic discriminator which learns to discriminate between real and generated sentences; and a semantic discriminator which assesses the coherence with the external conditioning. Our experiments on six probing datasets have showed that the model has been able to achieve interesting results, retaining or improving the syntactic quality of the generated sentences while significantly improving their semantic coherence with the given input.

## introduction natural language generation (nlg) is gaining increasing attention in the nlp community thanks to its intriguing complexity and central role in many tasks and applications. recently, generative adversarial networks (gans) @xcite have started to display promising performance also in nlg. gans leverage a form of adversarial learning where a generator incrementally learns to generate realistic samples, while a discriminator simultaneously learns to discriminate between real and generated data. they had originally been proposed as a generative approach for continuous data, such as images, but have later found application also for discrete data, despite their well-known "non-differentiability issue". in fact, several gans have recently been proposed for text generation @xcite @xcite and have achieved encouraging results in comparison to comparable maximum likelihood approaches; in particular, relgan @xcite has outperformed state-of-theart (sota) results. in general, an effective nlg model should enjoy two main properties: the syntactic correctness and the semantic coherence of the generated sentences. although both these aspects are key for the usability of nlg models, often only the syntactic aspect is taken into account during training and evaluation. for this reason, in this paper we propose a new model -the controlled text generation relational memory gan (cterm-gan) -which explicitly takes into account both syntactic and semantic aspects. cterm-gan consists of the following main modules: 1) a generator based on a relational memory with self-attention conditioned on an external input; 2) a syntax discriminator which learns to discriminate between real and generated sentences based on syntactic correctness; and 3) a semantic discriminator trained to assess whether a sentence is coherent with the external conditioning. like a conventional nlg gan, this model is trained to generate syntactically-correct sentences; however, the inclusion of both a second discriminator and a generator influenced by an external input allows improving the coherence of the generated sentences. the experimental results in section 4 show that the proposed model has been able to retain or increase syntactic accuracy while at the same time drastically improving semantic coherence. ## related work using gans for discrete data generation is still a developing research area. the two main research directions are along reinforcement learning (rl)based and reparametrization-based models. the former use rl algorithms to circumvent the nondifferentiability issue and include seqgan @xcite and several other models @xcite @xcite . the latter, instead, leverage continuous approximations of discrete sampling @xcite @xcite . recently, relgan @xcite has introduced a gumbel-softmax relaxation of discrete sampling @xcite , alongside a multiple discriminator model to extract different features from the sentences. relgan has outperformed all other compared gan models on a variety of challenging datasets. the idea of using external conditioning to improve or control nlg has also been widely explored @xcite @xcite . for instance, topicrnn @xcite increases the probability of words related to a control topic during sentence generation. sentigan @xcite has proposed a model that generates sentences conditioned on a sentiment by using multiple generators, one per sentiment, and a multi-label discriminator. tcnlm @xcite uses a neural topic model to first extract the latent topic, and then feeds it to a mixture of expert language models, each specialized for an individual topic. differently from them, in our model we use a single generator that controls the text generation by means of a relational memory which has been exposed to the conditioning input. in turn, two distinct discriminators respectively assess the syntactic quality and coherence to the input of the generated sentences. our model is independent of the specific nature of the conditioning input and, as such, it is the only one to date that can be used for both topic-conditioned and sentiment-conditioned generation, and, in principle, other flavors. ## model this section presents the main details of cterm-gan (namely, the generator and the syntax and semantic discriminators). 1 ## experiments the cterm-gan model has been tested over two tasks: topic conditioning and sentiment conditioning. the former consists of generation guided by exogenous text input, while the latter focuses on the generation of sentences given a sentiment. in all experiments, we have separately trained the generator for 150 epochs and the semantic discriminator for 300 epochs before the adversarial training was started. after that, the generator has been trained for 2 batches and the discriminators for 3 batches in each adversarial epoch. for the weight in the loss function, several values were tested and the optimal value was found to be 0.1. ## conclusion in this short paper we have proposed the controlled text generation relational memory gan (cterm-gan), a model aiming to generate sentences that are both syntactically correct and semantically coherent. the proposed model leverages a relational memory that is influenced by a conditioning input and is used to generate sentences, alongside two discriminators that respectively assess the sentences' syntactic quality and semantic coherence. the experimental results over topicconditioned and sentiment-conditioned tasks have shown that the proposed model has performed at the same level or above that of sota gans and relevant baselines. in the near future, we will explore text generation with other type of conditioning inputs such as writer's style and images to further probe the generality of the proposed model.