Energy-Based Reranking: Improving Neural Machine Translation Using Energy-Based Models
Paper · 2021 · Sumanta Bhattacharyya, Amirmohammad Rooshenas, Subhajit Naskar et al.
Summary
A translation system can generate a good answer and still choose a worse one. This paper examines why that happens in neural machine translation. The authors start with an autoregressive translator, which generates a sentence by predicting each token from the source and the tokens it has already produced. Its training rewards high probability for the reference translation. At evaluation time, however, a common measure rewards overlap with a reference through the BLEU score. The two criteria can put the same candidates in very different orders. On the IWSLT’14 German-to-English test set, ordinary beam decoding scored 33.87 BLEU. When the authors drew 100 candidates per source sentence and used the references to pick among them, the resulting diagnostic reached 67.54 BLEU. The references gave this selector information that a translator would lack in use. The result established how much better the sampled candidates could score if they were chosen with that information.
The authors keep the original translator and train a separate scorer to make the choice. Their method, energy-based reranking, gives each complete candidate a numerical score called its energy. A preferred translation should receive lower energy. During training, the scorer compares two generated translations against the same reference and learns to favor the candidate with higher sentence-level BLEU. A larger BLEU gap calls for a larger separation in energy. The reference supplies the training judgment, and the trained scorer can then rank candidates for a new sentence.
The paper tests a target-only scorer and a source-conditioned scorer. Both build on BERT representations. The target-only version scores a proposed translation by itself and can share training across different source languages that translate into English. The source-conditioned version reads the source alongside the candidate. It can therefore assign different scores to the same target sentence depending on what it is supposed to translate. This version gives the strongest results in the main comparison. It raises BLEU from 33.87 to 37.58 on IWSLT’14 German-to-English, from 7.10 to 10.47 on FLoRes Sinhala-to-English devtest, and from 28.84 to 30.23 on WMT’16 English-to-German.
The experiments also show what the extra scoring stage buys and what it costs. Training the scorer to compare generated translations works better in the tested settings than frequently inserting the reference itself as a candidate. A target-only scorer tends to prefer intact sentences to shuffled versions, which helps explain how it can improve a choice without seeing the source. Source conditioning produces better BLEU in the main comparisons, and considerable room remains between the trained scorer and a selector that can see the references. The deployed procedure also pays for generating and scoring the candidate list. On German-to-English in the timing comparison, the base translator averaged 572 milliseconds per sentence, and the source-conditioned variant using Joint-BERT averaged 836.
Deep dive: Energy-Based Reranking: Improving Neural Machine Translation Using Energy-Based Models
Energy-based reranking improves neural machine translation by learning to pick higher-BLEU translations from candidates sampled by a Transformer. · about 37 minutes to read
The problem and its context
How a translator decides what to return
An autoregressive translator processes a source sentence and assigns probabilities to successive tokens of a possible translation. Each prediction depends on the target prefix, the part of the translation already generated. When evaluating a complete sentence, the translator can combine the probabilities of those successive choices into a single conditional probability. The likelihood of a training reference can therefore be computed from the probabilities of its tokens given the source and their preceding reference tokens. Maximum likelihood estimation, or MLE, adjusts the translator to make the observed references more probable. The paper treats its computational efficiency and stability as reasons it remained the standard training procedure.
Beam search uses those probabilities to build a translation. At each step it keeps a limited collection of promising partial sentences and extends them. The decoded output is an approximation to the most probable complete translation, the aim of maximum a posteriori decoding or MAP. Because beam search prunes partial sentences along the way, the search procedure and the probability criterion are separate issues. An improved search could uncover a candidate the current beam misses. Even a search that recovered the exact highest-probability sentence would still be using probability to decide which sentence should win.
BLEU brings a different consideration into the decision. It compares wording in the output with wording in a reference, using overlap between contiguous token sequences and accounting for output length. The likelihood objective rewards predicting the reference tokens under the training distribution. It leaves open how the translator orders complete alternatives according to a reference-overlap score. A system might assign substantial probability to many plausible translations while making a different choice when asked to return just the most probable one. What matters for the paper is the order within the set of candidates available for the same source. That is where a change in the scoring rule can change the final answer.
The authors examine that order with Spearman rank correlation. This coefficient compares the positions that two criteria give to the same items. Here, one ordering comes from the translator’s log probabilities and the other comes from comparison with the reference. The paper looks across source sentences, so the distribution of coefficients reveals how common strong agreement is. The issue is easier to see at this level than in a single aggregate BLEU score. A corpus score describes the translations that ultimately came out. A within-source rank comparison examines the decisions the system could have made among its alternatives.
The distinction between assigning probability and choosing an output also appears in work the authors describe as parallel to theirs. Eikema and Aziz relate poor MAP decisions to how probability mass is spread across translations. On this account, the shape of the distribution matters for the translation chosen at its mode. Changing the procedure for estimating the translator’s parameters is only one possible response. The diagnostic question is whether a different decision can be made with the distribution already available. Is MAP Decoding All You Need? The Inadequacy of the Mode in Neural Machine Translation
Earlier ways of changing the objective or the decision
The paper describes prior work that trained sequence predictors with rewards tied to a task measure. Some of these approaches use reinforcement learning, where the training signal is based on the quality of generated outputs. Other work frames training as minimizing risk according to a task loss. Such methods address the discrepancy by bringing the evaluation criterion into training the translator itself. As the paper notes, translation systems frequently use these techniques alongside maximum likelihood or apply them during a later stage of training. Sequence Level Training with Recurrent Neural Networks · Minimum Risk Training for Neural Machine Translation
Another line of work changes the choice after a translator has produced candidates. The authors describe an early discriminative reranker that used a linear separator to distinguish the best candidates from the rest of a ranked list. It relied on features of both the source and the translation. A later example combined a translation score with a linear score using more elaborate syntactic features. These approaches established that the generator and the final selector could be trained for different jobs. The present paper retains that division and learns comparisons across sampled pairs using representations supplied by BERT.
There is also a tradition of using a language model to score the target text. A word-by-word fusion method can combine target-language probabilities with translation probabilities during prediction. A deeper integration can combine hidden representations before making each prediction and adapt the combination on parallel data. The paper also describes work that feeds target-language scores into a decoder and work that uses monolingual sentences to create additional parallel examples through back-translation. These choices bring target-language information into different places in the translation pipeline. Improving Neural Machine Translation Models with Monolingual Data
At the level of complete candidates, the paper describes a combination of the forward translation score, a reverse translation score and a target-language score. The forward direction asks how probable the translation is given the source. The reverse direction asks how probable the source is given the proposed translation. The language score evaluates the proposed translation by itself. The benchmark comparison in this paper includes the forward and language scores, and the authors mention reverse translation as a possible extension. Facebook FAIR’s WMT19 News Translation Task Submission
A masked language scorer gives another way to assess a complete sentence. It hides each token in turn and asks how well the surrounding sentence predicts the missing token. Averaging these judgments gives a sentence score that can use words on both sides of every position. The paper includes such a scorer as a baseline. This comparison matters because reranking with BERT could benefit from access to the whole sentence even before the scorer learns anything from BLEU comparisons. Masked Language Model Scoring
The authors also place their work in a line of research that reweights samples from an existing generator. A generator provides a convenient way to draw possible outputs. An additional scoring function changes how much influence each output has. Earlier work used feature-based exponential weights or trained a discriminator to distinguish generated examples from real data. The paper adapts this structure to a different learning signal. It uses comparisons of translation quality within the candidate set for a particular source sentence. This makes the behavior of the scorer when faced with imperfect candidates central to the design.
The method, step by step
From a source sentence to a decision
The system has a generator and a scorer. The generator is an already trained Transformer. It receives the source sentence and draws a complete translation by sampling from its successive token predictions. Repeating this process produces a list of candidate translations for the same source. Some candidates may share most of their wording. Others may differ substantially. The base translator determines what can enter the list.
The energy scorer takes a whole candidate at once. The marginal scorer reads the candidate alone. The joint scorer reads the source and candidate together. Each produces a scalar, a single number, on a scale where smaller values are preferable. Since the score is assigned to a finished candidate, the scoring network can draw on information that becomes available only after the whole translation has been generated. For instance, the representation of a word can reflect its place in the complete target sentence.
During training, the authors draw two candidates from an energy-weighted version of the list. Both candidates are compared with the same reference. The one that gets higher BLEU should have lower energy, and its advantage in energy should be large enough to reflect the difference in BLEU. This setup treats a pair of close alternatives differently from a pair whose reference-overlap scores are far apart. At test time, the learned energy supplies the judgment and the candidate list still comes from the translator.
Training the energy reranker and using it for translation
The steps in order.
The proposal and the energy weights
In the authors’ notation, the base translator supplies a conditional distribution over target sentences. The article’s idealized decoding rule can be written over a finite draw from that distribution.
ŷ = argmax_{y ∈ Y(x)} ωθ(y, x)
Here, x is the source sentence and y is a possible translation. Y(x) is the collection of translations drawn for x, and ∈ means that a candidate belongs to that collection. The symbol θ denotes the learned scoring parameters. The function ωθ gives a higher value to a candidate it prefers. The operator argmax returns a candidate attaining the maximum score, and ŷ denotes the chosen translation. The authors seek a score whose preferences resemble those obtained by comparing the candidates with a gold translation.
The energy notation reverses the direction of preference. With training references available, the authors want candidates that have higher BLEU to get lower scores from Eθ. They motivate this with a distribution that reweights the translator’s probabilities.
Pθ(y | x) ∝ Pₙₘₜ(y | x) exp(−Eθ(y, x) / T)
In this expression, Pθ is the reweighted distribution and Pₙₘₜ is the base translation distribution. The vertical bar means that both are conditional on x, the source sentence. The variable y denotes the target candidate. Eθ gives its energy for the source, with θ denoting the energy scorer’s parameters. The minus sign makes a lower energy correspond to a larger weight. The function exp is the exponential, T is the temperature, and ∝ denotes proportionality up to a common normalization factor.
This expression connects two aspects of the method. The proposal distribution supplies variation and keeps the system grounded in sentences the translator can generate. The energy supplies a preference among those possibilities. Computing a normalized distribution over every possible translation would require summing weights over all target sentences. The training procedure needs a much smaller calculation. It draws candidate occurrences from the base distribution and normalizes the energy weights within that draw.
Pᵢ(j) = exp(−Eθ(y⁽ʲ⁾, xᵢ) / T) / Σₐ∈Iᵢ exp(−Eθ(y⁽ᵃ⁾, xᵢ) / T)
Here, i indexes a training example with source xᵢ. The set Iᵢ contains the positions in its sampled list. The indices j and a refer to candidate positions, and y⁽ʲ⁾ and y⁽ᵃ⁾ are the translations at those positions. Pᵢ(j) is the probability of resampling position j. The numerator is the weight of that candidate, and Σ adds weights in the denominator over positions a in Iᵢ. The energy function Eθ, its parameters θ, the exponential exp and the temperature T have the same roles as above. At a given energy gap, a larger T makes the weights closer together.
The base translator’s contribution to this finite calculation is the act of generating the list. Each draw follows its token probabilities. The resampling step then gives lower-energy candidates more weight among the occurrences already drawn. This distinction helps make sense of the log-probability baseline. That baseline also uses sampled candidates, and it explicitly chooses among them by their base translation score. Energy-based reranking changes the final preference while keeping the translator as the source of candidates.
What a training comparison asks the scorer to learn
Suppose a training source has reference translation yᵢ. The procedure compares each of the resampled candidates with yᵢ using sentence-level BLEU. The authors use the resulting order to name a higher-scoring candidate yₕ and a lower-scoring candidate yₗ. The difference between their BLEU scores sets the required gap in energy.
M = α [BLEU(yₕ, yᵢ) − BLEU(yₗ, yᵢ)]
M is the margin for the particular comparison. The parameter α determines how strongly the BLEU difference scales the requested energy gap. BLEU with a candidate and yᵢ as its arguments is the score of that candidate against the reference yᵢ. The subscripts h and l identify the higher- and lower-BLEU candidates, and i identifies the training example. Subtraction gives the BLEU gap and the square brackets group that gap for multiplication by α.
The condition learned by the scorer is that the higher-BLEU sentence should have an energy smaller by at least the margin. The authors express the extent to which the pair falls short as follows.
ξᵢ = M + Eθ(yₕ, xᵢ) − Eθ(yₗ, xᵢ)
The symbol ξᵢ is the margin violation for the comparison drawn for training example i. M is its BLEU-derived margin. The energy function Eθ evaluates the preferred candidate yₕ and the other candidate yₗ with source xᵢ. For the marginal version, the scorer’s value depends on y alone. A positive ξᵢ means that the preferred candidate has too little of an energy advantage, or that the scorer has put the pair in the opposite order. A nonpositive ξᵢ means that the requested separation is already met.
The objective sums the positive parts of these violations.
minθ Σ_{(xᵢ, yᵢ) ∈ D} max(ξᵢ, 0)
Here, minθ means to minimize over θ, the energy parameters. The data collection D contains the paired sources xᵢ and references yᵢ. The sum Σ runs over these pairs, each contributing a comparison through ξᵢ. The max operation keeps ξᵢ when it is positive and gives 0 otherwise. This is a margin loss. Once a sampled pair satisfies its required margin, it contributes no further penalty on that comparison.
The algorithm accumulates violations across a batch. Its update can be expressed as a gradient step, with the experiment using Adam for optimization. Adam
θ ← θ − λ ∇θ L
The arrow means that the value on the right replaces the current parameters θ. The variable λ is the learning rate in the algorithm, L is the batch loss, and ∇θ L is the gradient of that loss with respect to the scorer’s parameters. The minus sign indicates a step in the direction of decreasing loss. The base translator provides the sampled translations and stays fixed during this ranking procedure.
There are two uses of the reference in the margin loss. It identifies which candidate should be preferred, and it determines how large the preferred candidate’s energy advantage should be. The pair itself ordinarily consists of translations produced by the base system. Thus the scorer learns distinctions such as which of two incomplete or differently worded attempts comes closer to the reference. The experiment that inserts gold translations into pairs changes this part of the procedure. The reference can then become an item to be scored as well as the means of judging the other item.
The authors also test a target-only scorer shared across translation directions. Sharing is possible when the outputs use the same target language, because the marginal scorer never needs to encode the source. The training procedure chooses a translation task in proportion to its training-set size and draws training data from that task. The samples compared against any one reference still come from a translator for that reference’s source. Sharing pools the evidence about useful target-side preferences while keeping each BLEU comparison tied to its original source and gold translation.
How BERT supplies an energy for a complete sentence
The marginal energy network starts from an uncased BERT-base checkpoint. Its encoder has 12 layers, hidden states with 768 dimensions, 12 attention heads and 110M parameters. BERT gives a contextual representation at each target token. The authors pass each representation through a 2-layer multilayer perceptron with 256 hidden variables. This produces a scalar for each position. Averaging these scalars gives the energy for the target sentence.
The average lets candidate sentences of different lengths receive scores on the same numerical scale. The contribution at a single position can still depend on the words elsewhere in the candidate, because it is computed from the contextualized BERT state. Accordingly, the architecture does more than score each word in isolation and average its lexical preference. It can encode whether tokens fit together in the whole target sentence, although its input supplies no information that identifies the source.
For marginal rank training, the projection is learned and the BERT weights stay frozen. The authors set the margin weight α to 10 and the resampling temperature T to 1000. They apply L2 regularization to the projection, which penalizes large weights, and report an Adam learning rate of 0.01. The optimizer settings include a first moment coefficient of 0.9 and a second moment coefficient of 0.98. The marginal energy experiments are described as running on 1 Nvidia TESLA M40 GPU. The BERT checkpoints come from Hugging Face. Transformers
The joint network uses source context by presenting both sentences to one multilingual cased BERT-base encoder. The input starts with a classification marker, places a separator between the source and target, and ends with another separator. The source goes first. Before training the energy projection, the authors adapt BERT on source–target sentence pairs from the task. For this stage, only target tokens are masked. The encoder therefore learns to recover missing target tokens while it can attend to the source and to the available target context. This adaptation is a form of fine-tuning.
The main description specifies 12 epochs for this paired adaptation. The multilingual checkpoint is listed as having 110 million parameters, 12 attention heads, 12 encoder layers, and a hidden-state width of 768. The energy architecture then follows the marginal design, taking a projection of the contextual representations to obtain a sentence score. The difference in the input matters even when the candidate wording is identical across examples. In the joint version, the candidate’s representation can change with the source, so a preference learned for one source need never become a general preference for that target sentence.
The paper calls the target-only scorer Marginal-EBM and the source-conditioned scorer Joint-EBM. Their reranking procedures are called Marginal-EBR and Conditional-EBR. Shared-EBR uses the marginal design with training data from several tasks. This terminology separates what a scorer reads from how its training is organized. The authors released the implementation under the name ebr_mt.
How the comparison scorers assign a sentence score
The paper considers several ways to use probabilities for the same decision. The earlier news-translation system that motivates one baseline combined three kinds of evidence.
s(y, x) = log p(y | x) + λ₁ log p(x | y) + λ₂ log p(y)
Here, s is the combined score for proposed translation y and source x. The forward translation probability is p(y | x), the reverse translation probability is p(x | y), and p(y) is the target-language probability. The vertical bar indicates conditioning. The log operation puts each probability on a logarithmic scale, and λ₁ and λ₂ weight the reverse and target-language terms. The paper’s baseline uses the forward and target scores and keeps the reverse component outside its reported comparison.
sₗₘ(y, x) = log Pₙₘₜ(y | x) + λ log Pₗₘ(y)
In this baseline, sₗₘ is the combined score assigned to candidate y for source x. Pₙₘₜ is the base translator’s conditional probability and Pₗₘ is the target-language probability. The operator log takes the logarithm, the plus sign adds the score contributions, and λ controls the target-language term. The authors try 0.001, 0.01 and 0.1, reporting the best performance with 0.01 for this baseline. The candidate pool comes from the base translator just as it does for reranking by energy.
For the masked scorer, a full sentence likelihood is replaced by an average of token predictions conditioned on the other tokens. This is called normalized pseudo-log-likelihood.
PLL(y) = (1 / N) Σᵢ log p(wᵢ | w∖ᵢ)
Here, PLL is the scoring function applied to sentence y, and N is the number of tokens in y. The index i runs over token positions, with wᵢ denoting the token at position i. The notation w∖ᵢ denotes the sentence context with that token masked. The conditional probability p(wᵢ | w∖ᵢ) is the probability assigned to the original token given the masked context. The logarithm is summed over positions by Σ, and the factor 1 divided by N converts the sum to an average. The baseline adds this average, weighted by a tuned coefficient, to the translator’s log probability. Its BERT uses target-side training text for 10 epochs of masked prediction adaptation.
These baselines illuminate what is special about the learned energy. The target-language scores give an independent judgment of whether the target text is probable or predictable. The energy is trained on pairwise judgments derived from task performance. For its source-conditioned form the energy can also relate the target text to the source directly. Including both language scoring baselines separates several possible reasons for improvements that would otherwise be entangled in a comparison against beam search alone.
Two alternative training objectives
One experiment changes the training of the generator so its sampled lists may contain a broader range of outputs. The paper adds an entropy regularizer to the likelihood objective.
maxθ { Σ_{(x, y) ∈ D} Σᵢ log p(yᵢ | y₍₍ᵢ, x) − β Σᵢ p(yᵢ) log p(yᵢ) }
Here, maxθ denotes maximization over the translator’s parameters θ. The collection D holds parallel pairs, x is the source and y is its reference. The index i denotes a target-token position in the likelihood term, and yᵢ is the reference token at that position. The prefix y₍₍ᵢ denotes the target tokens before i. The conditional probability p(yᵢ | y₍₍ᵢ, x) is the next-token probability given the prefix and source. In the entropy term, p(yᵢ) denotes the predictive probabilities in the paper’s abbreviated notation, and the sum of probability times log probability carries a minus sign to yield entropy. The weight β controls the strength of the regularizer. The first summations collect the reference likelihoods, and the entropy contribution encourages less concentrated predictions.
A separate experiment leaves the proposal in place and changes how the energy scorer is trained. It seeks high expected BLEU under the reweighted distribution.
maxθ 𝔼_{yₚ ∼ pθ(· | x)} [BLEU(yₚ, y*)]
The operator maxθ means to maximize the objective over energy parameters θ. The symbol 𝔼 denotes an expectation. The draw yₚ comes from the energy-reweighted distribution pθ conditional on source x, as indicated by ∼. The dot stands for the variable target sentence. The function BLEU scores the draw against the reference y*. This objective gives credit according to the BLEU values of samples from the learned distribution. The ranking objective uses BLEU to specify the relative order and required separation of individual pairs.
To estimate the gradient, the paper uses the log-derivative identity. In the paper’s energy notation the expression is as follows.
∇θ 𝔼_{yₚ ∼ pθ} [BLEU(yₚ, y*)] = 𝔼_{yₚ ∼ pθ} [BLEU(yₚ, y*) {−∇θ Eθ(yₚ, x) + 𝔼_{y′ ∼ pθ} [∇θ Eθ(y′, x)]}]
In this expression, ∇θ denotes differentiation with respect to θ. The expectations 𝔼 use the reweighted distribution pθ for the fixed source x. The variable yₚ is the draw whose BLEU against reference y* weights the update. The function Eθ gives energy and y′ is the draw inside the inner expectation. The negative gradient comes from the preference for low energy. The inner mean gradient accounts for the normalization of the distribution. The braces group the two gradient contributions multiplied by the BLEU score. The displayed expression uses the energy scale of this derivation. When the exponent is expressed using a separate temperature, the energies in that exponent are scaled by T.
The authors approximate the expectations with self-normalized importance sampling. This means using the energy weights within a finite proposal draw and rescaling them so their total is one. The experiment uses one sample for the outer expectation and 10 for the inner expectation. Its results therefore describe a particular implementation of expected-score training, including how the gradient is estimated.
Experiments and results
The evaluation settings
The experiments include several settings in which different source languages are translated into English. IWSLT’14 supplies German-to-English, Romanian-to-English and Italian-to-English. IWSLT’17 supplies French-to-English. IWSLT’14 English-to-German checks the approach with German as the target. For these IWSLT tasks, the authors report BLEU on the merged test sets tst2010, tst2011 and tst2012. Sentence preprocessing uses byte-pair encoding, a form of subword tokenization.
The WMT comparisons use WMT’14 German-to-English and WMT’16 English-to-German. The FLoRes comparisons use Sinhala-to-English and Nepali-to-English, the two low-resource directions the paper takes from that collection. It follows the FLoRes data organization and preprocessing and uses the devtest split for evaluation in both directions. The English-target sharing experiment draws on IWSLT and FLoRes. Its results describe sharing across those tasks instead of a shared scorer evaluated on the WMT directions.
The base Transformer has six encoder and six decoder layers. It uses 8 attention heads, embeddings of dimension 512 and an inner-layer dimension of 4096. The training setup includes dropout, weight decay and label smoothing, along with layer normalization and early stopping. The paper uses Adam and follows the learning-rate schedule described in the fairseq work. The translation training is reported on 1 Nvidia TITANX GPU. The implementations of the baseline come from two toolkits. OpenNMT · fairseq
The authors use SacreBLEU for consistent BLEU reporting. They use comparisons at the level of an individual source sentence to train or diagnose a selector, then report BLEU on the set of chosen outputs. These levels answer different questions. Sentence-level BLEU says which candidate is closer to the reference according to the criterion used in the comparison. The full-set score evaluates the collection of returned translations. Accordingly, the reference-based oracle in this paper should be read as the result of its specified sentence-by-sentence rule, which is then scored on the resulting output collection. A Call for Clarity in Reporting BLEU Scores
Which decisions the baselines test
The main baseline runs beam decoding with beam size five on BaseNMT. BaseNMT+Sample generates 100 candidates per source and returns the one with the highest base log probability. Comparing these settings tests how changing the search procedure affects the output while retaining the same preference for base probability. Sampling can expose candidates that beam search would prune. The best candidate by probability from such a draw can still score poorly according to BLEU, so this comparison is also a useful control for the claim that changing the ranking matters.
BaseNMT+LM augments base log probability with a pretrained target-language score. The English-target configuration uses Transformer-XL, and the German-target configuration described for English-to-German uses XLM. BaseNMT+MLM instead incorporates the average masked-token score from BERT. These systems test whether target-language plausibility is enough to identify better candidates. NCE-EBR uses the marginal energy architecture with noise-contrastive estimation, which here trains a discriminator to distinguish gold translations from generated ones.
Marginal-EBR and Conditional-EBR use the rank objective. The main difference is whether the scorer reads the source. Shared-EBR uses the same target-only mechanism as Marginal-EBR while broadening its training across English-target tasks. Sample-based systems use 100 candidates per source. The oracle sees the reference and chooses from the sampled candidates by BLEU. Its score describes the available headroom under that selection rule. The deployable systems have to make their decisions from the source, the hypotheses and their learned scores.
Where candidate selection makes a difference
The IWSLT’14 German-to-English results show a modest improvement when sampling replaces beam search and the translator continues to decide by log probability. The score goes from 33.87 for beam decoding to 33.98 for probability-based selection among samples. Augmenting the base score with a language scorer gives 34.25 for BaseNMT+LM and 34.42 for the masked version. The comparison then moves to scoring candidates with an energy trained for the selection task. Marginal-EBR reaches 35.68, cross-task sharing reaches 35.75, and Conditional-EBR reaches 37.58. The oracle’s 67.54 shows how far candidate selection is from exploiting all the reference overlap represented in the sampled material.
Candidate selection on the merged IWSLT’14 German-to-English test set
The source-conditioned energy scorer leads the usable systems, and reference-informed selection reveals further headroom.
The numbers
| System or setting | BLEU |
|---|---|
| BaseNMT with beam search | 33.87 |
| BaseNMT with probability-ranked samples | 33.98 |
| BaseNMT with masked language scoring | 34.42 |
| Marginal-EBR | 35.68 |
| Shared-EBR | 35.75 |
| Conditional-EBR (this paper) | 37.58 |
| Reference-informed oracle | 67.54 |
The rank diagnostic adds evidence about this gap. On both training and test data for German-to-English, the paper compares reference-based candidate order with the orders given by probability and by the two energy scorers. The base probability lacks strong agreement with BLEU for most sources. With learned energy, the distribution of the rank coefficients shifts toward stronger agreement, and the source-conditioned scorer aligns better than the target-only version. This means the better choice at the top of the list is accompanied by a broader improvement in how the candidates are ordered. The experiment observes agreement within sampled lists, where all candidates concern the same source.
The other IWSLT English-target comparisons show the advantage of source conditioning across several directions. On French-to-English, beam decoding yields 31.50 BLEU, Marginal-EBR yields 33.77 and Conditional-EBR yields 35.02. Italian-to-English gives 32.08 with beam search, 34.00 with marginal reranking and 36.05 with conditional reranking. For Romanian-to-English, the corresponding results are 33.21, 34.48 and 37.19. The French, Italian and Romanian oracle scores are 68.43, 71.77 and 73.95, respectively, under the same kind of reference-informed selection.
The base language scorers have a less uniform effect. For example, ordinary language scoring gives 33.01 BLEU on Romanian-to-English, where ranking the samples only by BaseNMT gives 33.64. On Italian-to-English, plain language scoring reaches 32.52 and masked scoring reaches 33.68. The masked baseline beats the ordinary language baseline in the main comparison. The authors associate that result with its access to context on each side of a masked target token. The comparison measures the complete scoring setups, including their pretrained checkpoints and their adaptation, so it offers observational support for that explanation.
Low-resource directions and larger translation benchmarks
For FLoRes Sinhala-to-English devtest, the main beam baseline is 7.10 BLEU. Masked language reranking reaches 7.70, and NCE-EBR reaches 7.98. With the ranking loss, Marginal-EBR reaches 8.62 and Shared-EBR reaches 10.29. Conditional-EBR records 10.47, and the oracle reaches 14.71. In this direction, the shared training of a source-independent scorer produces a substantial part of the improvement seen among the energy variants.
Reranking on FLoRes Sinhala-to-English devtest
Shared training improves the target-only energy scorer, and source conditioning gives the highest usable score.
The numbers
| System or setting | BLEU |
|---|---|
| BaseNMT with beam search | 7.10 |
| BaseNMT with masked language scoring | 7.70 |
| NCE-EBR | 7.98 |
| Marginal-EBR | 8.62 |
| Shared-EBR | 10.29 |
| Conditional-EBR (this paper) | 10.47 |
On FLoRes Nepali-to-English devtest, beam decoding reaches 6.07 BLEU and selecting the highest-probability sample reaches 6.44. The marginal rank-trained scorer gives 7.26, while the scorer trained with noise-contrastive estimation gives 7.36. Nepali-to-English is the exception the authors identify in their general comparison of rank-based marginal training with noise-contrastive marginal training. Sharing raises the rank-trained marginal score to 9.25, and conditioning on the source gives 9.82. The reference-informed score is 11.91.
For IWSLT’14 English-to-German, beam decoding yields 28.83 BLEU. Marginal-EBR reaches 30.82, and Conditional-EBR reaches 30.97. The oracle records 52.14. Here, the marginal version already captures much of the gain seen with conditional reranking. Taken with the English-target experiments, this direction shows that the recipe can be used with a different target language. The shared English scorer is specific to the tasks for which it was trained.
On WMT’14 German-to-English the scores are 30.13 for beam decoding, 31.65 for Marginal-EBR and 32.21 for Conditional-EBR. The oracle gives 50.89. On WMT’16 English-to-German, beam decoding gets 28.84, Marginal-EBR gets 29.14 and Conditional-EBR gets 30.23, with an oracle score of 45.15. The WMT improvements are generally smaller than the gains reported on the IWSLT and FLoRes tasks. The authors suggest that pretrained BERT is more helpful when translation resources are more limited. Since the benchmarks also differ in other ways, that interpretation is a hypothesis about the pattern across tasks.
The cost of choosing among samples
The timing comparison measures average milliseconds per sentence. It uses beam width 5 for the base translator and 100 samples for the energy rerankers. For German-to-English, Table 5 reports 572 milliseconds for the base translator, 749 for Marginal-EBR, 836 for Conditional-EBR with Joint-BERT and 921 for Conditional-EBR with XY-BERT. For English-to-German, the same sequence is 577, 756, 838 and 929 milliseconds. These figures quantify the costs under the paper’s decoding configurations.
Part of the time goes to generating many complete outputs, and part goes to evaluating them. Marginal scoring reads only the translation, whereas joint scoring also processes the source. The joint input therefore includes more tokens for the scorer to process. The XY-BERT comparison uses separate source and target networks, adding a further cost. The paper reports that this variant adds 3.3 million parameters relative to the Joint-BERT version in the comparison. The measurements make the central tradeoff concrete. Reranking gains access to better alternatives by keeping more candidates available until a final scoring pass, and that pass takes time.
What the ablations show
Should the reference itself enter a comparison?
The rank objective normally uses the reference to judge two generated translations. The authors test what happens when the reference replaces one of the generated candidates some of the time. The variable γ specifies that proportion. If a generated list contains few exact reference matches, a scorer trained mainly on reference-versus-generation judgments can get practice on comparisons that occur rarely at test time. A comparison between two realistic outputs more closely resembles the final selection problem.
Gold candidate use in Marginal-EBR training for IWSLT’14 German-to-English
The reranker performs best when the reference judges the sampled pair from outside it.
The numbers
| System or setting | BLEU |
|---|---|
| Gold candidate proportion 0.0 (this paper) | 35.68 |
| Gold candidate proportion 0.25 | 35.00 |
| Gold candidate proportion 0.75 | 34.20 |
| Gold candidate proportion 1.0 | 33.75 |
The German-to-English result declines across the tested proportions. The same ordering appears on IWSLT’17 French-to-English. The French-to-English Marginal-EBR scores are 33.77 BLEU at γ of 0.0, 33.15 at 0.25, 31.65 at 0.75 and 30.82 at 1.0. This is a targeted comparison because it varies how the reference enters the ranking pairs. The full noise-contrastive comparison changes the objective as well, so it answers a broader question about different ways to use gold data.
The authors’ explanation concerns the usefulness of the comparisons. Identifying the reference as better than a generated translation can be easy even when the scorer has learned little about which of two imperfect translations deserves preference. Under the original scheme, both items can contain errors or differ from the reference in wording. They still give a training signal through the difference in BLEU. The observed ordering of the gold-insertion settings supports training on that more typical choice for the tested tasks.
What sharing and source conditioning contribute
The Sinhala-to-English experiment breaks down the shared marginal result by changing which directions contribute training. The Sinhala-only scorer gives 8.62 BLEU on FLoRes devtest, with 7.10 for the base beam output. Adding German-to-English training gives 9.30 in the progression reported by the authors. The setting that adds French-to-English reaches 9.76, and the full shared setting reaches 10.29. The target remains English across the contributing tasks. Because the same type of scorer is used throughout, the improvement shows that supervision from additional directions can help it learn a transferable target-side preference.
The study varies the amount and composition of the training pool together. It shows the outcome of these particular additions and leaves several explanations open. More examples may help the scorer estimate a preference that is shared across tasks. The additional tasks may also provide useful contrasts absent from the smaller Sinhala training pool. Since entire tasks are added, the comparison does not assign a separate effect to any one of these factors. It does establish a concrete benefit for the pooled setup the authors evaluated.
The contrast between marginal and conditional energy addresses a different question. A marginal scorer can learn that one target sentence is better formed or closer in style to the target references in general. Given two fluent alternatives that express different meanings, it has only their target-side properties to distinguish them. The joint scorer can potentially favor whichever sentence better reflects the source. In the main experiments, the conditional scorer beats the marginal scorer, and it also beats Shared-EBR wherever the latter is reported. Its preferences align more closely with BLEU in the German-to-English rank diagnostic.
The joint scorer changes more than access to source text. It also uses a multilingual checkpoint adapted on bilingual sentence pairs. The comparison shows the value of the complete conditional construction. Determining how much of its gain is due to source access, checkpoint choice or the adaptation procedure would require holding the other changes fixed. The paper’s interpretation is that source conditioning makes it possible to learn different preferences for different input sentences. That account fits the architecture and the observed ranks, while the benchmark comparison incorporates all of the differences between the variants.
How the proposal affects what the scorer can recover
The entropy regularization experiment asks whether the base translator can make reranking more effective by proposing a better set of alternatives. A more dispersed next-token distribution can produce more varied samples. If the added variation brings candidates closer to the reference, oracle BLEU can rise even when the highest-probability output remains similar. The paper tests this on IWSLT’14 German-to-English with β values of 0.01 and 0.1, selecting 0.01 based on validation.
With β of 0.01, the test oracle reaches 68.21 BLEU, compared with 67.54 for the unregularized generator. The corresponding beam scores are 33.96 and 33.87. Conditional-EBR reaches 37.88 with regularization and 37.58 without it. In this setting the generator change improves the reach of the sampled list and the trained selector turns part of the available improvement into a higher final score. The beam result changes little. That pattern supports the idea that a change to the proposal can matter more when the system looks beyond its preferred beam output.
The stronger regularization setting has a different outcome. With β of 0.1, test oracle BLEU is 65.76, below the 68.21 obtained at β of 0.01. The experiment therefore gives a concrete example of diversity and candidate quality pulling in different directions. Increasing entropy affects which outputs can enter the candidate pool and how often. A pool benefits the reranker when its extra variation includes stronger candidates for the evaluation criterion. For the stronger setting, even reference-informed selection extracts a lower score.
Alternate ways to train or construct the scorer
Training by expected BLEU is the paper’s direct comparison with the pairwise loss. On IWSLT’14 German-to-English, the expected-score objective gives 34.20 BLEU with the marginal scorer and 34.77 with the joint scorer. Pairwise ranking gives 35.68 and 37.58, respectively. The experiment favors rank training for both architectures under the paper’s sampling and gradient-estimation procedure. It also shows that the advantage of joint over marginal scoring appears with either training objective in this comparison.
The expected-score implementation estimates an outer and an inner expectation from finite draws. Pairwise training uses a local inequality with a margin supplied by the difference between two observed BLEU scores. The outcome compares two practical procedures with different training signals and different estimation demands. It supports the authors’ choice to use the ranking procedure in their main experiments. A comparison with other estimators or sampling budgets could change how directly the result speaks to the underlying objectives.
The paper also compares Joint-BERT with an energy scorer built from XY-BERT on IWSLT’14 German-to-English. XY-BERT uses a German BERT encoder and an English BERT decoder. The authors remove its output layer and project the final hidden states to obtain energy values, following the same broad design as their other energy scorers. Conditional reranking with XY-BERT reaches 38.33 BLEU, whereas Conditional-EBR with Joint-BERT reaches 37.58. The original XY-BERT result cited by the authors is 36.49 BLEU with 10 iterations of mask-predict decoding. The cited score gives context for what changes when XY-BERT is repurposed as the scorer of a candidate list. Mask-Predict
The authors attribute much of the XY-BERT advantage to the use of separate, language-specialized networks. They also note a difference in how adaptation works. XY-BERT has additional trainable components, allowing adaptation for 60 epochs while other parameters remain fixed. In the discussion of this comparison, the authors describe updating all Joint-BERT parameters for only 15 epochs and report that training it longer hurt performance. The architecture, specialization and adaptation setup all vary. The result identifies a stronger configuration for this task and leaves the individual contribution of those changes unresolved.
Which preferences appear in the outputs?
The qualitative analysis looks at cases where Marginal-EBR and the base translator make different choices on IWSLT’14 German-to-English. The authors examine 200 examples that favor Marginal-EBR and 200 that favor the base system. Across those 400 cases, pronoun changes, contractions and rephrasing each appear roughly 30% of the time. Changes in tense appear in 10%. Categories can overlap, since a rephrasing can also introduce a new pronoun. The authors also observe changes involving determiners, prepositions and deletions.
These categories offer a view of what a target-only score can reward. A contraction changes register without necessarily changing the proposition. A different tense or pronoun can change what the sentence says. In one of the paper’s examples, a switch in pronoun accompanies a change in the wording around freedom. Another example replaces a reference to something unseen with a formulation using invisible. The authors suggest that a preference for contractions may reflect the spoken style of the TED material. The examples include both cases that favored the reranker and cases that favored the base system, so they illustrate recurring differences in the decisions.
The study also sorts the IWSLT’14 German-to-English test results by reference length. For references of length at most 5, the base translator scores 23.78 BLEU and marginal reranking scores 26.38. In the group above 5 through 10, the corresponding scores are 33.22 and 35.20. For references longer than 10, they are 34.77 and 35.68. The largest improvement appears in the shortest group. The authors propose that training can cover more of the relevant range of alternative short sentences. The length breakdown establishes where the observed improvement is concentrated while leaving that explanation open.
Finally, the authors shuffle the tokens of IWSLT’14 German-to-English reference targets and score the modified sentences with the marginal network. In one condition, they shuffle tokens across the whole sentence. In the other, they select a position and shuffle within a window of three. This gives a simple test that keeps the token inventory while disturbing their order. The intact sentences get an average energy of -0.037, the locally shuffled sentences -0.013 and the globally shuffled sentences 0.002. The scorer prefers the original to the local shuffle in 87% of comparisons and to the global shuffle in 90.5%.
Lower energy for intact targets supports the authors’ interpretation that marginal scoring is sensitive to fluency. The difference between local and global perturbations is also consistent with wider disruption making the ordering easier to detect. The test concerns the coherence of the target sentence itself, which is information the network can access directly. It explains how a scorer with no source input can make useful distinctions while leaving the accuracy of its judgments about the source beyond the scope of this diagnostic.
Limitations
Limits identified by the authors
The authors identify inference latency as a principal limitation. The method depends on an autoregressive translator to generate a candidate pool, then has to score that pool. Its best-performing variants read longer inputs or use more than one pretrained network. The reported results therefore attach to decoding configurations with a measurable time cost. The authors propose drawing translations directly from the energy-based system as a direction for future work. The experiments use base-translator proposals throughout.
The authors also identify a structural limit of the marginal scorer. It assigns the same energy to a target sentence however it was produced and whatever source it is offered as a translation of. Training across tasks improves the available evidence about target-side preferences, and the scorer’s ability to match an individual source remains bounded by that input choice. Its comparatively strong performance on the shuffle test addresses fluency. Assessing what the target says about a given source is the reason the paper constructs a conditional alternative.
For Joint-BERT, the authors discuss the difficulty of extending adaptation by updating the whole network. They report poorer performance when training was prolonged in the comparison with XY-BERT, and leave additional trainable modules for future work. The architecture description gives 12 epochs for joint adaptation, while the later XY-BERT comparison describes 15 epochs for Joint-BERT. It remains unclear whether these counts refer to distinct runs or different accounts of the same configuration. That distinction matters for reproducing the adaptation schedule.
Limits of the evidence
A strong oracle score demonstrates that the sampled lists contain candidates that can perform well under reference-informed selection. It measures performance with information unavailable to a system translating a new sentence. The oracle also depends on the generator, the finite sampling budget and its use of sentence-level BLEU to choose candidates. Its score is best read as an empirical measure of opportunity within that procedure. The large gap between it and the learned reranker leaves open how much of that opportunity can be recovered under a practical test-time decision rule.
An energy scorer can choose only from the sampled translations. Its form may allow it to assign a very favorable score to some unseen sentence, but the reported decoding system has no route to returning that sentence unless it is sampled. This dependency matters in both directions. A weak proposal may deny a good scorer any acceptable options. A strong proposal may contain good options that the scorer consistently overlooks. The paper’s oracle and entropy experiments provide ways to investigate these cases, while the main experiments use a common pool size of 100 per source for the sample-based methods. The best tradeoff at other budgets remains open.
BLEU defines the training preferences and serves as the reported evaluation measure. The evidence is consequently strongest for improving reference overlap under that metric. The qualitative examples give some insight into the changes users might notice, and the shuffle experiment isolates sensitivity to target-word order. Human assessments of meaning preservation, overall acceptability or the appropriateness of a preferred style remain outside the evaluation. Changes of pronoun and tense make this gap especially relevant, since their significance depends on what the source expresses.
The analysis of recurring output changes uses examples selected to favor each system. Its percentages characterize the inspected set of 400 examples. A frequency of pronoun changes in that set need not describe the overall test distribution, which also includes outputs on which the two decision procedures make similar choices. The categories overlap and the examples serve to characterize types of differences. They do not establish independent rates of improvement in each linguistic category.
Likewise, the shuffling experiment tests a specific sort of degradation. Globally scrambled word order can make a sentence conspicuously abnormal. Local scrambling is subtler, but it still supplies a targeted contrast against an intact reference. A pair of fluent candidates with different implications presents another kind of decision. Evidence from these perturbations supports a preference for coherent order and leaves source faithfulness to the source-conditioned comparison or to a test designed around meaning.
The language directions provide a range of benchmark conditions. Most target English, and the German-target cases establish feasibility in another tested target language. The sharing result comes from pooling data for English as the common target. Its extension to other shared target languages, to new domains or to substantially different training conditions remains an empirical question. The authors’ suggestion that BERT helps translation more when resources are limited is consistent with their task comparisons, which vary corpus, direction and the quality of the base candidate sets together.
The benchmarks report point scores for the configurations tested. The results establish the ordering shown in those comparisons, with the reliability of close differences across repeated training or sampling runs left open. That distinction is particularly important when comparing marginal and shared reranking on a direction where their scores are close, or conditional and shared reranking on a low-resource split where both improve substantially over the base system. Larger patterns, such as the gap between the reference-informed oracle and deployable selection, are visible directly in the reported diagnostic.
What came after
The closest connection in the listed work is the study by Eikema and Aziz, which the authors describe as parallel research. It locates the difficulty of MAP decoding in the distribution of probability mass. The most probable sentence can be a poor representative of a distribution that assigns substantial total mass to many other outputs. Bhattacharyya and colleagues use that observation to motivate a specific alternative decision rule. They draw candidates from a likelihood-trained translator and learn a separate preference among them. The parallel study helps explain why this can work even when the generator’s training procedure stays in place. Is MAP Decoding All You Need? The Inadequacy of the Mode in Neural Machine Translation
Quality-aware decoding is the most direct later topic in the list. It puts the quality criterion at the point where a system decides which translation to return. That connects to the central division of work in energy-based reranking, where one component supplies alternatives and another judges their suitability. The link establishes the follow-on topic. The extent to which the later work uses the earlier paper’s particular sampling procedure, energy function or pairwise loss is unspecified. Quality-Aware Decoding for Neural Machine Translation
Work on language systems as representations of agents belongs to a broader connection with the use of generated text. Its title identifies agency as its subject, a different application from selecting a translation with high reference overlap. Its specific use of energy-based reranking, whether as method or as context for a distinction between generation and judgment, is unspecified. Language Models as Agent Models
LENS moves the theme of a learned quality judgment into text simplification. The relevant connection is the distinction between generating a text and learning how to evaluate it. In Bhattacharyya and colleagues’ experiments, BLEU supplies the supervision for a judgment used to pick among translations. LENS is framed as a learnable evaluation metric for simplification. Whether it adopts any of the reranker’s training or selection mechanisms is unspecified. LENS: A Learnable Evaluation Metric for Text Simplification
The work on latent discourse translation connects quality-aware decoding with translation at the level of discourse. That framing extends the question of selecting an output toward properties that matter across a broader stretch of text. The energy-based reranking experiments establish the opportunity for such selection at the level of sampled sentence translations. The later title identifies discourse as the focus of its quality-aware decoding, while its use of the earlier paper’s architecture and supervision is unspecified. Unlocking Latent Discourse Translation in LLMs Through Quality-Aware Decoding
Cite
Cite as Sumanta Bhattacharyya, Amirmohammad Rooshenas, Subhajit Naskar, Simeng Sun, Mohit Iyyer and Andrew McCallum. 2021. Energy-Based Reranking: Improving Neural Machine Translation Using Energy-Based Models. Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers).
@inproceedings{bhattacharyya2021energy,
title = {{Energy-Based Reranking: Improving Neural Machine Translation Using Energy-Based Models}},
author = {Sumanta Bhattacharyya, Amirmohammad Rooshenas, Subhajit Naskar, Simeng Sun, Mohit Iyyer and Andrew McCallum},
booktitle = {Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers)},
year = {2021},
doi = {10.18653/v1/2021.acl-long.349},
url = {https://doi.org/10.18653/v1/2021.acl-long.349}
}This page in Markdown https://md.research.elamur.ai/free/en/papers/bhattacharyya-2021-energy-based-reranking-improving-neural/