That is why LM and NMT are usually trained with the sum of cross-entropies over the target sentence.
although language related tasks are more of generation rather than classification, the models estimate target probabilities with the softmax operation on the previous neural network layers and the target distributions are provided as one-hot representations.