skills/skillxiv-v0.0.2-claude-opus-4.6/diffcot-diffusion-chain-of-thought/SKILL.md
Recast chain-of-thought reasoning as iterative denoising using diffusion principles to overcome exposure bias in autoregressive reasoning. DiffCoT enables retrospective refinement of intermediate steps while maintaining temporal consistency through causal noise scheduling.
npx skillsauth add ADu2021/skillXiv diffcot-diffusion-chain-of-thoughtInstall 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.
Chain-of-thought reasoning in language models suffers from a fundamental vulnerability: early mistakes propagate irreversibly through autoregressive decoding. When step N depends on step N-1, and step N-1 is incorrect, cascading errors accumulate. Additionally, exposure bias—training on gold steps but decoding with model-generated ones—creates distribution mismatch that compounds across steps.
Rather than generate steps linearly in single pass, use sliding-window approach to both generate AND retrospectively refine intermediate steps, maintaining temporal consistency through causal noise scheduling.
class DiffCoT:
def __init__(self, model, num_refine_steps=3):
self.model = model
self.num_refine_steps = num_refine_steps
def forward_with_denoising(self, question):
"""Generate reasoning steps with iterative refinement"""
# Phase 1: Initial step generation
steps = []
cumulative_text = question
while not_done():
# Generate next step
next_step = self.model.generate_step(cumulative_text)
steps.append(next_step)
cumulative_text += next_step
# Phase 2: Iterative refinement via diffusion
for refine_iteration in range(self.num_refine_steps):
# Apply sliding-window retrospective refinement
for window_idx in range(len(steps) - 1):
# Create context: previous steps + current window + future steps
prev_context = "".join(steps[:window_idx])
window_step = steps[window_idx]
next_context = "".join(steps[window_idx + 1:])
# Noisy variant of current step (diffusion noise)
noise_schedule = compute_noise_schedule(
refine_iteration, self.num_refine_steps
)
noisy_step = apply_noise(window_step, noise_schedule)
# Denoising refinement: regenerate with neighboring context
refined_step = self.model.refine_step(
prev_context, noisy_step, next_context
)
# Update if refinement improves coherence
coherence_score = compute_coherence(
prev_context + refined_step + next_context
)
if coherence_score > original_coherence:
steps[window_idx] = refined_step
return steps, final_answer
def compute_noise_schedule(self, iteration, total_iterations):
"""Causal noise scheduling for temporal consistency"""
# Later iterations have less noise (refinement signal strengthens)
noise_level = 1.0 - (iteration / total_iterations)
return {
"magnitude": noise_level * 0.1,
"positions": "random", # Noise applied to random positions within step
"type": "character-level" # Perturbations at character level
}
Sliding-Window Refinement:
Causal Noise Schedule:
Training Details:
Evaluation Configuration:
Multi-Step Reasoning Benchmarks:
Comparison to Baselines:
Ablations:
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.