Model save
Browse files- README.md +78 -530
- config.json +1 -1
- configuration_neollm.py +5 -5
- model.safetensors +2 -2
- modeling_neollm.py +49 -67
- optimizer_precision.json +7 -7
- training_args.bin +1 -1
README.md
CHANGED
|
@@ -1,536 +1,84 @@
|
|
| 1 |
---
|
| 2 |
-
|
| 3 |
-
license: apache-2.0
|
| 4 |
tags:
|
| 5 |
-
-
|
| 6 |
-
-
|
| 7 |
-
-
|
| 8 |
-
|
| 9 |
-
- normalization
|
| 10 |
-
- neollm
|
| 11 |
-
datasets:
|
| 12 |
-
- HuggingFaceFW/fineweb-edu
|
| 13 |
---
|
| 14 |
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
NeoLLM is a **85.16 M parameter** decoder-only language model trained from scratch on
|
| 18 |
-
[FineWeb-Edu](https://huggingface.co/datasets/HuggingFaceFW/fineweb-edu) with
|
| 19 |
-
**BF16** compute, completing training in approximately
|
| 20 |
-
**~1h 00m** on **NVIDIA RTX PRO 6000 Blackwell Server Edition**.
|
| 21 |
-
It integrates a collection of recently published attention and normalization techniques
|
| 22 |
-
into a single architecture, with the goal of studying how they interact during
|
| 23 |
-
pretraining. The model is actively being developed and the current checkpoint represents
|
| 24 |
-
an intermediate training state.
|
| 25 |
-
|
| 26 |
-
> **Author / contact:** [@Kyokopom](https://x.com/Kyokopom) on X
|
| 27 |
-
> **Repository:** [KitsuVp/NeoLLM](https://huggingface.co/KitsuVp/NeoLLM)
|
| 28 |
-
|
| 29 |
-
---
|
| 30 |
-
|
| 31 |
-
## Architecture
|
| 32 |
-
|
| 33 |
-
NeoLLM is a decoder-only transformer with the following configuration:
|
| 34 |
-
|
| 35 |
-
| Parameter | Value |
|
| 36 |
-
|---|---|
|
| 37 |
-
| Hidden size | 512 |
|
| 38 |
-
| Layers | 12 |
|
| 39 |
-
| Attention heads | 8 |
|
| 40 |
-
| KV heads (GQA) | 4 |
|
| 41 |
-
| Head dim | 64 |
|
| 42 |
-
| Attention layers | full: 4, ckda: 8 |
|
| 43 |
-
| Intermediate size | 1536 |
|
| 44 |
-
| Vocabulary | LiquidAI/LFM2.5-1.2B-Thinking tokenizer (64,402 tokens) |
|
| 45 |
-
| Context length | 512 tokens |
|
| 46 |
-
| Leviathan | enabled=True; d_seed=128, modes=8, knots=16 |
|
| 47 |
-
| JTok / JTok-M | enabled=False / False; Torch continuous surfaces, experts=5, top_k=2 |
|
| 48 |
-
| DAGFormer | enabled=False; {'predictor_dim': 256, 'predictor_layers': 2, 'predictor_heads': 4, 'local_dim': 128, 'input_source': 'tokens'} |
|
| 49 |
-
| Linear Depth Memory | enabled=False; groups=8, key dimension=8; shared branch history when combined with SiameseNorm |
|
| 50 |
-
| Virtual Head Attention | enabled=False; query/KV heads follow the configured geometry |
|
| 51 |
-
| Copy-Paste LM | enabled=True; causal vocabulary/pointer mixture |
|
| 52 |
-
|
| 53 |
-
### Parameter breakdown
|
| 54 |
-
|
| 55 |
-
| Parameter bucket | Count |
|
| 56 |
-
|---|---|
|
| 57 |
-
| **Total parameters** | 85.16M (85,162,728) |
|
| 58 |
-
| **Embedding parameters** (tied) | 32.97M (32,973,824) |
|
| 59 |
-
| **Non-embedding parameters** | 52.19M (52,188,904) |
|
| 60 |
-
| **Effective trainable parameters** | 85.16M (85,162,728) |
|
| 61 |
-
|
| 62 |
-
> Weight tying is **enabled**: the input embedding matrix and the language-model head
|
| 63 |
-
> share the same parameters, so the effective trainable budget is
|
| 64 |
-
> `total − embed = 52.19M`.
|
| 65 |
-
|
| 66 |
-
### Integrated techniques
|
| 67 |
-
|
| 68 |
-
NeoLLM combines architecture modules, optional auxiliary objectives, and
|
| 69 |
-
training-time optimizer/stability components from the following papers.
|
| 70 |
-
|
| 71 |
-
**Embedding and token representation**
|
| 72 |
-
|
| 73 |
-
- **Learnable Multipliers** ([arXiv:2601.04890](https://arxiv.org/abs/2601.04890)) — Adds
|
| 74 |
-
per-row and per-column learnable scalar parameters to selected matrix layers and, when
|
| 75 |
-
enabled, embeddings.
|
| 76 |
-
- **Leviathan** ([arXiv:2601.22040](https://arxiv.org/abs/2601.22040)) — Optional
|
| 77 |
-
continuous token embedding generator that can replace the discrete input lookup table.
|
| 78 |
-
- **Leviathan-JTok / JTok-M** ([arXiv:2602.00800](https://arxiv.org/abs/2602.00800)) —
|
| 79 |
-
Optional continuous adaptation of JTok over the shared Leviathan coordinate. JTok
|
| 80 |
-
applies one normalized surface as a multiplicative MLP gate; JTok-M routes a
|
| 81 |
-
Sigmoid+TopK mixture of continuous surfaces and adds the paper's depth-scaled
|
| 82 |
-
residual. Runtime ``jtok_kernel_backend`` selects the PyTorch reference or the
|
| 83 |
-
CCE Triton adapter; the JTok surfaces remain outside MXFP8 conversion.
|
| 84 |
-
- **KHRONOS** ([arXiv:2505.13315](https://arxiv.org/abs/2505.13315)) — Kernel/basis
|
| 85 |
-
reference used by the Leviathan continuous token generator implementation.
|
| 86 |
-
- **Spelling Bee Embeddings** ([arXiv:2601.18030](https://arxiv.org/abs/2601.18030)) —
|
| 87 |
-
Augments token embeddings with character-level spelling information.
|
| 88 |
-
- **Token Embedding Manifold analysis** ([arXiv:2504.01002](https://arxiv.org/abs/2504.01002)) —
|
| 89 |
-
Reference motivation for treating token embeddings as structured objects rather than
|
| 90 |
-
unconstrained lookup rows.
|
| 91 |
-
|
| 92 |
-
**Attention, positions, and output projection**
|
| 93 |
-
|
| 94 |
-
- **Virtual Head Attention** ([arXiv:2610.17959](https://arxiv.org/abs/2610.17959)) — Optional
|
| 95 |
-
group-specific query premix and low-rank head postmix. NeoLLM shares its gated query
|
| 96 |
-
projection across corresponding head slots in KV groups and applies postmix after the gate; inference weights are
|
| 97 |
-
not automatically folded into standard GQA projections.
|
| 98 |
-
- **Copy-Paste LM** ([arXiv:2610.19247](https://arxiv.org/abs/2610.19247)) — Optional
|
| 99 |
-
causal pointer and sink mixed with the vocabulary distribution. CUDA training
|
| 100 |
-
uses CCE's sparse Copy-Paste kernels; inference returns dense mixed logits.
|
| 101 |
-
- **FAN** ([arXiv:2502.21309](https://arxiv.org/abs/2502.21309)) — Fourier Analysis Networks.
|
| 102 |
-
A portion of the projection channels are dedicated to periodic cosine/sine features.
|
| 103 |
-
- **MEA** ([arXiv:2601.19611](https://arxiv.org/abs/2601.19611)) — Explicit Multi-head
|
| 104 |
-
Attention. Adds small learnable interaction matrices between attention heads for K and V.
|
| 105 |
-
- **LUCID** ([arXiv:2602.10410](https://arxiv.org/abs/2602.10410)) — Applies a learned
|
| 106 |
-
lower-triangular preconditioner to V before attention, decorrelating value representations
|
| 107 |
-
across positions.
|
| 108 |
-
- **Affine-Scaled Attention** ([arXiv:2602.23057](https://arxiv.org/abs/2602.23057)) — Adds
|
| 109 |
-
two learnable per-head scalars (α and β) to the softmax weights:
|
| 110 |
-
`[α·softmax(QKᵀ) + β]·V`.
|
| 111 |
-
- **XSA** ([arXiv:2603.09078](https://arxiv.org/abs/2603.09078)) — Exclusive Self Attention.
|
| 112 |
-
After computing attention, removes the component of the output aligned with the token's
|
| 113 |
-
own value vector.
|
| 114 |
-
- **Directional Routing** ([arXiv:2603.14923](https://arxiv.org/abs/2603.14923)) — Each head
|
| 115 |
-
learns K=4 directions in the output space; a learned router suppresses the attention output
|
| 116 |
-
along each direction per input.
|
| 117 |
-
- **Gated Attention** ([arXiv:2505.06708](https://arxiv.org/abs/2505.06708)) — A sigmoid gate
|
| 118 |
-
is applied to the attention output before the output projection, introducing non-linearity
|
| 119 |
-
and preventing attention sinks.
|
| 120 |
-
- **Momentum Attention** ([arXiv:2411.03884](https://arxiv.org/abs/2411.03884)) — Modifies Q
|
| 121 |
-
and K by subtracting a fraction of the previous position's Q and K values (causal
|
| 122 |
-
first-difference).
|
| 123 |
-
- **Interleaved Head Attention / IHA** ([arXiv:2602.21371](https://arxiv.org/abs/2602.21371)) —
|
| 124 |
-
Builds pseudo-heads from learned cross-head mixtures to create multiple attention patterns
|
| 125 |
-
per original head.
|
| 126 |
-
- **REPO** ([arXiv:2512.14391](https://arxiv.org/abs/2512.14391)) — Context re-positioning
|
| 127 |
-
module that learns contextual position coordinates above a configurable start layer.
|
| 128 |
-
- **GRAPE** ([arXiv:2512.07805](https://arxiv.org/abs/2512.07805)) — Group representational
|
| 129 |
-
position encoding used by the REPO-GRAPE positional path.
|
| 130 |
-
- **GOAT priors** ([arXiv:2601.15380](https://arxiv.org/abs/2601.15380)) — Optional
|
| 131 |
-
factorized attention log-prior channels inspired by trainable attention priors.
|
| 132 |
-
- **Hadamard output projection** ([arXiv:2603.08343](https://arxiv.org/abs/2603.08343)) —
|
| 133 |
-
Replaces dense attention output projection with a structured Hadamard transform plus
|
| 134 |
-
lightweight scaling.
|
| 135 |
-
|
| 136 |
-
**Normalization, residual flow, and MLP**
|
| 137 |
-
|
| 138 |
-
- **SeeDNorm** ([arXiv:2510.22777](https://arxiv.org/abs/2510.22777)) — Applied to Q and K
|
| 139 |
-
projections. Dynamically rescales normalization from the input's own statistics.
|
| 140 |
-
- **LayerNorm Scaling / LNS** ([arXiv:2502.05795](https://arxiv.org/abs/2502.05795)) — Each
|
| 141 |
-
layer's output is scaled by 1/√ℓ where ℓ is the layer index.
|
| 142 |
-
- **GPAS** ([arXiv:2506.22049](https://arxiv.org/abs/2506.22049)) — Gradient-Preserving
|
| 143 |
-
Activation Scaling for residual junctions.
|
| 144 |
-
- **PolyNorm** ([arXiv:2602.04902](https://arxiv.org/abs/2602.04902)) — Replaces the standard
|
| 145 |
-
MLP activation with normalized linear, quadratic, and cubic branches.
|
| 146 |
-
- **SimpleGPT** ([arXiv:2602.01212](https://arxiv.org/abs/2602.01212)) — Second-order
|
| 147 |
-
geometry-inspired normalization strategy applied inside MLP projections.
|
| 148 |
-
- **StackMemory / STACKTRANS** ([NeurIPS 2025](https://openreview.net/forum?id=2bbDg587uh)) —
|
| 149 |
-
Optional differentiable hidden-state stack between decoder layers.
|
| 150 |
-
- **Attention Residuals / AttnRes** ([arXiv:2603.15031](https://arxiv.org/abs/2603.15031)) —
|
| 151 |
-
Optional learned depth-wise aggregation over previous layer outputs or block summaries.
|
| 152 |
-
- **LAUREL** ([arXiv:2411.07501](https://arxiv.org/abs/2411.07501)) — Optional learned
|
| 153 |
-
augmented residual layer with residual-weight and low-rank variants.
|
| 154 |
-
|
| 155 |
-
**Training objectives and training-time regularizers**
|
| 156 |
-
|
| 157 |
-
- **Cut Cross Entropy** ([Apple repository](https://github.com/apple/ml-cross-entropy)) —
|
| 158 |
-
Memory-efficient next-token loss that avoids materializing the full token-by-vocabulary
|
| 159 |
-
logits tensor. NeoLLM remains compatible with the upstream package when the extensions
|
| 160 |
-
below are disabled.
|
| 161 |
-
- **MiLe Loss** ([arXiv:2310.19531](https://arxiv.org/abs/2310.19531)) — Optional detached,
|
| 162 |
-
mean-normalized predictive-entropy weighting of token losses, implemented inside the
|
| 163 |
-
extended CCE path.
|
| 164 |
-
- **Output Embedding Centering / mu-loss**
|
| 165 |
-
([arXiv:2601.02031](https://arxiv.org/abs/2601.02031)) — Optional
|
| 166 |
-
`lambda * ||mean(output_embeddings)||^2` regularizer for output-logit stability.
|
| 167 |
-
- **MEAP** ([arXiv:2502.07490](https://arxiv.org/abs/2502.07490)) — Optional training-only
|
| 168 |
-
input corruption that masks a fixed fraction of eligible tokens while preserving clean
|
| 169 |
-
next-token labels, causal attention, and the inference path.
|
| 170 |
-
- **TWEO** ([arXiv:2511.23225](https://arxiv.org/abs/2511.23225)) — Optional
|
| 171 |
-
Transformers Without Extreme Outliers activation regularizer for FP8/low-bit-friendly
|
| 172 |
-
training.
|
| 173 |
-
- **NITP** ([arXiv:2605.24956](https://arxiv.org/abs/2605.24956)) — Optional Next Implicit
|
| 174 |
-
Token Prediction auxiliary objective using shallow-layer implicit token targets and a
|
| 175 |
-
cosine loss.
|
| 176 |
-
- **NextLat** ([arXiv:2511.05963](https://arxiv.org/abs/2511.05963)) — Optional next-latent
|
| 177 |
-
prediction objective using latent dynamics, Smooth L1 supervision, and frozen-head KL.
|
| 178 |
-
|
| 179 |
-
### Optional extended-CCE configuration
|
| 180 |
-
|
| 181 |
-
| Feature | Enabled | Value |
|
| 182 |
-
|---|---:|---:|
|
| 183 |
-
| MiLe Loss | True | gamma=1.0 |
|
| 184 |
-
| mu-loss | True | lambda=0.0001 |
|
| 185 |
-
| MEAP | True | ratio=0.15 |
|
| 186 |
-
|
| 187 |
-
Copy-Paste uses CCE sparse mixture statistics for CUDA training and computes mu-loss in Torch. MEAP and patch training also use the extended cut-cross-entropy package.
|
| 188 |
-
[`Kitsunp/ml-cross-entropy`](https://github.com/Kitsunp/ml-cross-entropy) supplies the extended kernels.
|
| 189 |
-
Copy-Paste exposes three compact
|
| 190 |
-
scalars: unweighted NTP cross entropy, the MiLe reweighting delta, and the mu-loss penalty.
|
| 191 |
-
Their sum reconstructs `ntp_loss` exactly. MEAP reports its eligible and selected counts from
|
| 192 |
-
the masking kernel; the trainer logs the selected count and exact fraction. Copy-Paste diagnostics use sparse source-token candidates and CCE vocabulary reductions.
|
| 193 |
-
|
| 194 |
-
**Optimizer and training stability**
|
| 195 |
-
|
| 196 |
-
- **Adam-family optimizer mode** — Active variant: **AdEMAMix**.
|
| 197 |
-
**AdEMAMix** ([arXiv:2409.03137](https://arxiv.org/abs/2409.03137)) contributes the optional
|
| 198 |
-
beta3 slow-memory branch when `ADEMAMIX=True`. **DeltaMomentum**
|
| 199 |
-
([arXiv:2608.19491](https://arxiv.org/abs/2608.19491)) optionally replaces only the fast beta1
|
| 200 |
-
first-moment update on hidden Linear weights when `DELTA=True`; beta2 remains Adam's
|
| 201 |
-
ordinary squared-gradient EMA in every mode.
|
| 202 |
-
- **BF16 stochastic rounding** ([arXiv:2502.20566](https://arxiv.org/abs/2502.20566)) —
|
| 203 |
-
Optional master-free BF16 model update with stochastic rather than nearest rounding; the same
|
| 204 |
-
write-back path is shared by AdamW, DeltaAdamW, AdEMAMix, and DeltaAdEMAMix.
|
| 205 |
-
- **Cautious Weight Decay** ([arXiv:2510.12402](https://arxiv.org/abs/2510.12402)) —
|
| 206 |
-
Sign-selective weight decay variant used by the custom optimizer logic.
|
| 207 |
-
- **Correction of Decoupled Weight Decay** ([arXiv:2512.08217](https://arxiv.org/abs/2512.08217)) —
|
| 208 |
-
Adapts decoupled weight decay during learning-rate decay.
|
| 209 |
-
- **AdamHD** ([arXiv:2511.14721](https://arxiv.org/abs/2511.14721)) —
|
| 210 |
-
Decoupled Huber decay regularization reference used by the optimizer.
|
| 211 |
-
- **Gradient conditioning** — CAST active; history-adaptive spectral/norm policies by optimizer group; 5208 committed updates.
|
| 212 |
-
References: [CAST](https://arxiv.org/abs/2610.19761),
|
| 213 |
-
[GradientStabilizer](https://arxiv.org/abs/2502.17055).
|
| 214 |
-
---
|
| 215 |
-
|
| 216 |
-
## Training
|
| 217 |
-
|
| 218 |
-
| Setting | Value |
|
| 219 |
-
|---|---|
|
| 220 |
-
| Dataset | FineWeb-Edu (sample-10BT) |
|
| 221 |
-
| Tokens seen | ~0.51B (15,625 steps × batch 64 × length 512) |
|
| 222 |
-
| Precision | BF16 model state (bfloat16: 85,157,752 elements, float32: 4,976 elements) + AdEMAMix FP32 master active; stochastic rounding disabled |
|
| 223 |
-
| Optimizer | AdEMAMix |
|
| 224 |
-
| Gradient transform | CAST active; history-adaptive spectral/norm policies by optimizer group; 5208 committed updates |
|
| 225 |
-
| Learning rate | 1e-03 with 4,000-step linear warmup |
|
| 226 |
-
| Patch transition | Reset optimizer/conditioner at step 10,417; per-phase LR warmup; restarted AdEMAMix warmup fitted to each phase |
|
| 227 |
-
| Weight decay | coefficients [0.005, 0.01, 0.1]; WD 5/6 groups; CWD 2; Huber 0; Correction 0 |
|
| 228 |
-
| Training time | ~1h 00m |
|
| 229 |
-
| Hardware | NVIDIA RTX PRO 6000 Blackwell Server Edition |
|
| 230 |
-
|
| 231 |
|
| 232 |
-
#
|
| 233 |
-
|
| 234 |
-
Total includes MiLe when enabled, plus all active auxiliary objectives and regularizers. Without MiLe means model total minus its MiLe delta on the same forward; this is not a separate training run without MiLe.
|
| 235 |
-
|
| 236 |
-
| Step | Train total | Val total | Train without MiLe | Val without MiLe |
|
| 237 |
-
|---|---|---|---|---|
|
| 238 |
-
| 1 | 12.1569 | — | 12.1569 | — |
|
| 239 |
-
| 250 | 7.43977 | — | 7.43193 | — |
|
| 240 |
-
| 500 | 7.26973 | — | 7.2544 | — |
|
| 241 |
-
| 750 | 7.19437 | — | 7.17487 | — |
|
| 242 |
-
| 1,000 | 7.14684 | — | 7.12439 | — |
|
| 243 |
-
| 1,250 | 7.11603 | — | 7.09145 | — |
|
| 244 |
-
| 1,500 | 7.09486 | — | 7.06766 | — |
|
| 245 |
-
| 1,750 | 7.06701 | — | 7.03783 | — |
|
| 246 |
-
| 2,000 | 7.04502 | — | 7.01332 | — |
|
| 247 |
-
| 2,250 | 7.03388 | — | 7.0007 | — |
|
| 248 |
-
| 2,500 | 7.00954 | — | 6.97522 | — |
|
| 249 |
-
| 2,750 | 6.99406 | — | 6.95859 | — |
|
| 250 |
-
| 3,000 | 6.97407 | — | 6.93746 | — |
|
| 251 |
-
| 3,250 | 6.95565 | — | 6.91757 | — |
|
| 252 |
-
| 3,500 | 6.93633 | — | 6.89698 | — |
|
| 253 |
-
| 3,750 | 6.91393 | — | 6.8733 | — |
|
| 254 |
-
| 4,000 | 6.89179 | — | 6.85102 | — |
|
| 255 |
-
| 4,250 | 6.87827 | — | 6.83644 | — |
|
| 256 |
-
| 4,500 | 6.85901 | — | 6.81621 | — |
|
| 257 |
-
| 4,750 | 6.83507 | — | 6.79141 | — |
|
| 258 |
-
| 5,000 | 6.81285 | 6.72223 | 6.76761 | 6.65072 |
|
| 259 |
-
| 5,250 | 6.79736 | — | 6.75163 | — |
|
| 260 |
-
| 5,500 | 6.78718 | — | 6.7406 | — |
|
| 261 |
-
| 5,750 | 6.76926 | — | 6.72092 | — |
|
| 262 |
-
| 6,000 | 6.75714 | — | 6.70777 | — |
|
| 263 |
-
| 6,250 | 6.74706 | — | 6.69821 | — |
|
| 264 |
-
| 6,500 | 6.73372 | — | 6.68512 | — |
|
| 265 |
-
| 6,750 | 6.72918 | — | 6.67894 | — |
|
| 266 |
-
| 7,000 | 6.71321 | — | 6.66257 | — |
|
| 267 |
-
| 7,250 | 6.709 | — | 6.65742 | — |
|
| 268 |
-
| 7,500 | 6.70526 | — | 6.65312 | — |
|
| 269 |
-
| 7,750 | 6.69506 | — | 6.64233 | — |
|
| 270 |
-
| 8,000 | 6.68961 | — | 6.63594 | — |
|
| 271 |
-
| 8,250 | 6.6791 | — | 6.62425 | — |
|
| 272 |
-
| 8,500 | 6.67233 | — | 6.61803 | — |
|
| 273 |
-
| 8,750 | 6.66846 | — | 6.61245 | — |
|
| 274 |
-
| 9,000 | 6.65872 | — | 6.60286 | — |
|
| 275 |
-
| 9,250 | 6.64321 | — | 6.58543 | — |
|
| 276 |
-
| 9,500 | 6.63519 | — | 6.57696 | — |
|
| 277 |
-
| 9,750 | 6.63123 | — | 6.57312 | — |
|
| 278 |
-
| 10,000 | 6.61406 | 6.49322 | 6.55421 | 6.39542 |
|
| 279 |
-
| 10,250 | 6.60986 | — | 6.54967 | — |
|
| 280 |
-
| 10,500 | 6.35387 | — | 6.23053 | — |
|
| 281 |
-
| 10,750 | 5.52453 | — | 5.18023 | — |
|
| 282 |
-
| 11,000 | 5.41604 | — | 5.04308 | — |
|
| 283 |
-
| 11,250 | 5.35595 | — | 4.96565 | — |
|
| 284 |
-
| 11,500 | 5.3127 | — | 4.9082 | — |
|
| 285 |
-
| 11,750 | 5.2762 | — | 4.86209 | — |
|
| 286 |
-
| 12,000 | 5.249 | — | 4.82771 | — |
|
| 287 |
-
| 12,250 | 5.22035 | — | 4.79211 | — |
|
| 288 |
-
| 12,500 | 5.19179 | — | 4.75853 | — |
|
| 289 |
-
| 12,750 | 5.18146 | — | 4.73926 | — |
|
| 290 |
-
| 13,000 | 5.15687 | — | 4.71174 | — |
|
| 291 |
-
| 13,250 | 5.14689 | — | 4.69688 | — |
|
| 292 |
-
| 13,500 | 5.12962 | — | 4.67441 | — |
|
| 293 |
-
| 13,750 | 5.13156 | — | 4.67378 | — |
|
| 294 |
-
| 14,000 | 5.11436 | — | 4.65388 | — |
|
| 295 |
-
| 14,250 | 5.10853 | — | 4.64635 | — |
|
| 296 |
-
| 14,500 | 5.10456 | — | 4.63878 | — |
|
| 297 |
-
| 14,750 | 5.08745 | — | 4.61515 | — |
|
| 298 |
-
| 15,000 | 5.0795 | 4.72568 | 4.60567 | 4.15717 |
|
| 299 |
-
| 15,250 | 5.04957 | — | 4.56981 | — |
|
| 300 |
-
| 15,500 | 5.03392 | — | 4.55032 | — |
|
| 301 |
-
| 15,625 | 5.01443 | 4.67434 | 4.52845 | 4.09541 |
|
| 302 |
-
|
| 303 |
-
### Cross-entropy with and without MiLe
|
| 304 |
-
|
| 305 |
-
CE without MiLe is unweighted CE; CE with MiLe adds the reweighting delta. Both exclude mu and auxiliary terms. `ntp_loss` includes mu when enabled.
|
| 306 |
-
|
| 307 |
-
| Step | Train CE without MiLe | Val CE without MiLe | Train CE with MiLe | Val CE with MiLe |
|
| 308 |
-
|---|---|---|---|---|
|
| 309 |
-
| 1 | 11.1701 | — | 11.1701 | — |
|
| 310 |
-
| 250 | 7.29727 | — | 7.30511 | — |
|
| 311 |
-
| 500 | 6.9752 | — | 6.99054 | — |
|
| 312 |
-
| 750 | 6.85647 | — | 6.87596 | — |
|
| 313 |
-
| 1,000 | 6.78162 | — | 6.80407 | — |
|
| 314 |
-
| 1,250 | 6.72941 | — | 6.75399 | — |
|
| 315 |
-
| 1,500 | 6.68879 | — | 6.71599 | — |
|
| 316 |
-
| 1,750 | 6.64708 | — | 6.67627 | — |
|
| 317 |
-
| 2,000 | 6.61682 | — | 6.64852 | — |
|
| 318 |
-
| 2,250 | 6.59735 | — | 6.63052 | — |
|
| 319 |
-
| 2,500 | 6.56865 | — | 6.60297 | — |
|
| 320 |
-
| 2,750 | 6.5461 | — | 6.58158 | — |
|
| 321 |
-
| 3,000 | 6.52786 | — | 6.56447 | — |
|
| 322 |
-
| 3,250 | 6.51125 | — | 6.54932 | — |
|
| 323 |
-
| 3,500 | 6.49461 | — | 6.53397 | — |
|
| 324 |
-
| 3,750 | 6.47505 | — | 6.51568 | — |
|
| 325 |
-
| 4,000 | 6.45678 | — | 6.49755 | — |
|
| 326 |
-
| 4,250 | 6.44566 | — | 6.48749 | — |
|
| 327 |
-
| 4,500 | 6.43062 | — | 6.47341 | — |
|
| 328 |
-
| 4,750 | 6.41224 | — | 6.4559 | — |
|
| 329 |
-
| 5,000 | 6.39302 | 6.10403 | 6.43826 | 6.17555 |
|
| 330 |
-
| 5,250 | 6.38207 | — | 6.4278 | — |
|
| 331 |
-
| 5,500 | 6.37265 | — | 6.41923 | — |
|
| 332 |
-
| 5,750 | 6.3573 | — | 6.40565 | — |
|
| 333 |
-
| 6,000 | 6.34639 | — | 6.39577 | — |
|
| 334 |
-
| 6,250 | 6.33966 | — | 6.38852 | — |
|
| 335 |
-
| 6,500 | 6.32792 | — | 6.37652 | — |
|
| 336 |
-
| 6,750 | 6.32322 | — | 6.37345 | — |
|
| 337 |
-
| 7,000 | 6.30764 | — | 6.35829 | — |
|
| 338 |
-
| 7,250 | 6.30256 | — | 6.35414 | — |
|
| 339 |
-
| 7,500 | 6.29889 | — | 6.35103 | — |
|
| 340 |
-
| 7,750 | 6.28792 | — | 6.34064 | — |
|
| 341 |
-
| 8,000 | 6.28031 | — | 6.33398 | — |
|
| 342 |
-
| 8,250 | 6.26715 | — | 6.322 | — |
|
| 343 |
-
| 8,500 | 6.26087 | — | 6.31517 | — |
|
| 344 |
-
| 8,750 | 6.25325 | — | 6.30926 | — |
|
| 345 |
-
| 9,000 | 6.2418 | — | 6.29765 | — |
|
| 346 |
-
| 9,250 | 6.22361 | — | 6.28139 | — |
|
| 347 |
-
| 9,500 | 6.21424 | — | 6.27247 | — |
|
| 348 |
-
| 9,750 | 6.20976 | — | 6.26787 | — |
|
| 349 |
-
| 10,000 | 6.19095 | 5.83395 | 6.2508 | 5.93174 |
|
| 350 |
-
| 10,250 | 6.1862 | — | 6.24638 | — |
|
| 351 |
-
| 10,500 | 5.84885 | — | 5.9722 | — |
|
| 352 |
-
| 10,750 | 4.83343 | — | 5.17773 | — |
|
| 353 |
-
| 11,000 | 4.70232 | — | 5.07528 | — |
|
| 354 |
-
| 11,250 | 4.62258 | — | 5.01289 | — |
|
| 355 |
-
| 11,500 | 4.56063 | — | 4.96513 | — |
|
| 356 |
-
| 11,750 | 4.50957 | — | 4.92368 | — |
|
| 357 |
-
| 12,000 | 4.47011 | — | 4.8914 | — |
|
| 358 |
-
| 12,250 | 4.43025 | — | 4.85849 | — |
|
| 359 |
-
| 12,500 | 4.39278 | — | 4.82604 | — |
|
| 360 |
-
| 12,750 | 4.36963 | — | 4.81182 | — |
|
| 361 |
-
| 13,000 | 4.33854 | — | 4.78368 | — |
|
| 362 |
-
| 13,250 | 4.32028 | — | 4.77029 | — |
|
| 363 |
-
| 13,500 | 4.29482 | — | 4.75004 | — |
|
| 364 |
-
| 13,750 | 4.29068 | — | 4.74846 | — |
|
| 365 |
-
| 14,000 | 4.26889 | — | 4.72937 | — |
|
| 366 |
-
| 14,250 | 4.25928 | — | 4.72146 | — |
|
| 367 |
-
| 14,500 | 4.24998 | — | 4.71576 | — |
|
| 368 |
-
| 14,750 | 4.22652 | — | 4.69881 | — |
|
| 369 |
-
| 15,000 | 4.21672 | 3.78368 | 4.69055 | 4.35219 |
|
| 370 |
-
| 15,250 | 4.18105 | — | 4.6608 | — |
|
| 371 |
-
| 15,500 | 4.16243 | — | 4.64603 | — |
|
| 372 |
-
| 15,625 | 4.14067 | 3.72466 | 4.62666 | 4.30359 |
|
| 373 |
-
|
| 374 |
-
### Observed loss components — weighted contributions
|
| 375 |
-
|
| 376 |
-
Only contributions actually added to the objective are shown; raw values and subcomponents remain in training metrics. `regularization_loss` is the subtotal of mu, weighted TWeo, JTok-M and StackMemory entropy, excluding NITP/NextLat; do not add it again to those components. JTok-M auxiliary loss is training-only.
|
| 377 |
-
|
| 378 |
-
| Step | Phase | mu | TWeo | NITP | Reg. subtotal |
|
| 379 |
-
|---|---|---|---|---|---|
|
| 380 |
-
| 1 | train | 3.29888e-10 | 8.48626e-07 | 0.986843 | 8.48956e-07 |
|
| 381 |
-
| 250 | train | 4.14796e-06 | 0.000991383 | 0.133666 | 0.000995531 |
|
| 382 |
-
| 500 | train | 9.26922e-06 | 0.000522309 | 0.27866 | 0.000531578 |
|
| 383 |
-
| 750 | train | 1.54994e-05 | 0.000563869 | 0.317831 | 0.000579369 |
|
| 384 |
-
| 1,000 | train | 2.29899e-05 | 0.000667879 | 0.34208 | 0.000690869 |
|
| 385 |
-
| 1,250 | train | 3.11781e-05 | 0.000880633 | 0.361128 | 0.000911811 |
|
| 386 |
-
| 1,500 | train | 3.90434e-05 | 0.0010814 | 0.377748 | 0.00112044 |
|
| 387 |
-
| 1,750 | train | 4.62851e-05 | 0.00120793 | 0.389492 | 0.00125421 |
|
| 388 |
-
| 2,000 | train | 5.29924e-05 | 0.0013658 | 0.395081 | 0.00141879 |
|
| 389 |
-
| 2,250 | train | 5.94789e-05 | 0.00148332 | 0.401808 | 0.0015428 |
|
| 390 |
-
| 2,500 | train | 6.67849e-05 | 0.00154828 | 0.404959 | 0.00161507 |
|
| 391 |
-
| 2,750 | train | 7.49795e-05 | 0.00155874 | 0.410846 | 0.00163372 |
|
| 392 |
-
| 3,000 | train | 8.46922e-05 | 0.00156715 | 0.407948 | 0.00165184 |
|
| 393 |
-
| 3,250 | train | 9.67422e-05 | 0.00153115 | 0.404699 | 0.0016279 |
|
| 394 |
-
| 3,500 | train | 0.000110971 | 0.00144551 | 0.400806 | 0.00155648 |
|
| 395 |
-
| 3,750 | train | 0.000130353 | 0.00136114 | 0.396762 | 0.00149149 |
|
| 396 |
-
| 4,000 | train | 0.000154362 | 0.00130591 | 0.392777 | 0.00146027 |
|
| 397 |
-
| 4,250 | train | 0.000184102 | 0.00123947 | 0.389356 | 0.00142357 |
|
| 398 |
-
| 4,500 | train | 0.000221222 | 0.00121635 | 0.38416 | 0.00143757 |
|
| 399 |
-
| 4,750 | train | 0.000270394 | 0.00112581 | 0.377766 | 0.0013962 |
|
| 400 |
-
| 5,000 | train | 0.000329293 | 0.00104372 | 0.373213 | 0.00137302 |
|
| 401 |
-
| 5,000 | validation | 0.000360502 | 0.00300473 | 0.543321 | 0.00336524 |
|
| 402 |
-
| 5,250 | train | 0.000392398 | 0.000965072 | 0.368199 | 0.00135747 |
|
| 403 |
-
| 5,500 | train | 0.00045961 | 0.000925218 | 0.366562 | 0.00138483 |
|
| 404 |
-
| 5,750 | train | 0.000528098 | 0.000901479 | 0.362185 | 0.00142958 |
|
| 405 |
-
| 6,000 | train | 0.000591771 | 0.000816563 | 0.359964 | 0.00140833 |
|
| 406 |
-
| 6,250 | train | 0.000653964 | 0.000787942 | 0.357107 | 0.00144191 |
|
| 407 |
-
| 6,500 | train | 0.000715662 | 0.000744753 | 0.355735 | 0.00146041 |
|
| 408 |
-
| 6,750 | train | 0.000772059 | 0.000724611 | 0.354228 | 0.00149667 |
|
| 409 |
-
| 7,000 | train | 0.000824695 | 0.0007098 | 0.353387 | 0.0015345 |
|
| 410 |
-
| 7,250 | train | 0.000869477 | 0.000695535 | 0.353298 | 0.00156501 |
|
| 411 |
-
| 7,500 | train | 0.000910874 | 0.000696223 | 0.35262 | 0.0016071 |
|
| 412 |
-
| 7,750 | train | 0.000952081 | 0.000657018 | 0.3528 | 0.0016091 |
|
| 413 |
-
| 8,000 | train | 0.00099915 | 0.000646211 | 0.353984 | 0.00164536 |
|
| 414 |
-
| 8,250 | train | 0.00104221 | 0.000617805 | 0.355436 | 0.00166002 |
|
| 415 |
-
| 8,500 | train | 0.00107749 | 0.000568957 | 0.355507 | 0.00164644 |
|
| 416 |
-
| 8,750 | train | 0.00110638 | 0.000522036 | 0.357573 | 0.00162841 |
|
| 417 |
-
| 9,000 | train | 0.00113453 | 0.000480492 | 0.359452 | 0.00161502 |
|
| 418 |
-
| 9,250 | train | 0.00115607 | 0.000435784 | 0.360226 | 0.00159185 |
|
| 419 |
-
| 9,500 | train | 0.00117275 | 0.000402017 | 0.361148 | 0.00157476 |
|
| 420 |
-
| 9,750 | train | 0.00118449 | 0.000366701 | 0.361806 | 0.00155119 |
|
| 421 |
-
| 10,000 | train | 0.00118936 | 0.000332726 | 0.361733 | 0.00152209 |
|
| 422 |
-
| 10,000 | validation | 0.00119075 | 0.00078579 | 0.559497 | 0.00197654 |
|
| 423 |
-
| 10,250 | train | 0.00119141 | 0.00030158 | 0.361981 | 0.00149299 |
|
| 424 |
-
| 10,500 | train | 0.00119632 | 0.000360923 | 0.380119 | 0.00155724 |
|
| 425 |
-
| 10,750 | train | 0.0012154 | 0.000378246 | 0.345206 | 0.00159365 |
|
| 426 |
-
| 11,000 | train | 0.00120116 | 0.000295311 | 0.339263 | 0.00149647 |
|
| 427 |
-
| 11,250 | train | 0.00117451 | 0.000256025 | 0.341638 | 0.00143054 |
|
| 428 |
-
| 11,500 | train | 0.00114554 | 0.000232495 | 0.346194 | 0.00137804 |
|
| 429 |
-
| 11,750 | train | 0.00112226 | 0.00021073 | 0.351185 | 0.00133299 |
|
| 430 |
-
| 12,000 | train | 0.00109982 | 0.000196519 | 0.356304 | 0.00129634 |
|
| 431 |
-
| 12,250 | train | 0.00107239 | 0.000192012 | 0.360594 | 0.0012644 |
|
| 432 |
-
| 12,500 | train | 0.001045 | 0.000192727 | 0.364515 | 0.00123773 |
|
| 433 |
-
| 12,750 | train | 0.00102371 | 0.000192792 | 0.368415 | 0.0012165 |
|
| 434 |
-
| 13,000 | train | 0.00100721 | 0.000202993 | 0.371987 | 0.0012102 |
|
| 435 |
-
| 13,250 | train | 0.000990148 | 0.000218566 | 0.375393 | 0.00120871 |
|
| 436 |
-
| 13,500 | train | 0.0009695 | 0.000237501 | 0.378378 | 0.001207 |
|
| 437 |
-
| 13,750 | train | 0.00094896 | 0.000262072 | 0.381884 | 0.00121103 |
|
| 438 |
-
| 14,000 | train | 0.000940227 | 0.000291677 | 0.383756 | 0.0012319 |
|
| 439 |
-
| 14,250 | train | 0.00093996 | 0.000329635 | 0.385801 | 0.00126959 |
|
| 440 |
-
| 14,500 | train | 0.000946027 | 0.00038465 | 0.387467 | 0.00133068 |
|
| 441 |
-
| 14,750 | train | 0.000957708 | 0.000446461 | 0.387233 | 0.00140417 |
|
| 442 |
-
| 15,000 | train | 0.000971831 | 0.00044881 | 0.387528 | 0.00142064 |
|
| 443 |
-
| 15,000 | validation | 0.000978731 | 0.000483302 | 0.372026 | 0.00146203 |
|
| 444 |
-
| 15,250 | train | 0.000985148 | 0.000454519 | 0.387328 | 0.00143967 |
|
| 445 |
-
| 15,500 | train | 0.000994999 | 0.000437405 | 0.386456 | 0.0014324 |
|
| 446 |
-
| 15,625 | train | 0.000999827 | 0.000417227 | 0.386356 | 0.00141705 |
|
| 447 |
-
| 15,625 | validation | 0.00100091 | 0.000434212 | 0.369312 | 0.00143513 |
|
| 448 |
-
|
| 449 |
-
Tables use exact logged steps; missing values are — without carrying values forward. Repeated evaluations at one step use the latest logged value. Components average batch scalars weighted by examples; CE/PPL token metrics retain their valid-target weighting. Weight decay/CWD act in the optimizer, outside these forward losses.
|
| 450 |
-
|
| 451 |
-
---
|
| 452 |
-
|
| 453 |
-
## Limitations
|
| 454 |
-
|
| 455 |
-
- **Token budget** — ~1.5 B tokens seen; below estimated optimum. Knowledge-intensive tasks
|
| 456 |
-
will improve with more training.
|
| 457 |
-
- **Gradient spike at step 40k** — Reorganized the attention pattern in layer 9 that
|
| 458 |
-
previously captured long-range token correlations. A checkpoint from ~step 38k is expected
|
| 459 |
-
to have better aggregate benchmark scores.
|
| 460 |
-
- **PolyNorm exclusivity** — The quadratic branch has become partially redundant with the
|
| 461 |
-
linear branch. Will be corrected in the next training run.
|
| 462 |
-
- **Base model only** — Not instruction-tuned or aligned; purely a next-token-prediction
|
| 463 |
-
base model.
|
| 464 |
-
|
| 465 |
-
---
|
| 466 |
-
|
| 467 |
-
## References
|
| 468 |
-
|
| 469 |
-
All papers whose techniques are integrated into NeoLLM's architecture,
|
| 470 |
-
training objective, or training stack:
|
| 471 |
-
|
| 472 |
-
| Area | Technique | Paper title | Reference |
|
| 473 |
-
|---|---|---|---|
|
| 474 |
-
| Embeddings | Learnable Multipliers | Freeing the Scale of Language Model Matrix Layers | [arXiv:2601.04890](https://arxiv.org/abs/2601.04890) |
|
| 475 |
-
| Embeddings | Leviathan | A Separable Architecture for Continuous Token Representation in Language Models | [arXiv:2601.22040](https://arxiv.org/abs/2601.22040) |
|
| 476 |
-
| Embeddings / residual modulation | JTok / JTok-M | JTok: On Token Embedding as another Axis of Scaling Law via Joint Token Self-modulation | [arXiv:2602.00800](https://arxiv.org/abs/2602.00800) |
|
| 477 |
-
| Embeddings | KHRONOS | KHRONOS: a Kernel-Based Neural Architecture for Rapid, Resource-Efficient Scientific Computation | [arXiv:2505.13315](https://arxiv.org/abs/2505.13315) |
|
| 478 |
-
| Embeddings | Spelling Bee | Spelling Bee Embeddings for Language Modeling | [arXiv:2601.18030](https://arxiv.org/abs/2601.18030) |
|
| 479 |
-
| Embeddings | Token embedding analysis | Token Embeddings Violate the Manifold Hypothesis | [arXiv:2504.01002](https://arxiv.org/abs/2504.01002) |
|
| 480 |
-
| Attention / positions | FAN | Fourier Analysis Networks | [arXiv:2502.21309](https://arxiv.org/abs/2502.21309) |
|
| 481 |
-
| Attention / positions | MEA | Explicit Multi-head Attention for Inter-head Interaction in Large Language Models | [arXiv:2601.19611](https://arxiv.org/abs/2601.19611) |
|
| 482 |
-
| Attention / positions | LUCID | Attention with Preconditioned Representations | [arXiv:2602.10410](https://arxiv.org/abs/2602.10410) |
|
| 483 |
-
| Attention / positions | Affine-Scaled Attention | Affine-Scaled Attention: Towards Flexible and Stable Transformer Attention | [arXiv:2602.23057](https://arxiv.org/abs/2602.23057) |
|
| 484 |
-
| Attention / positions | XSA | Exclusive Self Attention | [arXiv:2603.09078](https://arxiv.org/abs/2603.09078) |
|
| 485 |
-
| Attention / positions | Directional Routing | Directional Routing in Transformers | [arXiv:2603.14923](https://arxiv.org/abs/2603.14923) |
|
| 486 |
-
| Attention / positions | Gated Attention | Gated Attention for Large Language Models: Non-linearity, Sparsity, and Attention-Sink-Free | [arXiv:2505.06708](https://arxiv.org/abs/2505.06708) |
|
| 487 |
-
| Attention / positions | Momentum Attention | Momentum Attention | [arXiv:2411.03884](https://arxiv.org/abs/2411.03884) |
|
| 488 |
-
| Attention / positions | IHA | Interleaved Head Attention | [arXiv:2602.21371](https://arxiv.org/abs/2602.21371) |
|
| 489 |
-
| Attention / positions | REPO | Language Models with Context Re-Positioning | [arXiv:2512.14391](https://arxiv.org/abs/2512.14391) |
|
| 490 |
-
| Attention / positions | GRAPE | Group Representational Position Encoding | [arXiv:2512.07805](https://arxiv.org/abs/2512.07805) |
|
| 491 |
-
| Attention / positions | GOAT priors | You Need Better Attention Priors | [arXiv:2601.15380](https://arxiv.org/abs/2601.15380) |
|
| 492 |
-
| Attention / positions | Hadamard o_proj | Rethinking Attention Output Projection: Structured Hadamard Transforms for Efficient Transformers | [arXiv:2603.08343](https://arxiv.org/abs/2603.08343) |
|
| 493 |
-
| Residual / normalization | SeeDNorm | Self-Rescaled Dynamic Normalization | [arXiv:2510.22777](https://arxiv.org/abs/2510.22777) |
|
| 494 |
-
| Residual / normalization | LNS | The Curse of Depth in LLMs | [arXiv:2502.05795](https://arxiv.org/abs/2502.05795) |
|
| 495 |
-
| Residual / normalization | GPAS | Gradient-Preserving Activation Scaling | [arXiv:2506.22049](https://arxiv.org/abs/2506.22049) |
|
| 496 |
-
| Residual / normalization | PolyNorm | PolyNorm / PolyCom | [arXiv:2602.04902](https://arxiv.org/abs/2602.04902) |
|
| 497 |
-
| Residual / normalization | SimpleGPT | SimpleGPT | [arXiv:2602.01212](https://arxiv.org/abs/2602.01212) |
|
| 498 |
-
| Residual / normalization | StackMemory / STACKTRANS | Recursive Transformer: Boosting Reasoning Ability with State Stack | [NeurIPS 2025](https://openreview.net/forum?id=2bbDg587uh) |
|
| 499 |
-
| Residual / normalization | Attention Residuals | Attention Residuals | [arXiv:2603.15031](https://arxiv.org/abs/2603.15031) |
|
| 500 |
-
| Residual / normalization | Linear Depth Memory | Depth Memory | [arXiv:2610.18809](https://arxiv.org/abs/2610.18809) |
|
| 501 |
-
| Residual / normalization | LAUREL | LAUREL: Learned Augmented Residual Layer | [arXiv:2411.07501](https://arxiv.org/abs/2411.07501) |
|
| 502 |
-
| Objectives | TWEO | Transformers Without Extreme Outliers Enables FP8 Training And Quantization For Dummies | [arXiv:2511.23225](https://arxiv.org/abs/2511.23225) |
|
| 503 |
-
| Objectives | NITP | Next Implicit Token Prediction for LLM Pre-training | [arXiv:2605.24956](https://arxiv.org/abs/2605.24956) |
|
| 504 |
-
| Objectives | NextLat | Next-Latent Prediction Transformers Learn Compact World Models | [arXiv:2511.05963](https://arxiv.org/abs/2511.05963) |
|
| 505 |
-
| Optimizer / training | AdEMAMix | The AdEMAMix Optimizer: Better, Faster, Older | [arXiv:2409.03137](https://arxiv.org/abs/2409.03137) |
|
| 506 |
-
| Optimizer / training | DeltaMomentum | DeltaMomentum: A Key-Value based Anisotropic Momentum Update via Delta Rule | [arXiv:2608.19491](https://arxiv.org/abs/2608.19491) |
|
| 507 |
-
| Optimizer / training | BF16 + SR | Stochastic Rounding for LLM Training: Theory and Practice | [arXiv:2502.20566](https://arxiv.org/abs/2502.20566) |
|
| 508 |
-
| Optimizer / training | CWD | Cautious Weight Decay | [arXiv:2510.12402](https://arxiv.org/abs/2510.12402) |
|
| 509 |
-
| Optimizer / training | WD correction | Correction of Decoupled Weight Decay | [arXiv:2512.08217](https://arxiv.org/abs/2512.08217) |
|
| 510 |
-
| Optimizer / training | AdamHD | AdamHD: Decoupled Huber Decay Regularization for Language Model Pre-Training | [arXiv:2511.14721](https://arxiv.org/abs/2511.14721) |
|
| 511 |
-
| Optimizer / training | GradientStabilizer | GradientStabilizer | [arXiv:2502.17055](https://arxiv.org/abs/2502.17055) |
|
| 512 |
-
|
| 513 |
-
---
|
| 514 |
-
|
| 515 |
-
## Citation
|
| 516 |
-
|
| 517 |
-
```bibtex
|
| 518 |
-
@misc{neollm2026,
|
| 519 |
-
title = {NeoLLM: A Research Language Model Integrating Recent Attention and Normalization Techniques},
|
| 520 |
-
author = {KitsuVp},
|
| 521 |
-
year = {2026},
|
| 522 |
-
url = {https://huggingface.co/KitsuVp/NeoLLM}
|
| 523 |
-
}
|
| 524 |
-
```
|
| 525 |
-
|
| 526 |
-
---
|
| 527 |
-
|
| 528 |
-
## Author
|
| 529 |
-
|
| 530 |
-
[@Kyokopom](https://x.com/Kyokopom) on X
|
| 531 |
-
|
| 532 |
-
---
|
| 533 |
-
|
| 534 |
-
## License
|
| 535 |
|
| 536 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
library_name: transformers
|
|
|
|
| 3 |
tags:
|
| 4 |
+
- generated_from_trainer
|
| 5 |
+
model-index:
|
| 6 |
+
- name: NeoLLM
|
| 7 |
+
results: []
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
+
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
|
| 11 |
+
should probably proofread and complete it, then remove this comment. -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
+
# NeoLLM
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
+
This model is a fine-tuned version of [](https://huggingface.co/) on an unknown dataset.
|
| 16 |
+
It achieves the following results on the evaluation set:
|
| 17 |
+
- Loss: 4.6689
|
| 18 |
+
- Ce: 3.6325
|
| 19 |
+
- Valid Targets: 2083162.0
|
| 20 |
+
- Ppl: 37.8089
|
| 21 |
+
- Mile Loss: 4.2281
|
| 22 |
+
- Mile Ppl: 68.5884
|
| 23 |
+
- Top1 Accuracy: 0.3089
|
| 24 |
+
- Top3 Accuracy: 0.4925
|
| 25 |
+
- Topk Valid Targets: 2083162.0
|
| 26 |
+
- Copy Gate Mean: 0.2791
|
| 27 |
+
- Copy Sink Mean: 0.6099
|
| 28 |
+
- Copy Effective Gate Mean: 0.1439
|
| 29 |
+
- Copy Target Responsibility Mean: 0.1414
|
| 30 |
+
- Copy Target In Context Fraction: 0.4607
|
| 31 |
+
- Copy Valid Targets: 2083162.0
|
| 32 |
+
- Ntp Loss: 4.2294
|
| 33 |
+
- Ntp Ce Unweighted: 3.6331
|
| 34 |
+
- Mile Reweighting Delta: 0.5955
|
| 35 |
+
- Mu Loss: 0.0008
|
| 36 |
+
- Tweo Loss: 4.8147
|
| 37 |
+
- Nitp Loss: 0.3914
|
| 38 |
+
- Total Model Loss: 4.6689
|
| 39 |
+
- Tweo Weighted Loss: 0.0481
|
| 40 |
+
- Nitp Weighted Loss: 0.3914
|
| 41 |
+
- Auxiliary Loss: 0.4395
|
| 42 |
+
- Regularization Loss: 0.0489
|
| 43 |
+
|
| 44 |
+
## Model description
|
| 45 |
+
|
| 46 |
+
More information needed
|
| 47 |
+
|
| 48 |
+
## Intended uses & limitations
|
| 49 |
+
|
| 50 |
+
More information needed
|
| 51 |
+
|
| 52 |
+
## Training and evaluation data
|
| 53 |
+
|
| 54 |
+
More information needed
|
| 55 |
+
|
| 56 |
+
## Training procedure
|
| 57 |
+
|
| 58 |
+
### Training hyperparameters
|
| 59 |
+
|
| 60 |
+
The following hyperparameters were used during training:
|
| 61 |
+
- learning_rate: 0.001
|
| 62 |
+
- train_batch_size: 64
|
| 63 |
+
- eval_batch_size: 64
|
| 64 |
+
- seed: 42
|
| 65 |
+
- optimizer: Use OptimizerNames.ADAMW_TORCH_FUSED with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
|
| 66 |
+
- lr_scheduler_type: linear
|
| 67 |
+
- num_epochs: 1
|
| 68 |
+
|
| 69 |
+
### Training results
|
| 70 |
+
|
| 71 |
+
| Training Loss | Epoch | Step | Validation Loss | Ce | Valid Targets | Ppl | Mile Loss | Mile Ppl | Top1 Accuracy | Top3 Accuracy | Topk Valid Targets | Copy Gate Mean | Copy Sink Mean | Copy Effective Gate Mean | Copy Target Responsibility Mean | Copy Target In Context Fraction | Copy Valid Targets | Ntp Loss | Ntp Ce Unweighted | Mile Reweighting Delta | Mu Loss | Tweo Loss | Nitp Loss | Total Model Loss | Tweo Weighted Loss | Nitp Weighted Loss | Auxiliary Loss | Regularization Loss |
|
| 72 |
+
|:-------------:|:-----:|:-----:|:---------------:|:------:|:-------------:|:-------:|:---------:|:--------:|:-------------:|:-------------:|:------------------:|:--------------:|:--------------:|:------------------------:|:-------------------------------:|:-------------------------------:|:------------------:|:--------:|:-----------------:|:----------------------:|:-------:|:---------:|:---------:|:----------------:|:------------------:|:------------------:|:--------------:|:-------------------:|
|
| 73 |
+
| 5.5014 | 0.32 | 5000 | 5.1422 | 4.0948 | 2083162.0 | 60.0244 | 4.6077 | 100.2542 | 0.2594 | 0.4360 | 2083162.0 | 0.3215 | 0.5617 | 0.1674 | 0.1650 | 0.4607 | 2083162.0 | 4.6084 | 4.0952 | 0.5129 | 0.0002 | 5.6657 | 0.4772 | 5.1422 | 0.0567 | 0.4772 | 0.5338 | 0.0568 |
|
| 74 |
+
| 5.2629 | 0.64 | 10000 | 4.8937 | 3.8387 | 2083162.0 | 46.4664 | 4.3937 | 80.9401 | 0.2866 | 0.4673 | 2083162.0 | 0.2638 | 0.5579 | 0.1464 | 0.1483 | 0.4607 | 2083162.0 | 4.3947 | 3.8392 | 0.5549 | 0.0006 | 5.4333 | 0.4446 | 4.8937 | 0.0543 | 0.4446 | 0.4989 | 0.0549 |
|
| 75 |
+
| 5.0697 | 0.96 | 15000 | 4.6966 | 3.6587 | 2083162.0 | 38.8125 | 4.2554 | 70.4849 | 0.3060 | 0.4893 | 2083162.0 | 0.2770 | 0.6103 | 0.1435 | 0.1423 | 0.4607 | 2083162.0 | 4.2566 | 3.6593 | 0.5966 | 0.0008 | 4.8820 | 0.3911 | 4.6966 | 0.0488 | 0.3911 | 0.4399 | 0.0496 |
|
| 76 |
+
| 5.0386 | 1.0 | 15625 | 4.6689 | 3.6325 | 2083162.0 | 37.8089 | 4.2281 | 68.5884 | 0.3089 | 0.4925 | 2083162.0 | 0.2791 | 0.6099 | 0.1439 | 0.1414 | 0.4607 | 2083162.0 | 4.2294 | 3.6331 | 0.5955 | 0.0008 | 4.8147 | 0.3914 | 4.6689 | 0.0481 | 0.3914 | 0.4395 | 0.0489 |
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
### Framework versions
|
| 80 |
+
|
| 81 |
+
- Transformers 5.22.1
|
| 82 |
+
- Pytorch 2.14.1+cu130
|
| 83 |
+
- Datasets 4.8.5
|
| 84 |
+
- Tokenizers 0.23.3
|
config.json
CHANGED
|
@@ -159,7 +159,7 @@
|
|
| 159 |
"use_ldm": false,
|
| 160 |
"use_learnable_multipliers": true,
|
| 161 |
"use_liger_kernel": false,
|
| 162 |
-
"use_linear_attention":
|
| 163 |
"use_lns": true,
|
| 164 |
"use_lucid_attention": false,
|
| 165 |
"use_mea_attention": false,
|
|
|
|
| 159 |
"use_ldm": false,
|
| 160 |
"use_learnable_multipliers": true,
|
| 161 |
"use_liger_kernel": false,
|
| 162 |
+
"use_linear_attention": false,
|
| 163 |
"use_lns": true,
|
| 164 |
"use_lucid_attention": false,
|
| 165 |
"use_mea_attention": false,
|
configuration_neollm.py
CHANGED
|
@@ -356,9 +356,9 @@ class NeoLLMConfig(PretrainedConfig):
|
|
| 356 |
normalized-input mechanism used by the strongest SiameseNorm
|
| 357 |
variant.
|
| 358 |
siamese_depth_scaling (:obj:`bool`, *optional*, defaults to ``True``):
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
|
| 362 |
siamese_attn_x_scale_init (:obj:`float`, *optional*, defaults to ``1.0``):
|
| 363 |
Initial value for the learnable elementwise scale applied to the
|
| 364 |
bounded stream in the SiameseNorm attention input.
|
|
@@ -928,9 +928,9 @@ class NeoLLMConfig(PretrainedConfig):
|
|
| 928 |
# ── CKDA / GDN2 linear attention ──────────────────────────────────
|
| 929 |
# Keyword-only to preserve positional compatibility with old configs.
|
| 930 |
*,
|
| 931 |
-
use_linear_attention=
|
| 932 |
linear_attention_type="ckda", # "none", "ckda", or "gdn2"
|
| 933 |
-
linear_attention_full_attention_every=3, #
|
| 934 |
linear_attention_layer_types=None, # Optional per-layer list overrides type and interval
|
| 935 |
linear_attention_num_heads=None, # None: inherit num_attention_heads
|
| 936 |
linear_attention_head_dim=None, # None: inherit the model's head_dim
|
|
|
|
| 356 |
normalized-input mechanism used by the strongest SiameseNorm
|
| 357 |
variant.
|
| 358 |
siamese_depth_scaling (:obj:`bool`, *optional*, defaults to ``True``):
|
| 359 |
+
Store the X stream as ``sqrt(2 * (layer_idx + 1)) * RMSNorm(X) +
|
| 360 |
+
update`` after each shared sublayer, following the official
|
| 361 |
+
SiameseNorm post/pre implementation. Y receives the shared update.
|
| 362 |
siamese_attn_x_scale_init (:obj:`float`, *optional*, defaults to ``1.0``):
|
| 363 |
Initial value for the learnable elementwise scale applied to the
|
| 364 |
bounded stream in the SiameseNorm attention input.
|
|
|
|
| 928 |
# ── CKDA / GDN2 linear attention ──────────────────────────────────
|
| 929 |
# Keyword-only to preserve positional compatibility with old configs.
|
| 930 |
*,
|
| 931 |
+
use_linear_attention=False, # None: infer; False: disable; True: require linear layers
|
| 932 |
linear_attention_type="ckda", # "none", "ckda", or "gdn2"
|
| 933 |
+
linear_attention_full_attention_every=3, # 2 linear + 1 full with 12 layers
|
| 934 |
linear_attention_layer_types=None, # Optional per-layer list overrides type and interval
|
| 935 |
linear_attention_num_heads=None, # None: inherit num_attention_heads
|
| 936 |
linear_attention_head_dim=None, # None: inherit the model's head_dim
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:66dc2f6bbe5587cd8054d940bd728671738fff4227dda29a0989d4d7311681f8
|
| 3 |
+
size 170287752
|
modeling_neollm.py
CHANGED
|
@@ -8031,6 +8031,12 @@ class NeoLLMDecoderLayer(GradientCheckpointingLayer):
|
|
| 8031 |
self.siamesenorm_kernel_backend = getattr(config, "siamesenorm_kernel_backend", "reference")
|
| 8032 |
if self.siamesenorm_kernel_backend not in {"reference", "triton", "cute"}:
|
| 8033 |
raise ValueError("siamesenorm_kernel_backend must be reference, triton or cute.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8034 |
self.siamese_normalized_input = bool(
|
| 8035 |
getattr(config, "siamese_normalized_input", True)
|
| 8036 |
)
|
|
@@ -8040,19 +8046,18 @@ class NeoLLMDecoderLayer(GradientCheckpointingLayer):
|
|
| 8040 |
self.siamese_attn_x_scale_init = float(
|
| 8041 |
getattr(config, "siamese_attn_x_scale_init", 1.0)
|
| 8042 |
)
|
| 8043 |
-
|
| 8044 |
1.0
|
| 8045 |
if not self.siamese_depth_scaling
|
| 8046 |
-
else
|
| 8047 |
)
|
| 8048 |
# A tensor buffer keeps the depth-dependent value out of Python control
|
| 8049 |
# flow during forward. Computing it from ``self.layer_idx`` inside a
|
| 8050 |
# Dynamo resume frame specialized that frame once per decoder layer.
|
| 8051 |
-
#
|
| 8052 |
-
# determined by layer_idx and the config on every construction.
|
| 8053 |
self.register_buffer(
|
| 8054 |
-
"
|
| 8055 |
-
torch.tensor(
|
| 8056 |
persistent=True,
|
| 8057 |
)
|
| 8058 |
# Controls only the first pre-attention normalisation applied directly
|
|
@@ -8104,13 +8109,13 @@ class NeoLLMDecoderLayer(GradientCheckpointingLayer):
|
|
| 8104 |
# constructed only when the Siamese topology is active, so no
|
| 8105 |
# inactive RMSNorm pre-norm modules remain in the graph.
|
| 8106 |
self.siamese_attn_x_norm = nn.RMSNorm(
|
| 8107 |
-
config.hidden_size, eps=config.rms_norm_eps
|
| 8108 |
)
|
| 8109 |
self.siamese_attn_y_norm = nn.RMSNorm(
|
| 8110 |
config.hidden_size, eps=config.rms_norm_eps
|
| 8111 |
)
|
| 8112 |
self.siamese_mlp_x_norm = nn.RMSNorm(
|
| 8113 |
-
config.hidden_size, eps=config.rms_norm_eps
|
| 8114 |
)
|
| 8115 |
self.siamese_mlp_y_norm = nn.RMSNorm(
|
| 8116 |
config.hidden_size, eps=config.rms_norm_eps
|
|
@@ -8132,6 +8137,9 @@ class NeoLLMDecoderLayer(GradientCheckpointingLayer):
|
|
| 8132 |
dtype=torch.float32,
|
| 8133 |
)
|
| 8134 |
)
|
|
|
|
|
|
|
|
|
|
| 8135 |
else:
|
| 8136 |
self.input_layernorm = (
|
| 8137 |
_make_norm(
|
|
@@ -8152,6 +8160,7 @@ class NeoLLMDecoderLayer(GradientCheckpointingLayer):
|
|
| 8152 |
self.siamese_attn_input_norm = None
|
| 8153 |
self.siamese_mlp_input_norm = None
|
| 8154 |
self.siamese_attn_x_scale = None
|
|
|
|
| 8155 |
|
| 8156 |
self.lns_attn = LNS(layer_idx) if self.use_lns else None
|
| 8157 |
self.lns_mlp = LNS(layer_idx) if self.use_lns else None
|
|
@@ -8452,8 +8461,8 @@ class NeoLLMDecoderLayer(GradientCheckpointingLayer):
|
|
| 8452 |
self._last_dag_r_dynamics = packed.detach().clone()
|
| 8453 |
return h, coefficients, residual, y_residual
|
| 8454 |
|
| 8455 |
-
def
|
| 8456 |
-
return self.
|
| 8457 |
device=ref.device,
|
| 8458 |
dtype=ref.dtype,
|
| 8459 |
)
|
|
@@ -8507,7 +8516,6 @@ class NeoLLMDecoderLayer(GradientCheckpointingLayer):
|
|
| 8507 |
# parameters. All Siamese normalization modules are RMSNorm by
|
| 8508 |
# construction; no dynamic-normalization branch remains.
|
| 8509 |
# ── Attention shared block ────────────────────────────────────────
|
| 8510 |
-
norm_backend = getattr(self, "siamesenorm_kernel_backend", "reference")
|
| 8511 |
if self.use_msar:
|
| 8512 |
branch = 2 * self.layer_idx
|
| 8513 |
msar_sources, msar_partial = _msar_start_branch(
|
|
@@ -8516,29 +8524,16 @@ class NeoLLMDecoderLayer(GradientCheckpointingLayer):
|
|
| 8516 |
branch, self.msar_block_branches, msar_valid, msar_position)
|
| 8517 |
else:
|
| 8518 |
msar_attn = None
|
| 8519 |
-
|
| 8520 |
-
|
| 8521 |
-
|
| 8522 |
-
|
| 8523 |
-
dtype=x_attn_norm.dtype, device=x_attn_norm.device
|
| 8524 |
-
)
|
| 8525 |
-
h_attn = x_scale * x_attn_norm + y_attn_norm
|
| 8526 |
-
else:
|
| 8527 |
-
from cut_cross_entropy.siamesenorm import siamesenorm
|
| 8528 |
-
h_attn = siamesenorm(
|
| 8529 |
-
x_states, y_states,
|
| 8530 |
-
self.siamese_attn_x_norm.weight, self.siamese_attn_y_norm.weight,
|
| 8531 |
-
self.siamese_attn_input_norm.weight
|
| 8532 |
-
if not (self.use_msar or self.use_ldm) and self.siamese_attn_input_norm is not None else None,
|
| 8533 |
-
self.siamese_attn_x_scale.to(dtype=x_states.dtype, device=x_states.device),
|
| 8534 |
-
eps=self.siamese_attn_x_norm.eps, backend=norm_backend,
|
| 8535 |
-
)
|
| 8536 |
if self.use_msar:
|
| 8537 |
h_attn = h_attn + msar_attn
|
| 8538 |
if self.use_ldm:
|
| 8539 |
ldm_memory, ldm_covariance, ldm_attn = self.ldm_attn_read(h_attn, ldm_state, ldm_valid)
|
| 8540 |
h_attn = h_attn + ldm_attn
|
| 8541 |
-
if self.siamese_attn_input_norm is not None
|
| 8542 |
h_attn = self.siamese_attn_input_norm(h_attn)
|
| 8543 |
|
| 8544 |
stack_metrics = None
|
|
@@ -8570,12 +8565,12 @@ class NeoLLMDecoderLayer(GradientCheckpointingLayer):
|
|
| 8570 |
**kwargs,
|
| 8571 |
)
|
| 8572 |
|
| 8573 |
-
|
| 8574 |
-
|
| 8575 |
-
x_states = x_states + dag_rx
|
| 8576 |
-
y_states = y_states + dag_ry
|
| 8577 |
-
x_after_attn = x_states + stream_scale * attn_out
|
| 8578 |
y_after_attn = y_states + attn_out
|
|
|
|
|
|
|
|
|
|
| 8579 |
if self.use_ldm:
|
| 8580 |
ldm_state = (ldm_memory, ldm_covariance,
|
| 8581 |
*self.ldm_attn_write((x_after_attn + y_after_attn) * .5,
|
|
@@ -8595,37 +8590,21 @@ class NeoLLMDecoderLayer(GradientCheckpointingLayer):
|
|
| 8595 |
branch, self.msar_block_branches, msar_valid, msar_position)
|
| 8596 |
else:
|
| 8597 |
msar_mlp = None
|
| 8598 |
-
|
| 8599 |
-
|
| 8600 |
-
|
| 8601 |
-
|
| 8602 |
-
else:
|
| 8603 |
-
h_mlp = siamesenorm(
|
| 8604 |
-
x_after_attn, y_after_attn,
|
| 8605 |
-
self.siamese_mlp_x_norm.weight, self.siamese_mlp_y_norm.weight,
|
| 8606 |
-
self.siamese_mlp_input_norm.weight
|
| 8607 |
-
if not (self.use_msar or self.use_ldm) and self.siamese_mlp_input_norm is not None else None,
|
| 8608 |
-
eps=self.siamese_mlp_x_norm.eps, backend=norm_backend,
|
| 8609 |
-
post_scale=(
|
| 8610 |
-
self.lns_mlp.scale.to(device=x_after_attn.device, dtype=x_after_attn.dtype)
|
| 8611 |
-
if self.use_lns and not (self.use_msar or self.use_ldm) else None
|
| 8612 |
-
),
|
| 8613 |
-
out_dtype=(
|
| 8614 |
-
torch.get_autocast_dtype("cuda")
|
| 8615 |
-
if not (self.use_msar or self.use_ldm) and torch.is_autocast_enabled("cuda") else None
|
| 8616 |
-
),
|
| 8617 |
-
)
|
| 8618 |
if self.use_msar:
|
| 8619 |
h_mlp = h_mlp + msar_mlp
|
| 8620 |
if self.use_ldm:
|
| 8621 |
ldm_memory, ldm_covariance, ldm_mlp = self.ldm_mlp_read(h_mlp, ldm_state, ldm_valid)
|
| 8622 |
h_mlp = h_mlp + ldm_mlp
|
| 8623 |
-
if self.siamese_mlp_input_norm is not None
|
| 8624 |
h_mlp = self.siamese_mlp_input_norm(h_mlp)
|
| 8625 |
|
| 8626 |
# Only this consumer starts directly with an autocast Linear. Attention
|
| 8627 |
# also exposes native states to positional, router and memory consumers.
|
| 8628 |
-
h_lns2 = self.lns_mlp(h_mlp) if self.use_lns
|
| 8629 |
delta_m = self.mlp(h_lns2)
|
| 8630 |
|
| 8631 |
jtok_aux_stats = None
|
|
@@ -8644,7 +8623,7 @@ class NeoLLMDecoderLayer(GradientCheckpointingLayer):
|
|
| 8644 |
else:
|
| 8645 |
shared_update = delta_m
|
| 8646 |
|
| 8647 |
-
x_next =
|
| 8648 |
y_next = y_after_attn + shared_update
|
| 8649 |
if self.use_ldm:
|
| 8650 |
ldm_state = (ldm_memory, ldm_covariance,
|
|
@@ -9297,18 +9276,17 @@ class NeoLLMPreTrainedModel(PreTrainedModel):
|
|
| 9297 |
and requested_dtype.is_floating_point
|
| 9298 |
):
|
| 9299 |
for module in model.modules():
|
| 9300 |
-
|
| 9301 |
-
|
| 9302 |
-
siamese_scale
|
| 9303 |
-
dtype=requested_dtype
|
| 9304 |
-
)
|
| 9305 |
stream_scale = getattr(
|
| 9306 |
module,
|
| 9307 |
-
"
|
| 9308 |
None,
|
| 9309 |
)
|
| 9310 |
if stream_scale is not None:
|
| 9311 |
-
module._buffers["
|
| 9312 |
stream_scale.to(dtype=requested_dtype)
|
| 9313 |
)
|
| 9314 |
if return_loading_info:
|
|
@@ -9475,6 +9453,8 @@ class NeoLLMPreTrainedModel(PreTrainedModel):
|
|
| 9475 |
and module.siamese_attn_x_scale is not None
|
| 9476 |
):
|
| 9477 |
module.siamese_attn_x_scale.data.fill_(module.siamese_attn_x_scale_init)
|
|
|
|
|
|
|
| 9478 |
# AttnRes pseudo-queries: MUST be initialized to zero.
|
| 9479 |
# Zero initialization ensures uniform attention weights at step 0
|
| 9480 |
# (softmax of zeros is uniform), making AttnRes equivalent to a
|
|
@@ -12520,9 +12500,10 @@ class NeoLLMForCausalLM(NeoLLMPreTrainedModel, GenerationMixin):
|
|
| 12520 |
if gpas is not None:
|
| 12521 |
metrics[prefix + f"gpas_{slot}_forward_gain"] = (1-F.silu(gpas.alpha.detach().float())).reshape(())
|
| 12522 |
if layer.use_siamesenorm:
|
| 12523 |
-
|
| 12524 |
-
|
| 12525 |
-
|
|
|
|
| 12526 |
if layer.layer_idx > 0 and layer.self_attn.use_fan_residual:
|
| 12527 |
for name in ("lambda_1", "lambda_2"):
|
| 12528 |
metrics[prefix + "fan_" + name] = getattr(layer.self_attn, name).detach().float().reshape(())
|
|
@@ -12574,6 +12555,7 @@ class NeoLLMForCausalLM(NeoLLMPreTrainedModel, GenerationMixin):
|
|
| 12574 |
"laurel": ("laurel_rw_attn", "laurel_rw_mlp", "laurel_lr_A_attn",
|
| 12575 |
"laurel_lr_B_attn", "laurel_lr_A_mlp", "laurel_lr_B_mlp"),
|
| 12576 |
"siamese": ("siamese_attn_x_scale",),
|
|
|
|
| 12577 |
"stack": ("stack_memory",),
|
| 12578 |
"gpas": ("gpas_attn", "gpas_mlp"),
|
| 12579 |
}
|
|
|
|
| 8031 |
self.siamesenorm_kernel_backend = getattr(config, "siamesenorm_kernel_backend", "reference")
|
| 8032 |
if self.siamesenorm_kernel_backend not in {"reference", "triton", "cute"}:
|
| 8033 |
raise ValueError("siamesenorm_kernel_backend must be reference, triton or cute.")
|
| 8034 |
+
if self.use_siamesenorm and self.siamesenorm_kernel_backend != "reference":
|
| 8035 |
+
if layer_idx == 0:
|
| 8036 |
+
logger.warning("SiameseNorm sublayers use PyTorch: the selected custom backend "
|
| 8037 |
+
"does not implement the corrected residual topology. "
|
| 8038 |
+
"The final stream merge retains the selected backend.")
|
| 8039 |
+
self.siamesenorm_kernel_backend = "reference"
|
| 8040 |
self.siamese_normalized_input = bool(
|
| 8041 |
getattr(config, "siamese_normalized_input", True)
|
| 8042 |
)
|
|
|
|
| 8046 |
self.siamese_attn_x_scale_init = float(
|
| 8047 |
getattr(config, "siamese_attn_x_scale_init", 1.0)
|
| 8048 |
)
|
| 8049 |
+
siamese_depth_factor = (
|
| 8050 |
1.0
|
| 8051 |
if not self.siamese_depth_scaling
|
| 8052 |
+
else math.sqrt(2.0 * float(layer_idx + 1))
|
| 8053 |
)
|
| 8054 |
# A tensor buffer keeps the depth-dependent value out of Python control
|
| 8055 |
# flow during forward. Computing it from ``self.layer_idx`` inside a
|
| 8056 |
# Dynamo resume frame specialized that frame once per decoder layer.
|
| 8057 |
+
# The factor is determined by the layer index and configuration.
|
|
|
|
| 8058 |
self.register_buffer(
|
| 8059 |
+
"_siamese_depth_factor",
|
| 8060 |
+
torch.tensor(siamese_depth_factor, dtype=torch.float32),
|
| 8061 |
persistent=True,
|
| 8062 |
)
|
| 8063 |
# Controls only the first pre-attention normalisation applied directly
|
|
|
|
| 8109 |
# constructed only when the Siamese topology is active, so no
|
| 8110 |
# inactive RMSNorm pre-norm modules remain in the graph.
|
| 8111 |
self.siamese_attn_x_norm = nn.RMSNorm(
|
| 8112 |
+
config.hidden_size, eps=config.rms_norm_eps, elementwise_affine=False
|
| 8113 |
)
|
| 8114 |
self.siamese_attn_y_norm = nn.RMSNorm(
|
| 8115 |
config.hidden_size, eps=config.rms_norm_eps
|
| 8116 |
)
|
| 8117 |
self.siamese_mlp_x_norm = nn.RMSNorm(
|
| 8118 |
+
config.hidden_size, eps=config.rms_norm_eps, elementwise_affine=False
|
| 8119 |
)
|
| 8120 |
self.siamese_mlp_y_norm = nn.RMSNorm(
|
| 8121 |
config.hidden_size, eps=config.rms_norm_eps
|
|
|
|
| 8137 |
dtype=torch.float32,
|
| 8138 |
)
|
| 8139 |
)
|
| 8140 |
+
self.siamese_mlp_x_scale = nn.Parameter(
|
| 8141 |
+
torch.ones(config.hidden_size, dtype=torch.float32)
|
| 8142 |
+
)
|
| 8143 |
else:
|
| 8144 |
self.input_layernorm = (
|
| 8145 |
_make_norm(
|
|
|
|
| 8160 |
self.siamese_attn_input_norm = None
|
| 8161 |
self.siamese_mlp_input_norm = None
|
| 8162 |
self.siamese_attn_x_scale = None
|
| 8163 |
+
self.siamese_mlp_x_scale = None
|
| 8164 |
|
| 8165 |
self.lns_attn = LNS(layer_idx) if self.use_lns else None
|
| 8166 |
self.lns_mlp = LNS(layer_idx) if self.use_lns else None
|
|
|
|
| 8461 |
self._last_dag_r_dynamics = packed.detach().clone()
|
| 8462 |
return h, coefficients, residual, y_residual
|
| 8463 |
|
| 8464 |
+
def _siamese_depth_scale(self, ref: torch.Tensor) -> torch.Tensor:
|
| 8465 |
+
return self._siamese_depth_factor.to(
|
| 8466 |
device=ref.device,
|
| 8467 |
dtype=ref.dtype,
|
| 8468 |
)
|
|
|
|
| 8516 |
# parameters. All Siamese normalization modules are RMSNorm by
|
| 8517 |
# construction; no dynamic-normalization branch remains.
|
| 8518 |
# ── Attention shared block ────────────────────────────────────────
|
|
|
|
| 8519 |
if self.use_msar:
|
| 8520 |
branch = 2 * self.layer_idx
|
| 8521 |
msar_sources, msar_partial = _msar_start_branch(
|
|
|
|
| 8524 |
branch, self.msar_block_branches, msar_valid, msar_position)
|
| 8525 |
else:
|
| 8526 |
msar_attn = None
|
| 8527 |
+
x_attn_norm = self.siamese_attn_x_norm(x_states)
|
| 8528 |
+
y_attn_norm = self.siamese_attn_y_norm(y_states)
|
| 8529 |
+
x_scale = self.siamese_attn_x_scale.to(dtype=x_attn_norm.dtype, device=x_attn_norm.device)
|
| 8530 |
+
h_attn = x_scale * x_attn_norm + y_attn_norm
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8531 |
if self.use_msar:
|
| 8532 |
h_attn = h_attn + msar_attn
|
| 8533 |
if self.use_ldm:
|
| 8534 |
ldm_memory, ldm_covariance, ldm_attn = self.ldm_attn_read(h_attn, ldm_state, ldm_valid)
|
| 8535 |
h_attn = h_attn + ldm_attn
|
| 8536 |
+
if self.siamese_attn_input_norm is not None:
|
| 8537 |
h_attn = self.siamese_attn_input_norm(h_attn)
|
| 8538 |
|
| 8539 |
stack_metrics = None
|
|
|
|
| 8565 |
**kwargs,
|
| 8566 |
)
|
| 8567 |
|
| 8568 |
+
depth_factor = self._siamese_depth_scale(attn_out)
|
| 8569 |
+
x_after_attn = depth_factor * x_attn_norm + attn_out
|
|
|
|
|
|
|
|
|
|
| 8570 |
y_after_attn = y_states + attn_out
|
| 8571 |
+
if dag_rx is not None:
|
| 8572 |
+
x_after_attn = x_after_attn + dag_rx
|
| 8573 |
+
y_after_attn = y_after_attn + dag_ry
|
| 8574 |
if self.use_ldm:
|
| 8575 |
ldm_state = (ldm_memory, ldm_covariance,
|
| 8576 |
*self.ldm_attn_write((x_after_attn + y_after_attn) * .5,
|
|
|
|
| 8590 |
branch, self.msar_block_branches, msar_valid, msar_position)
|
| 8591 |
else:
|
| 8592 |
msar_mlp = None
|
| 8593 |
+
x_mlp_norm = self.siamese_mlp_x_norm(x_after_attn)
|
| 8594 |
+
y_mlp_norm = self.siamese_mlp_y_norm(y_after_attn)
|
| 8595 |
+
mlp_scale = self.siamese_mlp_x_scale.to(dtype=x_mlp_norm.dtype, device=x_mlp_norm.device)
|
| 8596 |
+
h_mlp = mlp_scale * x_mlp_norm + y_mlp_norm
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8597 |
if self.use_msar:
|
| 8598 |
h_mlp = h_mlp + msar_mlp
|
| 8599 |
if self.use_ldm:
|
| 8600 |
ldm_memory, ldm_covariance, ldm_mlp = self.ldm_mlp_read(h_mlp, ldm_state, ldm_valid)
|
| 8601 |
h_mlp = h_mlp + ldm_mlp
|
| 8602 |
+
if self.siamese_mlp_input_norm is not None:
|
| 8603 |
h_mlp = self.siamese_mlp_input_norm(h_mlp)
|
| 8604 |
|
| 8605 |
# Only this consumer starts directly with an autocast Linear. Attention
|
| 8606 |
# also exposes native states to positional, router and memory consumers.
|
| 8607 |
+
h_lns2 = self.lns_mlp(h_mlp) if self.use_lns else h_mlp
|
| 8608 |
delta_m = self.mlp(h_lns2)
|
| 8609 |
|
| 8610 |
jtok_aux_stats = None
|
|
|
|
| 8623 |
else:
|
| 8624 |
shared_update = delta_m
|
| 8625 |
|
| 8626 |
+
x_next = depth_factor * x_mlp_norm + shared_update
|
| 8627 |
y_next = y_after_attn + shared_update
|
| 8628 |
if self.use_ldm:
|
| 8629 |
ldm_state = (ldm_memory, ldm_covariance,
|
|
|
|
| 9276 |
and requested_dtype.is_floating_point
|
| 9277 |
):
|
| 9278 |
for module in model.modules():
|
| 9279 |
+
for name in ("siamese_attn_x_scale", "siamese_mlp_x_scale"):
|
| 9280 |
+
siamese_scale = getattr(module, name, None)
|
| 9281 |
+
if siamese_scale is not None:
|
| 9282 |
+
siamese_scale.data = siamese_scale.data.to(dtype=requested_dtype)
|
|
|
|
| 9283 |
stream_scale = getattr(
|
| 9284 |
module,
|
| 9285 |
+
"_siamese_depth_factor",
|
| 9286 |
None,
|
| 9287 |
)
|
| 9288 |
if stream_scale is not None:
|
| 9289 |
+
module._buffers["_siamese_depth_factor"] = (
|
| 9290 |
stream_scale.to(dtype=requested_dtype)
|
| 9291 |
)
|
| 9292 |
if return_loading_info:
|
|
|
|
| 9453 |
and module.siamese_attn_x_scale is not None
|
| 9454 |
):
|
| 9455 |
module.siamese_attn_x_scale.data.fill_(module.siamese_attn_x_scale_init)
|
| 9456 |
+
if getattr(module, "siamese_mlp_x_scale", None) is not None:
|
| 9457 |
+
module.siamese_mlp_x_scale.data.fill_(1.0)
|
| 9458 |
# AttnRes pseudo-queries: MUST be initialized to zero.
|
| 9459 |
# Zero initialization ensures uniform attention weights at step 0
|
| 9460 |
# (softmax of zeros is uniform), making AttnRes equivalent to a
|
|
|
|
| 12500 |
if gpas is not None:
|
| 12501 |
metrics[prefix + f"gpas_{slot}_forward_gain"] = (1-F.silu(gpas.alpha.detach().float())).reshape(())
|
| 12502 |
if layer.use_siamesenorm:
|
| 12503 |
+
for slot in ("attn", "mlp"):
|
| 12504 |
+
scale = getattr(layer, f"siamese_{slot}_x_scale").detach().float()
|
| 12505 |
+
metrics[prefix + f"siamese_{slot}_x_scale_mean"] = scale.mean()
|
| 12506 |
+
metrics[prefix + f"siamese_{slot}_x_scale_rms"] = scale.square().mean().sqrt()
|
| 12507 |
if layer.layer_idx > 0 and layer.self_attn.use_fan_residual:
|
| 12508 |
for name in ("lambda_1", "lambda_2"):
|
| 12509 |
metrics[prefix + "fan_" + name] = getattr(layer.self_attn, name).detach().float().reshape(())
|
|
|
|
| 12555 |
"laurel": ("laurel_rw_attn", "laurel_rw_mlp", "laurel_lr_A_attn",
|
| 12556 |
"laurel_lr_B_attn", "laurel_lr_A_mlp", "laurel_lr_B_mlp"),
|
| 12557 |
"siamese": ("siamese_attn_x_scale",),
|
| 12558 |
+
"siamese_mlp": ("siamese_mlp_x_scale",),
|
| 12559 |
"stack": ("stack_memory",),
|
| 12560 |
"gpas": ("gpas_attn", "gpas_mlp"),
|
| 12561 |
}
|
optimizer_precision.json
CHANGED
|
@@ -8,9 +8,9 @@
|
|
| 8 |
"delta_enabled": false,
|
| 9 |
"delta_eta": 0.37,
|
| 10 |
"fp32_master_active": true,
|
| 11 |
-
"fp32_master_elements":
|
| 12 |
-
"fp32_master_groups":
|
| 13 |
-
"fp32_master_tensors":
|
| 14 |
"fp32_passthrough_elements": 0,
|
| 15 |
"mode": "fp32_master",
|
| 16 |
"mxfp8_active": false,
|
|
@@ -19,12 +19,12 @@
|
|
| 19 |
"mxfp8_recipe": null,
|
| 20 |
"native_precision_elements": 0,
|
| 21 |
"optimizer_variant": "AdEMAMix",
|
| 22 |
-
"ordinary_linear_layers":
|
| 23 |
"parameter_elements_by_dtype": {
|
| 24 |
-
"bfloat16":
|
| 25 |
-
"float32":
|
| 26 |
},
|
| 27 |
-
"parameter_storage_bytes":
|
| 28 |
"runtime_precision_mode": "BF16_FP32_MASTER",
|
| 29 |
"stochastic_round_seed": 0
|
| 30 |
}
|
|
|
|
| 8 |
"delta_enabled": false,
|
| 9 |
"delta_eta": 0.37,
|
| 10 |
"fp32_master_active": true,
|
| 11 |
+
"fp32_master_elements": 85119928,
|
| 12 |
+
"fp32_master_groups": 6,
|
| 13 |
+
"fp32_master_tensors": 368,
|
| 14 |
"fp32_passthrough_elements": 0,
|
| 15 |
"mode": "fp32_master",
|
| 16 |
"mxfp8_active": false,
|
|
|
|
| 19 |
"mxfp8_recipe": null,
|
| 20 |
"native_precision_elements": 0,
|
| 21 |
"optimizer_variant": "AdEMAMix",
|
| 22 |
+
"ordinary_linear_layers": 129,
|
| 23 |
"parameter_elements_by_dtype": {
|
| 24 |
+
"bfloat16": 85117752,
|
| 25 |
+
"float32": 2176
|
| 26 |
},
|
| 27 |
+
"parameter_storage_bytes": 170244208,
|
| 28 |
"runtime_precision_mode": "BF16_FP32_MASTER",
|
| 29 |
"stochastic_round_seed": 0
|
| 30 |
}
|
training_args.bin
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 5329
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9874bd7fc0bda2eb6503079473525ee5fe8948e0ee4bb947a748e8326822ac5b
|
| 3 |
size 5329
|