Fix RBF time-bias initialization

This commit is contained in:
2026-07-24 14:43:59 +08:00
parent f6bde7e167
commit 3af823f2e1
2 changed files with 50 additions and 1 deletions

View File

@@ -111,7 +111,10 @@ class TemporalAttention(nn.Module):
# Layer-specific projection from shared RBF basis activations to per-head attention bias.
self.rbf_proj = nn.Linear(n_rbf_bases, n_head, bias=False)
self.time_bias_scale = nn.Parameter(torch.tensor(0.0))
# Keep the initial RBF attention bias exactly zero through the
# zero-initialized projection, while leaving that projection with a
# live gradient from the first optimization step.
self.time_bias_scale = nn.Parameter(torch.tensor(1.0))
self.resid_drop = nn.Dropout(dropout)
self.reset_parameters()