Diffusion Language Models › The Training Objective
Language AI HandbookAll chapters The reveal probability also determines the weight on the denoising loss. To connect the two, start from the model’s likelihood over reverse paths.
The bound
A clean sequence can be reached by many reverse paths. The model probability sums their probabilities. We can bound that probability by using the forward corruption chain as the distribution over latent paths. Write for its path probability and for the joint probability defined by the terminal prior and learned reverse transitions. Jensen's inequality gives
The likelihood can also include paths outside the forward chain's support. The inequality still holds because the ratio expectation sums only over paths in the forward support. Factorizing those paths in reverse order separates the negative bound into reconstruction, intermediate transitions and terminal prior mismatch:
Both distributions in the last term are point masses on the all-mask state when and we start the reverse model there. The term vanishes. If some visible tokens can survive forward corruption at , an all-mask prior gives those states zero probability and makes the terminal KL infinite. A different terminal prior requires carrying its KL term through the derivation.
A visible position contributes zero to the intermediate KL because both transitions copy it. For a masked position each distribution assigns the same mass to the mask. The true transition assigns the remaining mass to the original token . The model assigns mass to that token. The matching mask terms cancel, leaving
At the model reveals every remaining mask. The reconstruction term is the same sum of negative log probabilities with . With independent corruption conditioned on and product reverse transitions, the result is the masked reconstruction loss
With the linear schedule, . Training averages this bound over sequences drawn from the training distribution. Sahoo et al. (2024) use the carry-over and zero-mask-probability properties to simplify this objective for masked diffusion.
The continuous-time limit
Taking turns the sum into an integral with a weight. Use , , and :
where . In expectation form, with drawn uniformly:
The evaluation points are right endpoints, and . A sufficient condition for convergence is that the mean loss given a position is masked extends continuously to the endpoints for every position. Drawing uniformly in and then sampling the mask gives an unbiased estimate of the integral when the expected weighted loss is integrable.
For , the expected sum of masked losses divided by equals . Each mask indicator contributes a factor of in its expectation, which the denominator cancels. The conditional losses still depend on the visible context.
BERT selects prediction positions at random and applies its own corruption mixture to them. A masked-token training loss by itself gives no reverse transition rule or normalized sequence likelihood. Here the forward chain and the model's normalized reverse transitions supply both. In the population model, a content-independent mask schedule makes time redundant once a possible partially visible state is given. An implementation can still supply a time embedding as a modeling choice.
Estimating the bound
To estimate the continuous-time objective, sample uniformly from and draw the mask at that rate. Average the weighted masked loss over draws. At small , most samples have few masks, while a rare mask can receive a large weight. The estimator can have a finite mean and infinite variance. For one position whose masked loss is a constant , the contribution is with probability and zero otherwise. Its conditional mean is , while its conditional second moment is . Integrating that second moment over uniform diverges. A stratum that includes the zero endpoint can still have this problem. Clipping to a positive threshold changes the sampling law and generally changes the estimand unless the procedure corrects for it.
For a finite , a direct Monte Carlo estimate samples uniformly from and weights the masked cross-entropy by . On short sequences one can instead enumerate all masks at each step. The code later in this chapter compares these two estimates at the same .
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!