GSA-49B-Tokens / README.md
X-Zhang's picture
Release final GSA checkpoint trained on 49.152B tokens
95c5a88 verified
|
Raw History Blame Contribute Delete
3 kB
metadata
library_name: pytorch
pipeline_tag: text-generation
tags:
  - nexttransformer
  - linear-attention
  - causal-lm
  - pretrained
  - safetensors

NextTransformer GSA

This is the final Gated Slot Attention (GSA) checkpoint from run A02_gsa in the NextTransformer 49.152B-token comparison. It has 1,421,873,930 parameters and a 2,048-token context. Pretraining used ClimbMix for 46,875 updates at seed 42.

Each head stores keys and values in 64 slots. An input-dependent gate controls how much each slot retains and writes at each token. The query reads the key state to form a softmax distribution over slots, then uses that distribution to read the value state. This checkpoint uses the original A02 mixer, which applies SiLU to the queries and keys without Q/K RMS normalization.

Final evaluation Result
Validation BPB 0.8755
CORE-22 (×100) 9.20

Validation BPB was measured on 20,971,520 tokens in a separate evaluation of the final checkpoint. CORE-22 is the mean of the 22 centered task scores.

The training log records repeated loss spikes. The scores above come from the final checkpoint of the original run. Gated Slot Attention paper

Load the weights

Install the pinned NextTransformer implementation and the safetensors reader with Python 3.10–3.13.

pip install "nexttransformer @ git+https://github.com/Interactive-Active-AI/NextTransformer.git@b2ea46627f7d0d5c9ef57a655c43b553558417d3" safetensors

The example uses the PyTorch reference recurrence on CPU. The saved model configuration records the fused recurrence used in training. The repository includes the original GSA mixer as a NextTransformer method plugin.

import base64
import json
import os
from pathlib import Path

os.environ["CUDA_VISIBLE_DEVICES"] = ""

import tiktoken
import torch
from huggingface_hub import snapshot_download
from safetensors.torch import load_file

root = Path(snapshot_download("NextTransformer/GSA-49B-Tokens"))

# Register the original A02 mixer before importing NextTransformer.
os.environ["NEXTTRANSFORMER_METHOD_PATHS"] = str(root / "methods")

from nexttransformer.models import build_model, config_from_dict

raw = json.loads((root / "model_config.json").read_text())
config = config_from_dict({**raw, "backend": "reference"})
model = build_model(config, device="cpu")
model.load_state_dict(load_file(root / "model.safetensors"), strict=True)
model.set_step(46875)
model.eval()

spec = json.loads((root / "tokenizer.tiktoken.json").read_text())
encoding = tiktoken.Encoding(
    name=spec["name"],
    pat_str=spec["pat_str"],
    mergeable_ranks={base64.b64decode(b): rank for b, rank in spec["mergeable_ranks"]},
    special_tokens=spec["special_tokens"],
)
prompt = [encoding.encode_single_token("<|bos|>")] + encoding.encode_ordinary("The sky is")
with torch.inference_mode():
    logits = model(torch.tensor([prompt]))
print(encoding.decode([int(logits[0, -1].argmax())]))