Dissipative Softmax Latent Layer / token_expert_sequence_snapshot.py

Failed on benchmark

Raw ⬇ ZIP
 1"""Кастомный трек «token_expert_sequence» — добавлен экспериментом.
 2Провенанс: эксперимент #714 «Maximum-cardinality token-expert routing»
 3Дата: 2026-09-01 01:44
 4Автоматическая приёмка: смок-тест пройден."""
 5import numpy as np
 6META={"name":"token_expert_sequence","domain":"moe-routing","description":"Synthetic multi-token classification where each example contains correlated tokens processed by capacity-limited experts."}
 7def get_dataset(seed,n_train,n_test):
 8    def gen(s,n):
 9        rng=np.random.default_rng(s); y=rng.integers(0,2,n)
10        # class controls a shared latent direction; tokens are correlated observations
11        z=(2*y-1)[:,None,None].astype(np.float32)
12        x=z*np.array([1.,-.7,.45],np.float32)[None,None,:]+rng.normal(0,.85,(n,8,3)).astype(np.float32)
13        x += rng.normal(0,.25,(n,1,3)).astype(np.float32)
14        return x,y.astype(np.int64)
15    xtr,ytr=gen(seed,n_train); xte,yte=gen(seed+5000,n_test)
16    return {"xtr":xtr,"ytr":ytr,"xte":xte,"yte":yte,"task":"classification","metric":"err","out_dim":2}