NextTransformer GQA

Four query heads share each of three key/value heads.

This is the final Grouped-Query Attention · GQA checkpoint in the NextTransformer 49.152B-token architecture comparison. It has 744,751,182 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.

Full causal attention with 12 query heads grouped four to a key/value head: three key/value heads of dimension 128. It is the native attention with three key/value heads and the same shared-key normalization as MQA, trained from scratch at 26 layers and FFN 6144.

Final evaluation Result
Validation BPB 0.6714
CORE-22 (×100) 32.62

Architecture · Run record

Three key/value heads is this project's registered choice. Trained from scratch, without uptraining from a multi-head checkpoint. Value embeddings are disabled in this family because their width follows the key/value heads; the matching multi-head control without them has not been trained. No KV-cache or decoding saving is measured. Single seed 42; trained from the frozen Others branch, not yet ported to the current code.

The upstream run record reports completed training and the trainer's cumulative compute audit; its independent read-only audit remains pending.

Load the weights

The run record lists this checkpoint as trained from a frozen source revision whose shell is not in the current code: ReferenceLM always builds multi-head attention with value embeddings, while this run uses fewer key/value heads and no value embeddings. The example therefore builds the native shell directly from model_config.json and loads the weights strictly; the architecture itself is unchanged native attention.

Install the tested NextTransformer implementation and the safetensors reader in a Python 3.10–3.13 environment.

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

The example encodes a prompt with the checkpoint's tokenizer and prints its most likely next token.

import base64
import json
import os
from pathlib import Path

os.environ["CUDA_VISIBLE_DEVICES"] = ""  # This example runs on CPU.

import tiktoken
import torch
from huggingface_hub import snapshot_download
from safetensors.torch import load_file
from torch import nn
from nexttransformer.models.backbone import GPT, GPTConfig
from nexttransformer.models.lm import FlexibleMLP

root = Path(snapshot_download("NextTransformer/GQA-49B-Tokens"))
config = json.loads((root / "model_config.json").read_text())
model = GPT(GPTConfig(
    sequence_len=config["sequence_len"], vocab_size=config["vocab_size"],
    n_layer=config["layers"], n_embd=config["width"], n_head=config["heads"],
    n_kv_head=config["kv_heads"], window_pattern=config["window_pattern"],
))


class _Widths:  # FlexibleMLP reads only these two fields.
    width, mlp_width = config["width"], config["mlp_width"]


for block in model.transformer.h:
    if config["mlp_width"] != 4 * config["width"]:
        block.mlp = FlexibleMLP(_Widths)
    block.attn.ve_gate = None  # this run trains without value embeddings
model.value_embeds = nn.ModuleDict()
model.load_state_dict(load_file(root / "model.safetensors"), strict=True)
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())]))
Downloads last month

-

Downloads are not tracked for this model. How to track
Safetensors
Model size
0.7B params
Tensor type
F32
·
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Collection including NextTransformer/GQA-49B-Tokens