KitsuVp commited on
Commit
7f31298
·
verified ·
1 Parent(s): 59581fd

Update configuration_neollm.py

Browse files
Files changed (1) hide show
  1. configuration_neollm.py +16 -9
configuration_neollm.py CHANGED
@@ -556,8 +556,8 @@ class NeoLLMConfig(PretrainedConfig):
556
  ``0 <= repo_start_layer < num_hidden_layers`` when
557
  ``use_repo=True``, ``use_repo_grape=True`` or
558
  ``use_repo_goat_prior=True``.
559
- - At most one of ``use_laurel=True``, ``use_attn_res=True``,
560
- ``use_stack_memory=True`` or ``use_siamesenorm=True`` may be active.
561
  - When ``use_laurel=True``, at least one of ``use_laurel_rw`` or
562
  ``use_laurel_lr`` must be ``True``.
563
  - ``stack_d_model`` must be divisible by ``num_mem_heads`` when
@@ -686,8 +686,8 @@ class NeoLLMConfig(PretrainedConfig):
686
  use_attn_res=False,
687
  attn_res_num_blocks=4,
688
  # ── StackMemory / STACKTRANS (Zhang et al., NeurIPS 2025) ───────
689
- use_stack_memory=False,
690
- stack_d_model=32, # H * d_s = 4 * 16
691
  num_mem_heads=4, # H = 4
692
  stack_slots=16, # S = 24
693
  stack_memory_cache_size=2048,
@@ -931,9 +931,9 @@ class NeoLLMConfig(PretrainedConfig):
931
  )
932
 
933
  # ── Residual-flow mechanism mutex ─────────────────────────────────
934
- # AttnRes, LAuReL, StackMemory and SiameseNorm all alter the residual
935
- # topology. Keep exactly one experimental residual-flow mechanism
936
- # active at a time so ablations remain interpretable.
937
  _residual_flow_flags = {
938
  "use_laurel": bool(use_laurel),
939
  "use_attn_res": bool(use_attn_res),
@@ -943,11 +943,18 @@ class NeoLLMConfig(PretrainedConfig):
943
  _active_residual_flow = [
944
  name for name, enabled in _residual_flow_flags.items() if enabled
945
  ]
946
- if len(_active_residual_flow) > 1:
 
 
 
 
 
 
947
  raise ValueError(
948
  "Enable at most one residual-flow mechanism among "
949
  "`use_laurel`, `use_attn_res`, `use_stack_memory`, "
950
- "and `use_siamesenorm`. "
 
951
  f"Active flags: {_active_residual_flow}."
952
  )
953
 
 
556
  ``0 <= repo_start_layer < num_hidden_layers`` when
557
  ``use_repo=True``, ``use_repo_grape=True`` or
558
  ``use_repo_goat_prior=True``.
559
+ - At most one residual-flow mechanism may be active, except the
560
+ explicit ``use_stack_memory=True`` + ``use_siamesenorm=True`` pair.
561
  - When ``use_laurel=True``, at least one of ``use_laurel_rw`` or
562
  ``use_laurel_lr`` must be ``True``.
563
  - ``stack_d_model`` must be divisible by ``num_mem_heads`` when
 
686
  use_attn_res=False,
687
  attn_res_num_blocks=4,
688
  # ── StackMemory / STACKTRANS (Zhang et al., NeurIPS 2025) ───────
689
+ use_stack_memory=False,
690
+ stack_d_model=24, # H * d_s = 4 * 16
691
  num_mem_heads=4, # H = 4
692
  stack_slots=16, # S = 24
693
  stack_memory_cache_size=2048,
 
931
  )
932
 
933
  # ── Residual-flow mechanism mutex ─────────────────────────────────
934
+ # AttnRes and LAuReL compete directly with residual topology.
935
+ # StackMemory may be paired with SiameseNorm because it acts on the
936
+ # shared block input, while SiameseNorm owns the X/Y stream updates.
937
  _residual_flow_flags = {
938
  "use_laurel": bool(use_laurel),
939
  "use_attn_res": bool(use_attn_res),
 
943
  _active_residual_flow = [
944
  name for name, enabled in _residual_flow_flags.items() if enabled
945
  ]
946
+ allow_stack_siamese = (
947
+ bool(use_stack_memory)
948
+ and bool(use_siamesenorm)
949
+ and not bool(use_laurel)
950
+ and not bool(use_attn_res)
951
+ )
952
+ if len(_active_residual_flow) > 1 and not allow_stack_siamese:
953
  raise ValueError(
954
  "Enable at most one residual-flow mechanism among "
955
  "`use_laurel`, `use_attn_res`, `use_stack_memory`, "
956
+ "and `use_siamesenorm`, except the explicit "
957
+ "`use_stack_memory` + `use_siamesenorm` pair. "
958
  f"Active flags: {_active_residual_flow}."
959
  )
960