xjxyys commited on
Commit
f77c619
·
verified ·
1 Parent(s): fd54c47

Publish final 49.152B-token checkpoint with model card and tokenizer

Browse files
Files changed (4) hide show
  1. README.md +74 -0
  2. model.safetensors +3 -0
  3. model_config.json +40 -0
  4. tokenizer.tiktoken.json +0 -0
README.md ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: pytorch
3
+ tags:
4
+ - nexttransformer
5
+ - sparse
6
+ - causal-lm
7
+ - pretrained
8
+ - safetensors
9
+ pipeline_tag: text-generation
10
+ ---
11
+
12
+ # NextTransformer QSA
13
+
14
+ Compress micro-blocks before selecting historical context.
15
+
16
+ This is the final Qwen Sparse Attention · QSA checkpoint in the NextTransformer 49.152B-token architecture comparison. It has 1,378,420,488 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
+ Four-token key blocks are pooled for indexer scoring. Attention selects fully visible historical blocks and retains the unfinished tail. Only the QSA mixer is transferred, without the original system’s hybrid layers or additional training recipe.
19
+
20
+ | Final evaluation | Result |
21
+ |---|---:|
22
+ | Validation BPB | 0.6681 |
23
+ | CORE-22 (×100) | 29.82 |
24
+
25
+ [Architecture](https://github.com/Interactive-Active-AI/NextTransformer/blob/b2ea46627f7d0d5c9ef57a655c43b553558417d3/results/methods/qsa.json) · [Run record](https://github.com/Interactive-Active-AI/NextTransformer/blob/b2ea46627f7d0d5c9ef57a655c43b553558417d3/results/runs/qsa.json)
26
+
27
+ Excludes the GDN/QSA hybrid, MoE, gated residuals, MTP and 256K continued pretraining. The tail can add up to 3 tokens.
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@b2ea46627f7d0d5c9ef57a655c43b553558417d3" 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/QSA-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
+ if hasattr(model, "set_step"):
60
+ model.set_step(46875)
61
+ model.eval()
62
+
63
+ spec = json.loads((root / "tokenizer.tiktoken.json").read_text())
64
+ encoding = tiktoken.Encoding(
65
+ name=spec["name"],
66
+ pat_str=spec["pat_str"],
67
+ mergeable_ranks={base64.b64decode(b): rank for b, rank in spec["mergeable_ranks"]},
68
+ special_tokens=spec["special_tokens"],
69
+ )
70
+ prompt = [encoding.encode_single_token("<|bos|>")] + encoding.encode_ordinary("The sky is")
71
+ with torch.inference_mode():
72
+ logits = model(torch.tensor([prompt]))
73
+ print(encoding.decode([int(logits[0, -1].argmax())]))
74
+ ```
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7d1e9c15b3be94d58b74e6365a54d525e02120540c20d58c4a2705f3ecddcf83
3
+ size 4205082528
model_config.json ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "method": "qsa",
3
+ "width": 1536,
4
+ "heads": 12,
5
+ "vocab_size": 32768,
6
+ "sequence_len": 2048,
7
+ "mlp_width": 6144,
8
+ "layers": 23,
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