skills/skillxiv-v0.0.2-claude-opus-4.6/discreteness-diffusion-llm/SKILL.md
Understand fundamental limitations of applying diffusion to discrete text: position-agnostic corruption ignores linguistic structure, and token-wise training misses multi-token dependencies. Design text diffusion systems satisfying five essential properties: position-aware corruption, dependency-aware training, parallel consistency, linguistic structure respecting, and robust handling of token boundaries.
npx skillsauth add ADu2021/skillXiv discreteness-diffusion-llmInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Diffusion models excel at images because:
But text is fundamentally different:
Standard diffusion directly applied to text creates two critical failures:
Standard diffusion applies uniform corruption—each position receives the same noise level regardless of linguistic importance.
Original: "The cat sat on the mat"
Noise level: same for all positions
Problem: Function words (the, on) are noisy same as content (cat, sat)
Better: Function words are more robust to noise → less important to denoise
During parallel decoding, all tokens are generated simultaneously. But tokens aren't independent:
Tokens at position i and i+1 are generated in parallel:
- Position i generates word "read" (ambiguous: past tense? infinitive?)
- Position i+1 needs this information to correctly generate following word
- But they're denoised in parallel, losing this dependency
The paper identifies requirements for effective text diffusion systems:
Position-Aware Corruption: Noise should respect linguistic position importance
Dependency-Aware Training: Training loss should penalize breaking token relationships
Parallel Consistency: Parallel-denoised tokens must remain mutually consistent
Linguistic Structure Respecting: Denoising should preserve linguistic boundaries
Robust Token Boundary Handling: Edge cases at sequence start/end/padding
The paper categorizes existing methods:
# Text diffusion system respecting the five properties
class TextDiffusionLM:
def __init__(self, vocab_size, max_length):
self.vocab_size = vocab_size
self.max_length = max_length
self.position_importance = self.compute_position_importance() # Property 1
def compute_position_importance(self):
"""Learn which positions are important to denoise (Property 1)"""
# Function words less important, content words more important
importance = torch.ones(self.max_length)
# Reduce importance of common positions (articles, prepositions)
importance[position_type=='function_word'] *= 0.3
return importance
def corrupt_with_schedule(self, tokens, timestep):
"""Position-aware corruption (Property 1)"""
noise_level = self.noise_schedule(timestep)
# Adjust noise by position importance
effective_noise = noise_level * self.position_importance
# Apply per-position masking probability
mask = torch.bernoulli(effective_noise)
corrupted = tokens.clone()
corrupted[mask.bool()] = MASK_TOKEN
return corrupted
def denoise_with_context(self, corrupted_tokens, context_window=2):
"""Dependency-aware denoising (Property 2)"""
# For each masked position, gather surrounding context
denoised = []
for i in range(len(corrupted_tokens)):
if corrupted_tokens[i] == MASK_TOKEN:
# Include multi-token context (Property 2)
context = corrupted_tokens[max(0, i-context_window):
min(len(corrupted_tokens), i+context_window)]
pred_token = self.denoise_fn(context, position=i)
denoised.append(pred_token)
else:
denoised.append(corrupted_tokens[i])
return torch.tensor(denoised)
def parallel_decode_consistent(self, corrupted_tokens, batch_size=8):
"""Parallel consistency with joint scoring (Property 3)"""
candidates_per_position = []
for i in range(len(corrupted_tokens)):
if corrupted_tokens[i] == MASK_TOKEN:
# Generate candidate tokens (Property 3: joint scoring)
candidates = self.get_candidates(corrupted_tokens, i, top_k=batch_size)
candidates_per_position.append(candidates)
# Select consistent combination (not independent)
best_sequence = self.select_joint_best(candidates_per_position)
return best_sequence
Today's diffusion LLMs only partially satisfy these five properties:
| Property | Current Status | Gap | |----------|---|---| | Position-Aware Corruption | Rarely implemented | Most use uniform noise | | Dependency-Aware Training | Partially addressed | Single-token training common | | Parallel Consistency | Experimental | Joint decoding uncommon | | Structure Respecting | Not standard | Would add training complexity | | Token Boundary Robustness | Not well-studied | Underexplored area |
Despite limitations, text diffusion has advantages in:
When building a text diffusion system, explicitly address:
testing
Uses flow maps as look-ahead operators to enable principled reward-guided diffusion by predicting trajectory endpoints at any denoising step. Deploy when applying rewards or preferences to diffusion trajectories with meaningful gradients throughout generation.
testing
Train language models where each expert learns independently on closed datasets, enabling flexible inference with selective data inclusion or exclusion. 41% performance improvement while allowing users to opt out of specific data sources without retraining.
data-ai
Understand how token generation flexibility in diffusion LMs paradoxically constrains reasoning, as models exploit ordering flexibility to avoid uncertain tokens, and apply simplified approaches that preserve parallel decoding benefits. Use when optimizing diffusion-based language models for reasoning tasks.
devops
Enable LLM agents to improve continuously during deployment by constructing structured experience libraries through self-reflection on successes and failures—achieving 23% improvement on reasoning without gradient-based parameter updates or external training.