summaryrefslogtreecommitdiff
path: root/src/config.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/config.py')
-rw-r--r--src/config.py21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/config.py b/src/config.py
index 945c259..915cdae 100644
--- a/src/config.py
+++ b/src/config.py
@@ -25,6 +25,9 @@ class Config:
min_steps: int = 2 # ACT: halt prob forced to 0 for the first min_steps-1 steps
n_layers: int = 2
n_heads: int = 4
+ # scratchpad / token-space recurrence (Addendum 8, E8)
+ scratch_mode: str = "none" # "none" | "structured" | "filler" | "random_learned" | "random_frozen" | "random_noise"
+ scratch_len: int = 16 # length of filler / random token sequence
# training
lr: float = 1e-3
lr_decay: bool = False # cosine 1e-3 -> 1e-4 over the run (E3)
@@ -45,7 +48,11 @@ class Config:
@property
def vocab(self) -> int:
- """Token count. Integers mode: value tokens 0..next_prime(range_end), plus EOS (+1) and pad (+1)."""
+ """Token count.
+ - Integers mode: value tokens 0..next_prime(range_end) + EOS + pad.
+ - Digits mode (none): 10 digits + EOS = 11.
+ - Digits mode (scratchpad): 10 digits + EOS + SEP + PAUSE + 16 random (a-p) + 4 structured symbols (c,=,d,:) + 1 noise slot = 34.
+ """
if self.vocab_mode == "integers":
# inline mini-sieve: next prime above range_end bounds the target domain
limit = self.range_end + 100
@@ -57,15 +64,21 @@ class Config:
is_prime[m] = False
np_ = next(i for i in range(self.range_end + 1, limit + 1) if is_prime[i])
return np_ + 2 # values 0..np_, EOS=np_+1, pad=np_+2
- return 11 # digits 0-9 + EOS
+ if self.scratch_mode != "none":
+ return 34 # expanded vocabulary for scratchpad/filler/random tokens
+ return 11 # digits 0-9 + EOS
@property
def eos_id(self) -> int:
- return self.vocab - 1
+ if self.vocab_mode == "integers":
+ return self.vocab - 1
+ if self.scratch_mode != "none":
+ return 10 # fixed ID 10 for EOS in digits mode
+ return self.vocab - 1 # 10 for digits mode none
@property
def pad_id(self) -> int:
- return self.vocab # one extra embedding row reserved for pad
+ return self.vocab # one extra embedding row reserved for pad
def to_json(self) -> dict:
d = {f.name: getattr(self, f.name) for f in fields(self)}