skills/skillxiv-v0.0.2-claude-opus-4.6/fastcurl-curriculum-rl-efficient-reasoning/SKILL.md
Train efficient reasoning models using stage-wise context scaling and complexity-aware data selection. Achieves 49.6% accuracy on AIME 2024 while reducing training steps by 50% through alternating compress-extend cycles that progressively refine reasoning quality.
npx skillsauth add ADu2021/skillXiv fastcurl-curriculum-rl-efficient-reasoningInstall 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.
FastCuRL addresses the training inefficiency of large reasoning models by jointly optimizing context length and training data complexity through a curriculum learning framework. The key insight is that controlling context length and selecting data based on problem complexity can significantly improve RL training efficiency while generating more concise Chain-of-Thought (CoT) outputs. The approach uses a cyclical compress-extend strategy that iteratively refines reasoning outputs.
FastCuRL integrates three main components:
The GRPO objective maximizes policy improvements with KL divergence regularization and optional entropy bonus:
# Simplified GRPO loss computation
import torch
import torch.nn.functional as F
def compute_grpo_loss(policy_logits, old_policy_logits, rewards,
kl_coefficient=0.02, entropy_coeff=0.01, epsilon=0.2):
"""
Compute Group Relative Policy Optimization loss.
Args:
policy_logits: logits from current policy
old_policy_logits: logits from reference policy
rewards: shape [batch, group_size]
kl_coefficient: KL penalty weight
entropy_coeff: entropy bonus weight
epsilon: clipping threshold
"""
# Normalize advantages across group
mean_reward = rewards.mean(dim=-1, keepdim=True)
std_reward = rewards.std(dim=-1, keepdim=True) + 1e-8
advantages = (rewards - mean_reward) / std_reward
# Compute log probability ratio
log_ratio = policy_logits - old_policy_logits
ratio = torch.exp(log_ratio)
# Clipped surrogate objective
surr1 = ratio * advantages
surr2 = torch.clamp(ratio, 1-epsilon, 1+epsilon) * advantages
policy_loss = -torch.min(surr1, surr2).mean()
# KL divergence penalty
kl_loss = kl_coefficient * ((ratio - 1) - log_ratio).mean()
# Optional entropy bonus for exploration
entropy = -torch.sum(torch.softmax(policy_logits, -1) *
torch.log_softmax(policy_logits, -1), dim=-1)
entropy_loss = -entropy_coeff * entropy.mean()
return policy_loss + kl_loss + entropy_loss
Segment the training dataset by input prompt length to match problem complexity with context requirements:
def partition_dataset_by_complexity(dataset,
complexity_thresholds=None):
"""
Partition dataset into complexity levels based on prompt length.
Args:
dataset: list of (prompt, response) tuples
complexity_thresholds: percentile cutoffs [25, 75] for L1/L2/L3
Returns:
dict with keys 'L1' (short), 'L2' (medium), 'L3' (long)
"""
prompt_lengths = [len(item['prompt'].split()) for item in dataset]
if complexity_thresholds is None:
# Use percentile-based splitting
p25 = np.percentile(prompt_lengths, 25)
p75 = np.percentile(prompt_lengths, 75)
complexity_thresholds = [p25, p75]
partitions = {'L1': [], 'L2': [], 'L3': []}
for item, length in zip(dataset, prompt_lengths):
if length <= complexity_thresholds[0]:
partitions['L1'].append(item)
elif length <= complexity_thresholds[1]:
partitions['L2'].append(item)
else:
partitions['L3'].append(item)
return partitions
Implement the multi-stage training with alternating context lengths:
def train_with_stage_scaling(model, train_partitions, num_stages=5,
context_lengths=None, epochs_per_stage=1):
"""
Train model using stage-wise context scaling curriculum.
Args:
model: the reasoning model to train
train_partitions: dict with 'L1', 'L2', 'L3' datasets
num_stages: number of training stages
context_lengths: list of context window sizes per stage
epochs_per_stage: epochs per stage (typically 1 for efficiency)
"""
if context_lengths is None:
# Example: compress-extend cycle
context_lengths = [8192, 8192, 16384, 16384, 24576]
stage_configs = [
# Stage 1: L1 (short) at 8K context
{'dataset': train_partitions['L1'], 'context': context_lengths[0]},
# Stage 2: L2 (medium) at 8K context
{'dataset': train_partitions['L2'], 'context': context_lengths[1]},
# Stage 3: L2 (medium) at 16K context (extend phase)
{'dataset': train_partitions['L2'], 'context': context_lengths[2]},
# Stage 4: L3 (long) at 16K context
{'dataset': train_partitions['L3'], 'context': context_lengths[3]},
# Stage 5: L3 (long) at 24K context
{'dataset': train_partitions['L3'], 'context': context_lengths[4]},
]
for stage_idx, config in enumerate(stage_configs):
print(f"Training Stage {stage_idx + 1}: "
f"dataset={list(train_partitions.keys())[stage_idx % 3]}, "
f"context={config['context']}")
# Set model context window
model.config.max_position_embeddings = config['context']
# Train on this stage's dataset
for epoch in range(epochs_per_stage):
for batch in DataLoader(config['dataset'], batch_size=8):
# Forward pass with GRPO
loss = compute_grpo_loss(batch, model)
loss.backward()
optimizer.step()
optimizer.zero_grad()
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.