Controllable Text Generation with Neurally-Decomposed Oracle
Abstract
We propose a general and efficient framework to control auto-regressive generation models with NeurAlly-Decomposed Oracle (NADO).
Given a pre-trained base language model and a sequence-level boolean oracle function, we propose to decompose the oracle function into token-level guidance to steer the base model in text generation.
Specifically, the token-level guidance is approximated by a neural model trained with examples sampled from the base model, demanding no additional auxiliary labeled data.
Based on posterior regularization, we present the closed-form optimal solution to incorporate the token-level guidance into the base model for controllable generation.
We further provide a theoretical analysis of how the approximation quality of NADO affects the controllable generation results.
Experiments conducted on two tasks: (1) text generation with lexical constraints and (2) machine translation with formality control demonstrate that our framework efficiently guides the base model towards the given control factors while maintaining high generation quality.
Introduction
Auto-regressive language models have been widely used for text generation.
With the recent development of large-scale pre-trained language models (Radford et al., 2019; Brown et al., 2020; Raffel et al., 2020; Lewis et al., 2020), they have achieved state-of-the-art performances in applications such as machine translation (Bahdanau et al., 2015;
Luong et al., 2015), image captioning (Anderson et al., 2018;
You et al., 2016) and open domain text generation (Zhang and Lapata, 2014; Yao et al., 2019; Vinyals and Le, 2015; Shang et al., 2015; Lu et al., 2018).
However, many applications such as open-domain creative generation (Yao et al., 2019; Goldfarb-Tarrant et al., 2020; Tian and Peng, 2022; Han et al., 2022; Chen et al., 2022; Spangher et al., 2022) require to control model output with specific sequence-level attributes.
The attributes can be specified by a set of rules 2 or by an abstract concept (e.g., the generated text follows a particular writing style).
How to control auto-regressive language models to satisfy these attributes is an open challenge.
In this paper, we propose a general and flexible framework for controllable text generation.
Given a base pre-trained language model and a sequence-level oracle function indicating whether an attribute is satisfied, our goal is to guide the text generation to satisfy certain attributes using the oracle.
To x +
Sampling
Oracle ? ? ??
Training generated text
A girl with hair sits at a table looking around.
A woman is sitting and looking down.
hair
[Figure]
NADO (a) Take lexically constrained generation as an exam-
ple
, where the oracle checks whether all keywords in the input x are incorporated in generated text y .
With proper training using samples from the base model p (dashed arrow) that labeled by the oracle, we decompose the oracle into token-level guidance and parameterize it by an auxiliary model R θ (NADO).
We use R θ to provide guidance when generating text with the base model (see details in
Fig. 1(b)).
[Figure]
Model
Base Model
Base Model
Base Model ······
Aux.
[Figure]
Aux.
[Figure]
the controlled generation pro- cess.
Both the base model and the auxiliary
[Figure]
and the generated sequence
[Figure]
y
[Figure] [Figure]
|
[Figure]
y <
[Figure] [Figure]
by NADO
[Figure]
[Figure]
the distribution q (See Sec. 3.2)
[Figure]
based on which we generate the output
[Figure]
this end, we propose to decompose the sequence-level oracle into token-level guidance, such that when generating the i − th token in the output sequence given the prefix, instead of sampling from the base model, we modify the probability distribution of the output token based on the token-level guidance.
Specifically, we formulate the control as an optimization problem based on posterior regularization (Ganchev et al., 2010) and solve the closed-form optimal solution to incorporate the token-level guidance for text generation.
The decomposition is approximated by an auxiliary neural network model, called NeurAlly-Decomposed Oracle (NADO), which is trained on data sampled from the base model and supervised by the sequence-level oracle (see the illustration Fig. 1a).
We further provide theoretical analysis on how NADO’s approximation quality affects the controllable generation results.
Note that in the entire process, we treat the base model and the sequence-level oracle as black-box functions, without the need for any refactoring or fine-tuning.
A few existing controllable generation works (e.g., Lu et al.
(2021, 2022b)) design search algorithms for generating texts with lexical constraints .
However, their approaches are in a post-process manner and cannot generally be applied to constraints such as formality.
Another line of work such as PPLM (Dathathri et al., 2020), GeDI (Krause et al., 2021), and FUDGE (Yang and Klein, 2021) also aim to guide the base model with an auxiliary model.
However, they either shift the base model distribution in a post-hoc manner without theoretical guarantee, or/and require external labeled data to train the auxiliary model.
Khalifa et al.
; Korbak et al.
(2022) propose a generation with distributional control approach. Our control objective derived through posterior regularization resembles their energy-based model representation.
However, they approximate the energy-based model using a KL-adaptive distributional policy, while we propose to decompose the sequence-level oracles into token-level approximated by NADO. With the decomposition, base models receive explicit controlling signal in generating every token from the oracle.
Furthermore, since NADO is trained on the data sampled from the base models, it aligns better with the base model’s distribution and thus can achieve better control.
We conduct experiments on lexically constrained generation (LCG) tasks and a machine translation (MT) formality change task.
In LCG tasks, the oracle is a rule-based keyword checker.
We achieve almost perfect keyword incorporation with significantly boosted BLEU scores compared to previous approaches that design specific decoding algorithms (Lu et al., 2021).
In the formality-controlled
MT task, we are provided with a formality oracle predicting whether a sentence is formal or not, and the goal is to guide the model to generate formal translations.
Compared with recent work (Yang and Klein, 2021), we improve the BLEU score by 3 points as well as improve the formality rate, demonstrating NADO’s superior ability to incorporate external oracle supervision.
Both experiments demonstrate the effectiveness of our framework in dealing with various types of control while maintaining high-quality generation results.
Related Work
Controllable Text Generation with Auto-regressive Models.
Most previous work on controllable text generation are based on the auto-regressive framework.
Zhang et al.
(2022) summarize these methods into three categories: fine-tuning, refactor/retraining and post-processing.
The first two categories, e.g., fine-tuning with control code (Peng et al., 2018; Keskar et al., 2019) or prompt-based methods (Sheng et al., 2020; Shin et al., 2020; Lester et al., 2021; Li and Liang, 2021), are usually weaker in controllability and inefficient in training considering the size of language models are dramatically increasing nowadays.
Generally, the post-processing methods are considered expensive in inference and low quality in generated texts.
However, our framework, as a kind of post-processing method, is able to achieve high generation quality demonstrated in the experiments and maintains efficient inference.
Controllable Text Generation via Post-processing.
There are two major lines in post-processing: (1) modifying the decoding algorithm and (2) guiding generation with an auxiliary model.
For some token-level controlled generation tasks like lexically constrained generation, we can inject the constraints into the decoding algorithm (e.g., constrained beam search (Anderson et al., 2017; Post and Vilar, 2018) and NeuroLogic decoding (Lu et al., 2021, 2022b)).
Though shown effectiveness in lexically constrained generation, these algorithmic methods fail to fundamentally touch the token distribution, and are hard to handle other abstract attributes.
In the second line, PPLM (Dathathri et al., 2020) proposes an auxiliary discriminator for the expected attribute to guide the model; GeDi (Krause et al., 2021) and DEXPERTS (Liu et al., 2021) apply contrastive learning and train an auxiliary language model to reweight the token distribution in each step; Plug-and-Blend (Lin and Riedl, 2021) further extends the GeDi framework by adding a planner architecture.
FUDGE (Yang and Klein, 2021) leverages external token-level oracle to train a discriminator for guiding the base model.
These methods either require external token-level oracle guidance or auxiliary labeled datasets to train the auxiliary models.
However, the distribution of the data used to train the auxiliary model is different from what the based model is trained on.
This distributional discrepancy causes the drop of generating quality as we will show in the experiments.
For example, given a controlling attribute a , Fudge generates next token
y i based on Bayesian rule
P ( y i | y <i , a ) ∝ P ( a | y ≤ i ) P
y i |
y <i ) .
However, their P ( a | y ≤ i ) and P ( y i | y <i ) are not estimated based on the same distribution.
In contrast, NADO is trained with data sampled from the base model.
Therefore, it learns to incorporate with the base model, which avoids the distributional discrepancy.
We also provide a principle, theoretical framework to discuss the optimal solution of incorporating the sequence-level oracle.
Methodology
We approach the sequence-level controllable text generation problem by decomposing the sentencelevel oracle into token-level guidance.
We formulate this as an optimization problem.
Since the tokenlevel guidance is intractable, we propose to train an auxiliary model, called NeurAlly-Decomposed
Oracle (NADO), to approximate it.
During the inference time, NADO guides the base model to generate sequences that satisfy the oracle constraints.
In the rest of this section, we discuss 1) the formulation to decompose the sequence-level oracle function into token-level guidance; 2) the formulation to incorporate the token-level guidance into the base model to achieve control; 3) the approximation of the token-level guidance using NADO; 4) a theoretical analysis of the impact of NADO approximation to the controllable generation results; and 5) the training of NADO.
3.1 Setup: Notations and Problem Formulation
We use x ∈ X to denote the input and y ∈ Y to denote the generated sequence.
y i is the
i − th token in y and y <
i is the sequence prefix from the beginning to the ( i − 1) − th token.
We denote the base auto-regressive generation model as p ( y i | x , y <i ) , hence the sequence-level distribution is given by p ( y | x )
= (cid:81)
i p ( y i | x , y <i ) .
A sequence-level oracle is defined as a boolean function C :
X ×Y → { 0 , 1 } .
We formalize the optimization objective based on posterior regularization (Ganchev et al., 2010).
Basically, we explore a token-level distribution q ∗ ( y i | x , y <i ) and its corresponding sequence-level distribution q ∗ ( y | x ) , satisfying
q ∗ ( y | x ) =
(cid:81)
i q ∗ ( y i | x , y <i ) , i.e., q ∗ can be treated as an auto-regressive model.
q ∗ ( y | x ) =
if C ( x , y ) = 0 , i.e., q ∗ only generates sequences satisfying the oracle C. 3.
Given an input x , KL ( p ( y | x ) ∥ q ∗ ( y | x )) is minimized, i.e., q ∗ should be as similar to the base model as possible.
Khalifa et al.
; Korbak et al.
(2022) derive a similar optimization formulation as property 2, 3, to represent constraints through energy-based models and approximate it with distributional policy gradient.
In this work, we propose to decompose oracle to token-level guidance to steer the generation. We discuss our approach in the following.
3.2 Token-level Guidance and Closed-Form Solution For q ∗
Before we compute the solution for q ∗ , given the base model p and oracle C , we first define the token-level guidance as a success rate prediction function R Cp ( x ) , which defines the probability of the sequence generated by p satisfies the oracle C given the input x .
We similarly define R Cp ( x , y ≤ i ) as the probability of success given input x and prefix y <i .
By definition, we have
[Equation]
[Equation] With the function R Cp , we now derive the closed-form solution of q ∗ considering conditions 2 anddefined in Sec. 3.1.
Given input x , we define the feasible sequence-level distribution set Q as
[Equation]
then the sequence-level closed-form solution for q ∗ is given by
[Equation]
Considering condition 1 in Sec.
3.1 to make q ∗ tractable, we decompose q ∗ ( y | x ) into token-level.
The closed-form solution is given by
[Equation]
The decomposition is unique.
The proof and detailed derivation can be found in the appendix.
Control with Soft Constraints.
In Eq.
(2) we define the feasible distribution set as distribution that the possibility of a sequence violate the oracle function is 0 .
However, in some applications, we expect to control the generation with soft constraints.
For example, we want the model to generate sentence about sports with probability r = 0 .
Our framework also supports controlling the generation with soft constraints.
To achieve this, with a pre-defined ratio r ∈ [0 , 1] , we alternatively define a general feasible set Q as
[Equation]
where Eq.
(2) is the special case when r = 1 .
The general token-level closed-form solution is
[Equation]
where α = r R C p ( x ) [Equation] β = [Equation]
− r
[Equation]
− R C p
[Equation]
x ) .
Similar to Eq.
(4), once we have access to R Cp , we can directly compute the closed-form solution even though the form is much more complicated.
In this paper we only focus on hard constraints ( r = 1 ), however, here we demonstrate that our framework is capable of handling soft constraints as well.
3.3 Approximating R Cp by NADO and Theoretical Analysis
Unfortunately, function R Cp defined in Eq.
(1) is intractable.
We cannot enumerate all possible sequences y since the space is exponentially large and essentially infinite.
Hence, we train a neural model NADO to approximate this well-defined function.
We use R Cθ to denote NADO parameterized by θ .
In this section, we derive bounds to provide a theoretical analysis about the correlation between errors in approximation and errors in corresponding sequence-level distribution.
Generally, when
R Cθ approximates R Cp precisely enough, we have an upper bound for the sequence-level distribution discrepancy.
The following lemma provides the formal definition.
Lemma 1 We define distribution
[Equation]
If there exists δ > 1 such that given input x , ∀ y <i , 1 δ < R Cθ ( x
[Equation]
y ≤ i ) R Cp ( x
[Equation]
y
[Equation]
< δ, we have
[Equation]
where L is the length of the sequence y .
We also notice that by definition, R Cp satisfies the following equation:
[Equation]
If R also satisfies Eq.
(6), we can tighten this bound.
Formally,
Lemma
Given the condition in Lemma 1, if q is naturally a valid distribution without normalization (i.e., (cid:80)
y i R
Cθ ( x , y ≤ i ) R
Cθ ( x , y ≤ i − 1 ) p ( y i | x , y <i ) = 1 ), we have
[Equation]
This lemma shows that with the auto-regressive property, the error does not accumulate along with the sequence.
The proof is in the appendix.
These two bounds indicate that when training the model
R Cθ , we should push it to satisfy Eq.
(6) while approximating R Cp .
3.4 Training NADO
In Fig.
1b we show the architecture of NADO.
In general, NADO can be any seq2seq model.
During training, it takes x , y as input and predicts from R Cθ ( x , y ≤ 0 ) to R Cθ ( x , y ≤ T ) .
During the inference time, there are two parallel forward pass 3 to compute the token distribution q .
Considering the size of the NADO is usually much smaller than the base model, the whole forward pass takes no more than 2x base model forward pass time.
Now we discuss the training objective.
In training, with some predefined input distribution X , we sample x ∼ X , y ∼ p ( y | x ) .
We take these sampled ( x , y ) pairs as training examples, and use the boolean value C ( x , y ) as their labels for all steps.
We use cross entropy (denoted as CE ( · , · ) ) as the loss function, formally, L CE ( x , y , R Cθ )
= (cid:80)
Ti =0 CE ( R Cθ ( x , y ≤ i ) , C ( x , y )) .
Given a particular input x , in expectation, we have
[Equation]
[Equation]
Therefore, L CE empirically estimates the cross entropy loss between R Cθ and the ground truth R
Cp which is intractable.
As we analyze above, we also regularize R Cθ for satisfying Eq.
(6) based on KL-divergence:
[Equation]
f KL
[Equation]
[Equation]
q is KL-divergence regarding p and q as two Bernoulli distributions.
We use a hyper-parameter λ > 0 to balance these losses.
The final training loss is
[Equation]
3.5 Sampling
In Sec.
3.4 we describe that we train NADO by sampled data from base model p .
One advantage is that we are able to leverage different sampling strategies to better adapt to different application scenarios.
It is also possible to leverage reinforcement learning to train R Cθ , and we discuss our connection to reinforcement learning in the appendix.
In this section, we introduce two sampling strategies and their corresponding properties.
Sampling with Temperature Control.
In some task, the output sequences are not diverse much, in other words, the token distribution in each step is very peaky.
Since our NADO is trained on the sampled examples, we expect those examples to cover as much tokens combination as possible to avoid overfitting.
Therefore, we add temperature factor T to smooth the distribution (Ackley et al., 1985).
Specifically, we sample y from distribution p ( y | x ) 1 T , and add coefficient p ( y | x ) 1 − 1 T when computing the cross-entropy loss.
Formally, the expected loss is
[Equation]
which is same as the original expected loss in Eq.
Importance Sampling.
In practice, the training process of NADO can be extraordinarily difficult when samples generated by the base model p hardly satisfy C .
i.e. E y ∼ p
( y | x ) [ p ( C | x , y )] ≃ 0 .
Hence, we introduce the importance sampling (Hammersley and Morton, 1954) to tackle this issue.
Basically, we leverage existing partially trained ˆ R θ to form distribution ˆ q .
Although ˆ R θ is not well-trained, it is still able to provide positive guidance to produce samples satisfying C .
Note that ˆ q does not have to be updated in each training epoch.
With coefficient p ( y | x ) ˆ q ( y | x ) , the expected loss is same as the original expected loss:
[Equation]
Experiments
We conduct experiments on two tasks: lexically constrained generation (LCG) and machine translation (MT) with formality change.
For the former, we use GPT-
(Radford et al., 2019) as the base model and for the latter, we use a sequence-to-sequence model, MarianMT (Junczys-Dowmunt et al., 2018).
We demonstrate our framework is generally effective in both scenarios.
The boolean oracle is a rule-based function checking whether all lexical constraints are satisfied in LCG task, while in MT it is a classifier trained on an external dataset identifying the formality of the text.
We put all details about hyper-parameter settings in the appendix.
4.1 Text Generation with Lexical Constraints
We evaluate our model on two general classes of LCG problems:
• Unsupervised LCG: annotation for lexical constraints are not available during training, but are expected to be in their exact order and lexical form during inference.
• Supervised LCG: annotation for lexical constraints are available, yet the words may appear in a different lexical form (e.g., “look” can appear in the past tense “looked”) or a different order in the generated text.
In both cases, we define oracle C as a boolean function indicating whether the generated sequence satisfies all of the lexical constraints.
We do not naturally have negative samples (i.e. the sequences that do not satisfy all constraints) to train the auxiliary model in both settings, thus, it is non-trivial to compare against methods requiring both positive and negative labeled data for training the auxiliary model like FUDGE and GeDi.
Data Setup For unsupervised LCG, we follow the settings in POINTER (Zhang et al., 2020) and conduct our experiments on Yelp!
Review and News dataset.
Each of the unsupervised LCG dataset contains a great number of un-annotated, raw sequences for training (160K for Yelp!
Review and 268,586 for News).
During inference, the model is expected to generate text lexically constrained in the exact order and form by a specific number of keywords (7 for Yelp!
Review and 4 for News).
For supervised LCG, we evaluate the proposed method on CommonGen (Lin et al., 2020).
CommonGen is a supervised LCG task that aims to examine the commonsense of neural text generation models.
For training, it contains 32,651 unique key concepts (i.e. the constraints) with 67,389 completed sequences in total.
It also contains a validation set with 993 concepts and 4018 reference sequences.
For a more robust evaluation, the dataset maintains an open leaderboard that benchmarks different approaches on a withheld test set.
We follow most of the data configurations specified in the original paper that first introduced the datasets.
General Model Setup We investigate the effectiveness of different factors in our framework by enumerating different combinations of them.
We implement two types of base model:
• (Seq2seq base model)
A sequence-to-sequence model p ( y | x ) that takes into account the lexical constraints as condition sequence input; • (DA base model)
A language model that is only domain-adapted to p ( y ) but unconditioned on anything.
This is a challenging setting, since we impose the lexical constraints only with NADO.
This setting is to better verify the effectiveness and efficiency of the proposed method and control irrelevant factors.
Under both p ( y | x ) and p ( y ) settings, we fine-tune the base model from the pre-trained GPT2-Large.
During training, NADO is trained as a Seq2seq-like model 4 , which takes in the keys (for unsupervised
LCGs, they are generated by randomly sampling a specific number of natural words in the original sentence) and generates the token-level guidance R Cθ ( x , y ≤ i ) .
For each pseudo key, we sampletarget text with top-p ( p = 0 . 8 ) random sampling from base model p .
We conduct experiments to test different training setups for NADO:
• (NADO training)
The proposed training process described in Sec. 3.4. • (Warmup)
We warm up NADO by maximizing the likelihood of positive samples, but only backpropagating the gradient to the parameters of R θ .
The warm-up R Cθ is used for importance sampling described in Sec.
With DA base models, however, the warmup process is always incorporated for practical success of training (see the results for DA pretrained w/o warmup).
We also consider the setting with warmup only, which can be treated as a stronger baseline to verify that the major improvement of our framework is not coming from the extended capacity in NADO.
Results and Analysis
We compare the performance under different setups of our model to previous state-of-the-art methods on LCG tasks, including insertion-based models (Levenshtein Transformer (Gu et al., 2019) with Lexical Constraints (Susanto et al., 2020), InsNet (Lu et al., 2022a), etc.) and decoding-based algorithms.
We also compare the results with a simple baseline which address the problems with a standard Seq2seq pipeline.
The results are as shown in Table 1.
NADO consistently improves the BLEU score and coverage in different setups.
Furthermore, under the best setting of each task (see bolded items in the table), NADO performs significantly better than most baselines in generation quality and can achieve very good lexical constraints coverage rate. [Figure]
Epochs
[Figure] [Figure] [Figure]
[Figure]
Epochs
[Figure]
Compared to InsNet, it is much easier for an autoregressive model with NADO to handle flexible reordering/transformation of lexical constraints.
This is reflected in the performance comparison of
InsNet and NADO on CommonGen dataset.
Under most settings, a Seq2seq base model makes it easier for the framework to perform well, as it guarantees a reasonable level of lexical constraint coverage in even the initial state of the model.
Using a DA pretrained base model is a even challenging setup since the lexical constraints are only imposed with NADO.
Therefore, the base model distribution is much distinct from the one filtered by the oracle, which is shown by poor performances on both metrics.
However, with warmup and
NADO under importance sampling, we show that it is still possible to obtain a powerful model with the proposed method.
To further study the correlation between the base model quality and the improvement of NADO, we conduct experiments on GPT-2 base model.
The GPT-2 base model has lower scores with and without
NADO compared with GPT-2 large, while the coverage improvements are similar.
It shows NADO is capable to push the base model distribution towards the oracle if the base model has decent quality.
We also do human evaluation on base model (GPT-2 Large fine-tune) and the best NADO system, together with the gold reference for comparison.
The results are shown in Tab. 2.
The evaluation metrics are detailed described in the Appendix.
Some qualitative are shown in Tab. 3.
To study the importance of the regularization term, we conduct an ablative study under the optimal setting on the CommonGen dataset (Seq2seq base model with NADO only).
The results are shown in Figure 2.
While the success of achieving lexical control does not degenerate when NADO w/o regularization overfits, adding regularization can significantly improve the robustness of NADO generation quality when training NADO for more epochs.
4.2 Machine Translation with Formality Change
Datasets and Setup We follow the experimental setting in FUDGE (Yang and Klein, 2021) to formalize the results of machine translation.
Given an informal source sentence, our goal is to translate it into formal sentence written in the target language.
We conduct our experiments on Fisher and CALLHOME Spanish-English Speech Translation Corpus (Post et al., 2013), where both of the
Spanish source and English reference are informal and casual.
Instead of evaluating the translation on original references, we use the formal and fluent rewritten version of references (Salesky et al., 2019) to evaluate the translation quality by BLEU scores.
In the training process, the formal version reference is unseen to the models.
We also evaluate the formality scores by a discriminator trained on
GYAFC formality dataset (Rao and Tetreault, 2018) as what FUDGE paper does.
In this experiment, pre-trained Marian MT model (Junczys-Dowmunt et al., 2018) is used as the base model.
In FUDGE, the authors train an auxiliary model also on GYAFC modeling token-level guidance
P ( formal | y <i ) , and leverage it to guide the base model by Bayesian rule
[Equation]
For the formality supervision, FUDGE leverages an external token-level oracle.
In NADO, we load the same oracle but exclusively leverage sequence-level binary supervision as oracle C .
We randomly
[Table]
GPT-2 Base Reference
[Table] [Table]
choose 10,000 (7.2%) source texts from the training set as input examples, and sample 8 target texts by sampling with temperature T from base model p for each source text.
We use those sampled examples to train NADO.
In total, we have 80 , 000 training samples, which is similar to the number of training data (105k) for the token-level oracle in FUDGE.
All the methods are using greedy decoding.
Results and Discussion
The experimental results are shown in Table 4.
Compared to FUDGE, although only the sequence-level supervision is leveraged, we are consistently better in both metrics, especially in BLEU score we boost about 3 points.
We conjecture that the improvement is because our formulation is more principle and correct.
In methods using auxiliary model to guide the base model, including FUDGE, their formulation is based on Eq. 9.
However, the auxiliary model is trained on a distribution different from where the base model is pretrained on, which leads to a distributional discrepancy issue.
In other words, directly multiplying these two terms is not rigorous, since they are estimated on two different distributions.
On the contrary, NADO is trained specifically to the base model.
This avoids the discrepancy issue and provides an accurate guidance.
Considering we are
[Table]
[Table] using the same oracle function and similar number of training samples [Table] the higher generation quality reflected by BLEU scores supports our conjecture.
In sampling, for each input we sample 8 examples to train R Cθ , which are usually identical in this task.
Applying temperature in sampling allows NADO to be trained with more diverse data.
Results show that with a properly set temperature, we can further improve the generation quality.
It is still possible that the neural oracle leverages some superficial or even spurious features and
NADO is catering those features in order to improve the formality scores.
For example, some informal little words like “hmm” “uh”, and some abbreviations like “ ‘cause ” “gonna” could make the formality score lower.
We find that NADO tends to fix them (see Appendix D).
However, how to get an good oracle is orthogonal to our contributions.
Conclusion
We purpose a general and efficient framework for controllable generation.
We leverage an auxiliary neural model, NADO, to approximate the decomposed oracle guidance, and incorporate it with a fixed base model.
By training with sampled data from the base model, NADO aligns better with the base model, and our framework is more flexible dealing with various application scenarios provided by different sampling methods.
As NADO is a general framework, in the future, we plan to apply it in boarder application scenarios.
For example, reducing societal bias (Sheng et al., 2019)
(e.g., gender or racial bias) in generation by providing corresponding oracle.
Acknowledgement
We thank anonymous reviewers for their comments and suggestions.
We also thank members at
UCLANLP and UCLAPLUS labs for their feedback.
The project is supported in part by CISCO, Sloan foundation, Google, and DARPA MCS program under Cooperative Agreement N66001-19-2-4032.
Limitation
In this work we assume that a base model with decent quality (e.g., large pretrained language models) and a good oracle for controlling attributes are available.
However, in some applications, the quality of the base model may be low and the oracle may only capture superficial shortcut between constraints and labels.
How to control a generation model under these situations is an interesting future work direction.
Similar to other language generation approaches, we note that there is a risk that malicious users may use NADO to generate improper or toxic texts.
Also, the generated text may contain societal biases inherited from data.
However, on the other hand, NADO provides a powerful weapon against toxicity as developers can design constraints to detoxify the generated text.
We refer readers to the discussion in Sheng et al.
; Zellers et al.
; Bender et al.
; Radford et al.
Brown et al.
Checklist
For all authors... (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope?
[Yes] (b) Did you describe the limitations of your work?
[Yes] We emphasize the oracle should be boolean.
(c) Did you discuss any potential negative societal impacts of your work?
[No] (d) Have you read the ethics review guidelines and ensured that your paper conforms to them?
[Yes] 2.
If you are including theoretical results... (a) Did you state the full set of assumptions of all theoretical results?
[Yes] See Sec. 3.
(b) Did you include complete proofs of all theoretical results?
[Yes]
In the appendix 3.
If you ran experiments... (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)?
[Yes] Data is described the appendix and code will be uploaded in supplementary materials.
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)?
[Yes] In the appendix (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)?
[No] Generation is too computational expensive (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)?
[Yes]
In the appendix 4.
If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... (a) If your work uses existing assets, did you cite the creators?
[Yes] (b) Did you mention the license of the assets?
[Yes] In the appendix (c) Did you include any new assets either in the supplemental material or as a URL?
[No] (d) Did you discuss whether
and how consent was obtained from people whose data you’re using/curating?
[Yes] In the appendix (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content?
[N/A] 5.
If you used crowdsourcing or conducted research with human subjects... (a) Did you include the full text of instructions given to participants and screenshots, if applicable?
[N/A] (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable?
[N/A] (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation?
[N/A]