Style Transfer from Non-Parallel Text by Cross-Alignment

Tianxiao Shen, Tao Lei, Regina Barzilay, Tommi Jaakkola

Introduction

Using massive amounts of parallel data has been essential for recent advances in text generation tasks, such as machine translation and summarization. However, in many text generation problems, we can only assume access to non-parallel or mono-lingual data. Problems such as decipherment or style transfer are all instances of this family of tasks. In all of these problems, we must preserve the content of the source sentence but render the sentence consistent with desired presentation constraints (e.g., style, plaintext/ciphertext).

The goal of controlling one aspect of a sentence such as style independently of its content requires that we can disentangle the two. However, these aspects interact in subtle ways in natural language sentences, and we can succeed in this task only approximately even in the case of parallel data. Our task is more challenging here. We merely assume access to two corpora of sentences with the same distribution of content albeit rendered in different styles. Our goal is to demonstrate that this distributional equivalence of content, if exploited carefully, suffices for us to learn to map a sentence in one style to a style-independent content vector and then decode it to a sentence with the same content but a different style.

In this paper, we introduce a refined alignment of sentence representations across text corpora. We learn an encoder that takes a sentence and its original style indicator as input, and maps it to a style-independent content representation. This is then passed to a style-dependent decoder for rendering. We do not use typical VAEs for this mapping since it is imperative to keep the latent content representation rich and unperturbed. Indeed, richer latent content representations are much harder to align across the corpora and therefore they offer more informative content constraints. Moreover, we reap additional information from cross-generated (style-transferred) sentences, thereby getting two distributional alignment constraints. For example, positive sentences that are style-transferred into negative sentences should match, as a population, the given set of negative sentences. We illustrate this cross-alignment in Figure 1.

To demonstrate the flexibility of the proposed model, we evaluate it on three tasks: sentiment modification, decipherment of word substitution ciphers, and recovery of word order. In all of these applications, the model is trained on non-parallel data. On the sentiment modification task, the model successfully transfers the sentiment while keeps the content for 41.5% of review sentences according to human evaluation, compared to 41.0% achieved by the control-gen model of Hu et al. (2017). It achieves strong performance on the decipherment and word order recovery tasks, reaching Bleu score of 57.4 and 26.1 respectively, obtaining 50.2 and 20.9 gap than a comparable method without cross-alignment.

Related work

Non-parallel style transfer has been extensively studied in computer vision (Gatys et al., 2016; Zhu et al., 2017; Liu and Tuzel, 2016; Liu et al., 2017; Taigman et al., 2016; Kim et al., 2017; Yi et al., 2017). Gatys et al. (2016) explicitly extract content and style features, and then synthesize a new image by combining “content” features of one image with “style” features from another. More recent approaches learn generative networks directly via generative adversarial training (Goodfellow et al., 2014) from two given data domains X1\bm{X}_{1} and X2\bm{X}_{2}. The key computational challenge in this non-parallel setting is aligning the two domains. For example, CoupledGANs (Liu and Tuzel, 2016) employ weight-sharing between networks to learn cross-domain representation, whereas CycleGAN (Zhu et al., 2017) introduces cycle consistency which relies on transitivity to regularize the transfer functions. While our approach has a similar high-level architecture, the discreteness of natural language does not allow us to reuse these models and necessitates the development of new methods.

Non-parallel transfer in natural language

In natural language processing, most tasks that involve generation (e.g., translation and summarization) are trained using parallel sentences. Our work most closely relates to approaches that do not utilize parallel data, but instead guide sentence generation from an indirect training signal (Mueller et al., 2017; Hu et al., 2017). For instance, Mueller et al. (2017) manipulate the hidden representation to generate sentences that satisfy a desired property (e.g., sentiment) as measured by a corresponding classifier. However, their model does not necessarily enforce content preservation. More similar to our work, Hu et al. (2017) aims at generating sentences with controllable attributes by learning disentangled latent representations (Chen et al., 2016). Their model builds on variational auto-encoders (VAEs) and uses independency constraints to enforce that attributes can be reliably inferred back from generated sentences. While our model builds on distributional cross-alignment for the purpose of style transfer and content preservation, these constraints can be added in the same way.

Adversarial training over discrete samples

Recently, a wide range of techniques addresses challenges associated with adversarial training over discrete samples generated by recurrent networks (Yu et al., 2016; Lamb et al., 2016; Hjelm et al., 2017; Che et al., 2017). In our work, we employ the Professor-Forcing algorithm (Lamb et al., 2016) which was originally proposed to close the gap between teacher-forcing during training and self-feeding during testing for recurrent networks. This design fits well with our scenario of style transfer that calls for cross-alignment. By using continuous relaxation to approximate the discrete sampling process (Jang et al., 2016; Maddison et al., 2016), the training procedure can be effectively optimized through back-propagation (Kusner and Hernández-Lobato, 2016; Goyal et al., 2017).

Formulation

In this section, we formalize the task of non-parallel style transfer and discuss the feasibility of the learning problem. We assume the data are generated by the following process:

a latent style variable y\bm{y} is generated from some distribution p(y)p(\bm{y});

a latent content variable z\bm{z} is generated from some distribution p(z)p(\bm{z});

a datapoint x\bm{x} is generated from conditional distribution p(x∣y,z)p(\bm{x}|\bm{y},\bm{z}).

We observe two datasets with the same content distribution but different styles y1\bm{y}_{1} and y2\bm{y}_{2}, where y1\bm{y}_{1} and y2\bm{y}_{2} are unknown. Specifically, the two observed datasets X1={x1(1),⋯ ,x1(n)}\bm{X}_{1}=\{\bm{x}_{1}^{(1)},\cdots,\bm{x}_{1}^{(n)}\} and X2={x2(1),⋯ ,x2(m)}\bm{X}_{2}=\{\bm{x}_{2}^{(1)},\cdots,\bm{x}_{2}^{(m)}\} consist of samples drawn from p(x1∣y1)p(\bm{x}_{1}|\bm{y}_{1}) and p(x2∣y2)p(\bm{x}_{2}|\bm{y}_{2}) respectively. We want to estimate the style transfer functions between them, namely p(x1∣x2;y1,y2)p(\bm{x}_{1}|\bm{x}_{2};\bm{y}_{1},\bm{y}_{2}) and p(x2∣x1;y1,y2)p(\bm{x}_{2}|\bm{x}_{1};\bm{y}_{1},\bm{y}_{2}).

A question we must address is when this estimation problem is feasible. Essentially, we only observe the marginal distributions of x1\bm{x}_{1} and x2\bm{x}_{2}, yet we are going to recover their joint distribution:

As we only observe p(x1∣y1)p(\bm{x}_{1}|\bm{y}_{1}) and p(x2∣y2)p(\bm{x}_{2}|\bm{y}_{2}), y1\bm{y}_{1} and y2\bm{y}_{2} are unknown to us. If two different y\bm{y} and y′\bm{y}^{\prime} lead to the same distribution p(x∣y)=p(x∣y′)p(\bm{x}|\bm{y})=p(\bm{x}|\bm{y}^{\prime}), then given a dataset X\bm{X} sampled from it, its underlying style can be either y\bm{y} or y′\bm{y}^{\prime}. Consider the following two cases: (1) both datasets X1\bm{X}_{1} and X2\bm{X}_{2} are sampled from the same style y\bm{y}; (2) X1\bm{X}_{1} and X2\bm{X}_{2} are sampled from style y\bm{y} and y′\bm{y}^{\prime} respectively. These two scenarios have different joint distributions, but the observed marginal distributions are the same. To prevent such confusion, we constrain the underlying distributions as stated in the following proposition:

In the generative framework above, x1\bm{x}_{1} and x2\bm{x}_{2}’s joint distribution can be recovered from their marginals only if for any different y,y′∈Y\bm{y},\bm{y}^{\prime}\in\mathcal{Y}, distributions p(x∣y)p(\bm{x}|\bm{y}) and p(x∣y′)p(\bm{x}|\bm{y}^{\prime}) are different.

This proposition basically says that X\bm{X} generated from different styles should be “distinct” enough, otherwise the transfer task between styles is not well defined. While this seems trivial, it may not hold even for simplified data distributions. The following examples illustrate how the transfer (and recovery) becomes feasible or infeasible under different model assumptions. As we shall see, for a certain family of styles Y\mathcal{Y}, the more complex distribution for z\bm{z}, the more probable it is to recover the transfer function and the easier it is to search for the transfer.

Consider the common choice that z∼N(0,I)\bm{z}\sim\mathcal{N}(\bm{0},\bm{I}) has a centered isotropic Gaussian distribution. Suppose a style y=(A,b)\bm{y}=(\bm{A},\bm{b}) is an affine transformation, i.e. x=Az+b+ϵ\bm{x}=\bm{A}\bm{z}+\bm{b}+\bm{\epsilon}, where ϵ\bm{\epsilon} is a noise variable. For b=0\bm{b}=\bm{0} and any orthogonal matrix A\bm{A}, Az+b∼N(0,I)\bm{A}\bm{z}+\bm{b}\sim N(\bm{0},\bm{I}) and hence x\bm{x} has the same distribution for any such styles y=(A,0)\bm{y}=(\bm{A},\bm{0}). In this case, the effect of rotation cannot be recovered.

Interestingly, if z\bm{z} has a more complex distribution, such as a Gaussian mixture, then affine transformations can be uniquely determined.

Let z\bm{z} be a mixture of Gaussians p(z)=∑k=1KπkN(z;μk,Σk)p(\bm{z})=\sum_{k=1}^{K}\pi_{k}\mathcal{N}(\bm{z};\bm{\mu}_{k},\bm{\Sigma}_{k}). Assume K≥2K\geq 2, and there are two different Σi≠Σj\bm{\Sigma}_{i}\neq\bm{\Sigma}_{j}. Let Y={(A,b)∣∣A∣≠0}\mathcal{Y}=\{(\bm{A},\bm{b})||\bm{A}|\neq 0\} be all invertible affine transformations, and p(x∣y,z)=N(x;Az+b,ϵ2I)p(\bm{x}|\bm{y},\bm{z})=\mathcal{N}(\bm{x};\bm{A}\bm{z}+\bm{b},\epsilon^{2}\bm{I}), in which ϵ\epsilon is a noise. Then for all y≠y′∈Y\bm{y}\neq\bm{y}^{\prime}\in\mathcal{Y}, p(x∣y)p(\bm{x}|\bm{y}) and p(x∣y′)p(\bm{x}|\bm{y}^{\prime}) are different distributions.

If the distribution of z\bm{z} is a mixture of Gaussians which has more than two different components, and x1,x2\bm{x}_{1},\bm{x}_{2} are two affine transformations of z\bm{z}, then the transfer between them can be recovered given their respective marginals.

2 Example 2: Word substitution

Consider here another example when z\bm{z} is a bi-gram language model and a style y\bm{y} is a vocabulary in use that maps each “content word” onto its surface form (lexical form). If we observe two realizations x1\bm{x}_{1} and x2\bm{x}_{2} of the same language z\bm{z}, the transfer and recovery problem becomes inferring a word alignment between x1\bm{x}_{1} and x2\bm{x}_{2}.

Note that this is a simplified version of language decipherment or translation. Nevertheless, the recovery problem is still sufficiently hard. To see this, let M1,M2∈Rn×n\bm{M}_{1},\bm{M}_{2}\in\mathcal{R}^{n\times n} be the estimated bi-gram probability matrix of data X1\bm{X}_{1} and X2\bm{X}_{2} respectively. Seeking the word alignment is equivalent to finding a permutation matrix P\bm{P} such that P⊤M1P≈M2\bm{P}^{\top}\bm{M}_{1}\bm{P}\approx\bm{M}_{2}, which can be expressed as an optimization problem,

The same formulation applies to graph isomorphism (GI) problems given M1\bm{M}_{1} and M2\bm{M}_{2} as the adjacency matrices of two graphs, suggesting that determining the existence and uniqueness of P\bm{P} is at least GI hard. Fortunately, if M\bm{M} as a graph is complex enough, the search problem could be more tractable. For instance, if each vertex’s weights of incident edges as a set is unique, then finding the isomorphism can be done by simply matching the sets of edges. This assumption largely applies to our scenario where z\bm{z} is a complex language model. We empirically demonstrate this in the results section.

The above examples suggest that z\bm{z} as the latent content variable should carry most complexity of data x\bm{x}, while y\bm{y} as the latent style variable should have relatively simple effects. We construct the model accordingly in the next section.

Method

Learning the style transfer function under our generative assumption is essentially learning the conditional distribution p(x1∣x2;y1,y2)p(\bm{x}_{1}|\bm{x}_{2};\bm{y}_{1},\bm{y}_{2}) and p(x2∣x1;y1,y2)p(\bm{x}_{2}|\bm{x}_{1};\bm{y}_{1},\bm{y}_{2}). Unlike in vision where images are continuous and hence the transfer functions can be learned and optimized directly, the discreteness of language requires us to operate through the latent space. Since x1\bm{x}_{1} and x2\bm{x}_{2} are conditionally independent given the latent content variable z\bm{z},

This suggests us learning an auto-encoder model. Specifically, a style transfer from x2\bm{x}_{2} to x1\bm{x}_{1} involves two steps—an encoding step that infers x2\bm{x}_{2}’s content z∼p(z∣x2,y2)\bm{z}\sim p(\bm{z}|\bm{x}_{2},\bm{y}_{2}), and a decoding step which generates the transferred counterpart from p(x1∣y1,z)p(\bm{x}_{1}|\bm{y}_{1},\bm{z}). In this work, we approximate and train p(z∣x,y)p(\bm{z}|\bm{x},\bm{y}) and p(x∣y,z)p(\bm{x}|\bm{y},\bm{z}) using neural networks (where y∈{y1,y2}\bm{y}\in\{\bm{y}_{1},\bm{y}_{2}\}).

Let E:X×Y→ZE:\mathcal{X}\times\mathcal{Y}\rightarrow\mathcal{Z} be an encoder that infers the content z\bm{z} for a given sentence x\bm{x} and a style y\bm{y}, and G:Y×Z→XG:\mathcal{Y}\times\mathcal{Z}\rightarrow\mathcal{X} be a generator that generates a sentence x\bm{x} from a given style y\bm{y} and content z\bm{z}. EE and GG form an auto-encoder when applying to the same style, and thus we have reconstruction loss,

where θ\bm{\theta} are the parameters to estimate.

In order to make a meaningful transfer by flipping the style, X1\bm{X}_{1} and X2\bm{X}_{2}’s content space must coincide, as our generative framework presumed. To constrain that x1\bm{x}_{1} and x2\bm{x}_{2} are generated from the same latent content distribution p(z)p(\bm{z}), one option is to apply a variational auto-encoder (Kingma and Welling, 2013). A VAE imposes a prior density p(z)p(\bm{z}), such as z∼N(0,I)\bm{z}\sim\mathcal{N}(\bm{0},\bm{I}), and uses a KL-divergence regularizer to align both posteriors pE(z∣x1,y1)p_{E}(\bm{z}|\bm{x}_{1},\bm{y}_{1}) and pE(z∣x2,y2)p_{E}(\bm{z}|\bm{x}_{2},\bm{y}_{2}) to it,

The overall objective is to minimize Lrec+LKL\mathcal{L}_{\text{rec}}+\mathcal{L}_{\text{KL}}, whose opposite is the variational lower bound of data likelihood.

However, as we have argued in the previous section, restricting z\bm{z} to a simple and even distribution and pushing most complexity to the decoder may not be a good strategy for non-parallel style transfer. In contrast, a standard auto-encoder simply minimizes the reconstruction error, encouraging z\bm{z} to carry as much information about x\bm{x} as possible. On the other hand, it lowers the entropy in p(x∣y,z)p(\bm{x}|\bm{y},\bm{z}), which helps to produce meaningful style transfer in practice as we flip between y1\bm{y}_{1} and y2\bm{y}_{2}. Without explicitly modeling p(z)p(\bm{z}), it is still possible to force distributional alignment of p(z∣y1)p(\bm{z}|\bm{y}_{1}) and p(z∣y2)p(\bm{z}|\bm{y}_{2}). To this end, we introduce two constrained variants of auto-encoder.

Dispense with VAEs that make an explicit assumption about p(z)p(\bm{z}) and align both posteriors to it, we align pE(z∣y1)p_{E}(\bm{z}|\bm{y}_{1}) and pE(z∣y2)p_{E}(\bm{z}|\bm{y}_{2}) with each other, which leads to the following constrained optimization problem:

In practice, a Lagrangian relaxation of the primal problem is instead optimized. We introduce an adversarial discriminator DD to align the aggregated posterior distribution of z\bm{z} from different styles (Makhzani et al., 2015). DD aims to distinguish between these two distributions:

The overall training objective is a min-max game played among the encoder EE, generator GG and discriminator DD. They constitute an aligned auto-encoder:

We implement the encoder EE and generator GG using single-layer RNNs with GRU cell. EE takes an input sentence x\bm{x} with initial hidden state y\bm{y}, and outputs the last hidden state z\bm{z} as its content representation. GG generates a sentence x\bm{x} conditioned on latent state (y,z)(\bm{y},\bm{z}). To align the distributions of z1=E(x1,y1)\bm{z}_{1}=E(\bm{x}_{1},\bm{y}_{1}) and z2=E(x2,y2)\bm{z}_{2}=E(\bm{x}_{2},\bm{y}_{2}), the discriminator DD is a feed-forward network with a single hidden layer and a sigmoid output layer.

2 Cross-aligned auto-encoder

The second variant, cross-aligned auto-encoder, directly aligns the transfered samples from one style with the true samples from the other. Under the generative assumption, p(x2∣y2)=∫x1p(x2∣x1;y1,y2)p(x1∣y1)dx1p(\bm{x}_{2}|\bm{y}_{2})=\int_{\bm{x}_{1}}p(\bm{x}_{2}|\bm{x}_{1};\bm{y}_{1},\bm{y}_{2})p(\bm{x}_{1}|\bm{y}_{1})d\bm{x}_{1}, thus x2\bm{x}_{2} (sampled from the left-hand side) should exhibit the same distribution as transferred x1\bm{x}_{1} (sampled from the right-hand side), and vice versa. Similar to our first model, the second model uses two discriminators D1D_{1} and D2D_{2} to align the populations. D1D_{1}’s job is to distinguish between real x1\bm{x}_{1} and transferred x2\bm{x}_{2}, and D2D_{2}’s job is to distinguish between real x2\bm{x}_{2} and transferred x1\bm{x}_{1}.

Adversarial training over the discrete samples generated by GG hinders gradients propagation. Although sampling-based gradient estimator such as REINFORCE (Williams, 1992) can by adopted, training with these methods can be unstable due to the high variance of the sampled gradient. Instead, we employ two recent techniques to approximate the discrete training (Hu et al., 2017; Lamb et al., 2016). First, instead of feeding a single sampled word as the input to the generator RNN, we use the softmax distribution over words instead. Specifically, during the generating process of transferred x2\bm{x}_{2} from G(y1,z2)G(\bm{y}_{1},\bm{z}_{2}), suppose at time step tt the output logit vector is vt\bm{v}_{t}. We feed its peaked distribution softmax(vt/γ)\text{softmax}(\bm{v}_{t}/\gamma) as the next input, where γ∈(0,1)\gamma\in(0,1) is a temperature parameter.

Secondly, we use Professor-Forcing (Lamb et al., 2016) to match the sequence of hidden states instead of the output words, which contains the information about outputs and is smoothly distributed. That is, the input to the discriminator D1D_{1} is the sequence of hidden states of either (1) G(y1,z1)G(\bm{y}_{1},\bm{z}_{1}) teacher-forced by a real example x1\bm{x}_{1}, or (2) G(y1,z2)G(\bm{y}_{1},\bm{z}_{2}) self-fed by previous soft distributions.

The running procedure of our cross-aligned auto-encoder is illustrated in Figure 2. Note that cross-aligning strengthens the alignment of latent variable z\bm{z} over the recurrent network of generator GG. By aligning the whole sequence of hidden states, it prevents z1\bm{z}_{1} and z2\bm{z}_{2}’s initial misalignment from propagating through the recurrent generating process, as a result of which the transferred sentence may end up somewhere far from the target domain.

We implement both D1D_{1} and D2D_{2} using convolutional neural networks for sequence classification (Kim, 2014). The training algorithm is presented in Algorithm 1.

Experimental setup

Our first experiment focuses on text rewriting with the goal of changing the underlying sentiment, which can be regarded as “style transfer” between negative and positive sentences. We run experiments on Yelp restaurant reviews, utilizing readily available user ratings associated with each review. Following standard practice, reviews with rating above three are considered positive, and those below three are considered negative. While our model operates at the sentence level, the sentiment annotations in our dataset are provided at the document level. We assume that all the sentences in a document have the same sentiment. This is clearly an oversimplification, since some sentences (e.g., background) are sentiment neutral. Given that such sentences are more common in long reviews, we filter out reviews that exceed 10 sentences. We further filter the remaining sentences by eliminating those that exceed 15 words. The resulting dataset has 250K negative sentences, and 350K positive ones. The vocabulary size is 10K after replacing words occurring less than 5 times with the “” token. As a baseline model, we compare against the control-gen model of Hu et al. (2017).

To quantitatively evaluate the transfered sentences, we adopt a model-based evaluation metric similar to the one used for image transfer (Isola et al., 2016). Specifically, we measure how often a transferred sentence has the correct sentiment according to a pre-trained sentiment classifier. For this purpose, we use the TextCNN model as described in Kim (2014). On our simplified dataset for style transfer, it achieves nearly perfect accuracy of 97.4%.

While the quantitative evaluation provides some indication of transfer quality, it does not capture all the aspects of this generation task. Therefore, we also perform two human evaluations on 500 sentences randomly selected from the test setwe eliminated 37 sentences from them that were judged as neutral by human judges.. In the first evaluation, the judges were asked to rank generated sentences in terms of their fluency and sentiment. Fluency was rated from 1 (unreadable) to 4 (perfect), while sentiment categories were “positive”, “negative”, or “neither” (which could be contradictory, neutral or nonsensical). In the second evaluation, we evaluate the transfer process comparatively. The annotator was shown a source sentence and the corresponding outputs of the systems in a random order, and was asked “Which transferred sentence is semantically equivalent to the source sentence with an opposite sentiment?”. They can be both satisfactory, A/B is better, or both unsatisfactory. We collect two labels for each question. The label agreement and conflict resolution strategy can be found in the supplementary material. Note that the two evaluations are not redundant. For instance, a system that always generates the same grammatically correct sentence with the right sentiment independently of the source sentence will score high in the first evaluation setup, but low in the second one.

Word substitution decipherment

Our second set of experiments involves decipherment of word substitution ciphers, which has been previously explored in NLP literature (Dou and Knight, 2012; Nuhn and Ney, 2013). These ciphers replace every word in plaintext (natural language) with a cipher token according to a 1-to-1 substitution key. The decipherment task is to recover the plaintext from ciphertext. It is trivial if we have access to parallel data. However we are interested to consider a non-parallel decipherment scenario. For training, we select 200K sentences as X1\bm{X}_{1}, and apply a substitution cipher ff on a different set of 200K sentences to get X2\bm{X}_{2}. While these sentences are non-parallel, they are drawn from the same distribution from the review dataset. The development and test sets have 100K parallel sentences D1={x(1),⋯ ,x(n)}\bm{D}_{1}=\{\bm{x}^{(1)},\cdots,\bm{x}^{(n)}\} and D2={f(x(1)),⋯ ,f(x(n))}\bm{D}_{2}=\{f(\bm{x}^{(1)}),\cdots,f(\bm{x}^{(n)})\}. We can quantitatively compare between D1\bm{D}_{1} and transferred (deciphered) D2\bm{D}_{2} using Bleu score (Papineni et al., 2002).

Clearly, the difficulty of this decipherment task depends on the number of substituted words. Therefore, we report model performance with respect to the percentage of the substituted vocabulary. Note that the transfer models do not know that ff is a word substitution function. They learn it entirely from the data distribution.

In addition to having different transfer models, we introduce a simple decipherment baseline based on word frequency. Specifically, we assume that words shared between X1\bm{X}_{1} and X2\bm{X}_{2} do not require translation. The rest of the words are mapped based on their frequency, and ties are broken arbitrarily. Finally, to assess the difficulty of the task, we report the accuracy of a machine translation system trained on a parallel corpus (Klein et al., 2017).

Word order recovery

Our final experiments focus on the word ordering task, also known as bag translation (Brown et al., 1990; Schmaltz et al., 2016). By learning the style transfer functions between original English sentences X1\bm{X}_{1} and shuffled English sentences X2\bm{X}_{2}, the model can be used to recover the original word order of a shuffled sentence (or conversely to randomly permute a sentence). The process to construct non-parallel training data and parallel testing data is the same as in the word substitution decipherment experiment. Again the transfer models do not know that ff is a shuffle function and learn it completely from data.

Results

Table 1 and Table 2 show the performance of various models for both human and automatic evaluation. The control-gen model of Hu et al. (2017) performs better in terms of sentiment accuracy in both evaluations. This is not surprising as their generation is directly guided by a sentiment classifier. Their system also achieves higher fluency score. However, these gains do not translate into improvements in terms of the overall transfer, where our model faired better. As can be seen from the examples listed in Table 3, our model is more consistent with the grammatical structure and semantic meaning of the source sentence. In contrast, their model achieves sentiment change by generating an entirely new sentence which has little overlap with the source. The discrepancy between the two experiments demonstrates the crucial importance of developing appropriate evaluation measures to compare models for style transfer.

Word substitution decipherment

Table 4 summarizes the performance of our model and the baselines on the decipherment task, at various levels of word substitution. Consistent with our intuition, the last row in this table shows that the task is trivial when the parallel data is provided. In non-parallel case, the difficulty of the task is driven by the substitution rate. Across all the testing conditions, our cross-aligned model consistently outperforms its counterparts. The difference becomes more pronounced as the task becomes harder. When the substitution rate is 20%, all methods do a reasonably good job in recovering substitutions. However, when 100% of the words are substituted (as expected in real language decipherment), the poor performance of variational autoencoder and aligned auto-encoder rules out their application for this task.

Word order recovery

The last column in Table 4 demonstrates the performance on the word order recovery task. Order recovery is much harder—even when trained with parallel data, the machine translation model achieves only 64.6 Bleu score. Note that some generated orderings may be completely valid (e.g., reordering conjunctions), but the models will be penalized for producing them. In this task, only the cross-aligned auto-encoder achieves grammatical reorder to a certain extent, demonstrated by its Bleu score 26.1. Other models fail this task, doing no better than no transfer.

Conclusion

Transferring languages from one style to another has been previously trained using parallel data. In this work, we formulate the task as a decipherment problem with access only to non-parallel data. The two data collections are assumed to be generated by a latent variable generative model. Through this view, our method optimizes neural networks by forcing distributional alignment (invariance) over the latent space or sentence populations. We demonstrate the effectiveness of our method on tasks that permit quantitative evaluation, such as sentiment transfer, word substitution decipherment and word ordering. The decipherment view also provides an interesting open question—when can the joint distribution p(x1,x2)p(\bm{x}_{1},\bm{x}_{2}) be recovered given only marginal distributions? We believe addressing this general question would promote the style transfer research in both vision and NLP.

Acknowledgments

We thank Nicholas Matthews for helping to facilitate human evaluations, and Zhiting Hu for sharing his code. We also thank Jonas Mueller, Arjun Majumdar, Olga Simek, Danelle Shah, MIT NLP group and the reviewers for their helpful comments. This work was supported by MIT Lincoln Laboratory.

References

Appendix A Proof of Lemma 1

For different y=(A,b)\bm{y}=(\bm{A},\bm{b}) and y′=(A′,b′)\bm{y}^{\prime}=(\bm{A}^{\prime},\bm{b}^{\prime}), p(x∣y)=p(x∣y′)p(\bm{x}|\bm{y})=p(\bm{x}|\bm{y}^{\prime}) entails that for k=1,⋯ ,Kk=1,\cdots,K,

Suppose Σk=QkDkQk⊤\bm{\Sigma}_{k}=\bm{Q}_{k}\bm{D}_{k}\bm{Q}_{k}^{\top} is Σk\bm{\Sigma}_{k}’s orthogonal diagonalization. If k=1k=1, all solutions for A−1A′\bm{A}^{-1}\bm{A}^{\prime} have the form:

However, when K≥2K\geq 2 and there are two different Σi≠Σj\bm{\Sigma}_{i}\neq\bm{\Sigma}_{j}, the only solution is A−1A′=I\bm{A}^{-1}\bm{A}^{\prime}=\bm{I}, i.e. A=A′\bm{A}=\bm{A}^{\prime}, and thus b=b′\bm{b}=\bm{b}^{\prime}.

Therefore, for all y≠y′\bm{y}\neq\bm{y}^{\prime}, p(x∣y)≠p(x∣y′)p(\bm{x}|\bm{y})\neq p(\bm{x}|\bm{y}^{\prime}). ∎