Publish final 49.152B-token checkpoint with model card and tokenizer
Browse files- README.md +73 -0
- model.safetensors +3 -0
- model_config.json +40 -0
- tokenizer.tiktoken.json +0 -0
README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: pytorch
|
| 3 |
+
tags:
|
| 4 |
+
- nexttransformer
|
| 5 |
+
- looped
|
| 6 |
+
- causal-lm
|
| 7 |
+
- pretrained
|
| 8 |
+
- safetensors
|
| 9 |
+
pipeline_tag: text-generation
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# NextTransformer Fixed-Recursive
|
| 13 |
+
|
| 14 |
+
Isolate weight sharing, without routing or conditioning.
|
| 15 |
+
|
| 16 |
+
This is the final Fixed Recursive checkpoint in the NextTransformer 49.152B-token architecture comparison. It has 927,990,968 parameters and a 2,048-token context. The model was pretrained on ClimbMix for 46,875 updates. The 49B in the repository name refers to training tokens.
|
| 17 |
+
|
| 18 |
+
A shared-core control baseline. Every token traverses the same core twice, isolating the effect of parameter sharing and providing a control for the additional mechanisms used by adaptive looped models.
|
| 19 |
+
|
| 20 |
+
| Final evaluation | Result |
|
| 21 |
+
|---|---:|
|
| 22 |
+
| Validation BPB | 0.6757 |
|
| 23 |
+
| CORE-22 (×100) | 32.45 |
|
| 24 |
+
|
| 25 |
+
[Architecture](https://github.com/Interactive-Active-AI/NextTransformer/blob/4977f447d9aeb510ecb2cf8a9e8a6812d78b5c69/results/methods/fixed_recursive.json) · [Run record](https://github.com/Interactive-Active-AI/NextTransformer/blob/4977f447d9aeb510ecb2cf8a9e8a6812d78b5c69/results/runs/fixed_recursive.json)
|
| 26 |
+
|
| 27 |
+
A project control baseline, rather than a full reproduction of an individual Recursive Transformers paper.
|
| 28 |
+
|
| 29 |
+
The upstream run record reports completed training and the trainer's cumulative compute audit; its independent read-only audit remains pending.
|
| 30 |
+
|
| 31 |
+
## Load the weights
|
| 32 |
+
|
| 33 |
+
Install the tested NextTransformer implementation and the safetensors reader in a Python 3.10–3.13 environment.
|
| 34 |
+
|
| 35 |
+
```bash
|
| 36 |
+
pip install "nexttransformer @ git+https://github.com/Interactive-Active-AI/NextTransformer.git@4977f447d9aeb510ecb2cf8a9e8a6812d78b5c69" safetensors
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
The example encodes a prompt with the checkpoint's tokenizer and prints its most likely next token.
|
| 40 |
+
|
| 41 |
+
```python
|
| 42 |
+
import base64
|
| 43 |
+
import json
|
| 44 |
+
import os
|
| 45 |
+
from pathlib import Path
|
| 46 |
+
|
| 47 |
+
os.environ["CUDA_VISIBLE_DEVICES"] = "" # This example runs on CPU.
|
| 48 |
+
|
| 49 |
+
import tiktoken
|
| 50 |
+
import torch
|
| 51 |
+
from huggingface_hub import snapshot_download
|
| 52 |
+
from safetensors.torch import load_file
|
| 53 |
+
from nexttransformer.models import build_model, config_from_dict
|
| 54 |
+
|
| 55 |
+
root = Path(snapshot_download("NextTransformer/Fixed-Recursive-49B-Tokens"))
|
| 56 |
+
config = config_from_dict(json.loads((root / "model_config.json").read_text()))
|
| 57 |
+
model = build_model(config, device="cpu")
|
| 58 |
+
model.load_state_dict(load_file(root / "model.safetensors"), strict=True)
|
| 59 |
+
model.set_step(46875)
|
| 60 |
+
model.eval()
|
| 61 |
+
|
| 62 |
+
spec = json.loads((root / "tokenizer.tiktoken.json").read_text())
|
| 63 |
+
encoding = tiktoken.Encoding(
|
| 64 |
+
name=spec["name"],
|
| 65 |
+
pat_str=spec["pat_str"],
|
| 66 |
+
mergeable_ranks={base64.b64decode(b): rank for b, rank in spec["mergeable_ranks"]},
|
| 67 |
+
special_tokens=spec["special_tokens"],
|
| 68 |
+
)
|
| 69 |
+
prompt = [encoding.encode_single_token("<|bos|>")] + encoding.encode_ordinary("The sky is")
|
| 70 |
+
with torch.inference_mode():
|
| 71 |
+
logits = model(torch.tensor([prompt]))
|
| 72 |
+
print(encoding.decode([int(logits[0, -1].argmax())]))
|
| 73 |
+
```
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e6c705410e2b407659e5db47933d9074ef347d2f8014855582f31b9cfbda9784
|
| 3 |
+
size 2806006344
|
model_config.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"method": "fixed_recursive",
|
| 3 |
+
"width": 1536,
|
| 4 |
+
"heads": 12,
|
| 5 |
+
"vocab_size": 32768,
|
| 6 |
+
"sequence_len": 2048,
|
| 7 |
+
"mlp_width": 6144,
|
| 8 |
+
"layers": 24,
|
| 9 |
+
"pre_layers": 3,
|
| 10 |
+
"core_layers": 9,
|
| 11 |
+
"post_layers": 3,
|
| 12 |
+
"loops": 2,
|
| 13 |
+
"window_pattern": "SSSL",
|
| 14 |
+
"max_loops": 3,
|
| 15 |
+
"act_epsilon": 0.01,
|
| 16 |
+
"ponder_weight": 0.01,
|
| 17 |
+
"huginn_mean": 3.0,
|
| 18 |
+
"huginn_sigma": 0.5,
|
| 19 |
+
"huginn_backprop_loops": 2,
|
| 20 |
+
"routing_seed": 1729,
|
| 21 |
+
"eval_loops": 3,
|
| 22 |
+
"ouro_entropy_weight": 0.1,
|
| 23 |
+
"ouro_gate_steps": 1024,
|
| 24 |
+
"ouro_exit_quantile": 0.5,
|
| 25 |
+
"sparse_topk": 256,
|
| 26 |
+
"block_size": 128,
|
| 27 |
+
"compression_size": 4,
|
| 28 |
+
"local_window": 512,
|
| 29 |
+
"index_heads": 4,
|
| 30 |
+
"index_dim": 128,
|
| 31 |
+
"index_rope_dim": 64,
|
| 32 |
+
"index_loss_weight": 1.0,
|
| 33 |
+
"burnin_steps": 512,
|
| 34 |
+
"slots": 64,
|
| 35 |
+
"gate_rank": 16,
|
| 36 |
+
"conv_size": 4,
|
| 37 |
+
"reference_chunk": 32,
|
| 38 |
+
"backend": "reference",
|
| 39 |
+
"scale": "formal"
|
| 40 |
+
}
|
tokenizer.tiktoken.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|