KitsuVp commited on
Commit
f2e13d6
·
verified ·
1 Parent(s): bc28a32

Update configuration_neollm.py

Browse files
Files changed (1) hide show
  1. configuration_neollm.py +37 -0
configuration_neollm.py CHANGED
@@ -79,6 +79,29 @@ class NeoLLMConfig(PretrainedConfig):
79
  Whether to add a bias term to Q, K, V, and output projections.
80
  attention_dropout (:obj:`float`, *optional*, defaults to 0.1):
81
  Dropout probability applied to attention weights during training.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  head_dim (:obj:`int`, *optional*, defaults to 64):
83
  Dimensionality of each attention head.
84
  use_momentum_attention (:obj:`bool`, *optional*, defaults to ``True``):
@@ -666,6 +689,13 @@ class NeoLLMConfig(PretrainedConfig):
666
  partial_rotary_factor=0.25,
667
  attention_bias=False,
668
  attention_dropout=0.1,
 
 
 
 
 
 
 
669
  head_dim=64,
670
  use_momentum_attention=True,
671
  momentum_gamma=0.10,
@@ -1075,6 +1105,13 @@ class NeoLLMConfig(PretrainedConfig):
1075
  # ── Attention ─────────────────────────────────────────────────────
1076
  self.attention_bias = attention_bias
1077
  self.attention_dropout = attention_dropout
 
 
 
 
 
 
 
1078
  self.head_dim = head_dim
1079
  self.use_momentum_attention = use_momentum_attention
1080
  self.momentum_gamma = momentum_gamma
 
79
  Whether to add a bias term to Q, K, V, and output projections.
80
  attention_dropout (:obj:`float`, *optional*, defaults to 0.1):
81
  Dropout probability applied to attention weights during training.
82
+ use_hola_memory (:obj:`bool`, *optional*, defaults to ``False``):
83
+ Enable the FA2-compatible HOLA-derived episodic memory read path for
84
+ the IHA seq-expand branch. This is not a second attention branch: it
85
+ prepends a fixed-size selected KV memory to each FlashAttention-2
86
+ chunk and reads memory/current tokens inside one softmax. The write
87
+ policy uses a compile-friendly value-innovation proxy because the
88
+ stock FlashAttention-2 kernel does not expose the pre-dropout
89
+ accumulators required for the exact HOLA committed-residual score.
90
+ hola_memory_size (:obj:`int`, *optional*, defaults to 64):
91
+ Number of real-token episodes kept per layer/chunk when
92
+ ``use_hola_memory=True``. Each episode stores all IHA pseudo-slots.
93
+ hola_chunk_size (:obj:`int`, *optional*, defaults to 256):
94
+ Number of original tokens processed per HOLA memory chunk. The
95
+ memory is frozen while a chunk is processed and updated between
96
+ chunks, preserving causality with standard FlashAttention-2 masks.
97
+ hola_logit_bias_init (:obj:`float`, *optional*, defaults to -2.0):
98
+ Initial additive logit prior for memory entries in the augmented
99
+ FA2 subspace. Negative values make the model start close to the
100
+ baseline attention and learn to use memory gradually.
101
+ hola_rms_gamma_init (:obj:`float`, *optional*, defaults to 1.0):
102
+ Initial RMSNorm-γ scale for the memory-read query/key subspace.
103
+ hola_score_eps (:obj:`float`, *optional*, defaults to 1e-6):
104
+ Numerical epsilon for the HOLA-derived value-innovation score.
105
  head_dim (:obj:`int`, *optional*, defaults to 64):
106
  Dimensionality of each attention head.
107
  use_momentum_attention (:obj:`bool`, *optional*, defaults to ``True``):
 
689
  partial_rotary_factor=0.25,
690
  attention_bias=False,
691
  attention_dropout=0.1,
692
+ # ── HOLA-derived episodic memory for FlashAttention-2 ─────────────
693
+ use_hola_memory=False,
694
+ hola_memory_size=64,
695
+ hola_chunk_size=256,
696
+ hola_logit_bias_init=-2.0,
697
+ hola_rms_gamma_init=1.0,
698
+ hola_score_eps=1e-6,
699
  head_dim=64,
700
  use_momentum_attention=True,
701
  momentum_gamma=0.10,
 
1105
  # ── Attention ─────────────────────────────────────────────────────
1106
  self.attention_bias = attention_bias
1107
  self.attention_dropout = attention_dropout
1108
+ # ── HOLA-derived episodic memory for FlashAttention-2 ─────────────
1109
+ self.use_hola_memory = bool(use_hola_memory)
1110
+ self.hola_memory_size = int(hola_memory_size)
1111
+ self.hola_chunk_size = int(hola_chunk_size)
1112
+ self.hola_logit_bias_init = float(hola_logit_bias_init)
1113
+ self.hola_rms_gamma_init = float(hola_rms_gamma_init)
1114
+ self.hola_score_eps = float(hola_score_eps)
1115
  self.head_dim = head_dim
1116
  self.use_momentum_attention = use_momentum_attention
1117
  self.momentum_gamma = momentum_gamma