Views
No views yet
scalar_bias=True — a single shared (1,) bias across all neurons (matches the clean theoretical formulation of YatNMN). Trained in JAX/Flax on TPU v6e-8 to Chinchilla-optimal token budget on C4, then ported to PyTorch for easy inference via the HuggingFace transformers API.| MLP variant | Final smooth loss | vs GELU |
|---|---|---|
| YatNMN-Softplus (per-neuron bias) | 2.98 | −0.13 |
| YatNMN-Softplus + scalar_bias (this model) | 3.06 | −0.05 |
| GELU | 3.11 | baseline |
mlnomad/yatnmn-softplus-sb-d12-chinchilla-261M) — parity validated at max |Δ logits| = 1.6e-5 on CPU/fp32.pip install torch transformers safetensors1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4model = AutoModelForCausalLM.from_pretrained(
5 "mlnomad/yatnmn-softplus-sb-d12-chinchilla-261M-pytorch",
6 trust_remote_code=True,
7 dtype=torch.float32,
8).eval()
9
10tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-v0.1")
11
12prompt = "The meaning of life is"
13ids = tokenizer(prompt, return_tensors="pt").input_ids
14with torch.no_grad():
15 out = model.generate(
16 ids, max_new_tokens=50,
17 do_sample=True, temperature=0.8, top_p=0.9,
18 use_cache=True, pad_token_id=tokenizer.eos_token_id or 0,
19 )
20print(tokenizer.decode(out[0], skip_special_tokens=True))nmn>=0.2.29:y = α · (x · W + softplus(b))² / (||x − W||² + softplus(ε))b shape (1,) — single shared bias across all 4·n_embd = 3072 neurons (scalar_bias=True)ε shape (1,) — single learnable epsilon, kept positive via softplusα shape (1,) — single learnable scalar, applied as a final gainc_proj (Linear → 768) on top of YatNMN's output(x·W + b)² in the numerator and ||x − W||² in the denominator are both per-neuron quantities. A scalar bias preserves the per-neuron geometric interpretation cleanly, whereas a per-neuron bias (ff,) adds extra parameters that break the symmetry. Empirically the per-neuron variant beats this scalar one by 0.08 nats at d=12 — those extra parameters do help in practice — but scalar_bias=True is closer to the YatNMN definition.| Parameters | 261,096,374 |
| Architecture | Nanochat-style GPT with YatNMN-Softplus + scalar_bias MLP (ported from JAX/Flax NNX) |
| Config | d=12, n_embd=768, n_head=12, n_kv_head=12, seq_len=1024, tied embeddings, SSSL sliding window |
| Training data | allenai/c4 (English split), 5.22 B tokens (Chinchilla 20×) |
| Tokenizer | mistralai/Mistral-7B-v0.1 (vocab 32,768) |
| Optimizer | plain AdamW, peak LR 0.03, warmup-cosine |
| Hardware | TPU v6e-8 (TRC), europe-west4-a |
| Final loss (smooth) | 3.06 |
(1,) bias, softplus-positive, learnable α and ε)"SSSL" patternresid_lambdas, x0_lambdas)15 · tanh(logits / 15)YatGPTForCausalLM class implements a smear-aware KV cache for fast autoregressive generation. Pass use_cache=True (the default for .generate())..
├── config.json # HF config with auto_map → the classes below
├── generation_config.json
├── model.safetensors # ~1.04 GB, fp32 weights + persistent RoPE buffers
├── yatnmn_gpt.py # pure PyTorch Yat_GPT module + YatNMN layer
├── torch_gpt.py # shared building blocks (RMSNorm, RoPE, attention)
├── configuration_yatnmn_gpt.py # PretrainedConfig subclass
├── modeling_yatnmn_gpt.py # PreTrainedModel + GenerationMixin wrapper with KV cache
└── README.mdmlnomad/yatnmn-softplus-sb-d12-chinchilla-261M — original JAX/Flax Orbax checkpoint (model + AdamW optimizer state, resumable)mlnomad/yatnmn-softplus-d12-chinchilla-261M-pytorch — per-neuron bias variant (better loss: 2.98 vs 3.06)mlnomad/gelu-d12-chinchilla-261M-pytorch — GELU baseline at identical compute, smooth loss 3.11nmn — the YatNMN layer (used at training time; not required for inference here, the nonlinearity is reimplemented in pure PyTorch)| Metric | Value |
|---|---|
| Wikitext-103 test loss | 3.677 |
| Wikitext-103 test PPL | 39.53 |