Files
project_6/qwen3_6_scripts
project6 c17c490e06 fix(GDN): remove pre-cumsum clamp — match xllm reference, fix 99.98% NaN
ROOT CAUSE: g.clamp(-5,2) before cumsum corrupted gate values.
The GDN algorithm computes decay_mask = exp(g_i - g_j) which is
numerically stable via subtraction cancelling cumsum growth.
Pre-clamping g distorts these differences → wrong decay rates → NaN.

xllm reference: qwen3_gated_delta_net_base.cpp lines 170-238
- cumsum first (no pre-clamp)
- difference form: (g_i_last - g[:, i]).exp() for state update
- k_cumdecay uses g.exp() directly (not clamped)

Removed: g.clamp(-5,2), g.clamp(-20,20), g_exp_cache, g_clamped
Added: xllm-style g_i_last/g_exp_term/k_g_exp state update
2026-08-10 07:44:03 +00:00
..