KitsuVp commited on
Commit
ab90e76
·
verified ·
1 Parent(s): 86785c2

Update configuration_neollm.py

Browse files
Files changed (1) hide show
  1. configuration_neollm.py +31 -12
configuration_neollm.py CHANGED
@@ -154,7 +154,13 @@ class NeoLLMConfig(PretrainedConfig):
154
  periodicities in the feature space.
155
  dropout_rate (:obj:`float`, *optional*, defaults to 0.1):
156
  General dropout probability for attention outputs and MLP states.
157
- use_token_generator (:obj:`bool`, *optional*, defaults to ``True``):
 
 
 
 
 
 
158
  Replace the discrete vocabulary embedding lookup table with a
159
  **Leviathan** continuous token generator (Batley & Saha, 2026).
160
 
@@ -177,12 +183,14 @@ class NeoLLMConfig(PretrainedConfig):
177
  surfaces when ``use_jtokm=True``.
178
  generator_num_modes (:obj:`int`, *optional*, defaults to 8):
179
  Number of independent per-head generator modes. Each mode has its
180
- own preprocessing (Dense + LayerNorm + sigmoid(x/2)), its own
181
- learnable per-dimension scale, its own spline weights, and its own
182
- output projection. Head outputs are summed to form the embedding.
 
183
  generator_num_knots (:obj:`int`, *optional*, defaults to 32):
184
- Number of B-spline knot points on ``[0, 1]``. Shared between the
185
- input generator heads and all JTok-M surfaces.
 
186
  generator_spline_degree (:obj:`int`, *optional*, defaults to 2):
187
  Polynomial degree of the B-spline basis. Kept for documentation;
188
  the closed-form KHRONOS quadratic kernel is used in practice.
@@ -191,11 +199,13 @@ class NeoLLMConfig(PretrainedConfig):
191
  generator_krank (:obj:`int`, *optional*, defaults to 64):
192
  Output rank of each per-head KHRONOS tensor-product kernel inside
193
  the Leviathan generator. Each of the ``generator_num_modes`` heads
194
- produces a vector of this dimensionality via the tensor product
195
  aggregation, which is then projected independently to
196
- ``hidden_size`` via ``head_out[i]``. Matches the ``krank=64``
197
- default in the original ``ckhronos.py`` implementation.
198
- Ignored when ``use_token_generator=False``.
 
 
199
  use_jtokm (:obj:`bool`, *optional*, defaults to ``False``):
200
  Enable the **Leviathan-JTok-M** token-indexed modulation module
201
  (Yang et al., 2026; fused with Leviathan geometry).
@@ -567,7 +577,7 @@ class NeoLLMConfig(PretrainedConfig):
567
  head_dim=64,
568
  use_momentum_attention=True,
569
  momentum_gamma=0.10,
570
- use_mea_attention=True,
571
  mea_component_key_value_heads=None,
572
  mea_groupnorm_eps=1e-6,
573
  use_lucid_attention=False,
@@ -594,8 +604,10 @@ class NeoLLMConfig(PretrainedConfig):
594
  fan_ratio=0.125,
595
  fan_ratio_ffn=0.0625,
596
  dropout_rate=0.1,
 
 
597
  # ── Leviathan continuous token generator ──────────────────────────
598
- use_token_generator=False,
599
  generator_d_seed=128,
600
  generator_num_modes=8,
601
  generator_num_knots=32,
@@ -841,6 +853,13 @@ class NeoLLMConfig(PretrainedConfig):
841
  # ── Regularization ────────────────────────────────────────────────
842
  self.dropout_rate = dropout_rate
843
 
 
 
 
 
 
 
 
844
  # ── Leviathan generator ───────────────────────────────────────────
845
  self.use_token_generator = use_token_generator
846
  self.generator_d_seed = generator_d_seed
 
154
  periodicities in the feature space.
155
  dropout_rate (:obj:`float`, *optional*, defaults to 0.1):
156
  General dropout probability for attention outputs and MLP states.
157
+ use_embedding_input_norm (:obj:`bool`, *optional*, defaults to ``True``):
158
+ Controls only the first pre-attention normalisation applied to the
159
+ raw embedding stream. When ``True``, layer 0 applies ``SeeDNorm``
160
+ before its attention block, preserving the previous behaviour. When
161
+ ``False``, layer 0 receives the raw token embeddings directly while
162
+ all deeper decoder layers keep their normal pre-norm flow unchanged.
163
+ use_token_generator (:obj:`bool`, *optional*, defaults to ``False``):
164
  Replace the discrete vocabulary embedding lookup table with a
165
  **Leviathan** continuous token generator (Batley & Saha, 2026).
166
 
 
183
  surfaces when ``use_jtokm=True``.
184
  generator_num_modes (:obj:`int`, *optional*, defaults to 8):
185
  Number of independent per-head generator modes. Each mode has its
186
+ own preprocessing (Dense without bias + LayerNorm + sigmoid(x/2)),
187
+ its own learnable per-dimension scale, its own delta-parameterized
188
+ spline weights ``1 + wd_i``, and its own output projection. Head
189
+ outputs are summed to form the embedding.
190
  generator_num_knots (:obj:`int`, *optional*, defaults to 32):
191
+ Number of B-spline knot points on ``[0, 1]``. The quadratic basis
192
+ is explicitly normalized across the knot dimension after evaluation.
193
+ Shared between the input generator heads and all JTok-M surfaces.
194
  generator_spline_degree (:obj:`int`, *optional*, defaults to 2):
195
  Polynomial degree of the B-spline basis. Kept for documentation;
196
  the closed-form KHRONOS quadratic kernel is used in practice.
 
199
  generator_krank (:obj:`int`, *optional*, defaults to 64):
200
  Output rank of each per-head KHRONOS tensor-product kernel inside
201
  the Leviathan generator. Each of the ``generator_num_modes`` heads
202
+ produces a vector of this dimensionality via the tensor-product
203
  aggregation, which is then projected independently to
204
+ ``hidden_size`` via ``head_out[i]``. ``64`` matches the author
205
+ clarification for ``wd_i`` with shape ``(128, 32, 64)``. Lower
206
+ values, such as ``32``, are valid memory-saving variants but are
207
+ not the full paper-faithful default. Ignored when
208
+ ``use_token_generator=False``.
209
  use_jtokm (:obj:`bool`, *optional*, defaults to ``False``):
210
  Enable the **Leviathan-JTok-M** token-indexed modulation module
211
  (Yang et al., 2026; fused with Leviathan geometry).
 
577
  head_dim=64,
578
  use_momentum_attention=True,
579
  momentum_gamma=0.10,
580
+ use_mea_attention=False,
581
  mea_component_key_value_heads=None,
582
  mea_groupnorm_eps=1e-6,
583
  use_lucid_attention=False,
 
604
  fan_ratio=0.125,
605
  fan_ratio_ffn=0.0625,
606
  dropout_rate=0.1,
607
+ # ── Embedding input normalization ─────────────────────────────────
608
+ use_embedding_input_norm=False,
609
  # ── Leviathan continuous token generator ──────────────────────────
610
+ use_token_generator=True,
611
  generator_d_seed=128,
612
  generator_num_modes=8,
613
  generator_num_knots=32,
 
853
  # ── Regularization ────────────────────────────────────────────────
854
  self.dropout_rate = dropout_rate
855
 
856
+ # ── Embedding input normalization ───────────────���─────────────────
857
+ # True preserves the previous layer-0 pre-norm path:
858
+ # embeddings -> SeeDNorm -> LNS -> attention.
859
+ # False bypasses only that first SeeDNorm so raw embeddings enter the
860
+ # first attention block; layers >= 1 keep their pre-norm unchanged.
861
+ self.use_embedding_input_norm = use_embedding_input_norm
862
+
863
  # ── Leviathan generator ───────────────────────────────────────────
864
  self.use_token_generator = use_token_generator
865
  self.generator_d_seed = generator_d_seed