skills/skillxiv-v0.0.2-claude-opus-4.6/derf-normalization-free-transformers/SKILL.md
Replace LayerNorm with Derf(x) = erf(αx + s) for improved generalization in transformers. Derf outperforms LayerNorm across vision, speech, and DNA modeling—ideal when normalization-free training provides benefits without architectural complexity.
npx skillsauth add ADu2021/skillXiv derf-normalization-free-transformersInstall 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.
The paper demonstrates that simpler point-wise functions can replace traditional normalization while achieving superior generalization. Derf, based on rescaled Gaussian CDF, provides normalization-free transformers with improved performance across diverse domains.
Derf activation function design:
# Normalization-free transformers with Derf
class DerfNormalizationFree(nn.Module):
def __init__(self, dim):
super().__init__()
self.alpha = nn.Parameter(torch.ones(1))
self.s = nn.Parameter(torch.zeros(1))
def forward(self, x):
"""Derf(x) = erf(α*x + s)"""
from scipy.special import erf as scipy_erf
# Apply Derf activation
output = torch.erf((self.alpha * x + self.s) / math.sqrt(2.0))
return output
class TransformerBlock(nn.Module):
def __init__(self, dim, num_heads):
super().__init__()
self.attn = nn.MultiheadAttention(dim, num_heads)
# NO LayerNorm, use Derf instead
self.derf = DerfNormalizationFree(dim)
self.ffn = nn.Sequential(
nn.Linear(dim, 4 * dim),
self.derf,
nn.Linear(4 * dim, dim)
)
def forward(self, x):
# Self-attention
attn_output = self.attn(x, x, x)[0]
# Apply Derf instead of LayerNorm
x = x + self.derf(attn_output)
# Feed-forward
ffn_output = self.ffn(x)
# Derf-based combination
x = x + self.derf(ffn_output)
return x
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.