KitsuVp commited on
Commit
38f7c5e
·
verified ·
1 Parent(s): 0d6a8d0

Update configuration_neollm.py

Browse files
Files changed (1) hide show
  1. configuration_neollm.py +29 -5
configuration_neollm.py CHANGED
@@ -82,7 +82,10 @@ class NeoLLMConfig(PretrainedConfig):
82
  meap_mask_ratio (:obj:`float`, *optional*, defaults to ``0.15``):
83
  Fraction of eligible input positions replaced in each sequence.
84
  meap_mask_token_id (:obj:`int`, *optional*):
85
- Token ID used as the MEAP replacement. Required when MEAP is enabled.
 
 
 
86
  meap_seed (:obj:`int`, *optional*, defaults to ``0``):
87
  Base 32-bit seed. The Trainer derives a distinct deterministic seed
88
  for each microstep and distributed process.
@@ -699,6 +702,9 @@ class NeoLLMConfig(PretrainedConfig):
699
  mile_loss_gamma=1.0,
700
  use_mu_loss=True,
701
  mu_loss_lambda=1e-4,
 
 
 
702
  use_meap=False,
703
  meap_mask_ratio=0.15,
704
  meap_mask_token_id=None,
@@ -773,7 +779,7 @@ class NeoLLMConfig(PretrainedConfig):
773
  # ── PolyNorm exclusivity ──────────────────────────────────────────
774
  polynorm_exclusive=False,
775
  # ── Spelling Bee Embeddings (Rabe et al., 2026) ───────────────────
776
- use_spelling_bee_embeddings=True,
777
  # ── Context Re-Positioning (Li et al., 2026) ──────────────────────
778
  use_repo=True,
779
  repo_start_layer=None,
@@ -822,7 +828,7 @@ class NeoLLMConfig(PretrainedConfig):
822
  nextlat_kl_weight=1.0,
823
  nextlat_dynamics_proj_factor=1.0,
824
  # ── Interleaved Head Attention (Duvvuri et al., 2026) ─────────────
825
- use_iha=True,
826
  iha_num_pseudo_heads=2, # P=2 → 2×2=4 patrones por head
827
  iha_local_global_pattern="LLLLG", # 4 locales + 1 global (paper §5.1)
828
  iha_sliding_window=None, # auto = context // (2*P^2), independent of padding
@@ -863,8 +869,26 @@ class NeoLLMConfig(PretrainedConfig):
863
  )
864
  if use_meap and meap_mask_token_id is None:
865
  raise ValueError("`meap_mask_token_id` is required when `use_meap=True`.")
866
- if meap_mask_token_id is not None and int(meap_mask_token_id) < 0:
867
- raise ValueError("`meap_mask_token_id` must be a non-negative integer.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
868
  if not isinstance(meap_seed, int) or not 0 <= meap_seed <= 0xFFFFFFFF:
869
  raise ValueError("`meap_seed` must be an integer in [0, 2**32 - 1].")
870
  meap_implementation = str(meap_implementation).strip().lower()
 
82
  meap_mask_ratio (:obj:`float`, *optional*, defaults to ``0.15``):
83
  Fraction of eligible input positions replaced in each sequence.
84
  meap_mask_token_id (:obj:`int`, *optional*):
85
+ Dedicated reserved token ID used only as the MEAP replacement.
86
+ Required when MEAP is enabled; it must be inside the vocabulary and
87
+ distinct from PAD/BOS/EOS. Its final trainable representation is
88
+ independent from dense embeddings, Leviathan, and Spelling Bee.
89
  meap_seed (:obj:`int`, *optional*, defaults to ``0``):
90
  Base 32-bit seed. The Trainer derives a distinct deterministic seed
91
  for each microstep and distributed process.
 
702
  mile_loss_gamma=1.0,
703
  use_mu_loss=True,
704
  mu_loss_lambda=1e-4,
705
+ # Must remain disabled in the no-argument configuration. Transformers
706
+ # constructs ``NeoLLMConfig()`` while saving to determine class defaults;
707
+ # training enables MEAP explicitly together with its mask token ID.
708
  use_meap=False,
709
  meap_mask_ratio=0.15,
710
  meap_mask_token_id=None,
 
779
  # ── PolyNorm exclusivity ──────────────────────────────────────────
780
  polynorm_exclusive=False,
781
  # ── Spelling Bee Embeddings (Rabe et al., 2026) ───────────────────
782
+ use_spelling_bee_embeddings=False,
783
  # ── Context Re-Positioning (Li et al., 2026) ──────────────────────
784
  use_repo=True,
785
  repo_start_layer=None,
 
828
  nextlat_kl_weight=1.0,
829
  nextlat_dynamics_proj_factor=1.0,
830
  # ── Interleaved Head Attention (Duvvuri et al., 2026) ─────────────
831
+ use_iha=False,
832
  iha_num_pseudo_heads=2, # P=2 → 2×2=4 patrones por head
833
  iha_local_global_pattern="LLLLG", # 4 locales + 1 global (paper §5.1)
834
  iha_sliding_window=None, # auto = context // (2*P^2), independent of padding
 
869
  )
870
  if use_meap and meap_mask_token_id is None:
871
  raise ValueError("`meap_mask_token_id` is required when `use_meap=True`.")
872
+ if meap_mask_token_id is not None:
873
+ meap_mask_token_id = int(meap_mask_token_id)
874
+ if not 0 <= meap_mask_token_id < int(vocab_size):
875
+ raise ValueError(
876
+ "`meap_mask_token_id` must be inside the configured vocabulary."
877
+ )
878
+ if use_meap:
879
+ reserved_for_model = {
880
+ token_id
881
+ for token_id in (
882
+ kwargs.get("pad_token_id"),
883
+ kwargs.get("bos_token_id"),
884
+ kwargs.get("eos_token_id"),
885
+ )
886
+ if token_id is not None
887
+ }
888
+ if meap_mask_token_id in reserved_for_model:
889
+ raise ValueError(
890
+ "`meap_mask_token_id` must differ from PAD, BOS, and EOS."
891
+ )
892
  if not isinstance(meap_seed, int) or not 0 <= meap_seed <= 0xFFFFFFFF:
893
  raise ValueError("`meap_seed` must be an integer in [0, 2**32 - 1].")
894
  meap_implementation = str(meap_implementation).strip().lower()