{'fraction_non_alphanumeric': 0.03908038863791076, 'fraction_numerical': 0.00980877529550096, 'mean_word_length': 4.335809806835067, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Task Loss Estimation for Sequence Prediction

Often, the performance on a supervised machine learning task is evaluated with a emph{task loss} function that cannot be optimized directly. Examples of such loss functions include the classification error, the edit distance and the BLEU score. A common workaround for this problem is to instead optimize a emph{surrogate loss} function, such as for instance cross-entropy or hinge loss. In order for this remedy to be effective, it is important to ensure that minimization of the surrogate loss results in minimization of the task loss, a condition that we call emph{consistency with the task loss}. In this work, we propose another method for deriving differentiable surrogate losses that provably meet this requirement. We focus on the broad class of models that define a score for every input-output pair. Our idea is that this score can be interpreted as an estimate of the task loss, and that the estimation error may be used as a consistent surrogate loss. A distinct feature of such an approach is that it defines the desirable value of the score for every input-output pair. We use this property to design specialized surrogate losses for Encoder-Decoder models often used for sequence prediction tasks. In our experiment, we benchmark on the task of speech recognition. Using a new surrogate loss instead of cross-entropy to train an Encoder-Decoder speech recognizer brings a significant ~13% relative improvement in terms of Character Error Rate (CER) in the case when no extra corpora are used for language modeling.


INTRODUCTION
There has been an increase of interest in learning systems that can solve tasks in an "end-to-end" fashion. An early example of such a system is a highly successful convolutional network handwriting recognition pipeline (LeCun et al., 1998). More recent examples are deep convolutional networks designed for image recognition (Krizhevsky et al., 2012), neural translation systems (Sutskever et al., 2014;Bahdanau et al., 2015a), and speech recognizers (Graves & Jaitly, 2014;Hannun et al., 2014a;Chorowski et al., 2015;Bahdanau et al., 2015b). Parts of end-to-end systems, such as image features extracted by convolutional networks, often successfully replace hand-designed ones (Yosinski et al., 2014). This demonstrates how useful it can be that all parts of a system are learned to solve the relevant task.
In practice however, it often happens that the relevant task loss function, such as error rate in classification, word error rate in speech recognition, or BLEU score in machine translation, is only used for model evaluation, while a different surrogate loss is used to train the model. There are several reasons for the evaluation loss -training loss discrepancy: the evaluation criterion may be non-differentiable, it can be non-convex or otherwise inconvenient to optimize, or one may want to emphasize certain problem-agnostic model properties, such as a class separation margin (Vapnik, 1998). For instance, classification models are often evaluated based on their error rates, which corresponds to a 0-1 task loss. However, people often minimize surrogate losses like the cross-entropy (Bishop, 2006) or the hinge loss (Vapnik, 1998) instead. For classification, these surrogate losses are well-motivated and their minimization tends to lead to a low error rate. It is not clear, however, that the same methods should be preferred for structured output problems, in which typically there is a gradation in the quality of answers.
In this work, we revisit the problem of choosing an appropriate surrogate loss for training. We focus on the broad class of models that define a score for every input-output pair and make predictions by looking for the output with the lowest score. Our main idea is that if the scores defined by the model are approximately equal to the task loss, then the task loss of the model's prediction should be low. We hence propose to define the surrogate loss as the estimation error of a score function that is trained to mimic the task loss, a method we will refer to as task loss estimation. We prove that minimization of such a surrogate loss leads to the minimization of the targeted task loss as well, a property that we call consistency with the task loss. The main distinct feature of our new approach is that it prescribes a target value for the score of every input-output pair. This target value does not depend on the score of other outputs, which is the key property of the proposed method and the key difference from other approaches to define consistent surrogate losses, such as the generalized hinge loss used in Structured Support Vector Machines (Tsochantaridis et al., 2005).
Furthermore, we apply the task loss estimation principle to derive new surrogate losses for sequence prediction models of the Encoder-Decoder family. The Decoder, typically a recurrent network, produces the score for an input-output pair by summing terms associated with every element of the sequence. The fact that the target for the score is fixed in our approach allows us to define targets for each of the terms separately. By doing so we strive to achieve two goals: to facilitate faster training and to ensure that the greedy search and the beam search used to obtain predictions from an Encoder-Decoder work reasonably well. To validate our ideas we carry out an experiment on a speech recognition task. We show that when no external language model is used using a new surrogate loss indeed results in a relative 13% improvement of the CER compared to cross-entropy training for an Encoder-Decoder speech recognizer.

TASK LOSS ESTIMATION FOR SUPERVISED LEARNING
Basic Definitions Consider the broad class of supervised learning problems in which the trained learner is only allowed to deterministically produce a single answerŷ ∈ Y at run-time, when given an input x ∈ X . After training, the learner's performance is evaluated in terms of the task loss L(x,ŷ) that it suffered from outputtingŷ for x. We assume that the task loss is non-negative and that there exists a unique ground truth answer y = g(x) such that L(x, g(x)) = 0. 1 During the training, the learner is provided with training pairs (x i , y i ), where y i = g(x i ). We assume that given the ground truth y i , the loss L(x,ŷ) can be efficiently for any answerŷ.
The training problem is then defined as follows. Given a family of parametrized mappings {h α } , α ∈ A from X to Y, try to choose one that minimizes (as much as possible) the risk functional: where P is an unknown data distribution. The choice must be made using only a sample Here are two examples of task losses that are pretty much standard in some key supervised learning problems: • the 0-1 loss used in classification problems is L(x, y) = 1, g(x) = y 0, g(x) = y ; • the Levenshtein distance used in speech recognition is L(x, y) = ρ levenstein (g(x), y) is the minimum number of changes required to transform a transcript y into the correct transcript g(x).  Figure 1: A graphical illustration of how the loss estimation error provides an upper bound for the task loss L, which is the underlying idea of Theorem 1. The segments S, S 1 , S 2 , S 3 on the picture stand for the four main terms of the theorem statement, respectively. The location of the segments related to each other explains why the loss estimation error gives a bound on the task loss L(x,ŷ) of the predictionŷ. Figure 1a displays the case when the mininum of F (x) is successfully found by h α (x). Figure 1b explains the term F (x,ŷ) − F (x, y) which appears when h α (x) is an approximate minimizer incapable to find an output with a score lower than F (x, y).

Empirical Risk and Surrogate Losses
Under the assumptions that S is big enough and the family A is limited or some form of regularization is introduced, the empirical riskR(α) can be minimized instead of R (Vapnik, 1998).
A common practical issue with minimizing the empirical risk functionalR(α) is that L(x, y) is often not differentiable with respect to y, which in turn rendersR(α) non-differentiable with respect to α and therefore difficult to optimize. The prevalent workaround is to define h α (x) as the minimum of a scoring function F α (x, y) (often also called energy): h min α (x) = argmin y F α (x, y). Parameters α of the scoring function are chosen to minimize a (technically empirical) surrogate risk R(α) defined as the average surrogate loss L(x i , ·): where F α (x i ) ∈ R |Y| is the vector of scores computed on all elements of Y 2 .
We argue that, for the transition from the empirical riskR to the surrogate risk R to be helpful, a number of conditions should hold: 1. It must be easy to compute predictions h min α (x). Thus F α (x, y) must be easy to minimize over y, at least in an approximate sense. For instance, in most classification problems this is not an issue at all because the output space Y is small. On the other hand, for structured output prediction this might be a significant issue.
2. R should be simpler to optimize thanR.
3. Optimization of R should result in optimization ofR.
Let us consider two examples of surrogate losses 2 Without loss of generality, we assume here that the output space is discrete.
• The cross-entropy surrogate loss L CE is applicable when the scores F α (x, y) are interpreted as unnormalized negative log-probabilities: With L CE choosing α that minimizes R CE (α) corresponds to Maximum Likelihood Estimation (MLE).
• A generalized hinge loss used in Structured Support Vector Machines (Tsochantaridis et al., 2005): The respective surrogate risk R hinge is defined similarly to R CE .
Both of these surrogate loss functions have properties that make them relatively simple to optimize. The cross-entropy is both differentiable and convex. The hinge loss is piecewise differentiable and convex as well. We refer the reader to LeCun et al. (2006) for a survey of surrogate loss functions (note that their definition of a loss function differs slightly from the one we use in this text).
Popular surrogate losses are often agnostic to the task loss L, the cross-entropy surrogate loss L CE being a good example. Even if we find parameters α CE which make the cross-entropy R CE (α CE ) arbitrary small, there is no guarantee that the empirical riskR(α CE ) will also be small. However, some surrogate losses, such as the generalized hinge loss L hinge , provide certain guarantees for the empirical risk. Specifically, one can see that , or simply put, minimizing R hinge necessarily pushesR down.
Task Loss Estimation In this paper we introduce a novel paradigm for building surrogate losses with guarantees similar to those of L hinge . Namely, we propose to interpret the scoring function F as an estimate of the task loss L itself. In other words we want F α (x, y) ≈ L(x, y).
We can motivate this approach by showing that for the empirical risk to be low, it is sufficient for the task loss and the score to be similar at only two points: the ground truth g(x) and the prediction h α (x). We combine the estimation errors for these two outputs to obtain a new surrogate loss L min,min which we call the min-min loss.
Theorem 1. Let L min,min be defined as follows: here y = g(x),ŷ = h α (x). Then the respective surrogate risk R min,min provides the following bound onRR where Figure 1 illustrates the statement of Theorem 1. Simply put, the theorem says that if h α = h min α , or if h α is a good enough approximation of h min α such that the term M (α) is small, the surrogate loss R min,min is a sensible substitute forR. Please see Appendix for a formal proof of the theorem.
The key difference of our new approach from the generalized hinge loss is that it assigns a fixed target L(x, y) for the score F (x, y) of every pair (x, y) ∈ X × Y. This target is independent of the values of F (x, y ) for all other y ∈ Y. The knowledge that L is the target can be used at the stage of designing the model F α (x, y). For example, when y has a structure, a L(x, y) might be decomposed into separate targets for every element of y, thereby making optimization of R more tractable.
In consideration of optimization difficulties, our new surrogate loss L min, min is piece-wise smooth like L hinge , but it is not convex and even not continuous. In practice, we tackle the optimization by fixing the outputs h α (x) for a subset of the sample S, improving L min, min with the fixed outputs by e.g. a gradient descent step, and doing the same iteratively.

TASK LOSS ESTIMATION FOR SEQUENCE PREDICTION
In sequence prediction problems the outputs are sequences over an alphabet C. We assume that the alphabet is not too big, more specifically, that a loop over its elements is feasible. In addition we extend the alphabet C with a special end-of-sequence token $, creating the extended alphabet C = C ∪ {$}. For convenience, we assume that all valid output sequences must end with this token. Now we can formally define the output space as the set of all sequences which end with the end-of-sequence token Y = {y$ : y ∈ C * }, where C * denotes a set of all finite sequences over the alphabet C.
We will now describe how task loss estimation can be applied to sequence prediction for the following specific scenario: • The score function is an Encoder-Decoder model.
• The prediction h min α is approximated with a beam search or a greedy search.

ENCODER-DECODER MODEL
A popular model for sequence prediction is the Encoder-Decoder model. In this approach, the Decoder is trained to model the probability P (y j |z(x), y 1...j−1 ) of the next token y j given a representation of the input z(x) produced by the Encoder, and the previous tokens is the ground truth output. Decoders are typically implemented using recurrent neural networks.
Using the terminology of this paper, one can say that a standard Encoder-Decoder implements a parametrized function δ α (c, x, y 1...j−1 ) that defines the scoring function as follows: The cross-entropy surrogate loss can be used for training Encoder-Decoders. Since the score function (8) defined by an Encoder-Decoder is a proper distribution, the exact formula for the surrogate loss is simpler than in Equation 4 Exactly computing h min α is not possible for Encoder-Decoder models. A beam search procedure is used to compute an approximation h B α , where B is the beam size. In beam search at every step k the beam, that is a set of B "good prefixes" of length k, is replaced by a set of good prefixes of length k + 1. The transition is done by considering all continuations of the beam's sequences and leaving only those B candidates for which the partial sum of log q α is minimal.

APPLYING TASK LOSS ESTIMATION TO ENCODER-DECODERS
Adapting the Min-Min Loss. We want to keep the structure of the scoring function defined in Equation (8). However, the normalization carried out in (9) is not necessary any more, so our new Figure 2: A schematic representation of an Encoder-Decoder architecture implementing the score function F ED2 α (·). For this example, the score of a sequence of labels {y 1 , · · · , y 5 } and an input sequence x is computed, where each label y j is from the alphabet {0, 1, 2}. For each label in the sequence, the decoder produces a vector δ α that represents the predicted change δ o in the optimistic loss for each possible symbol at the next time step. The score for the whole sequence is computed by summing δ α (y j , y 1···j−1 , x) for all j. Note that at each timestep, the decoder also uses the representation z(x) computed by the encoder.
scoring function is simply the sum of δ α : Now, in theory, the min-min loss L min, min could be used for training F ED2 α . However, there are two concerns which render this straight-forward approach less attractive: • Intuitively, constraining only the sum of δ α might provide not enough supervision for training. Namely, the gradient of L min, min would be the same with respect to all δ α (y j , x, y 1...j−1 ), which might hamper gradient-based optimization methods.
• There is no guarantee that the beam search will be able to work with δ α values learnt this way.
To circumvent both of these potential issues, we propose to break the target loss L(x, y) into subtargets δ j L (x, y) assigned token-wise. We define the optimistic task loss L o (x, y) for an output prefix y as the loss of the best possible continuation of the prefix y. For completed output sequences, that is those ending with the end-of-sequence token, we say that the optimistic task loss is equal to the task loss. This results in the following formal definition: We argue that the change of the optimistic task loss δ o (y j , x, y 1...j−1 ) = L o (x, yc) − L o (x, y) is a good target for δ α (y j , x, y 1...j−1 ). Indeed, the pruning during beam search is done by looking at the sum s(x, y 1...k ) = k j=1 δ α (y j , x, y j−1 ) for the prefixes y from the beam. Informally, the pruning procedure should remove prefixes whose continuations are unlikely to be beneficial. The optimistic loss L o (x, y) tells us what is the lowest loss one can obtain by continuing y in an arbitrary way, and hence, it can be used for selecting the prefixes to be continued. Assuming that the network learns to output δ α (c, x, y 1...j ) ≈ δ o (c, x, y 1...j ), we can hope that pruning by s k (x, y 1...j ) ≈ L opt (x, y 1...k ) will keep the good prefixes in.
Our new surrogate loss consisting of the sum of token-wise errors looks as follows: L ED min, min (x, δ α (x)) = |y| j=1 |δ α (y j , x, y 1...j−1 ) − δ o (y j , x, y 1...j−1 )| (11) where y = g(x),ŷ = h min α (x). Note, that L ED min,min extends our previous surrogate loss definition from (3) by working not on F α (x) but on its additive components δ α (y j , x, y 1...j−1 ). One can also see that L ED min, min (x, δ α (x)) ≥ L min, min (x, δ α (x)) because of the triangle inequality, which implies that the respective surrogate risk is a bound for the empirical risk R ED min, min ≥R(α). A careful reader might have noticed, that in practice we do not have access to L ED min, min , because we can not compute h min α (x). The best we can have is L ED min,B (x, y) defined in a similar way but using the beam search to computeŷ = h B α (x) instead of the intractable exact minimization. However, according to Theorem 1 minimizing L ED min,B guarantees low empirical risk for beam search predictions h B α (x), as long as the beam search finds an output with a score that is lower than the score of the ground truth. In our experience, this is usually the case for Encoder-Decoder models.
A Loss for the Greedy Search One disadvantage of the approach with L ED min,B is that computing the surrogate loss, and therefore also its gradients, becomes quite expensive. We address this issue by proposing another surrogate loss which only involves beam search with the beam size B = 1, also often called greedy search. The new surrogate loss L ED greedy is defined as follows: whereŷ = h 1 α (x), c j min = argmin c∈C δ o (c, x, y 1...j−1 ). We can show, that optimizing the respective surrogate risk R ED greedy necessarily improves the performance of greedy search: Theorem 2. The empirical riskR greedy associated with using h 1 α for giving predictions is bounded by R ED greedy , that isR greedy (α) ≤ R ED greedy (α).
The proof can be found in the Appendix. Now, with the greedy search, the gradient ofR greedy (α) can be computed just as fast as the gradient of the average cross-entropy, since the computation of the gradient can be combined with the search.
Tricks of the Trade Driven by our intuition about the training process we make two further changes to the loss L greedy . First, we change Equation 13 by adding all characters into consideration: Our reasoning is that by providing a more informative training signal at each step we help optimization. We note, that the bound on the empirical risk provided by the respective surrogate risk R ED greedy1 (α) is looser then the one by R ED greedy (α) since R ED greedy ≤ R ED greedy1 . On the other hand, R ED greedy1 enforces a margin between the best next token and all the worse ones, which can possibly help generalization.
Finally, we found L ED greedy1 hard to optimize because the gradient of |a − b| is always either +1 or -1, that is it does not get smaller when a and b approach each other. To tackle this we replaced the absolute value by the square: Example: Edit Distance We explain how the decomposition of the task loss L(x, y) into a sum |y| j=1 δ o (y j , x, y 1...j−1 ) works on the example of the edit distance. The edit distance ρ levenstein (s 1 , s 2 ) between two strings s 1 , s 2 ∈ C * is the minimal number of actions required to transform s 1 into s 2 , where the actions allowed are token deletion, insertion and substitution. If the loss L(x, y) is defined as the edit distance ρ levenstein (g(x), y), there is a compact expression for the optimistic loss L o (x, y): Equation (15) formalizes the consideration that the optimal way to continue a prefix y is to append a suffix of the ground truth g(x). From the obtained expression for L o (x, y) one can see that δ o (c, x, y) can only be 0 or -1 when c = $. Indeed, by definition δ o ≥ 0, and also adding a character c to a prefix y can only change the edit distance ρ(y, g(x) 1...k ) by 1 at most. For the case of c = $ the value δ o ($, x, y) can be an arbitrarily large negative number, in particular for prefixes y which are shorter then g(x). It would be a waste of the model capacity to try to exactly approximate such larger numbers, and in practice we clip the values δ o ($, x, y) to be at most -5.
An attentive reader might have noticed, that for complex loss functions such as e.g. BLEU and METEOR computing the loss decomposition like we did it above might be significantly harder. However, we believe that by considering all ground truth suffixes one can often find a close to optimal continuation.

RELATED WORK
In an early attempt to minimize the empirical risk for speech recognition models, word error rate scores were used to rescale a loss similar to the objective that is often referred to as Maximum Mutual Information (Povey & Woodland, 2002). For each sequence in the data, this objective requires a summation over all possible sequences to compute the expected word error rate from the groundtruth, something that is possible for only a restricted class of models. A recent survey (He et al., 2008) explains and documents improvements in speech recognition brought by other methods of discriminative training of speech recognition systems.
In the context of Encoder-Decoders for sequence generation, a curriculum learning (Bengio et al., 2009) strategy has been proposed to address the discrepancy between the training and testing conditions of models trained with maximum likelihood . It was shown that the performance on several sequence prediction tasks can be improved by gradually transitioning from a fully guided training scheme to one where the model is increasingly conditioned on symbols it generated itself to make training more similar to the decoding stage in which the model will be conditioned on its own predictions as well. While this approach has an intuitive appeal and clearly works well in some situations, it doesn't take the task loss into account and to our knowledge no clear theoretical motivation for this method has been provided yet. Another issue is that one needs to decide how fast to transition between the two different types of training schemes.
Recently, methods for direct empirical risk minimization for structured prediction have been proposed that treat the model and the approximate inference procedure as a single black-box method for generating predictions (Stoyanov et al., 2011;Domke, 2012). The gradient of the loss is backpropagated through the approximate inference procedure itself. While this approach is certainly more direct than the optimization of some auxiliary loss, it requires the loss to be differentiable. Hazan et al. (2010) propose a method for direct loss minimization that approximates the gradient of the task loss using a loss adjusted inference procedure. This method has been extended to Hidden Markov Models and applied to phoneme recognition (Keshet et al., 2011).
For a model that provides a distribution over structured output configurations, the gradient with respect to any expectation over that distribution can be estimated using a sampling approach. This technique has been used for speech recognition (Graves & Jaitly, 2014) to estimate the gradient of the transcription loss (i.e., the word error rate) and is equivalent to the REINFORCE method (Williams, 1992) from reinforcement learning. A downside of this method is that in many cases the gradient estimates have high variance. The method also assumes that it is possible and computationally feasible to sample from the model. A related approach is to use an inference method to generate a list of the n best candidate output predictions according to the model (note that for this the model doesn't need to be probabilistic) and approximate the expected loss using an average over these candidate predictions Gao & He (2013). Similarly, one can anneal from a smooth expectation approximated with a large number of candidates towards the loss of a single prediction Smith & Eisner (2006).

EXPERIMENTAL SETUP AND RESULTS
For experimental confirmation 3 of the theory discussed in Sections 2 and 3, we use a characterlevel speech recognition task similar to Bahdanau et al. (2015b). Like in our previous work, we used the Wall Street Journal (WSJ) speech corpus for our experiments. The model is trained on the full 81 hour 'train-si284' training set, we use the 'dev93' development set for validation and model selection, and we report the performance on the 'eval92' test set. The inputs to our models were sequences of feature vectors. Each feature vector contained the energy and 40 mel-filter bank features with their deltas and delta-deltas, which means that the dimensionality of the feature vector is 123. We use the standard trigram language model shipped with the WSJ dataset; in addition we experiment with its extended version created by Kaldi WSJ s5 recipe (Povey et al., 2011).
Our main baseline is an Encoder-Decoder from our previous work on end-to-end speech recognition (Bahdanau et al., 2015b), trained with the cross-entropy surrogate loss. We trained a model with the same architecture but using the task loss estimation L ED greedy2 criterion, which involves greedy prediction of the candidate sequenceŷ during training. Algorithm 1 formally describes our training procedure.
Our main result is the 13% relative improvement of Character Error Rate that task loss estimation training brings compared to the baseline model when no external language model is used (see Table 1). This setup, being not typical for speech recognition research, is still an interesting benchmark for sequence prediction algorithms. We note, that the Word Error Rate of 18% we report here is the best in the literature. Another class of models for which results without the language model are sometimes reported are Connectionist Temporal Classification (CTC) models (Graves & Jaitly, 2014;Miao et al., 2015;Hannun et al., 2014b), and the best result we are aware of is 26.9% reported by Miao et al. (2015).
In our experiments with the language models we linearly interpolated the scores produced by the neural networks with the weights of the Finite State Transducer (FST), similarly to (Miao et al., 2015) and (Bahdanau et al., 2015b). Addition of language models resulted in a typical large performance improvement, but the advantage over the cross-entropy trained model was largely lost. Both the baseline and the experimental model perform worse than a combination of a CTC-trained network and a language model. As discussed in our previous work (Bahdanau et al., 2015b), we attribute it to the overfitting from which Encoder-Decoder models suffers due to their implicit language modelling capabilities.
while L ED greedy2 improves on the validation set do fetch a batch of input sequences B; generateŷ i for each x i from B using the greedy search; compute the score components δ α (c, x i ,ŷ 1...j−1 i ) ; compute the component-wise targets δ o (c, x i ,ŷ 1...j−1 i ) as changes of the optimistic task loss; compute the gradient of L ED greedy2 and update the parameters α; end Algorithm 1: The training procedure used in our experiments. Note, that generation ofŷ i and gradient computation can be combined in an efficient implementation, making it exactly as fast as cross-entropy training. Table 1: Character, word, and sentence error rates (CER, WER, and SER) for the cross-entropy (CE) and the task loss estimation (TLE) models. The first three sections of the table present performance of the considered models with no language model integration, with a standard trigram language model (std LM), and with an extended language model (ext LM). The last section contains results from Graves & Jaitly (2014) and Miao et al. (2015). We found that increasing the beam size over 100 for the CE model does not give any improvement. In addition to the results on the test set (eval92) we reported the performance on the validation set (dev93).

Model
Beam It is notable, that the performance of the experimental model changes very little when we change the beam size from 10 to 1. An unexpected result of our experiments is that the sentence error rate for the loss estimation model is consistently lower. Cross-entropy is de-facto the standard surrogate loss for classifiers, and the sentence error rate is essentially the classification error, for which reasons we did not expect an improvement of this performance measure. This result suggests that for classification problems with very big number of classes the cross-entropy might be a non-optimal surrogate loss.

CONCLUSION AND DISCUSSION
The main contributions of this work are twofold. First, we have developed a method for constructing surrogate loss functions that provide guarantees about the task loss. Second, we have demonstrated that such a surrogate loss for sequence prediction performs better than the cross-entropy surrogate loss at minimizing the character error rate for a speech recognition task.
Our loss function is somewhat similar to the one used in the Structured SVM (Tsochantaridis et al., 2005). The main difference is that while the structured SVM uses the task loss to define the difference between the energies assigned to the correct and incorrect predictions, we use the task loss to directly define the desired score for all outputs. Therefore, the target value for the score of an output does not change during training.
We can also analyze our proposed loss from the perspective of score-landscape shaping (LeCun et al., 2006). Maximum likelihood loss applied to sequence prediction pulls down the score of correct sequences, while directly pulling up on the score of sequences differing in only one element. This is also known as teacher-forcing -the model is only trained to predict the next element of a correct prefixes of training sequences. In contrast, our proposed loss function defines the desired score level for all possible output sequences. Thus it is not only possible to train the model by lowering the score of the correct outputs and raising the score of neighboring incorrect ones, but by precisely raising the score of any incorrect one. Therefore, the model can be trained on its own mistakes.
Future work should investigate the applicability of our framework to other task loss functions like the BLEU score. Our results with the language models stress the importance of developing methods of joint training of the whole system, including the language model. Finally, theoretical work needs to be done to extend our framework to different approximate inference algorithms as well and to be able to make stronger claims about the suitability of the surrogate losses for gradient-based optimization.
Equation (16) immediately follows from Theorem 1 when we apply it to every step of loss estimation. Then we compute sum over j = 1 . . . |y| in Equation (16) which proves the theorem.