Accelerate diffusion language models from many to few generation steps using trajectory self-distillation. Collect clean-noisy state pairs along teacher trajectories, apply reverse-KL mode-seeking distillation, and weight losses by decoding order to prioritize early predictions where cascading errors compound.
T3D: Few-Step Diffusion LMs via Trajectory Self-Distillation
version
0.0.2
engine
skillxiv-v0.0.2-claude-opus-4.6
license
MIT
url
https://arxiv.org/abs/2602.12262
keywords
["Diffusion Language Models","Distillation","Few-Step Generation","Self-Supervision","Mode-Seeking"]
description
Accelerate diffusion language models from many to few generation steps using trajectory self-distillation. Collect clean-noisy state pairs along teacher trajectories, apply reverse-KL mode-seeking distillation, and weight losses by decoding order to prioritize early predictions where cascading errors compound.
T3D: Few-Step Diffusion LMs via Trajectory Self-Distillation
Problem Context
Diffusion language models require many sampling steps (25-50+) for high-quality generation. Few-step variants are needed for deployment, but naive training on random corruption schedules causes train-test mismatch: inference uses confidence-based schedules while training sees uniform random masking. T3D solves this by collecting trajectory pairs from teacher's actual inference schedule and using mode-seeking distillation.
Core Concept
T3D operates in two phases: (1) collect (clean, intermediate) state pairs along teacher trajectories during inference, (2) train student via reverse-KL objective that promotes mode-seeking (concentrating on high-probability outputs) with path-consistency weighting. This addresses the multimodal posterior problem where forward-KL spreads mass across modes.
Architecture Overview
Trajectory collection: Run full teacher steps, save clean (x₀) and intermediate (xₜ) states
Reverse-KL distillation: Use discriminative KL divergence promoting mode concentration
Path-consistency weighting: Weight token losses by decoding order (early tokens > later tokens)
Mode-seeking loss: Prevent mode-covering behavior in highly multimodal posteriors
Few-step inference: Student generates quality outputs in 2-4 steps
"""
Get corruption level schedule for diffusion.
Args:
num_steps: Number of denoising steps
Returns:
sigma_t: Noise level at each step [num_steps]
"""
if
self
'linear'
# Linear schedule from max to min
return
1.0
0.0
elif
self
'cosine'
# Cosine schedule
0
1
return
2
else
raise
f"Unknown schedule: {self.corruption_schedule}"
def
corrupt_tokens
self,
clean_tokens: torch.Tensor, # [seq_len]
sigma: float,
mask_token_id: int
"""
Add noise by masking tokens.
Args:
clean_tokens: Original tokens
sigma: Noise level (0-1, where 1=all masked)
mask_token_id: Mask token ID
Returns:
corrupted: Noisy version with sigma fraction masked
"""
int
len
len
return
def
collect_trajectories
self,
prompt: str,
num_trajectories: int = 4
List
Dict
str
"""
Generate trajectories and collect (clean, intermediate) pairs.
Args:
prompt: Input prompt
num_trajectories: Number of trajectories to collect
Returns:
trajectories: List of {clean: Tensor, intermediates: List[Tensor]}
"""