Generative feature matching network (GFMN) is an approach for training implicit generative models for images by performing moment matching on features from pre-trained neural networks. In this paper, we present new GFMN formulations that are effective for sequential data. Our experimental results show the effectiveness of the proposed method, SeqGFMN, for three distinct generation tasks in English: unconditional text generation, class-conditional text generation, and unsupervised text style transfer. SeqGFMN is stable to train and outperforms various adversarial approaches for text generation and text style transfer. Generative feature matching networks (GFMNs) (dos Santos et al., 2019) has been recently proposed for learning implicit generative models by performing moment matching on features from pre-trained neural networks. This approach demonstrated that GFMN could produce state-of-the-art image generators while avoiding instabilities associated with adversarial learning. Similarly to training generative adversarial networks (GANs) (Goodfellow et al., 2014), GFMN training requires to backpropa-gate through the generated data to update the model parameters. This backpropagation through the generated data, combined with adversarial learning instabilities, has proven to be a compelling challenge when applying GANs for discrete data such as text. However, it remains unknown if this is also an issue for feature matching networks since the effectiveness of GFMN for sequential discrete data has not yet been studied. first contribution , we propose a new formulation of GFMN for unconditional sequence generation, which we name Sequence-GFMN or SeqGFMN for short, by performing token level feature matching. SeqGFMN has a stable training because it does not concurrently train a discriminator, which in principle could easily learn to distinguish between one-hot and soft one-hot representations. As a result, we can use soft one-hot representations that the generator outputs during training without using the Gumbel softmax or REINFORCE algorithm as needed in GANs for text. Additionally, different from GANs (Zhu et al., 2018), SeqGFMN can produce meaningful text without the need of pre-training the generator with maximum likelihood estimation (MLE). We perform experiments using Bidirectional Encoder Representations from Transformers (BERT), GloVe, and FastText as our feature extractor networks. We use two different corpora, and assess both the quality and diversity of the generated texts with three different quantitative metrics: BLEU, Self-BLEU and Frechet Infersent Distance (FID). Additionally, we show that the latent space induced by SeqGFMN contains semantic and syntactic structure, as evidenced by interpolations in the z space. Our second contribution consists in proposing a new strategy for class-conditional generation with GFMN. The key idea here is to perform class-wise feature matching. We apply SeqGFMN to perform sentiment-based conditional generation using the Yelp Reviews dataset, and assess its performance using classification accuracy, BLEU, and Self-BLEU. Finally, as a third contribution , we demonstrate that the feature matching loss is an effective approach to perform distribution matching in the context of unsupervised text style transfer (UTST). Most previous work on UTST adapts the autoencoder framework by adding an additional loss term: adversarial loss or back-translation loss. Our method consists in replacing the adversarial and back-translation loss with style-wise feature matching. Our experimental results indicate that the feature matching loss produces better results than the traditionally used losses. Let G be a sequence generator implemented as a neural network with parameters  , and let E be a pretrained NLP feature extractor network with L hidden layers, that produces features at token-level for each token in a sequence of length T . The method consists of training G by minimizing the following token-level feature matching loss function: min  T (cid:88) t =1 M (cid:88) j =1 ||  j,tp data   j,tp G (  ) || 2 + ||  j,tp data   j,tp G (  ) || 2 (1) where:  j,tp data = E x  p data E j,t ( x )  R d j ,  j,tp G (  ) = E z N (0 ,I nz ) E j,t ( G ( z ;  ))  R d j ,  j,tp data ,(cid:96) = E x  p data E j,(cid:96),t ( x ) 2  [  j,(cid:96),tp data ] 2 ,  j,tp G ,(cid:96) (  ) = E z N (0 ,I nz ) E j,(cid:96),t ( G ( z ;  )) 2  [  j,(cid:96),tp G ] 2 , (cid:96) = 1 . . . d j , where || . || 2 is the L 2 loss; x is a real data point sampled from the data distribution p data ; z  R n z is a noise vector sampled from the normal distribution N (0 , I n z ) ; E j,t ( x ) denotes the token-level t feature map at a hidden layer j from E ; M  L is the number of hidden layers used to perform feature matching; T is the maximum sequence length; and  2 p data and  2 p G are the variances of the features for real data and generated data respectively. Note that this loss function is quite different from both the MLE loss used in regular language models and the adversarial loss used in GANs. In order to train G , we first precompute  j,tp data and  j,tp data ,(cid:96) on the entire training data. During training, we generate a minibatch of fake data by passing the Gaussian noise vector through the generator. The fixed feature extractor E is used to extract features on the output of the generator at a per-token level. The loss is then computed, as mentioned in Eq. 1. The parameters  of the generator G are optimized using stochastic gradient descent. Note that the network E is used for feature extraction only and is kept fixed during the training of G . Similar to (dos Santos et al., 2019), we use ADAM moving average, which allows us to use small minibatch sizes. Fig. 1 illustrates SeqGFMN training; note that we use mean matching only for brevity, in practice we match both mean and diagonal covariance. In our SeqGFMN framework, the output of the generator G is a sequence  x of soft one-hot representations , {  w 1 ,  w 2 , ...,  w T } , where each element  w i consists in the output of the softmax function at token i . In the feature extractor E , these soft one-hot representations are multiplied by an embedding matrix to generate soft embeddings , which are then fed to the following layers of E . Conditional generation is motivated by the assump-tion that if the training data can be clustered into distinct and meaningful classes, knowledge of such classes at training time would improve the overall performance of the model. For class-based text generation, some datasets provide such opportunity by labeling the training data with relevant classes (e.g., positive/negative sentiment for Yelp Reviews dataset), information that can be leveraged by our model to condition the generation. For this to be effective, the extracted features used for SeqGFMN need to be sufficiently representative of the text generated yet still be different between classes. To account for the knowledge of latent classes, we extend the loss from Eq.1 for the case of two distinct classes: min  T (cid:88) t =1 M (cid:88) j =1 ||  j,tc =0 || 2 + ||  j,tc =0 || 2 + ||  j,tc =1 || 2 + ||  j,t c =1 || 2 (2) where  j,tc =  j,tp cdata   j,tp cG (  ) and  j,tc =  j,tp cdata   j,tp cG (  ) follows the same definition for means and variances as Eq.1, with the exception that they are now class-dependent. Given a class c , we allow for conditional generation by conditioning the noise vector z on c . Indeed, if z  N (0 , I n z ) , applying a class dependent linear transformation z c = A c z + b c will change the noise distribution such that z c  N (cid:0) b c , A (cid:62) c A c (cid:1) . A c and b c are learned at training time so to minimize our loss. This enables the model to effectively sample z 1  z N GeneratorNN  x 1   x N Feature extractor NN E 1 , 1 ( x 1 )  E M,T ( x 1 )  E 1 , 1 ( x N )  E M,T ( x N ) L = P Tt =1 P Mj =1 ||  j,tp data  1 NP Ni =1 E j,t ( x i ) || 2 Figure 1: For each training iteration, Generator ( G ) outputs N sentences from noise signals z 1    z N . a new input noise from distinct distributions, conditioned on the class c . Since the model can update the linear transformation parameters A c and b c to minimize its loss, the model can learn transformations that separate or disentangle between the different classes c naturally. For example, conditioning on sentiment where c =0 is the negative sentiment class and c = 1 the positive class, amounts simply to learning two transformations ( A 0 , b 0 ) and ( A 1 , b 1 ). This approach can be extended beyond learning linear transformations to allow for deep neural network to be employed. During training, a minibatch is composed of input noise samples conditioned on class c . Within our generator, we use a conditional batch normalization (condBN) from (Dumoulin et al., 2016). The conditional BN is a 2-stage process: First, we perform a standard BN of a minibatch regardless of c where y i = BN , ( x i ) , using notations from (Ioffe and Szegedy, 2015). Then y i enters a second stage where w i =  c y i +  c brings class dependency on c as proposed in (Du-moulin et al., 2016). This allows for the influence of class conditioning to carry over the whole model where conditional BN is used. Our models can have three distinct configurations: conditional input noise, conditional BN, or both conditional input noise and conditional BN. Text style transfer consists of rewriting a sentence from a given style s i (e.g., informal) into a different style s j (e.g., formal) while maintaining the content and keeping the sentence fluent. The major challenge for this task is the lack of parallel data, and many recent approaches adapt the encoder-decoder framework to work with non-parallel data (Shen et al., 2017; Fu et al., 2018). This adaptation normally consists in using: (1) the reconstruction loss in an autoencoding fashion, which is intended to learn a conditional language model (decoder D ) while providing content preservation; together with (2) a classification loss produced by a style classifier C , which is intended to guarantee the correct transfer. Balancing these two losses while generating good quality sentences is difficult, and several approaches such as adversarial discriminators (Shen et al., 2017) and cycle-consistency loss (Melnyk et al., 2017) have been employed in recent works. Here, we use feature matching as a way to alleviate this problem. Essentially, our unsupervised text style transfer approach is an encoder-decoder trained with the following three losses: Reconstruction loss: Given an input sentence x s i from set X and its decoded sentence  x s i = D ( E ( x s i ) , s i ) (decoded in the same input style s i ), the reconstruction loss measures how well the decoder D is able to reconstruct it: L rec = E x si  X [  log p D ( x s i | E ( x s i ) , s i )] . | (4) where  X is the set of style transferred sentences generated by the current model. For the classifier, the first term provides supervised signal regarding style classification and the second term gives additional training signal from the transferred data, enabling the classifier to be trained in a semi-supervised regime. For the encoder-decoder the second term gives feedback on the current gener-ator's effectiveness on transferring sentences to a different style. Feature Matching loss: It is computed in a similar way as the class-conditional loss (Eq. 2). This loss consists of matching statistics of the features for each style separately. This means that when transferring from style s i to s j , we match the features of the resulting sentence with the features of real data that are from the target style s j . (Zhang et al., 2017a) proposes Adversarial Feature Matching for Text Generation by adding a reconstruction feature loss to the GAN objective. This is different from our setup, as our discriminator is not learned, and our feature matching is per token and not on a global sentence level. Sequence GAN (SeqGAN) (Yu et al., 2017), MaliGAN (Che et al., 2017), and RankGAN (Lin et al., 2017) use a pretrained generator with MLE loss with a per token reward discriminator that is trained with reinforcement learning. SeqGFMN is similar to SeqGAN in the sense that it has a per token reward (per token feature matching loss). Still, it alleviates the need for pre-training the generator and the cumbersome training of a discriminator by relying on a fixed, state-of-the-art, text feature extractor such as BERT. Due to the discrete nature of the problem, training implicit models is tricky (de Masson d'Autume et al., 2019), which is addressed by using REINFORCE, actor-critic methods (Fedus et al., 2018), and Gumbel softmax trick(Kusner and Hernandez-Lobato, 2016). For unsupervised text style transfer, different adaptations of the encoder-decoder framework have been proposed recently. (Shen et al., 2017; Fu et al., 2018) uses adversarial classifiers to decode to a different style/language. (Melnyk et al., 2017),(Nogueira dos Santos et al., 2018) proposed a method that combines a collaborative classifier with the back-transfer loss. (Prabhumoye et al., 2018) presented an approach that trains different encoders, one per style, by combining the encoder of a pre-trained NMT and style classifiers. The main difference between our approach and these previous work consists in the fact that we use the feature matching loss to perform distribution matching. Datasets : We evaluate our proposed approach on three different english datasets: MSCOCO (Lin et al., 2014), EMNLP 2017 WMT News dataset (Bojar et al., 2017), and Yelp Reviews Dataset (Shen et al., 2017). Both COCO and WMT News datasets are used for unconditional models, while Yelp Reviews is employed to evaluate class-conditional generation and unsupervised text style transfer. Feature Extractors for Textual Data: We experiment with different feature extractors that generate token-level representations. We use word embeddings from GloVe (Pennington et al., 2014) and FastText (Bojanowski et al., 2017) as representatives of shallow (cheap-to-train) architectures. As a representative of large, deep feature extractor we use BERT (Devlin et al., 2018). Devlin et al. (2018) demonstrated that the features extracted by BERT can boost the performance of diverse NLP tasks. Our hypothesis is that BERT features are informative enough to allow the training of (cross-domain) text generators with the help of feature matching. Metrics: In order to evaluate the diversity and quality of texts of the unconditional generators we use three metrics BLEU (Papineni et al., 2002), Self-BLEU (Zhu et al., 2018) and Frechet Infersent Distance, FID (Heusel et al., 2017). Additionally, for class-conditional generation and unsupervised text style transfer, we report accuracy scores from a CNN sentiment classifier trained on the Yelp. Unconditional Text Generation : In Tab. 1, we show quantitative results for SeqGFMN trained on COCO and WMT News using different feature extractors. As expected, BERT as a feature extractor gives better performance because of a more significant and richer features used. We also present a comparison with other implicit generative models for text generation from scratch. We compare SeqGFMN with five different GAN approaches: SeqGAN (Yu et al., 2017), MaliGAN (Che et al., 2017), RankGAN (Lin et al., 2017), TextGAN (Zhang et al., 2017a) and RelGAN (Weili Nie and Patel, 2019). We do not use generator pre-training for any of the models. As reported in Tab. 1, SeqGFMN outperforms all GAN models in terms of BLEU and FID. The combination of low BLEU and low Self-BLEU for the different GANs indicates that the learned models generate random n-grams that do not appear in the test set. All GANs fail to learn reasonable models due to the challenges of learning a discrete data generator from scratch under the min-max game. Whereas, SeqGFMN can learn suitable generators without the need of generator pre-training. Class-conditional Generation : Conditional generation experiments were conducted on Yelp Reviews dataset with sentiment labels (178K negative, 268K positive). For this experiment, we first pre-trained the Generator using a conditional denoising AE where class labels are provided only to the decoder D . The architecture of the encoder is the same as in (Zhang et al., 2017b) with three strided convolutional layers. Once pre-trained, D is used as initialization for our Generator G . The training is similar Model BLEU-2 BLEU-3 BLEU-4 BLEU-5 Self-BLEU FID COCO Real Data 0.721 0.494 0.308 0.194 0.487 3.559 SeqGAN 0.044 0.019 0.012 0.010 0.026 13.167 MaliGAN 0.042 0.017 0.011 0.008 0.032 15.855 RankGAN 0.039 0.016 0.010 0.008 0.023 15.502 TextGAN 0.034 0.015 0.010 0.008 0.624 17.275 RelGAN 0.230 0.055 0.026 0.017 0.811 13.948 SeqGFMN (FastText) 0.389 0.153 0.089 0.059 0.644 6.371 SeqGFMN (Glove) 0.403 0.139 0.077 0.053 0.655 6.218 SeqGFMN (BERT) 0.695 0.476 0.277 0.186 0.802 5.610 WMT News Real Data 0.852 0.596 0.356 0.199 0.289 0.365 SeqGAN 0.008 0.004 0.003 0.003 0.088 8.731 MaliGAN 0.070 0.021 0.012 0.008 0.018 9.057 RankGAN 0.188 0.055 0.024 0.015 0.973 12.306 TextGAN 0.053 0.018 0.010 0.008 0.644 9.945 RelGAN 0.076 0.026 0.015 0.012 0.451 8.809 SeqGFMN (FastText) 0.364 0.102 0.045 0.028 0.787 3.761 SeqGFMN (Glove) 0.385 0.106 0.047 0.029 0.735 4.033 SeqGFMN (BERT) 0.760 0.464 0.204 0.096 0.888 3.530 Table 1: Quantitative results for different implicit generators trained from scratch. to the previous section except now sentiment class labels are passed to G , and class-dependent statistics of BERT features are used, as described in 2.2. Tab. 2 presents results for our regular model (baseline) and the three conditional generators: Cond. Noise, Cond. Batch Normalization (BN), Cond. Noise+BN. We use 10K generated sentences for each sentiment class to compute classification accuracy. In terms of accuracy and BLEU-3 score, the Cond. Noise+BN model provides the best generator as it is able to capture and leverage the class information. Unsupervised Text Style Transfer (UTST) : In Table 3, we report BLEU and accuracy scores for SeqGFMN and six baselines: BackTranslation (Prab-humoye et al., 2018), which uses back-transfer loss; CrossAligned (Shen et al., 2017), MultiDecoder (Fu et al., 2018), and StyleEmbedding (Fu et al., 2018), which use adversarial loss; and TemplateBased (Li et al., 2018) and Del-Retrieval (Li et al., 2018), which uses rule-based methods. The BLEU score is computed between the transferred sentences and the human-annotated transferred references, similar to (Li et al., 2018). And, the accuracy is based on our pre-trained classifier. Compared to the other models, SeqGFMN produces the best balance between BLEU and accuracy. Additionally, if we use back-transfer loss together with feature matching loss ( SeqGFMN + BT ) our model gets a significant improvement on both metrics. We presented new implicit generative models based on feature matching loss that are suitable for unconditional and conditional text generation. Our results demonstrated that backpropagating through discrete data is not an issue for the training via matching distributions at the token level. SeqGFMN can be trained from scratch without the need for RL or Gumbel Softmax. This approach has allowed us to create effective models for unconditional generation, class-conditional generation, and unsupervised text style transfer. We believe this work opens a new competitive avenue in the area of implicit generative models for sequential data.
abstain objective objective abstain abstain abstain abstain abstain abstain objective abstain result abstain method method result objective abstain method objective abstain method result abstain other other abstain abstain method abstain abstain abstain abstain abstain method method abstain abstain abstain method abstain other abstain abstain abstain other abstain abstain abstain abstain abstain method abstain abstain abstain abstain abstain abstain abstain abstain method method abstain abstain abstain abstain abstain abstain abstain other abstain other other other other other other other other method abstain other method method method other abstain method method abstain result abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain other abstain abstain result abstain abstain abstain abstain abstain abstain other abstain abstain abstain result objective objective abstain method objective