PPL-MCTS: Constrained Textual Generation Through Discriminator-Guided MCTS Decoding
Paper · 2022 · Antoine Chaffin, Vincent Claveau and Ewa Kijak
Summary
A review title can suggest what a review is about while leaving its verdict open. A system that continues the title may write a plausible review, yet the reader who requested a favorable or unfavorable one has little control over which direction it takes. Chaffin and colleagues study how to add that control when choosing the words of a continuation. Their method, PPL-MCTS, pairs a generator with a separate classifier, called a discriminator, that estimates whether the text expresses the requested sentiment or emotion. The generator can stay fixed when the requested property changes.
The method treats the possible continuations of a prompt as branches of a tree. Each branch adds a token, a unit of text used by the generator. Monte Carlo Tree Search (MCTS) spends more of its search budget on branches that have led to promising text while giving other plausible branches a chance. The discriminator can judge a continuation several tokens beyond the immediate choice. Its judgment then informs which token to emit now. The paper also tests a simpler alternative that generates a pool of complete continuations and uses the discriminator to select one.
The experiments cover English and French review polarity and emotion in English tweets. PPL-MCTS achieved oracle accuracy of 0.97 on amazon_polarity and 0.84 on emotion. On the French review dataset CLS, its accuracy rose from 0.89 with direct scoring of unfinished text to 0.95 in the reported setting that looked ahead 10 tokens. A class-conditioned competitor, GeDi with a classification loss, remained competitive across the datasets. In the separate human assessment of French reviews, that GeDi variant and PPL-MCTS received similar ratings for both polarity and readability.
Generating diverse candidates and reranking them frequently gave even stronger automatic evidence of constraint satisfaction. On amazon_polarity, the best-scoring sampled continuation achieved oracle accuracy of 0.99, alongside substantially higher oracle perplexity than PPL-MCTS. The contrast also showed up in French: people found the sampled-and-reranked reviews harder to read and rated their polarity less favorably than the automatic scores suggested. PPL-MCTS offers a different balance by using the generator’s preferences throughout search and spending additional computation on promising continuations.
Deep dive: PPL-MCTS: Constrained Textual Generation Through Discriminator-Guided MCTS Decoding
PPL-MCTS uses tree search and a separate classifier to steer text toward a target sentiment or emotion while keeping the generator fixed. · about 36 minutes to read
The problem and its context
A plausible continuation can express the wrong thing
The paper considers control over text generation. A prompt gives the generator some initial text, and the generator estimates which tokens could plausibly follow. That ability supports applications such as writing assistance, summarization, and creating examples for other language-processing tasks. The paper situates its work in the period when systems built on the Transformer could already sustain plausible prose over longer spans. That made the question of what the prose should express more consequential. The architecture is introduced in Attention Is All You Need.
The authors study requests for a property that may become clear only after several words or sentences. For review polarity, the target is a favorable or unfavorable judgment. For emotion control, the target is a particular affect conveyed in a short text. A review can name a book and describe its subject before revealing whether the reviewer liked it. The generator may assign a high probability to those opening words under either requested polarity. A classifier reading the same opening can also have little evidence for deciding which way the review is going. The task is to keep choosing plausible text while giving the intended judgment time to emerge. These experiments concern sentiment and emotion.
A language model supplies the probability of the next token given the preceding text. An ordinary decoding rule uses those probabilities to decide which token to emit or which partial continuations to keep. A discriminator answers a different question. It takes a piece of text and scores a property of it, such as whether it sounds positive. For constrained generation, a continuation needs support from both sources. The generator supplies evidence that the wording is plausible in context, and the discriminator supplies evidence that the wording expresses the requested property. The two sources can favor different continuations.
The paper mentions other reasons to want such control, including writing in a particular style, reducing toxic output, or promoting factual faithfulness in a summary. The examples differ in what a reliable discriminator would have to recognize. Review polarity serves as a concrete test because it has a clear target label and can be judged by readers. The emotion experiment puts more pressure on the decoder to find the right signal within a short continuation. Both make it possible to study control independently of the more demanding question of how to define and verify every proposed property.
Putting control into training or into decoding
One established approach trains a generator to treat the requested class as an input. The training sequences begin with a control code that identifies the relevant class. At generation time the same kind of code appears with the prompt, and the system predicts text conditioned on it. The learned weights carry the associations between the codes and the kinds of text that follow them. This is the approach the paper illustrates with CTRL.
A class-conditioned generator can handle multiple codes within the same set of weights. The design decision is to establish that set in time for training. A property introduced later requires a corresponding training procedure. The paper describes the cost of updating a large generator as a practical obstacle, and it also considers settings where users can obtain predictions from a generator but have limited access to its internals. This motivates a decoder that can use a task-specific classifier while leaving the generator’s weights alone. The relevant distinction is between learning how to produce text in the domain and deciding which property to enforce at the moment of generation. Updating the generator’s learned weights is a form of fine-tuning.
The most direct use of a discriminator is to apply it after generation. An earlier scheme described by the authors uses beam search to build a pool of likely continuations. Beam search carries forward a limited set of promising partial sequences at each step. Once those candidates are complete, the discriminator can assess each one with the benefit of the full text. The pool, however, reflects the preferences of the generator. Highly probable continuations can resemble one another, and texts that would have scored especially well for the requested class may have been dropped before the discriminator reads them. The paper traces this general approach to work including Learning to Write with Cooperative Discriminators.
Other approaches bring the discriminator into each decoding decision. One possibility is to evaluate what happens when each candidate token is added to the prefix. Doing that separately for every token would make a single decoding step expensive. GeDi uses a class-conditioned generator as a discriminator. Its next-token predictions make it possible to derive class scores across the vocabulary, so the decoder can incorporate the class signal while deciding among possible next tokens. The trained component in this setup guides a separate generator. GeDi
Plug and Play Language Models, or PPLM, also apply a control signal during decoding. They use a discriminator to move the generator’s hidden states, the intermediate representations used to produce its next prediction, towards the desired class. This gives the discriminator an influence on each step and requires access to those internal states. PPL-MCTS instead uses predictions at the generator’s output. The paper treats this interface as useful when a generator exposes its output scores but keeps its internals inaccessible. Plug and Play Language Models
The next token and the future text
The authors identify a question that remains even when class scores are cheap to obtain. A score for a prefix with one more token is a judgment of a very small change in an unfinished text. Its class may be ambiguous because the words that express the judgment or emotion still lie ahead. If a decoding rule follows an unreliable judgment immediately, each later decision inherits the prefix created by earlier ones. A locally attractive token can therefore put the generation on a path that is difficult to turn into a coherent example of the requested class.
Judging entire documents solves the evidence problem at the end of the process. It leaves open how to spend the effort used to produce those documents. By viewing a prompt and its continuations as a tree, the authors can allocate some of that effort before committing to the next token. The idea comes from a similarity to game search: an action taken now can be assessed in part by what happens after a sequence of subsequent actions. In text, the actions are token choices and the later score comes from the discriminator. A search that visits only a fraction of possible branches has to choose when to revisit an encouraging branch and when to try a different one.
The paper also discusses concurrent uses of tree search for generation. Work by Scialom and colleagues used a discriminator that distinguished real from generated text as part of a broader effort to train a generator. Work by Leblond and colleagues used tree search at decoding time to improve objectives for translation. The authors locate their contribution in applying search to a separately requested attribute while retaining the existing source of fluent text. The translation comparison concerns objectives for machine translation.
The method, step by step
Give the generator and the discriminator separate jobs
The decoder starts with a prompt and a target class. Think of a review title that could introduce either praise or criticism. The generator proposes tokens that could follow that title and supplies scores for them. A discriminator trained to recognize review polarity supplies a score for the desired judgment when it sees an unfinished or completed review. The target belongs to the scoring procedure. The prompt supplies the opening context whose continuation the search explores.
Every partial continuation is a node in a tree. The root holds the prompt. Each child adds a token to its parent’s text, and a path through the tree spells successive parts of a continuation. The paper illustrates this with a prompt about a cat. The branches express different possibilities for how the sentence might develop. The probability along a particular path is obtained from the generator’s successive predictions, while the class score in the illustration appears at the completed text. The distinction is between probabilities for individual moves and the evaluation of where a series of moves leads.
A single extension typically leaves many possible extensions after it. Even with a fixed output length, exploring them all would mean repeatedly branching across the vocabulary. PPL-MCTS builds the part of the tree it has a reason to inspect. It uses the generator to identify plausible moves, gathers class scores deeper in selected branches, and records both how often it visited a branch and what it found there. Its final decision at the current root is a next token. The same decoding procedure then makes a decision for the longer prefix.
How PPL-MCTS chooses the next token
The steps in order.
Define the score the search is trying to improve
The paper frames the goal as finding a token sequence that is probable given the requested class. A class-conditioned generator such as CTRL learns the corresponding probability directly. Its factorization describes how to score a whole sequence by scoring each token with access to the class and the earlier tokens.
pθ(x₁:ₜ | c) = ∏ₜ₌₁ᵀ pθ(xₜ | x₁:ₜ₋₁, c)
Here the full sequence on the left is understood to end at position T. In the product, t is the position being scored, xₜ is the token at that position, and x₁:ₜ₋₁ denotes the tokens preceding it. The initial 1 denotes the first position. The symbol c denotes the class or its control code, θ denotes the generator’s learned parameters, and pθ denotes a probability it assigns. The vertical bar reads as “given,” the comma places both the prefix and the class in the conditioning information, and ∏ multiplies the terms over the indicated positions.
PPL-MCTS has a generator that scores sequences without a class input. The likelihood of a path comes from multiplying its successive conditional token probabilities. The generator can therefore favor a plausible continuation even when it is silent about which attribute to apply. The discriminator supplies the missing class information, which the paper relates to the target probability through Bayes’ rule.
p(x | c) ∝ pD(c | x) · pθ(x)
The symbol x denotes a candidate sequence and c is the requested class. The expression p(x | c) is the target probability of the sequence given that class. D identifies the discriminator, so pD(c | x) is its estimate of the class probability given the sequence. The factor pθ(x) is the generator’s likelihood for the sequence, with θ denoting its parameters. The dot means multiplication. The symbol ∝ indicates proportionality. With a fixed class, the normalizing factor in Bayes’ rule is shared by the candidates, so the product can be used to rank them.
The authors also introduce a weighted version. It lets the same basic arrangement favor the requested property more strongly or put more weight on the generator’s likelihood.
p(x | c) ∝ pD(c | x)^α · pθ(x)^(1 − α)
The sequence x, class c, discriminator probability pD, and generator likelihood pθ have the same roles as in the previous expression. The caret denotes exponentiation. The weight α ranges from 0 to 1, and 1 − α gives the complementary exponent on the likelihood. The dot multiplies the weighted factors, and ∝ again means that the expression supplies a score up to a shared normalization. For the primary experiments the authors use α = 1, so the score returned for a visited text comes from the discriminator.
That choice leaves the generator with substantial influence. It supplies the probabilities used to choose which branches to explore. In the version with simulated continuations it also supplies the probabilities used to begin the simulation. In reranking, it produces the pool before any class-based selection. The absence of the full sequence likelihood from the final score in these experiments is thus a statement about one part of the procedure. Plausibility still affects which texts can reach that scoring step. This division matters when comparing results from methods that have the same discriminator and score, but reach very different parts of the space.
Select, expand, score, and update
At the start of a search iteration, the decoder follows a path from the current root through the part of the tree it has already explored. It chooses children using Polynomial Upper Confidence Trees, abbreviated PUCT. The rule adds an exploration bonus to the average score observed below a child. It can therefore return to a child with a strong history or investigate one that the generator finds plausible and that has received relatively little attention.
PUCT(i) = sᵢ / nᵢ + cₚᵤ꜀ₜ · pθ(xᵢ | x₁:ₜ₋₁) · √Nᵢ / (1 + nᵢ)
The index i identifies a candidate child, and xᵢ is the token that this child would add. The prefix x₁:ₜ₋₁ ends before the current decoding position t. Here pθ(xᵢ | x₁:ₜ₋₁) is the probability the generator assigns to that extension. nᵢ counts simulations through the child, and Nᵢ counts simulations through its parent. The quantity sᵢ in the numerator represents accumulated scores, so sᵢ / nᵢ is the average used for exploitation. The paper also describes the stored estimate in terms of this average. The square-root sign applies to the parent count, the 1 adds an offset to the child count in the exploration denominator, and the dots indicate multiplication. The constant cₚᵤ꜀ₜ sets the strength of the exploration term.
The average pulls the search toward branches whose continuations have received strong class scores. The exploration term accounts for the generator’s view of a token and how thoroughly the child has already been tried relative to its parent. As the search revisits that child, the denominator in the exploration term grows. A sibling with fewer visits can then become worth exploring even when the best score observed so far came from somewhere else. Increasing the exploration constant puts more weight on the bonus. This lets the decoder distinguish a branch with poor observed returns from a branch for which it has gathered little evidence.
Once selection reaches a node awaiting expansion, the generator predicts what could follow the node’s prefix. If the node is terminal, its text is already at the end of the search path. Otherwise, the prediction supplies the children. In the full simulation procedure, the decoder samples a child according to the generator’s probabilities and continues towards a terminal node following a rollout policy. A rollout is a provisional continuation for the purpose of obtaining a score. The token at which the rollout begins can receive credit for a polarity or emotion that appears several words later.
A score obtained at the end of the rollout updates the nodes along the path back to the root. This is back-propagation of search statistics. It changes visit counts and the estimates of how well the branches have performed. The paper considers ways of combining observations, including keeping a maximum, and uses the average across simulations below a node. The average lets repeated outcomes affect what the search expects from a branch. A single excellent continuation enters the same estimate as subsequent weak ones.
When the iteration budget is exhausted, the decoder emits the token belonging to the most visited child of the root. Selecting the child with the highest estimated score was another possible rule. The method reported in the paper uses visits. Those visits record how the search actually allocated its budget in light of both past scores and the generator’s probabilities. The committed token then becomes part of the prefix for the next decoding decision. A rollout can guide that commitment without causing the entire provisional continuation to be emitted.
Choose how far ahead to look
The full rollout makes the discriminator’s evidence easier to interpret because it can read text that has had time to express the attribute. That benefit comes with a cost. Each simulated step needs another prediction, and a review can have a long stretch of text remaining when the decoder is still near the prompt. Extending many branches to completion would cause early token decisions to consume substantial computation.
The paper studies two ways to shorten this work. One scores unfinished text directly. The authors explain that a discriminator can be trained on inputs of variable length so that it can score an interior node of the tree. The child still obtains a class score and subsequent visits can still reflect that score. The resulting search relies more heavily on judgments about partial text. It retains the allocation of effort across branches through PUCT.
The other option simulates a limited number of additional tokens and then scores what it has. This gives the discriminator a longer prefix while controlling the amount of work for each simulation. The rollout length and the iteration budget have distinct roles. Rollout length determines how much extra text the discriminator can see in a simulation. The iteration budget determines how many opportunities the decoder has to collect evidence and compare branches before emitting the next token. The authors use the short emotion texts for the main experiments with rollouts and study limited lookahead separately for French reviews.
Adjust token probabilities to reduce repetition
Early runs led the authors to observe repetitive patterns. A continuation can appeal to both components: the generator finds its words probable, and the discriminator already finds its target class clear. If that combination keeps steering the decoder towards similar wording, it can reduce the variety of the output. The authors import a soft repetition penalty from CTRL. The decoder changes the temperature applied to a token’s score when that token has already appeared.
p′θ(xᵢ | x₁:ₜ₋₁) = exp(zᵢ / (τ · I(i))) / ∑ᵥ∈V exp(zᵥ / (τ · I(v)))
The left side, p′θ, is the adjusted next-token probability from the generator with parameters θ. The candidate xᵢ has index i, and x₁:ₜ₋₁ is the prefix ending before position t. The raw output score, or logit, for the candidate is zᵢ. The symbol τ is the temperature applied to the logits, and I(i) is the repetition factor for token i. The expression exp is the exponential function. The denominator sums the same exponential expression for all vocabulary entries, with v indexing an entry, V denoting the vocabulary, and ∈ indicating membership. For a token already in the input sequence, the repetition factor is greater than 1. For other tokens it is 1.
The temperature controls how sharply the predictions concentrate on highly scored tokens. The repetition factor adjusts that calculation for previously occurring items. Because the adjustment operates on probabilities, a repeated word can still be selected when the generator strongly supports it. That matters for ordinary writing, where a product name or a word needed for a consistent reference may have to recur. The experiments use a repetition penalty of 1.2.
Prepare the components for generation and evaluation
The English experiments use GPT-2 small as the starting generator, and the French experiments use the small French counterpart belgpt2. The authors adapt the generators to the raw text of the experimental domains so they can produce reviews or tweets in the expected form. The generator used by PPL-MCTS receives no target class as a training control code. The comparison with class-conditioned generation uses a version of the domain generator trained with the code included. This makes the paper’s claim about avoiding generator fine-tuning specific to adding the constraint. The experimental systems still receive domain training.
The authors train a separate guiding classifier on labeled examples. They use BERT-base-cased for the English datasets and FlauBERT-large-cased for CLS. These classifiers provide the probabilities for the requested class during decoding. A separate partition supplies training data for the classifier and generator used to evaluate the resulting text. Dividing these roles means that the classifier steering an output is distinct from the classifier that will later judge it. The underlying language encoders are BERT and FlauBERT.
The authors implement batched textual tree search using Hugging Face’s Transformers library and release the PPL-MCTS implementation. The separation between generator predictions and text scoring is central to that implementation. It gives the search the same kind of input whether the target is review polarity or emotion. Replacing the scorer changes the evaluation of branches, while the generator can continue to represent the domain’s text. Transformers
Experiments and results
Three datasets with different prompts and output lengths
Two experiments use Amazon reviews with positive or negative labels. The English dataset, amazon_polarity, contains 4,000,000 instances in the dataset description. It provides the user’s review title as a separate field, so the authors use that title as the prompt. The French dataset, CLS from FLUE, serves as a review-polarity counterpart. For CLS, the authors use the first 6 tokens of the review as the prompt. The dataset overview gives 6,000 instances for CLS, while the data-split description attaches 6000 to its test set and describes partitioning a separate training set. Those statements leave the overall CLS count ambiguous.
The emotion dataset is a collection of labeled English tweets with 20,000 instances. The authors use the first 4 tokens as the prompt. The continuation is short and the task involves a finer distinction than choosing between positive and negative reviews. An opening clause can fit several emotions, so later words have to convey the requested class within the short generation. The paper’s examples show complete reviews for amazon_polarity and single-sentence generations for emotion. The authors chose the review dataset over the one used in the earlier PPLM and GeDi studies because of its size, its format, and the availability of a comparable French review task.
Every method uses an output budget based on the average sequence length of the dataset. The protocol calls for 98 generated tokens on amazon_polarity, 23 on emotion, and 137 on CLS. Holding that budget fixed within a dataset reduces the chance that a method looks better simply because its texts are shorter. A longer output has more opportunity to stray from its topic or repeat itself. The paper makes this point even for metrics that already account for length in their calculation. It also makes the difference in rollout cost concrete: a complete simulation from an early French review prefix has considerably more text to produce than one from the opening of a tweet.
The paper divides each dataset into disjoint parts for generation and evaluation, with training, validation, and test subsets on each side. For amazon_polarity, the appendix gives original splits of 3 600 000 training examples and 400 000 test examples. The authors divide each split between the two roles and hold back 20% of each resulting training portion for validation. For emotion, the original training, validation, and test sets already exist and each is divided between the roles. For CLS, the authors divide the original training set and partition the original test data to create the validation and test subsets.
On the generation side, the training and validation subsets support the domain generator, the classifier used for guidance, and the class-conditioned generator used in comparisons. The corresponding test data allow the authors to check those components. On the evaluation side, the classifier and generator used as judges learn from separate training data, and held-out data support checks of their performance. The prompts for generation come from the evaluation side’s test set. The automated metrics are computed on pools of 900 generated samples, using prompts that were unseen during training.
Baselines test both where and how to score
The strongest comparators in the paper represent different ways of using class information. A class-conditioned language generator can use its control code with greedy decoding, which chooses the highest-probability next token, or with sampling. The authors train class-conditioned variants with and without the classification loss introduced for GeDi. These variants also serve in the GeDi experiments. The results include the original Plug and Play Language Models approach. For PPLM, PPL-MCTS, and the reranking variants, the authors use the same generator and guiding classifier. That makes it easier to interpret their differences as effects of the way the decoder uses those components.
The reranking comparisons vary the proposal procedure separately from the final choice. One proposal procedure uses beam search with beam size 3. Another draws continuations with nucleus sampling, also called top-p sampling. At each step it samples from a set of probable next tokens delimited by the cumulative probability threshold, set to 0.9 here. The authors also try beam sampling, which introduces sampling into the process of carrying forward candidate sequences. These choices affect how concentrated the pool is around the generator’s favorite continuations. The paper’s source for nucleus sampling is The Curious Case of Neural Text Degeneration.
Once a proposal pool exists, argmax selects the candidate with the highest score for the requested class. The first-true rule orders the pool by generator likelihood and takes the first proposal that the guiding classifier assigns to the requested class. The sampling rule normalizes the candidates’ constraint scores into a distribution and draws the output from it. By changing one stage at a time, the experiments can distinguish the contribution of a freer proposal pool from the contribution of the last selection rule. The experimental unit being reranked is the whole generation, such as a full review.
The search budget for PPL-MCTS is 50 iterations for each token to be emitted. The reranking methods typically produce 50 proposals per choice, with the beam-sampling pool limited to 10 by memory. These values describe different units of work: a search iteration can include a rollout from a particular prefix, while a proposal is a candidate generation. The paper tests several decoding temperatures and exploration constants. Its main results use the parameter settings selected for accuracy. The comparison therefore shows what happens to the other metrics at settings chosen with class control in mind.
What the measurements capture
Accuracy is the share of generated texts that the evaluation classifier assigns to the requested class. The paper calls that classifier an oracle because it acts as the evaluation judge and is trained separately from the classifier that guides generation. A high accuracy score means the target attribute is recognizable to this external judge. The separation of training data offers stronger evidence than asking the guiding classifier whether it is satisfied by the outputs it helped to create.
Oracle perplexity measures how readily a separate, unconstrained generator predicts the produced text. A lower value indicates that the output lies closer to text this evaluator expects. The authors use this as an automatic indicator of language quality and of closeness to the original domain’s distribution. An output can convey the correct polarity yet have high perplexity because its wording is unusual, its continuation is hard to predict, or its sentences fit together poorly. The human study tests how the comparative results look when readers judge the writing directly.
The third measure, Self-BLEU, takes a candidate and uses other generated texts as its references. It applies the overlap measure BLEU to assess the pool’s diversity: extensive shared wording yields higher Self-BLEU, while lower values indicate less overlap. In this usage the references are other generations, so a low value is preferable when comparing variety. The score is a complement to class accuracy and perplexity. It can expose a narrow pool even when many texts receive the right class label. The underlying measure is the BLEU score.
English review polarity
PPL-MCTS reaches oracle accuracy of 0.97 on amazon_polarity. It is close to the highest-performing methods while drawing its control signal from an independent classifier during search. GeDi with classification loss and the GeDi version without that loss each score 0.96 in this comparison. Beam sampling followed by argmax also reaches 0.97. Sampling with argmax goes further on oracle accuracy: given a set of independently sampled candidates, retaining the highest class score often finds a text that the evaluation judge recognizes as a member of the intended class.
Oracle classification accuracy on amazon_polarity
Sampling followed by argmax has the highest accuracy, with PPL-MCTS close behind.
The numbers
| System or setting | accuracy |
|---|---|
| PPLM | 0.89 |
| GeDi with classification loss | 0.96 |
| GeDi | 0.96 |
| Beam sampling with argmax | 0.97 |
| Sampling with argmax | 0.99 |
| PPL-MCTS (this paper) | 0.97 |
The language-quality and diversity measurements show the price of different ways of attaining that accuracy. Sampling with argmax has oracle perplexity of 16.5 and Self-BLEU of 0.17, compared with 5.69 and 0.63 for PPL-MCTS. GeDi with classification loss has oracle perplexity of 5.16 and Self-BLEU of 0.6. In this setting, the search-based decoder and GeDi yield texts that the oracle generator finds much more predictable than the sampled-and-reranked outputs. Sampling with argmax gives the broadest variety among these particular outputs by the overlap measure and has the greatest departure from the evaluator’s expectations.
The paper illustrates the practical meaning of polarity control by giving PPL-MCTS the same film-review title with opposite targets. The unfavorable version dismisses the film while making an exception for its soundtrack. The favorable version praises aspects of the production and recommends it to viewers who like horror. The title supports both directions. The generated body supplies the words that make the two judgments clear. This is an illustration of how the target changes the continuation while the initial text stays fixed.
A separate positive-review example starts with a short title suggesting a realistic account. PPL-MCTS develops it as an appreciative book review. The candidate selected by sampling with argmax wanders between ideas about a movie and a war. A classifier can still find enough favorable wording to give text of this kind a high score. The example is consistent with the metric profile: strength of class evidence, closeness to the domain, and continuity of subject are separate aspects of an output.
Emotion in short English texts
On emotion, PPL-MCTS obtains oracle accuracy of 0.84. GeDi with classification loss scores 0.88 and Sampling with argmax scores 0.87. The class-conditioned generator with classification loss achieves 0.89, which shows that direct class training is a strong comparator for this task. The PPL-MCTS result puts the plug-and-play decoder in the same group of effective methods, with a distinct profile on the other metrics.
Oracle perplexity of selected decoding methods on emotion
PPL-MCTS stays closer to the evaluation generator’s expectations than sampling followed by argmax.
The numbers
| System or setting | oracle perplexity |
|---|---|
| PPLM | 7.31 |
| GeDi with classification loss | 5.57 |
| Sampling with argmax | 11.7 |
| PPL-MCTS (this paper) | 4.82 |
PPL-MCTS has Self-BLEU of 0.37 on emotion, compared with 0.68 for GeDi with classification loss and 0.13 for Sampling with argmax. The class-conditioned generator with classification loss records oracle perplexity of 3.72 and Self-BLEU of 0.65. The differences matter for interpreting the accuracy ranking. The methods with the strongest class scores can share more wording across their outputs. PPL-MCTS occupies a middle position on lexical overlap among these examples while retaining substantially lower perplexity than Sampling with argmax.
The short outputs also make it possible to illustrate what near-term evidence looks like. One figure starts several systems from a common opening that announces a feeling without specifying its object. The PPL-MCTS continuation describes the importance of working with people who share a passion. Other systems take the same opening in different directions. The example gives an intuitive reason to assess a prefix beyond the word that follows the prompt: the feeling is conveyed by the relationship among several words in the continuation.
French review polarity and human judgment
The main CLS configuration of PPL-MCTS scores partial sequences without a rollout and obtains oracle accuracy of 0.89. The separately reported 10-token rollout setting reaches 0.95. GeDi with classification loss scores 0.94, and Sampling with argmax reaches 0.92. These figures show how the ranking changes when the search is given a short horizon in this longer-text task. The controlled rollout experiment examines where that improvement appears and how much it changes the other metrics.
Oracle classification accuracy on CLS French reviews
The short-rollout PPL-MCTS setting reaches the highest accuracy among the methods shown.
The numbers
| System or setting | accuracy |
|---|---|
| PPLM | 0.79 |
| GeDi | 0.83 |
| Sampling with argmax | 0.92 |
| GeDi with classification loss | 0.94 |
| PPL-MCTS without rollout | 0.89 |
| PPL-MCTS with 10-token rollout (this paper) | 0.95 |
On the same dataset, the no-rollout PPL-MCTS configuration records oracle perplexity of 4.98 and Self-BLEU of 0.54. The 10-token setting records 5.07 and 0.57, respectively. GeDi with classification loss has oracle perplexity of 7.99 and Self-BLEU of 0.4. Sampling with argmax obtains 14.3 for perplexity and 0.12 for Self-BLEU. The French results reproduce the tradeoff seen with the other proposal pools: independently sampled continuations give the reranker a range of wording and strong class candidates, and the final selection can land on a text that the language evaluator finds unusual.
The paper uses a t-test at a significance level of 1% for its automatic comparisons against PPLM and GeDi with classification loss. The table marks improvements separately against those two comparators. On CLS, for instance, the reported PPL-MCTS settings improve oracle perplexity significantly against both. The table marks their accuracy improvements against PPLM. The displayed difference between the 10-token PPL-MCTS setting and GeDi with classification loss in oracle accuracy is best read as a comparison of reported values, with the paper’s significance markings attached to the comparisons they actually identify.
For the human assessment, 3 native speakers of French read the same shuffled pool. The authors randomly draw 50 reviews per method, with 25 intended to be positive and 25 intended to be negative, for a total of 200 reviews. The raters score how well each review matches its requested polarity and how readable it is. Both judgments run from 1 to 5. The top polarity rating indicates that the review fully expresses the intended label. The top readability rating indicates comprehensible writing free from mistakes. Sharing the pool lets the authors assess agreement across readers.
The mean polarity ratings are 4, 46 for GeDi with classification loss and 4, 43 for PPL-MCTS. Their mean readability ratings are 4, 19 and 4, 05, respectively. PPLM receives 3, 74 for polarity and 3, 12 for readability. The paper marks the gains for the GeDi variant and PPL-MCTS against PPLM as statistically significant on both scores. The authors describe the raters’ agreement as high. The two leading methods produced French reviews that these readers generally found easy to understand and consistent with the requested sentiment.
Sampling with argmax receives mean polarity of 4, 00 and readability of 2, 83. Its automatic polarity accuracy had put it close to the leading settings. Readers see a larger gap, and its readability is the lowest in this assessment. The authors suggest that a difficult passage can leave the reader unsure which opinion it expresses, leading to a more neutral polarity judgment. The gap is important precisely because the evaluation classifier was trained on disjoint data. An independent automatic judge and a human reader can still be sensitive to different aspects of a text.
What the ablations show
A short rollout helps the classifier judge the direction of a review
The clearest controlled test changes how far PPL-MCTS looks ahead on CLS. The authors compare rollouts of 0, 3, 5, 10, and 20 tokens. At 0, the decoder scores the unfinished prefix immediately. Each of the other settings gives the discriminator some extra continuation to read before its score is passed back to the earlier choice. The experiment keeps the problem of choosing the next token in view while changing the amount of future text available as evidence.
Accuracy improves rapidly at the start of the sweep. The authors report that a rollout of 5 tokens is sufficient for PPL-MCTS to reach the level of GeDi on this dataset. Increasing the length further produces a plateau in the plotted accuracy. The result supports the authors’ explanation that direct judgments of a partial review can miss class evidence that is only a little farther down the branch. It also shows why a rollout all the way to the end of a review is unnecessary to get much of the measured benefit in this setting.
The other measurements move within a narrow range. As the rollout increases from 0 to 20 tokens on CLS, the paper reports Self-BLEU ranging from 0.54 to 0.57 and oracle perplexity from 4.98 to 5.18. The largest visible change concerns which class the completed text expresses, with smaller variation in the overlap and predictability measurements. Because the intervention changes the length of the provisional continuation used for scoring, the evidence specifically supports looking ahead on this task. How much the result depends on the review domain, the classifier, and the amount of class evidence already present in a prompt remains open.
Sampling temperature changes the proposal pool
The paper compares temperatures of 1.0, 1.1, and 1.2 for the proposed methods. Raising temperature spreads the generator’s probability over more token choices. That can produce a more varied proposal pool. It can also lead the sampler into continuations that the independent evaluator finds much less predictable. Once the pool already contains diverse ways of expressing the target, additional spread need not make it easier for the reranker to find a better class match.
For Sampling with argmax on amazon_polarity, the appendix reports oracle accuracy of 0,99 at all the tested temperatures. In temperature order, oracle perplexity is 16,5, 31,8, and 84,50. Self-BLEU changes from 0,17 through 0,11 to 0,07 in the same sweep. The settings with more varied wording by the overlap measure thus produce an increasingly strong departure from what the evaluation generator expects. The additional variety leaves the class accuracy unchanged in these runs.
On emotion, the same reranking rule also yields higher perplexity at higher temperatures. The appendix reports 11,7 at 1.0 and 47,5 at 1.2, with accuracy of 0,87 and 0,86, respectively. Combined with the Amazon review comparison, this explains why the authors favor the lower temperature for these sampled proposals. The point is about the tested pool and selector. A class score has limited leverage over the quality of the selected output when the pool itself has been pushed farther away from typical text.
The exploration constant has a milder effect
The PPL-MCTS sweep also varies the strength of the PUCT exploration term. The tested constants are 1.0, 3.0, 5.0, and 8.0, each paired with the temperature settings. The authors highlight the pair with exploration constant 3 and temperature 1.0 as performing well across the datasets. The appendix contains ties in displayed accuracy and shows that the highlighted pair need not yield the lowest oracle perplexity. Its appeal is consistent accuracy across the settings tested.
For instance, at temperature 1.0 on amazon_polarity, PPL-MCTS records accuracy of 0,97 with exploration constant 3.0 and 0,93 with 8.0. On CLS, the analogous entries are 0,89 and 0,83, with oracle perplexity of 4,98 in both entries. Excessive emphasis on exploration can spend the available visits on branches that provide weaker eventual class control. The paper finds generally modest sensitivity over the tested settings, with the larger constant sometimes giving weaker results, especially at lower temperature.
This sweep presses on a different part of the algorithm from the rollout study. Exploration changes which branches the decoder visits. The rollout changes what the discriminator sees once the decoder visits a branch. A weak result at a high exploration setting leaves open whether the same branch would be easier to judge with a different horizon. The paper’s comparisons show that useful lookahead and effective search allocation each matter, while examining their interaction only within the tested runs.
The likelihood weight changes which sampled text wins
The authors vary α for Sampling with argmax on amazon_polarity as a proof of concept. This is the configuration that achieved the strongest automatic class accuracy while giving much higher oracle perplexity than several competitors. Reintroducing the likelihood into the ranking can favor candidates that the domain generator finds plausible even when another candidate offers stronger sentiment evidence. That allows the final decision to account for something that was previously represented only in the construction of the pool.
The appendix reports little change below 0.98. Most of the visible variation occurs between 0.98 and 1, where both accuracy and perplexity show an roughly linear relationship with the weight in the plotted experiment. The authors explain the narrow interval through the different scales of the scores. A long sequence’s likelihood is a product of token probabilities and can be small compared with a discriminator’s class probability. The exponent on the likelihood therefore needs to be small before the two weighted factors have comparable influence on ranking. A nominally moderate weight in the formula can yield a strong preference for the generator in practice.
The sweep gives a way to interpret the reranking results without treating their main setting as inevitable. A generator can place readable, strongly classified, and unusual candidates in the same pool. A choice made entirely on classifier confidence can favor the unusual one. A choice that restores some weight to likelihood can move towards readily predictable prose, at some cost to target recognition in the reported run. The experiment establishes that this balance can be changed for that reranker and dataset. The same weight sweep is a separate empirical question for PPL-MCTS.
Limitations
Limits the authors acknowledge
The method moves some of the work of applying a constraint to inference. A dedicated classifier is usually less expensive to train than a new large generator, but the decoder has to call it on candidate text. Search can also require additional predictions from the generator during rollouts. This makes the attraction of the plug-and-play interface depend on the costs of running the components and the value of control at generation time. A system with cheap access to generator outputs and a fast discriminator faces a different tradeoff from one that obtains each prediction at substantial cost.
Rollout cost constrains the paper’s own experiments. The authors use the short emotion task for the main experiments with full simulations and investigate limited rollouts on CLS. Direct scoring of unfinished text is cheaper and gives up some of the future evidence that motivated the method. A short rollout is a way to balance these considerations, and the observed plateau is evidence for choosing a modest horizon in French reviews. The authors also propose adaptive rollout lengths as a future direction, with the scoring process determining when enough evidence has accumulated. That proposal is distinct from the fixed-length comparison they report.
The authors acknowledge limits to their automatic measures. Classifier accuracy is evidence that generated text signals the intended class to a separate judge. Perplexity and Self-BLEU approximate expected wording and variety, respectively. Human judgment in the paper covers polarity and readability in French, and the authors leave diversity out of that assessment. The human rankings support the main readability finding and also expose a meaningful mismatch on how strongly the sampled-and-reranked outputs convey their intended polarity.
The paper describes a broad range of possible constraints and makes their feasibility conditional on having a scorer that can recognize the property. The authors discuss inappropriate or misleading output and the potential to use an updated discriminator to change what a fixed generator favors. They also note that the same mechanism can be directed toward unwanted properties. Claims about the suitability of the approach for toxicity, fairness, or fact checking therefore depend on the choice and reliability of the scorer. These concerns belong to bias, fairness, and safety.
Limits visible in the design
The experimental evidence concerns polarity and emotion in specific review and tweet settings. Two languages broaden the test, and the French and English polarity experiments have related review formats. The generator, classifier, prompt construction, and output length also change with the dataset. A similar pattern across the two review datasets supports transfer between these particular setups. The design offers no isolated estimate of the effect of changing language alone.
Constraints in the experiments come with labeled data. This gives the authors a practical way to train a discriminator and a separate evaluation classifier. A property such as factual faithfulness could require a scorer to examine the relationship between the generated text and a source document. A property such as style could require judgments over longer passages and allow multiple defensible interpretations. The plug-and-play design can accept such a score in principle. The paper’s strongest evidence concerns classifiers whose target classes are represented by the data used here.
The label accuracy can also reward text that states its sentiment in obvious terms while offering little relevant content about the item being reviewed. The fixed-prompt examples show that the decoder can produce relevant continuations, and the human evaluation asks whether the review reads well and expresses its target. The aggregate automatic tests leave prompt relevance and factual consistency as distinct unmeasured dimensions. Self-BLEU likewise reports overlap across generated samples, which can result from recurring wording without revealing whether different reviews make substantively different observations.
The strongest claims about easier training concern the separation of control from the generator. The experimental generators were adapted to their domains before decoding. This setup supports applying a target property to a prepared generator whose weights are fixed during controlled decoding. Broader claims about starting with a remote generator, changing domains, or using much larger systems remain architectural possibilities. The experiments establish performance with the particular generators, discriminators, datasets, and budgets the authors used.
The budgets describe iterations and proposals, and the paper identifies rollout and classification as important sources of additional work. A full comparison at matched elapsed time would need to track how many generator predictions and discriminator evaluations each configuration makes, how they can be batched, and how long the resulting sequences run. The reported quality measurements at the specified settings establish a comparison under the authors’ protocol. They leave the practical cost ranking dependent on a deployment’s components and budget.
Finally, the search rationale and the empirical result answer different questions. The authors appeal to theoretical bounds on the allocation of simulations in MCTS to motivate the exploration rule. The implemented decoder still operates with a finite budget, approximate class scores, and sometimes a shortened horizon. Its achieved scores describe the continuations it found under those conditions. A formal guarantee of the globally best text, or of satisfying the intended property for every generated sample, would require evidence beyond the search rationale and the experimental averages.
What came after
Planning over text and code
One later work moves the planning question into code generation. The shared issue is how a generator can use information about possible future output when choosing what to emit next. In PPL-MCTS, the future output is a continuation whose sentiment or emotion can become clearer as it develops. The later work frames code generation itself as a planning problem with a language generator. That framing extends the question from choosing text that expresses an attribute to choosing how code will develop. The connection rests on planning over a partially generated artifact. Planning with Large Language Models for Code Generation
Another later work puts the usefulness of tree search itself at the center of the question. Its title makes the answer depend on the discriminator. That focus develops a dependency already visible in PPL-MCTS. A search can identify branches that do well under its scoring procedure, so the value of the extra exploration depends on how informative that procedure is about the desired outcome. The CLS rollout experiment supplies a concrete example of one source of variation: the same kind of discriminator can give more useful guidance when it sees a little more of the review. The later work makes the relationship between the search and its judge the main subject. When is Tree Search Useful for LLM Planning? It Depends on the Discriminator
Reward and value as guidance during decoding
ARGS presents alignment as reward-guided search. The common idea is to apply a separate scoring signal while choosing an output. PPL-MCTS uses a class probability so the search prefers branches that lead toward a requested sentiment or emotion. The term reward in ARGS frames the later problem in terms of which outputs should be preferred for alignment. Its connection to the paper is at the level of the decoding decision: a scoring signal can help steer the search through alternatives offered by a generator. ARGS: Alignment as Reward-Guided Search
The work on value-guided MCTS decoding shares the use of tree search more directly. It applies value guidance with the aim of producing more preferable text and emphasizes using the value estimator during generation. PPL-MCTS needs an estimate of how promising a branch is before it commits to a token. It obtains evidence from a classifier applied to a prefix or a provisional continuation and aggregates that evidence over visits. The later work’s emphasis on the value estimator places the same intermediate decision in the setting of preference. Both formulations make the quality of the score used inside search central to the output ultimately chosen. Don't throw away your value model! Generating more preferable text with Value-Guided Monte-Carlo Tree Search decoding
Decoding as a place to spend more computation
The survey on test-time scaling places work of this kind in a wider discussion of how to spend computation when a system is answering a request. PPL-MCTS is an example with two visible ways to allocate that effort: the decoder can try more search iterations before committing to a token, or it can spend more computation evaluating what lies beyond a visited prefix. Reranking supplies another example from the same paper, in which computation goes into producing alternatives before selecting the final result. The survey’s framing connects these choices to the broader question of where extra computation is used and how its effect is measured. A Survey on Test-Time Scaling in Large Language Models: What, How, Where, and How Well?
Cite
Cite as Antoine Chaffin, Vincent Claveau and Ewa Kijak. 2022. PPL-MCTS: Constrained Textual Generation Through Discriminator-Guided MCTS Decoding. Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies.
@inproceedings{chaffin2022ppl,
title = {{PPL-MCTS: Constrained Textual Generation Through Discriminator-Guided MCTS Decoding}},
author = {Antoine Chaffin, Vincent Claveau and Ewa Kijak},
booktitle = {Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies},
year = {2022},
doi = {10.18653/v1/2022.naacl-main.215},
url = {https://doi.org/10.18653/v1/2022.naacl-main.215}
}This page in Markdown https://md.research.elamur.ai/free/en/papers/chaffin-2022-ppl-mcts-constrained-textual-generation/