Skip to content

Commit f696bb3

Browse files
committed
transformerless_lm: split-brain rank-modulated mixer
v73 geometric mean: too restrictive. v74 golden weighted: too lax in cycle 3. v75 resonance gate: dip at cycle 4. v76 rank-modulated: each hemisphere owns its natural rank-domain. rank 0 (most functional) -> 100% math, 0% lang rank V/2 -> 50/50 rank V-1 (rarest content) -> 0% math, 100% lang Math hemisphere (bigram, recency, anti-stag) dominates function words. Language hemisphere (iambic, anaphora, rhyme) dominates content words. No conflict in regions where one hemisphere doesn't belong. Pure substrate (rank-tier polarity).
1 parent c2bca6b commit f696bb3

1 file changed

Lines changed: 21 additions & 21 deletions

File tree

experiments/transformerless_lm/train_self_recursive.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,33 +1327,33 @@ def _omniweight_apply(base_probs: torch.Tensor,
13271327
def _omniweight_apply_split(base_probs: torch.Tensor,
13281328
math_delta: torch.Tensor,
13291329
lang_delta: torch.Tensor) -> torch.Tensor:
1330-
"""SPLIT-BRAIN omniweight: RESONANCE-AWARE mixer.
1330+
"""SPLIT-BRAIN omniweight: RANK-MODULATED mixer.
13311331
1332-
Math hemisphere: bigram, recency, substrate sampling, anti-stag,
1333-
bigram-saturation. Frequency / decay primitives.
1332+
Per-token weight derived from substrate rank position:
1333+
rank 0 (most-functional) -> math_weight = 1, lang_weight = 0
1334+
rank V/2 -> math_weight = 0.5, lang_weight = 0.5
1335+
rank V-1 (rarest content) -> math_weight = 0, lang_weight = 1
13341336
1335-
Language hemisphere: iambic, anaphora, need-fill, phonotactics,
1336-
rhyme, agreement, word-spacing, char-cascade, pronounceability,
1337-
subject-threading, theme. Purpose / structure primitives.
1337+
Each hemisphere gets sovereignty over its natural domain:
1338+
Math owns frequency/decay -> dominates function words.
1339+
Language owns purpose/structure -> dominates content words.
13381340
1339-
Per-token coherence gate (sign agreement of math_fluid x lang_fluid):
1340-
agree -> push through full sum (resonance)
1341-
conflict -> cancel back toward base (dissonance)
1342-
1343-
Substrate-canonical: coherence = sign(math) * sign(lang) in
1344-
{-1, 0, +1}. Weight = (1 + coherence) / 2 in {0, 0.5, 1}.
1345-
1346-
This models the split-brain corpus-callosum gate: hemispheres
1347-
only push through when they agree.
1341+
No more mixing in regions where one hemisphere doesn't belong.
13481342
"""
13491343
math_fluid = _OMNIWEIGHT_RESERVE * torch.tanh(math_delta / _OMNIWEIGHT_RESERVE)
13501344
lang_fluid = _OMNIWEIGHT_RESERVE * torch.tanh(lang_delta / _OMNIWEIGHT_RESERVE)
1351-
# Per-token sign coherence.
1352-
coherence = torch.sign(math_fluid) * torch.sign(lang_fluid)
1353-
gate = (1.0 + coherence) / 2.0 # in {0, 0.5, 1}
1354-
combined_fluid = (math_fluid + lang_fluid) * gate
1355-
out = base_probs * torch.exp(combined_fluid)
1356-
return out / (out.sum() + 1e-8)
1345+
p_math = base_probs * torch.exp(math_fluid)
1346+
p_lang = base_probs * torch.exp(lang_fluid)
1347+
p_math = p_math / (p_math.sum() + 1e-8)
1348+
p_lang = p_lang / (p_lang.sum() + 1e-8)
1349+
V = base_probs.shape[-1]
1350+
ranks = torch.arange(V, dtype=base_probs.dtype,
1351+
device=base_probs.device)
1352+
rank_norm = ranks / max(V - 1, 1)
1353+
math_w = 1.0 - rank_norm
1354+
lang_w = rank_norm
1355+
p_final = math_w * p_math + lang_w * p_lang
1356+
return p_final / (p_final.sum() + 1e-8)
13571357

13581358

13591359
def autoregressive_generate(model, prompt: torch.Tensor, n_new: int,

0 commit comments

Comments
 (0)