Text Generation
MLX
English
sol_lassi
causal-lm
decoder-only
small-language-model
experimental
sol-intelligence
Instructions to use solintellegence/Sol-Lassi with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use solintellegence/Sol-Lassi with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # if on a CUDA device, also pip install mlx[cuda] # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("solintellegence/Sol-Lassi") prompt = "Once upon a time in" text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- MLX LM
How to use solintellegence/Sol-Lassi with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Generate some text mlx_lm.generate --model "solintellegence/Sol-Lassi" --prompt "Once upon a time"
- Atomic Chat
Publish Sol Lassi 600K Base
Browse filesUpload trained 600K M-SimOW checkpoint, MLX loader, tokenizer, provenance, and Sol Lassi banner.
- .gitattributes +1 -0
- LICENSE +12 -0
- README.md +92 -0
- __pycache__/modeling_sol_lassi.cpython-314.pyc +0 -0
- config.json +15 -0
- keystone_mlx/__init__.py +5 -0
- keystone_mlx/dense_control.py +292 -0
- keystone_mlx/model.py +413 -0
- model.npz +3 -0
- modeling_sol_lassi.py +54 -0
- requirements.txt +3 -0
- sol-lassi-banner.png +3 -0
- tokenizer.json +0 -0
- tokenizer_config.json +8 -0
- training_state.json +23 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
sol-lassi-banner.png filter=lfs diff=lfs merge=lfs -text
|
LICENSE
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Creative Commons Attribution 4.0 International
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2026 Sol Labs
|
| 4 |
+
|
| 5 |
+
Licensed under the Creative Commons Attribution 4.0 International License.
|
| 6 |
+
You may obtain a copy of the License at:
|
| 7 |
+
|
| 8 |
+
https://creativecommons.org/licenses/by/4.0/legalcode
|
| 9 |
+
|
| 10 |
+
Unless required by applicable law or agreed to in writing, material distributed
|
| 11 |
+
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
| 12 |
+
CONDITIONS OF ANY KIND, either express or implied.
|
README.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-4.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
pipeline_tag: text-generation
|
| 6 |
+
tags:
|
| 7 |
+
- causal-lm
|
| 8 |
+
- decoder-only
|
| 9 |
+
- small-language-model
|
| 10 |
+
- mlx
|
| 11 |
+
- experimental
|
| 12 |
+
- sol-intelligence
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+

|
| 16 |
+
|
| 17 |
+
# Sol Lassi 600K Base
|
| 18 |
+
|
| 19 |
+
Sol Lassi is an experimental **600,000-parameter** decoder-only language model from **Sol Intelligence**. It was trained from scratch for **1 billion token exposures** with M-SimOW.
|
| 20 |
+
|
| 21 |
+
This is a small **base language model**, not an instruction-tuned assistant. No Intelligence Index or leaderboard score is claimed for this checkpoint.
|
| 22 |
+
|
| 23 |
+
## Model summary
|
| 24 |
+
|
| 25 |
+
| Property | Value |
|
| 26 |
+
|---|---|
|
| 27 |
+
| Parameters | **600,000** |
|
| 28 |
+
| Architecture | Dense decoder-only causal language model |
|
| 29 |
+
| Transformer blocks | 6 independent blocks |
|
| 30 |
+
| Hidden width | 96 |
|
| 31 |
+
| Attention | 3 heads, 32 dimensions per head |
|
| 32 |
+
| MLP | Gated SiLU, width 104 |
|
| 33 |
+
| Vocabulary | 2,048-token byte-level BPE |
|
| 34 |
+
| Input/output embeddings | Tied |
|
| 35 |
+
| Training context | 128 tokens |
|
| 36 |
+
| Weight format | MLX NPZ |
|
| 37 |
+
| Training tokens | **1,000,000,000 exposures** |
|
| 38 |
+
|
| 39 |
+
## Training
|
| 40 |
+
|
| 41 |
+
Sol Lassi was trained on a balanced FinePhrase stream composed of its `faq`, `math`, `table`, and `tutorial` configurations. Training used 128-token sequences, batch size 32, and seed 7.
|
| 42 |
+
|
| 43 |
+
The optimizer was M-SimOW (momentum beta 0.8) with decoupled weight decay of 0.1. The fixed learning-rate schedule was:
|
| 44 |
+
|
| 45 |
+
| Training span | Learning rate |
|
| 46 |
+
|---:|---:|
|
| 47 |
+
| First 500M tokens | 0.006 |
|
| 48 |
+
| Next 500M tokens | 0.003 |
|
| 49 |
+
|
| 50 |
+
The saved run used the FinePhrase-balanced-500m-2k-v2 manifest. It contains 500M training-stream tokens; the model received 1B token exposures. The tokenizer and training metadata are included in this repository.
|
| 51 |
+
|
| 52 |
+
## Quick start
|
| 53 |
+
|
| 54 |
+
Sol Lassi uses MLX and is intended to run on Apple Silicon.
|
| 55 |
+
|
| 56 |
+
```bash
|
| 57 |
+
pip install -r requirements.txt
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
```python
|
| 61 |
+
from huggingface_hub import snapshot_download
|
| 62 |
+
from modeling_sol_lassi import load_model, generate
|
| 63 |
+
|
| 64 |
+
model_dir = snapshot_download("solintellegence/sol-lassi")
|
| 65 |
+
model, tokenizer = load_model(model_dir)
|
| 66 |
+
print(generate(model, tokenizer, "A tiny language model can", max_new_tokens=48))
|
| 67 |
+
```
|
| 68 |
+
|
| 69 |
+
## Evaluation status
|
| 70 |
+
|
| 71 |
+
This release does not include Open-SLM, ArithMark, or Intelligence Index evaluations. Its training loss logs are per-minibatch measurements and are not presented as held-out performance.
|
| 72 |
+
|
| 73 |
+
## Intended use and limitations
|
| 74 |
+
|
| 75 |
+
Sol Lassi is for research on very small language models and optimizer experiments. At 600K parameters, it has substantial capability limits; its output may be incoherent, repetitive, factually incorrect, or unsafe. It is not suitable for high-stakes use.
|
| 76 |
+
|
| 77 |
+
## Repository files
|
| 78 |
+
|
| 79 |
+
| File | Purpose |
|
| 80 |
+
|---|---|
|
| 81 |
+
| `model.npz` | Trained MLX weights |
|
| 82 |
+
| `modeling_sol_lassi.py` | Standalone loader and generation helper |
|
| 83 |
+
| `keystone_mlx/` | Architecture implementation required by the loader |
|
| 84 |
+
| `tokenizer.json` | Frozen 2,048-token tokenizer |
|
| 85 |
+
| `tokenizer_config.json` | Tokenizer metadata |
|
| 86 |
+
| `config.json` | Architecture metadata |
|
| 87 |
+
| `training_state.json` | Training and provenance summary |
|
| 88 |
+
| `sol-lassi-banner.png` | Sol Lassi model artwork |
|
| 89 |
+
|
| 90 |
+
## License
|
| 91 |
+
|
| 92 |
+
Released under **CC BY 4.0**. Dataset terms remain with the upstream dataset providers.
|
__pycache__/modeling_sol_lassi.cpython-314.pyc
ADDED
|
Binary file (3.37 kB). View file
|
|
|
config.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_type": "sol_lassi",
|
| 3 |
+
"architectures": ["SolLassi"],
|
| 4 |
+
"model_name": "Sol Lassi 600K Base",
|
| 5 |
+
"parameter_count": 600000,
|
| 6 |
+
"vocab_size": 2048,
|
| 7 |
+
"hidden_size": 96,
|
| 8 |
+
"num_hidden_layers": 6,
|
| 9 |
+
"num_attention_heads": 3,
|
| 10 |
+
"head_dim": 32,
|
| 11 |
+
"intermediate_size": 104,
|
| 12 |
+
"max_position_embeddings": 128,
|
| 13 |
+
"tie_word_embeddings": true,
|
| 14 |
+
"model_format": "mlx_npz"
|
| 15 |
+
}
|
keystone_mlx/__init__.py
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Metal/MLX training implementation for the experimental Keystone-2M model."""
|
| 2 |
+
|
| 3 |
+
from .model import DEFAULT_CONFIG, KeystoneConfig, KeystoneLM
|
| 4 |
+
|
| 5 |
+
__all__ = ["DEFAULT_CONFIG", "KeystoneConfig", "KeystoneLM"]
|
keystone_mlx/dense_control.py
ADDED
|
@@ -0,0 +1,292 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Matched dense causal-decoder controls for the Keystone Metal contest.
|
| 2 |
+
|
| 3 |
+
Keystone's claim is *stored-parameter* efficiency, so any comparison is only
|
| 4 |
+
meaningful against a conventional dense decoder holding the same number of
|
| 5 |
+
trainable scalars, reading the same tokenizer, and seeing the same batches.
|
| 6 |
+
This module supplies that control: a tied dense token table, full-rank
|
| 7 |
+
multi-head causal attention, and dense gated channel MLPs. There is no weight
|
| 8 |
+
sharing, low-rank factorization, mixture routing, or quantization here — that is
|
| 9 |
+
the point of the control.
|
| 10 |
+
|
| 11 |
+
Two shapes are published rather than one. A single hand-picked control shape
|
| 12 |
+
can silently flatter the candidate, so the contest trains every shape and the
|
| 13 |
+
*best* dense result is used as the control (strongest-control policy).
|
| 14 |
+
"""
|
| 15 |
+
|
| 16 |
+
from __future__ import annotations
|
| 17 |
+
|
| 18 |
+
from dataclasses import asdict, dataclass
|
| 19 |
+
import math
|
| 20 |
+
from typing import Any
|
| 21 |
+
|
| 22 |
+
import mlx.core as mx
|
| 23 |
+
import mlx.nn as nn
|
| 24 |
+
from mlx.utils import tree_flatten
|
| 25 |
+
import numpy as np
|
| 26 |
+
|
| 27 |
+
try:
|
| 28 |
+
from keystone_mlx.model import CenteredUnitNorm, DenseTiedTokens, deterministic_coordinates
|
| 29 |
+
except ModuleNotFoundError:
|
| 30 |
+
from model import CenteredUnitNorm, DenseTiedTokens, deterministic_coordinates
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
@dataclass(frozen=True)
|
| 34 |
+
class DenseControlConfig:
|
| 35 |
+
"""Immutable specification for one matched dense decoder control.
|
| 36 |
+
|
| 37 |
+
Args:
|
| 38 |
+
vocab_size: Token IDs accepted by the tied dense interface.
|
| 39 |
+
width: Residual stream width.
|
| 40 |
+
blocks: Number of independent (non-shared) decoder blocks.
|
| 41 |
+
head_dim: Channels per attention head; ``width`` must divide evenly.
|
| 42 |
+
mlp_width: Hidden width of each block's dense gated MLP.
|
| 43 |
+
"""
|
| 44 |
+
|
| 45 |
+
vocab_size: int = 2_048
|
| 46 |
+
width: int = 128
|
| 47 |
+
blocks: int = 6
|
| 48 |
+
head_dim: int = 32
|
| 49 |
+
mlp_width: int = 148
|
| 50 |
+
|
| 51 |
+
def __post_init__(self) -> None:
|
| 52 |
+
if self.vocab_size < 2:
|
| 53 |
+
raise ValueError("vocab_size must be at least two")
|
| 54 |
+
if self.width < 2 or self.blocks < 1 or self.mlp_width < 1:
|
| 55 |
+
raise ValueError("width, blocks, and mlp_width must be positive")
|
| 56 |
+
if self.head_dim < 1 or self.width % self.head_dim != 0:
|
| 57 |
+
raise ValueError("head_dim must divide width exactly")
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
# The 1M shapes are matched to Keystone-1M-2K's exact 999,744 stored scalars.
|
| 61 |
+
# `deep` is 999,680 (0.0064% under) and `wide` is 999,360 (0.0384% under).
|
| 62 |
+
DENSE_CONTROL_DEEP = DenseControlConfig(vocab_size=2_048, width=128, blocks=6, head_dim=32, mlp_width=148)
|
| 63 |
+
DENSE_CONTROL_WIDE = DenseControlConfig(vocab_size=2_048, width=160, blocks=4, head_dim=32, mlp_width=135)
|
| 64 |
+
# 600K M-SimOW scale-down: preserve the 1M deep model's six blocks and 2K
|
| 65 |
+
# tied vocabulary while narrowing the residual stream to 96. This geometry
|
| 66 |
+
# lands on exactly 600,000 stored parameters.
|
| 67 |
+
DENSE_CONTROL_600K_DEEP = DenseControlConfig(vocab_size=2_048, width=96, blocks=6, head_dim=32, mlp_width=104)
|
| 68 |
+
# The 10M pair is matched to Trellis-10M-2K's 10,001,408 scalar budget:
|
| 69 |
+
# deep = 10,000,256 (-0.0115%); wide = 9,996,800 (-0.0461%). Both retain the
|
| 70 |
+
# same 2K tokenizer interface and are inside the predeclared 0.05% tolerance.
|
| 71 |
+
DENSE_CONTROL_10M_DEEP = DenseControlConfig(vocab_size=2_048, width=448, blocks=8, head_dim=64, mlp_width=246)
|
| 72 |
+
DENSE_CONTROL_10M_WIDE = DenseControlConfig(vocab_size=2_048, width=512, blocks=5, head_dim=64, mlp_width=481)
|
| 73 |
+
# Under-3M deep geometry for the Ember-inspired XSA recurrent scale gate.
|
| 74 |
+
# It preserves the 10 physical / 14 effective-block layout with a healthy
|
| 75 |
+
# 4.22x gated MLP and totals exactly 2,996,480 stored parameters.
|
| 76 |
+
DENSE_CONTROL_3M_DEEP = DenseControlConfig(vocab_size=2_048, width=128, blocks=10, head_dim=32, mlp_width=540)
|
| 77 |
+
# Exact 2.9M scale-up: 2,896,640 stored parameters at the 2K vocabulary.
|
| 78 |
+
DENSE_CONTROL_2P9M_DEEP = DenseControlConfig(vocab_size=2_048, width=128, blocks=10, head_dim=32, mlp_width=514)
|
| 79 |
+
# Matched-budget wider recurrent-XSA candidate. At 2,893,440 stored parameters,
|
| 80 |
+
# it trades four physical blocks for a wider residual stream while retaining
|
| 81 |
+
# ten effective transformations under XSA's recurrent middle-block layout.
|
| 82 |
+
DENSE_CONTROL_2P9M_WIDE = DenseControlConfig(vocab_size=2_048, width=192, blocks=6, head_dim=32, mlp_width=466)
|
| 83 |
+
# The 5M scale-up keeps the same tied dense-deep family while increasing width
|
| 84 |
+
# and depth together: 5,001,728 stored parameters at the 2K vocabulary.
|
| 85 |
+
DENSE_CONTROL_5M_DEEP = DenseControlConfig(vocab_size=2_048, width=256, blocks=8, head_dim=64, mlp_width=386)
|
| 86 |
+
DENSE_CONTROL_SHAPES = {
|
| 87 |
+
"1m-2k": {"deep": DENSE_CONTROL_DEEP, "wide": DENSE_CONTROL_WIDE},
|
| 88 |
+
"600k-2k": {"deep": DENSE_CONTROL_600K_DEEP},
|
| 89 |
+
"10m-2k": {"deep": DENSE_CONTROL_10M_DEEP, "wide": DENSE_CONTROL_10M_WIDE},
|
| 90 |
+
"3m-2k": {"deep": DENSE_CONTROL_3M_DEEP},
|
| 91 |
+
"2p9m-2k": {"deep": DENSE_CONTROL_2P9M_DEEP, "wide": DENSE_CONTROL_2P9M_WIDE},
|
| 92 |
+
"5m-2k": {"deep": DENSE_CONTROL_5M_DEEP},
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
def control_for_shape(shape: str, model_size: str = "1m-2k") -> DenseControlConfig:
|
| 97 |
+
"""Select a published dense control shape at one fixed budget."""
|
| 98 |
+
try:
|
| 99 |
+
return DENSE_CONTROL_SHAPES[model_size][shape]
|
| 100 |
+
except KeyError as error:
|
| 101 |
+
choices = ", ".join(sorted(DENSE_CONTROL_SHAPES))
|
| 102 |
+
raise ValueError(f"unknown dense control selection {shape!r} at {model_size!r}; budgets: {choices}") from error
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
class DenseCausalAttention(nn.Module):
|
| 106 |
+
"""Full-rank multi-head causal attention with an explicit additive mask."""
|
| 107 |
+
|
| 108 |
+
def __init__(self, width: int, head_dim: int) -> None:
|
| 109 |
+
super().__init__()
|
| 110 |
+
if width % head_dim != 0:
|
| 111 |
+
raise ValueError("head_dim must divide width exactly")
|
| 112 |
+
self.heads = width // head_dim
|
| 113 |
+
self.head_dim = head_dim
|
| 114 |
+
self.query = nn.Linear(width, width, bias=False)
|
| 115 |
+
self.key = nn.Linear(width, width, bias=False)
|
| 116 |
+
self.value = nn.Linear(width, width, bias=False)
|
| 117 |
+
self.output = nn.Linear(width, width, bias=False)
|
| 118 |
+
|
| 119 |
+
def __call__(self, hidden: mx.array) -> mx.array:
|
| 120 |
+
"""Attend only to the current position and its strict prefix.
|
| 121 |
+
|
| 122 |
+
Args:
|
| 123 |
+
hidden: States shaped ``[batch, sequence, width]``.
|
| 124 |
+
|
| 125 |
+
Returns:
|
| 126 |
+
Context shaped like ``hidden``. Position ``i`` cannot read ``> i``.
|
| 127 |
+
|
| 128 |
+
Side effects:
|
| 129 |
+
Allocates per-head query/key/value and mask intermediates.
|
| 130 |
+
"""
|
| 131 |
+
if hidden.ndim != 3:
|
| 132 |
+
raise ValueError("hidden must have shape [batch, sequence, width]")
|
| 133 |
+
batch, length, width = hidden.shape
|
| 134 |
+
|
| 135 |
+
def split_heads(values: mx.array) -> mx.array:
|
| 136 |
+
return values.reshape(batch, length, self.heads, self.head_dim).transpose(0, 2, 1, 3)
|
| 137 |
+
|
| 138 |
+
queries = split_heads(self.query(hidden))
|
| 139 |
+
keys = split_heads(self.key(hidden))
|
| 140 |
+
values = split_heads(self.value(hidden))
|
| 141 |
+
scores = (queries @ keys.transpose(0, 1, 3, 2)) * (self.head_dim**-0.5)
|
| 142 |
+
positions = mx.arange(length)
|
| 143 |
+
causal_block = mx.where(
|
| 144 |
+
positions[:, None] >= positions[None, :], mx.array(0.0, dtype=scores.dtype), mx.array(-1e9, dtype=scores.dtype)
|
| 145 |
+
)
|
| 146 |
+
weights = mx.softmax(scores + causal_block[None, None, :, :], axis=-1)
|
| 147 |
+
attended = (weights @ values).transpose(0, 2, 1, 3).reshape(batch, length, width)
|
| 148 |
+
return self.output(attended)
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
class DenseGatedMLP(nn.Module):
|
| 152 |
+
"""Dense gated channel MLP with independent, unshared matrices."""
|
| 153 |
+
|
| 154 |
+
def __init__(self, width: int, mlp_width: int) -> None:
|
| 155 |
+
super().__init__()
|
| 156 |
+
self.expand = nn.Linear(width, 2 * mlp_width, bias=False)
|
| 157 |
+
self.contract = nn.Linear(mlp_width, width, bias=False)
|
| 158 |
+
|
| 159 |
+
def __call__(self, state: mx.array) -> mx.array:
|
| 160 |
+
"""Apply one gated dense channel transform."""
|
| 161 |
+
content, gate = mx.split(self.expand(state), 2, axis=-1)
|
| 162 |
+
return self.contract(nn.silu(content) * mx.sigmoid(gate))
|
| 163 |
+
|
| 164 |
+
|
| 165 |
+
class DenseControlBlock(nn.Module):
|
| 166 |
+
"""One pre-normalized attention plus gated-MLP residual block."""
|
| 167 |
+
|
| 168 |
+
def __init__(self, config: DenseControlConfig) -> None:
|
| 169 |
+
super().__init__()
|
| 170 |
+
self.attention_norm = CenteredUnitNorm(config.width)
|
| 171 |
+
self.attention = DenseCausalAttention(config.width, config.head_dim)
|
| 172 |
+
self.mlp_norm = CenteredUnitNorm(config.width)
|
| 173 |
+
self.mlp = DenseGatedMLP(config.width, config.mlp_width)
|
| 174 |
+
|
| 175 |
+
def __call__(self, hidden: mx.array) -> mx.array:
|
| 176 |
+
"""Run attention and channel mixing with residual connections."""
|
| 177 |
+
hidden = hidden + self.attention(self.attention_norm(hidden))
|
| 178 |
+
return hidden + self.mlp(self.mlp_norm(hidden))
|
| 179 |
+
|
| 180 |
+
|
| 181 |
+
class DenseControlLM(nn.Module):
|
| 182 |
+
"""Conventional dense decoder used as Keystone's parameter-matched control."""
|
| 183 |
+
|
| 184 |
+
def __init__(self, config: DenseControlConfig = DENSE_CONTROL_DEEP) -> None:
|
| 185 |
+
super().__init__()
|
| 186 |
+
self.config = config
|
| 187 |
+
self.tokens = DenseTiedTokens(config.vocab_size, config.width)
|
| 188 |
+
self.blocks = [DenseControlBlock(config) for _ in range(config.blocks)]
|
| 189 |
+
self.final_norm = CenteredUnitNorm(config.width)
|
| 190 |
+
|
| 191 |
+
def __call__(self, token_ids: mx.array) -> mx.array:
|
| 192 |
+
"""Compute full-vocabulary causal next-token logits.
|
| 193 |
+
|
| 194 |
+
Args:
|
| 195 |
+
token_ids: Integer IDs shaped ``[batch, sequence]``.
|
| 196 |
+
|
| 197 |
+
Returns:
|
| 198 |
+
A ``[batch, sequence, vocab_size]`` logit tensor.
|
| 199 |
+
|
| 200 |
+
Side effects:
|
| 201 |
+
Allocates coordinate and per-block intermediate arrays.
|
| 202 |
+
"""
|
| 203 |
+
if token_ids.ndim != 2:
|
| 204 |
+
raise ValueError("token_ids must have shape [batch, sequence]")
|
| 205 |
+
if token_ids.shape[1] < 1:
|
| 206 |
+
raise ValueError("token_ids must include at least one position")
|
| 207 |
+
hidden = self.tokens.encode(token_ids)
|
| 208 |
+
coordinates = deterministic_coordinates(token_ids.shape[1], self.config.width)
|
| 209 |
+
hidden = hidden + mx.expand_dims(coordinates, axis=0)
|
| 210 |
+
for block in self.blocks:
|
| 211 |
+
hidden = block(hidden)
|
| 212 |
+
return self.tokens.decode(self.final_norm(hidden))
|
| 213 |
+
|
| 214 |
+
|
| 215 |
+
def parameter_accounting(config: DenseControlConfig = DENSE_CONTROL_DEEP) -> dict[str, int]:
|
| 216 |
+
"""Return the exact stored-parameter budget, counting the tied table once."""
|
| 217 |
+
vocabulary = config.vocab_size * config.width
|
| 218 |
+
attention = config.blocks * 4 * config.width * config.width
|
| 219 |
+
mlp = config.blocks * 3 * config.width * config.mlp_width
|
| 220 |
+
normalization = (config.blocks * 2 + 1) * 2 * config.width
|
| 221 |
+
total = vocabulary + attention + mlp + normalization
|
| 222 |
+
return {
|
| 223 |
+
"dense_tied_vocabulary_interface": vocabulary,
|
| 224 |
+
"independent_attention": attention,
|
| 225 |
+
"independent_gated_mlps": mlp,
|
| 226 |
+
"normalization": normalization,
|
| 227 |
+
"total": total,
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
|
| 231 |
+
def parameter_count(model: nn.Module) -> int:
|
| 232 |
+
"""Count trainable MLX scalars, including each tied array exactly once."""
|
| 233 |
+
return sum(int(parameter.size) for _, parameter in tree_flatten(model.trainable_parameters()))
|
| 234 |
+
|
| 235 |
+
|
| 236 |
+
def future_token_causality_error(
|
| 237 |
+
model: DenseControlLM,
|
| 238 |
+
sequence_length: int = 11,
|
| 239 |
+
batch_size: int = 2,
|
| 240 |
+
seed: int = 23,
|
| 241 |
+
) -> float:
|
| 242 |
+
"""Return the largest changed prefix logit after deterministic suffix edits."""
|
| 243 |
+
if sequence_length < 3 or batch_size < 1:
|
| 244 |
+
raise ValueError("sequence_length must be at least three and batch_size must be positive")
|
| 245 |
+
generator = np.random.default_rng(seed)
|
| 246 |
+
values = generator.integers(0, model.config.vocab_size, size=(batch_size, sequence_length), dtype=np.int32)
|
| 247 |
+
boundary = sequence_length // 2
|
| 248 |
+
mutated = values.copy()
|
| 249 |
+
mutated[:, boundary:] = (mutated[:, boundary:] + 1) % model.config.vocab_size
|
| 250 |
+
original = model(mx.array(values))
|
| 251 |
+
changed = model(mx.array(mutated))
|
| 252 |
+
mx.eval(original, changed)
|
| 253 |
+
return float(mx.max(mx.abs(original[:, :boundary] - changed[:, :boundary])))
|
| 254 |
+
|
| 255 |
+
|
| 256 |
+
def self_check(config: DenseControlConfig = DENSE_CONTROL_DEEP, reference_total: int = 999_744) -> dict[str, Any]:
|
| 257 |
+
"""Validate accounting, shape, causality, and the match tolerance.
|
| 258 |
+
|
| 259 |
+
Args:
|
| 260 |
+
config: Dense control shape to validate.
|
| 261 |
+
reference_total: Stored-parameter budget the control must match.
|
| 262 |
+
|
| 263 |
+
Returns:
|
| 264 |
+
A JSON-serializable diagnostic record including the signed mismatch.
|
| 265 |
+
|
| 266 |
+
Side effects:
|
| 267 |
+
Builds the model and evaluates two Metal inference passes.
|
| 268 |
+
"""
|
| 269 |
+
model = DenseControlLM(config)
|
| 270 |
+
formula = parameter_accounting(config)
|
| 271 |
+
observed = parameter_count(model)
|
| 272 |
+
if observed != formula["total"]:
|
| 273 |
+
raise RuntimeError(f"formula counted {formula['total']}, model stores {observed}")
|
| 274 |
+
relative = abs(observed - reference_total) / reference_total
|
| 275 |
+
if relative > 5e-4:
|
| 276 |
+
raise RuntimeError(f"control stores {observed} scalars, {relative:.4%} from reference {reference_total}")
|
| 277 |
+
probe = model(mx.zeros((2, 11), dtype=mx.int32))
|
| 278 |
+
mx.eval(probe)
|
| 279 |
+
if tuple(probe.shape) != (2, 11, config.vocab_size):
|
| 280 |
+
raise RuntimeError(f"unexpected logit shape {tuple(probe.shape)}")
|
| 281 |
+
causal_error = future_token_causality_error(model)
|
| 282 |
+
if causal_error != 0.0:
|
| 283 |
+
raise RuntimeError(f"future-token leakage: {causal_error}")
|
| 284 |
+
return {
|
| 285 |
+
"architecture": "DenseControl",
|
| 286 |
+
"config": asdict(config),
|
| 287 |
+
**formula,
|
| 288 |
+
"reference_total": reference_total,
|
| 289 |
+
"relative_mismatch": relative,
|
| 290 |
+
"causal_forward_shape": list(probe.shape),
|
| 291 |
+
"future_token_causality_error": causal_error,
|
| 292 |
+
}
|
keystone_mlx/model.py
ADDED
|
@@ -0,0 +1,413 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Keystone implemented directly with MLX for Apple Metal execution.
|
| 2 |
+
|
| 3 |
+
Keystone is an experimental, non-Transformer language-model hypothesis. A
|
| 4 |
+
causal read/write chronicle summarizes the prefix into a compact bank of dense
|
| 5 |
+
states; one shared dense gated processor then refines each token state several
|
| 6 |
+
times. The repeated processor intentionally trades extra compute for stored
|
| 7 |
+
parameter efficiency. It is not a Llama implementation and has not yet been
|
| 8 |
+
validated at meaningful language-model scale.
|
| 9 |
+
|
| 10 |
+
This module deliberately depends only on ``mlx.core`` and ``mlx.nn``. It has
|
| 11 |
+
no PyTorch fallback: a missing or inaccessible MLX Metal runtime is a setup
|
| 12 |
+
error, not an invitation to silently run a different backend.
|
| 13 |
+
"""
|
| 14 |
+
|
| 15 |
+
from __future__ import annotations
|
| 16 |
+
|
| 17 |
+
from dataclasses import asdict, dataclass
|
| 18 |
+
import math
|
| 19 |
+
from typing import Any
|
| 20 |
+
|
| 21 |
+
import mlx.core as mx
|
| 22 |
+
import mlx.nn as nn
|
| 23 |
+
from mlx.utils import tree_flatten
|
| 24 |
+
import numpy as np
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
@dataclass(frozen=True)
|
| 28 |
+
class KeystoneConfig:
|
| 29 |
+
"""Immutable architecture specification for the 1.95M-parameter model.
|
| 30 |
+
|
| 31 |
+
Args:
|
| 32 |
+
vocab_size: Number of token IDs accepted by the tied dense interface.
|
| 33 |
+
width: Width of token states and every chronicle slot.
|
| 34 |
+
memory_slots: Independently updated chronicle states.
|
| 35 |
+
processor_width: Hidden width of the shared gated processor.
|
| 36 |
+
refinement_steps: Number of repeated processor applications.
|
| 37 |
+
|
| 38 |
+
Side effects:
|
| 39 |
+
None. Invalid dimensions raise ``ValueError`` during construction.
|
| 40 |
+
"""
|
| 41 |
+
|
| 42 |
+
vocab_size: int = 4_096
|
| 43 |
+
width: int = 192
|
| 44 |
+
memory_slots: int = 17
|
| 45 |
+
processor_width: int = 1_500
|
| 46 |
+
refinement_steps: int = 4
|
| 47 |
+
|
| 48 |
+
def __post_init__(self) -> None:
|
| 49 |
+
if self.vocab_size < 2:
|
| 50 |
+
raise ValueError("vocab_size must be at least two")
|
| 51 |
+
if self.width < 2:
|
| 52 |
+
raise ValueError("width must be at least two")
|
| 53 |
+
if self.memory_slots < 2:
|
| 54 |
+
raise ValueError("memory_slots must be at least two")
|
| 55 |
+
if self.processor_width < self.width:
|
| 56 |
+
raise ValueError("processor_width must be at least width")
|
| 57 |
+
if self.refinement_steps < 1:
|
| 58 |
+
raise ValueError("refinement_steps must be positive")
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
# Every published configuration retains the same architecture. The vocabulary
|
| 62 |
+
# choice is an explicit stored-parameter allocation decision, not compression:
|
| 63 |
+
# a 2K interface buys more dense chronicle/processor capacity at the same 1M
|
| 64 |
+
# budget, while the 4K controls preserve the earlier allocation.
|
| 65 |
+
KEYSTONE_2M_CONFIG = KeystoneConfig()
|
| 66 |
+
KEYSTONE_1M_4K_CONFIG = KeystoneConfig(width=144, memory_slots=17, processor_width=556, refinement_steps=4)
|
| 67 |
+
KEYSTONE_1M_2K_CONFIG = KeystoneConfig(
|
| 68 |
+
vocab_size=2_048,
|
| 69 |
+
width=192,
|
| 70 |
+
memory_slots=17,
|
| 71 |
+
processor_width=532,
|
| 72 |
+
refinement_steps=4,
|
| 73 |
+
)
|
| 74 |
+
# Compatibility alias for callers that referred to the old generic 1M label.
|
| 75 |
+
# New training commands must use explicit `1m-2k` or `1m-4k` selection.
|
| 76 |
+
KEYSTONE_1M_CONFIG = KEYSTONE_1M_2K_CONFIG
|
| 77 |
+
DEFAULT_CONFIG = KEYSTONE_1M_2K_CONFIG
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
def config_for_size(model_size: str) -> KeystoneConfig:
|
| 81 |
+
"""Select one of the explicitly budgeted Keystone architecture variants.
|
| 82 |
+
|
| 83 |
+
Args:
|
| 84 |
+
model_size: One explicit published budget label: ``"1m-2k"``,
|
| 85 |
+
``"1m-4k"``, or ``"2m-4k"``.
|
| 86 |
+
|
| 87 |
+
Returns:
|
| 88 |
+
Immutable configuration for that exact stored-parameter budget.
|
| 89 |
+
|
| 90 |
+
Side effects:
|
| 91 |
+
None. An unsupported label raises ``ValueError`` rather than choosing a
|
| 92 |
+
nearby architecture silently.
|
| 93 |
+
"""
|
| 94 |
+
configurations = {
|
| 95 |
+
"1m-2k": KEYSTONE_1M_2K_CONFIG,
|
| 96 |
+
"1m-4k": KEYSTONE_1M_4K_CONFIG,
|
| 97 |
+
"2m-4k": KEYSTONE_2M_CONFIG,
|
| 98 |
+
}
|
| 99 |
+
try:
|
| 100 |
+
return configurations[model_size]
|
| 101 |
+
except KeyError as error:
|
| 102 |
+
raise ValueError(f"unknown Keystone model size: {model_size!r}") from error
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
def model_size_for_config(config: KeystoneConfig) -> str:
|
| 106 |
+
"""Return the published budget label for an exact Keystone configuration."""
|
| 107 |
+
for size, candidate in (
|
| 108 |
+
("1m-2k", KEYSTONE_1M_2K_CONFIG),
|
| 109 |
+
("1m-4k", KEYSTONE_1M_4K_CONFIG),
|
| 110 |
+
("2m-4k", KEYSTONE_2M_CONFIG),
|
| 111 |
+
):
|
| 112 |
+
if config == candidate:
|
| 113 |
+
return size
|
| 114 |
+
raise ValueError("configuration is not one of the published Keystone budget selections")
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
class CenteredUnitNorm(nn.Module):
|
| 118 |
+
"""Learned affine mean-and-variance normalization over the final axis."""
|
| 119 |
+
|
| 120 |
+
def __init__(self, width: int, epsilon: float = 1e-5) -> None:
|
| 121 |
+
super().__init__()
|
| 122 |
+
self.scale = mx.ones((width,))
|
| 123 |
+
self.shift = mx.zeros((width,))
|
| 124 |
+
self.epsilon = epsilon
|
| 125 |
+
|
| 126 |
+
def __call__(self, values: mx.array) -> mx.array:
|
| 127 |
+
"""Normalize vectors while preserving every batch and sequence axis.
|
| 128 |
+
|
| 129 |
+
Args:
|
| 130 |
+
values: Array whose final dimension is this norm's configured width.
|
| 131 |
+
|
| 132 |
+
Returns:
|
| 133 |
+
Centered, variance-scaled, affine transformed values.
|
| 134 |
+
|
| 135 |
+
Side effects:
|
| 136 |
+
None.
|
| 137 |
+
"""
|
| 138 |
+
mean = mx.mean(values, axis=-1, keepdims=True)
|
| 139 |
+
variance = mx.mean(mx.square(values - mean), axis=-1, keepdims=True)
|
| 140 |
+
return (values - mean) * mx.rsqrt(variance + self.epsilon) * self.scale + self.shift
|
| 141 |
+
|
| 142 |
+
|
| 143 |
+
class DenseTiedTokens(nn.Module):
|
| 144 |
+
"""One full-rank table, used exactly for both token input and output."""
|
| 145 |
+
|
| 146 |
+
def __init__(self, vocab_size: int, width: int) -> None:
|
| 147 |
+
super().__init__()
|
| 148 |
+
self.table = mx.random.normal(shape=(vocab_size, width)) * 0.02
|
| 149 |
+
|
| 150 |
+
def encode(self, token_ids: mx.array) -> mx.array:
|
| 151 |
+
"""Look up uncompressed token vectors from the sole vocabulary table."""
|
| 152 |
+
return self.table[token_ids]
|
| 153 |
+
|
| 154 |
+
def decode(self, hidden: mx.array) -> mx.array:
|
| 155 |
+
"""Produce logits using the exact transpose of the input table."""
|
| 156 |
+
return hidden @ self.table.T
|
| 157 |
+
|
| 158 |
+
|
| 159 |
+
def deterministic_coordinates(length: int, width: int) -> mx.array:
|
| 160 |
+
"""Build a fixed sinusoidal coordinate signal with no learned parameters.
|
| 161 |
+
|
| 162 |
+
Args:
|
| 163 |
+
length: Number of sequence positions.
|
| 164 |
+
width: Number of state channels.
|
| 165 |
+
|
| 166 |
+
Returns:
|
| 167 |
+
A float32 array shaped ``[length, width]``.
|
| 168 |
+
|
| 169 |
+
Side effects:
|
| 170 |
+
Allocates a temporary MLX array but does not examine token values.
|
| 171 |
+
"""
|
| 172 |
+
if length < 1:
|
| 173 |
+
raise ValueError("length must be positive")
|
| 174 |
+
half = (width + 1) // 2
|
| 175 |
+
positions = mx.expand_dims(mx.arange(length, dtype=mx.float32), axis=1)
|
| 176 |
+
frequencies = mx.exp(
|
| 177 |
+
mx.arange(half, dtype=mx.float32) * (-math.log(20_000.0) / max(half - 1, 1))
|
| 178 |
+
)
|
| 179 |
+
coordinates = mx.concatenate((mx.sin(positions * frequencies), mx.cos(positions * frequencies)), axis=-1)
|
| 180 |
+
return coordinates[:, :width]
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
class ChronicleReadWrite(nn.Module):
|
| 184 |
+
"""Prefix-only dense read/write state bank, evaluated left to right."""
|
| 185 |
+
|
| 186 |
+
def __init__(self, width: int, memory_slots: int) -> None:
|
| 187 |
+
super().__init__()
|
| 188 |
+
self.memory_slots = memory_slots
|
| 189 |
+
self.reader_address = nn.Linear(width, width, bias=False)
|
| 190 |
+
self.reader_output = nn.Linear(width, width, bias=False)
|
| 191 |
+
self.writer_address = nn.Linear(width, width, bias=False)
|
| 192 |
+
self.writer_proposal = nn.Linear(2 * width, width, bias=False)
|
| 193 |
+
self.initial_slots = mx.random.normal(shape=(memory_slots, width)) * 0.01
|
| 194 |
+
|
| 195 |
+
def __call__(self, hidden: mx.array) -> mx.array:
|
| 196 |
+
"""Read prefix state, then soft-write the current token into every slot.
|
| 197 |
+
|
| 198 |
+
Args:
|
| 199 |
+
hidden: Input states shaped ``[batch, sequence, width]``.
|
| 200 |
+
|
| 201 |
+
Returns:
|
| 202 |
+
Prefix-only context shaped like ``hidden``. Output at position ``i``
|
| 203 |
+
cannot depend on tokens after ``i``.
|
| 204 |
+
|
| 205 |
+
Side effects:
|
| 206 |
+
Allocates ephemeral recurrent slot arrays; stored initial slots are
|
| 207 |
+
never mutated in place.
|
| 208 |
+
"""
|
| 209 |
+
if hidden.ndim != 3:
|
| 210 |
+
raise ValueError("hidden must have shape [batch, sequence, width]")
|
| 211 |
+
batch, length, width = hidden.shape
|
| 212 |
+
if width != self.initial_slots.shape[1]:
|
| 213 |
+
raise ValueError("hidden width does not match chronicle slot width")
|
| 214 |
+
|
| 215 |
+
slots = mx.broadcast_to(mx.expand_dims(self.initial_slots, axis=0), (batch, self.memory_slots, width))
|
| 216 |
+
contexts: list[mx.array] = []
|
| 217 |
+
scale = width**-0.5
|
| 218 |
+
for position in range(length):
|
| 219 |
+
current = hidden[:, position, :]
|
| 220 |
+
read_query = self.reader_address(current)
|
| 221 |
+
read_weights = mx.softmax(mx.sum(mx.expand_dims(read_query, 1) * slots, axis=-1) * scale, axis=-1)
|
| 222 |
+
retrieved = mx.sum(mx.expand_dims(read_weights, -1) * slots, axis=1)
|
| 223 |
+
context = self.reader_output(retrieved)
|
| 224 |
+
contexts.append(context)
|
| 225 |
+
|
| 226 |
+
write_query = self.writer_address(current)
|
| 227 |
+
write_weights = mx.softmax(mx.sum(mx.expand_dims(write_query, 1) * slots, axis=-1) * scale, axis=-1)
|
| 228 |
+
proposal = mx.tanh(self.writer_proposal(mx.concatenate((current, context), axis=-1)))
|
| 229 |
+
slots = slots + mx.expand_dims(write_weights, -1) * (mx.expand_dims(proposal, 1) - slots)
|
| 230 |
+
return mx.stack(contexts, axis=1)
|
| 231 |
+
|
| 232 |
+
|
| 233 |
+
class SharedKeystoneProcessor(nn.Module):
|
| 234 |
+
"""Full-dense gated processor whose matrices are reused across refinements."""
|
| 235 |
+
|
| 236 |
+
def __init__(self, width: int, processor_width: int) -> None:
|
| 237 |
+
super().__init__()
|
| 238 |
+
self.expand = nn.Linear(width, 2 * processor_width, bias=False)
|
| 239 |
+
self.contract = nn.Linear(processor_width, width, bias=False)
|
| 240 |
+
|
| 241 |
+
def __call__(self, state: mx.array) -> mx.array:
|
| 242 |
+
"""Run one gated dense transform without storing a second processor."""
|
| 243 |
+
content, gate = mx.split(self.expand(state), 2, axis=-1)
|
| 244 |
+
return self.contract(nn.silu(content) * mx.sigmoid(gate))
|
| 245 |
+
|
| 246 |
+
|
| 247 |
+
class KeystoneLM(nn.Module):
|
| 248 |
+
"""Custom causal LM: chronicle state followed by repeated shared refinement."""
|
| 249 |
+
|
| 250 |
+
def __init__(self, config: KeystoneConfig = DEFAULT_CONFIG) -> None:
|
| 251 |
+
super().__init__()
|
| 252 |
+
self.config = config
|
| 253 |
+
self.tokens = DenseTiedTokens(config.vocab_size, config.width)
|
| 254 |
+
self.ingress = nn.Linear(config.width, config.width, bias=False)
|
| 255 |
+
self.read_norm = CenteredUnitNorm(config.width)
|
| 256 |
+
self.chronicle = ChronicleReadWrite(config.width, config.memory_slots)
|
| 257 |
+
self.processor_norm = CenteredUnitNorm(config.width)
|
| 258 |
+
self.processor = SharedKeystoneProcessor(config.width, config.processor_width)
|
| 259 |
+
self.refinement_gate = nn.Linear(2 * config.width, config.width, bias=False)
|
| 260 |
+
self.step_codes = mx.zeros((config.refinement_steps, config.width))
|
| 261 |
+
self.final_norm = CenteredUnitNorm(config.width)
|
| 262 |
+
|
| 263 |
+
def __call__(self, token_ids: mx.array) -> mx.array:
|
| 264 |
+
"""Compute full-vocabulary causal next-token logits.
|
| 265 |
+
|
| 266 |
+
Args:
|
| 267 |
+
token_ids: Integer IDs shaped ``[batch, sequence]`` in the
|
| 268 |
+
configured vocabulary range.
|
| 269 |
+
|
| 270 |
+
Returns:
|
| 271 |
+
A ``[batch, sequence, vocab_size]`` logit tensor. All sequence
|
| 272 |
+
dependence is created by the explicit prefix-only chronicle scan.
|
| 273 |
+
|
| 274 |
+
Side effects:
|
| 275 |
+
Allocates coordinate, chronicle, and refinement intermediate arrays.
|
| 276 |
+
"""
|
| 277 |
+
if token_ids.ndim != 2:
|
| 278 |
+
raise ValueError("token_ids must have shape [batch, sequence]")
|
| 279 |
+
if token_ids.shape[1] < 1:
|
| 280 |
+
raise ValueError("token_ids must include at least one position")
|
| 281 |
+
|
| 282 |
+
hidden = self.tokens.encode(token_ids)
|
| 283 |
+
coordinates = deterministic_coordinates(token_ids.shape[1], self.config.width)
|
| 284 |
+
hidden = self.ingress(hidden + mx.expand_dims(coordinates, axis=0))
|
| 285 |
+
context = self.chronicle(self.read_norm(hidden))
|
| 286 |
+
state = hidden + context
|
| 287 |
+
for step in range(self.config.refinement_steps):
|
| 288 |
+
coded_state = state + context + self.step_codes[step][None, None, :]
|
| 289 |
+
candidate = self.processor(self.processor_norm(coded_state))
|
| 290 |
+
gate = mx.sigmoid(self.refinement_gate(mx.concatenate((state, candidate), axis=-1)))
|
| 291 |
+
state = state + gate * (candidate - state)
|
| 292 |
+
return self.tokens.decode(self.final_norm(state))
|
| 293 |
+
|
| 294 |
+
|
| 295 |
+
def parameter_accounting(config: KeystoneConfig = DEFAULT_CONFIG) -> dict[str, int]:
|
| 296 |
+
"""Return the exact stored-parameter budget, counting tied tokens once.
|
| 297 |
+
|
| 298 |
+
Args:
|
| 299 |
+
config: Architecture specification to count.
|
| 300 |
+
|
| 301 |
+
Returns:
|
| 302 |
+
Counts by subsystem plus ``total``. No activation or optimizer memory
|
| 303 |
+
appears here because this is deliberately a stored-parameter budget.
|
| 304 |
+
|
| 305 |
+
Side effects:
|
| 306 |
+
None.
|
| 307 |
+
"""
|
| 308 |
+
vocabulary = config.vocab_size * config.width
|
| 309 |
+
ingress = config.width * config.width
|
| 310 |
+
chronicle_reader = 2 * config.width * config.width
|
| 311 |
+
chronicle_writer = 3 * config.width * config.width
|
| 312 |
+
chronicle_slots = config.memory_slots * config.width
|
| 313 |
+
processor = 3 * config.width * config.processor_width
|
| 314 |
+
refinement_gate = 2 * config.width * config.width
|
| 315 |
+
step_codes = config.refinement_steps * config.width
|
| 316 |
+
normalization = 3 * 2 * config.width
|
| 317 |
+
total = sum((
|
| 318 |
+
vocabulary, ingress, chronicle_reader, chronicle_writer, chronicle_slots,
|
| 319 |
+
processor, refinement_gate, step_codes, normalization,
|
| 320 |
+
))
|
| 321 |
+
return {
|
| 322 |
+
"dense_tied_vocabulary_interface": vocabulary,
|
| 323 |
+
"dense_ingress": ingress,
|
| 324 |
+
"chronicle_reader": chronicle_reader,
|
| 325 |
+
"chronicle_writer": chronicle_writer,
|
| 326 |
+
"chronicle_initial_slots": chronicle_slots,
|
| 327 |
+
"shared_dense_processor": processor,
|
| 328 |
+
"shared_refinement_gate": refinement_gate,
|
| 329 |
+
"refinement_step_codes": step_codes,
|
| 330 |
+
"normalization": normalization,
|
| 331 |
+
"total": total,
|
| 332 |
+
}
|
| 333 |
+
|
| 334 |
+
|
| 335 |
+
def parameter_count(model: nn.Module) -> int:
|
| 336 |
+
"""Count trainable MLX scalar parameters, including each tied array once."""
|
| 337 |
+
return sum(int(parameter.size) for _, parameter in tree_flatten(model.trainable_parameters()))
|
| 338 |
+
|
| 339 |
+
|
| 340 |
+
def future_token_causality_error(
|
| 341 |
+
model: KeystoneLM,
|
| 342 |
+
sequence_length: int = 11,
|
| 343 |
+
batch_size: int = 2,
|
| 344 |
+
seed: int = 23,
|
| 345 |
+
) -> float:
|
| 346 |
+
"""Return the largest changed prefix logit after deterministic suffix edits.
|
| 347 |
+
|
| 348 |
+
Args:
|
| 349 |
+
model: Keystone model under test.
|
| 350 |
+
sequence_length: Input length, at least three.
|
| 351 |
+
batch_size: Number of independent sequences.
|
| 352 |
+
seed: NumPy seed used only for this test.
|
| 353 |
+
|
| 354 |
+
Returns:
|
| 355 |
+
Maximum absolute prefix difference. A correct deterministic causal model
|
| 356 |
+
should return exactly zero to its evaluated floating-point precision.
|
| 357 |
+
|
| 358 |
+
Side effects:
|
| 359 |
+
Executes two MLX inference graphs and synchronizes their outputs.
|
| 360 |
+
"""
|
| 361 |
+
if sequence_length < 3 or batch_size < 1:
|
| 362 |
+
raise ValueError("sequence_length must be at least three and batch_size must be positive")
|
| 363 |
+
generator = np.random.default_rng(seed)
|
| 364 |
+
values = generator.integers(0, model.config.vocab_size, size=(batch_size, sequence_length), dtype=np.int32)
|
| 365 |
+
boundary = sequence_length // 2
|
| 366 |
+
mutated = values.copy()
|
| 367 |
+
mutated[:, boundary:] = (mutated[:, boundary:] + 1) % model.config.vocab_size
|
| 368 |
+
original_logits = model(mx.array(values))
|
| 369 |
+
changed_logits = model(mx.array(mutated))
|
| 370 |
+
mx.eval(original_logits, changed_logits)
|
| 371 |
+
return float(mx.max(mx.abs(original_logits[:, :boundary] - changed_logits[:, :boundary])))
|
| 372 |
+
|
| 373 |
+
|
| 374 |
+
def self_check(config: KeystoneConfig = DEFAULT_CONFIG) -> dict[str, Any]:
|
| 375 |
+
"""Validate accounting, output shape, and causal-prefix invariance.
|
| 376 |
+
|
| 377 |
+
Returns:
|
| 378 |
+
A JSON-serializable diagnostic record.
|
| 379 |
+
|
| 380 |
+
Side effects:
|
| 381 |
+
Instantiates the full model and evaluates two Metal inference passes.
|
| 382 |
+
It therefore requires a usable MLX device.
|
| 383 |
+
"""
|
| 384 |
+
model = KeystoneLM(config)
|
| 385 |
+
formula = parameter_accounting(config)
|
| 386 |
+
observed = parameter_count(model)
|
| 387 |
+
if observed != formula["total"]:
|
| 388 |
+
raise RuntimeError(f"formula counted {formula['total']}, model stores {observed}")
|
| 389 |
+
known_budgets = {
|
| 390 |
+
KEYSTONE_1M_2K_CONFIG: 999_744,
|
| 391 |
+
KEYSTONE_1M_4K_CONFIG: 999_792,
|
| 392 |
+
KEYSTONE_2M_CONFIG: 1_950_528,
|
| 393 |
+
}
|
| 394 |
+
expected_budget = known_budgets.get(config)
|
| 395 |
+
if expected_budget is None:
|
| 396 |
+
raise RuntimeError("self_check only accepts a published Keystone budget configuration")
|
| 397 |
+
if observed != expected_budget:
|
| 398 |
+
raise RuntimeError(f"model has {observed} parameters; expected published budget {expected_budget}")
|
| 399 |
+
probe = model(mx.zeros((2, 11), dtype=mx.int32))
|
| 400 |
+
mx.eval(probe)
|
| 401 |
+
expected_shape = (2, 11, config.vocab_size)
|
| 402 |
+
if tuple(probe.shape) != expected_shape:
|
| 403 |
+
raise RuntimeError(f"expected {expected_shape}, received {tuple(probe.shape)}")
|
| 404 |
+
causal_error = future_token_causality_error(model)
|
| 405 |
+
if causal_error != 0.0:
|
| 406 |
+
raise RuntimeError(f"future-token leakage: {causal_error}")
|
| 407 |
+
return {
|
| 408 |
+
"architecture": f"Keystone-{model_size_for_config(config).upper()}",
|
| 409 |
+
"config": asdict(config),
|
| 410 |
+
**formula,
|
| 411 |
+
"causal_forward_shape": list(probe.shape),
|
| 412 |
+
"future_token_causality_error": causal_error,
|
| 413 |
+
}
|
model.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7734c37961b04ba9eda11747023439e1ff47a444f0a2c44b1d5c56d110a96eaa
|
| 3 |
+
size 2414968
|
modeling_sol_lassi.py
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Standalone MLX loader and greedy/sampled generation for Sol Lassi 600K."""
|
| 2 |
+
from __future__ import annotations
|
| 3 |
+
|
| 4 |
+
from pathlib import Path
|
| 5 |
+
|
| 6 |
+
import mlx.core as mx
|
| 7 |
+
from tokenizers import Tokenizer
|
| 8 |
+
|
| 9 |
+
from keystone_mlx.dense_control import (
|
| 10 |
+
DENSE_CONTROL_600K_DEEP,
|
| 11 |
+
DenseControlLM,
|
| 12 |
+
parameter_count,
|
| 13 |
+
)
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
def load_model(model_dir: str | Path):
|
| 17 |
+
"""Load the frozen 600K MLX weights and tokenizer from a local snapshot."""
|
| 18 |
+
directory = Path(model_dir)
|
| 19 |
+
model = DenseControlLM(DENSE_CONTROL_600K_DEEP)
|
| 20 |
+
model.load_weights(str(directory / "model.npz"))
|
| 21 |
+
mx.eval(model.parameters())
|
| 22 |
+
if parameter_count(model) != 600_000:
|
| 23 |
+
raise RuntimeError("Sol Lassi checkpoint does not contain exactly 600,000 parameters")
|
| 24 |
+
tokenizer = Tokenizer.from_file(str(directory / "tokenizer.json"))
|
| 25 |
+
return model, tokenizer
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def generate(
|
| 29 |
+
model,
|
| 30 |
+
tokenizer: Tokenizer,
|
| 31 |
+
prompt: str,
|
| 32 |
+
max_new_tokens: int = 64,
|
| 33 |
+
temperature: float = 0.0,
|
| 34 |
+
seed: int = 0,
|
| 35 |
+
) -> str:
|
| 36 |
+
"""Generate a continuation; context is truncated to the trained 128 tokens."""
|
| 37 |
+
if max_new_tokens < 0:
|
| 38 |
+
raise ValueError("max_new_tokens must be nonnegative")
|
| 39 |
+
if temperature < 0:
|
| 40 |
+
raise ValueError("temperature must be nonnegative")
|
| 41 |
+
mx.random.seed(seed)
|
| 42 |
+
ids = tokenizer.encode(prompt).ids or [1]
|
| 43 |
+
eos_id = tokenizer.token_to_id("<|eos|>")
|
| 44 |
+
for _ in range(max_new_tokens):
|
| 45 |
+
context = ids[-128:]
|
| 46 |
+
logits = model(mx.array([context], dtype=mx.int32))[0, -1]
|
| 47 |
+
if temperature > 0:
|
| 48 |
+
next_id = int(mx.random.categorical(logits / temperature).item())
|
| 49 |
+
else:
|
| 50 |
+
next_id = int(mx.argmax(logits).item())
|
| 51 |
+
ids.append(next_id)
|
| 52 |
+
if eos_id is not None and next_id == eos_id:
|
| 53 |
+
break
|
| 54 |
+
return tokenizer.decode(ids)
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
mlx>=0.29
|
| 2 |
+
tokenizers>=0.22
|
| 3 |
+
huggingface_hub>=0.30
|
sol-lassi-banner.png
ADDED
|
Git LFS Details
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"backend": "tokenizers",
|
| 3 |
+
"clean_up_tokenization_spaces": false,
|
| 4 |
+
"eos_token": "<|eos|>",
|
| 5 |
+
"model_max_length": 1000000000000000019884624838656,
|
| 6 |
+
"tokenizer_class": "TokenizersBackend",
|
| 7 |
+
"unk_token": "<|unk|>"
|
| 8 |
+
}
|
training_state.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_name": "Sol Lassi 600K Base",
|
| 3 |
+
"backend": "MLX",
|
| 4 |
+
"architecture": "DenseControlLM / dense-deep",
|
| 5 |
+
"parameters": 600000,
|
| 6 |
+
"optimizer": "M-SimOW",
|
| 7 |
+
"optimizer_beta": 0.8,
|
| 8 |
+
"weight_decay": 0.1,
|
| 9 |
+
"learning_rate_schedule": [
|
| 10 |
+
{"tokens": 500000000, "learning_rate": 0.006},
|
| 11 |
+
{"tokens": 500000000, "learning_rate": 0.003}
|
| 12 |
+
],
|
| 13 |
+
"training_tokens": 1000000000,
|
| 14 |
+
"context_length": 128,
|
| 15 |
+
"batch_size": 32,
|
| 16 |
+
"seed": 7,
|
| 17 |
+
"dataset": "HuggingFaceFW/finephrase",
|
| 18 |
+
"dataset_revision": "78cf4a5ed0099214979c094c963e699c19163838",
|
| 19 |
+
"dataset_manifest": "finephrase-balanced-500m-2k-v2",
|
| 20 |
+
"dataset_configs": ["faq", "math", "table", "tutorial"],
|
| 21 |
+
"dataset_split_method": "source-id-disjoint SHA-256 split",
|
| 22 |
+
"training_loss_note": "The trainer recorded per-minibatch loss; no validation or benchmark result is claimed in this release."
|
| 23 |
+
}
|