skills/skillxiv-v0.0.2-claude-opus-4.6/deep-forcing-long-video/SKILL.md
Maintains half of sliding window as attention sinks with dynamic temporal RoPE alignment plus importance-aware KV cache pruning, enabling 12× extrapolation beyond training length (60+ seconds from 5-second training) without fine-tuning.
npx skillsauth add ADu2021/skillXiv deep-forcing-long-videoInstall 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.
Deep Forcing introduces two mechanisms enabling long video generation without fine-tuning. Deep Sink maintains approximately half of the sliding window as attention sinks while dynamically adjusting temporal RoPE to align sink tokens with current timeline. Participative Compression performs importance-aware KV cache pruning by computing attention scores between recent and candidate tokens. Together these enable 12× extrapolation with maintained visual quality.
Deep Sink Mechanism: Attention sinks are tokens that absorb excess attention mass, preventing context collapse. The key insight is maintaining them at the current timeline:
Sliding window: [sink_1, sink_2, ..., recent_1, recent_2, recent_3]
^--- Half are sinks (fixed at current time)
Dynamic Temporal RoPE: Adjust rotary positional embeddings to align sink positions with current timeline even as the window slides:
rope_angle(sink_t) = current_time - training_length/2
Participative Compression: Prune KV cache by importance:
Sliding window with sinks:
def sliding_window_with_sinks(kv_cache, window_size=256):
sink_ratio = 0.5
sink_size = int(window_size * sink_ratio)
# Maintain sinks at front
sinks = kv_cache[:sink_size]
recent = kv_cache[-sink_size:]
# Concatenate sinks + recent tokens
windowed_kv = torch.cat([sinks, recent], dim=0)
return windowed_kv
Dynamic temporal RoPE:
def dynamic_temporal_rope(positions, current_time, training_length):
# Sink positions: earlier in sequence
sink_positions = torch.arange(len(positions) // 2)
# Adjust sink angles to current time
sink_angles = current_time - (training_length / 2) + sink_positions
# Recent positions: keep original angles
recent_angles = current_time + torch.arange(len(positions) // 2)
combined_angles = torch.cat([sink_angles, recent_angles])
# Apply rotary embedding
freqs = 1.0 / (10000 ** (torch.arange(0, dim, 2).float() / dim))
angles = combined_angles.unsqueeze(-1) @ freqs.unsqueeze(0)
rope = torch.cat([torch.cos(angles), torch.sin(angles)], dim=-1)
return rope
Importance-aware pruning:
def participative_compression(query, kv_cache, sparsity=0.8):
# Compute attention scores for all KV tokens
scores = query @ kv_cache['keys'].T # [seq_len, kv_len]
# Keep top scoring tokens
keep_ratio = 1.0 - sparsity
num_keep = int(kv_cache['keys'].shape[0] * keep_ratio)
top_k_indices = torch.topk(scores.max(dim=0).values, num_keep).indices
# Prune KV cache
pruned_k = kv_cache['keys'][top_k_indices]
pruned_v = kv_cache['values'][top_k_indices]
return {'keys': pruned_k, 'values': pruned_v}
Long video generation loop:
def generate_long_video(prompt, num_frames=1440): # 60 sec at 24fps
# Initialize from prompt
video = initialize_from_prompt(prompt)
kv_cache = {}
for frame_idx in range(num_frames):
# Apply sliding window + sinks
windowed_kv = sliding_window_with_sinks(kv_cache, window_size=256)
# Apply dynamic temporal RoPE
rope = dynamic_temporal_rope(
positions=torch.arange(windowed_kv.shape[0]),
current_time=frame_idx,
training_length=120 # 5 seconds at 24fps
)
# Apply importance-aware pruning
pruned_kv = participative_compression(
query=video[-1],
kv_cache=windowed_kv,
sparsity=0.8
)
# Generate next frame
next_frame = model(video[-1], pruned_kv, rope)
video = torch.cat([video, next_frame.unsqueeze(0)], dim=0)
# Update cache
kv_cache = update_cache(pruned_kv, next_frame)
return video
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.