CoolFace
Modelpublic

AxiomicLabs/GPT-S2-5M

sourceHugging Faceapache-2.0updated 3mo agoView on Hugging Face
21likes607downloads
Model Card

[image]

GPT-S2-5M

GPT-S2-5M is the latest entry in our GPT-S small-model family, now based on the T-X4 architecture with the all new XSA refresh gate. trained from scratch.

The model takes the #1 spot on the [Open SLM Leaderboard](https://huggingface.co/spaces/AxiomicLabs/Open_SLM_Leaderboard), dethroning SLM-10M while being almost 1/2 the parameters.

It combines RoPE + RMSNorm + SwiGLU + exclusive grouped-query attention, and the refresh gate re-injects the original token embedding back into the residual stream conditioned on the (detached) attention output to conunteract diluted token identities common in deep XSA models.

Architecture

ComponentDetails
Position encodingRoPE, theta = 2,500
NormalizationRMSNorm (eps 1e-6)
Feed-forwardSwiGLU
AttentionExclusive grouped-query attention (XSA), 6 query heads / 2 KV heads
RefreshXSA refresh gate on layers 5 and 9, kernel 9
EmbeddingsWeight tied
Context length512 tokens
Parameters5,384,258

Config

text
vocab_size       = 4,096
hidden_size      = 192
num_layers       = 9
num_heads        = 6
num_kv_heads     = 2
head_dim         = 32
intermediate     = 672
block_size       = 512
rope_theta       = 2,500
inject_layers    = [4, 8]
refresh_kernel   = 9

The XSA refresh gate

The keystone of the T-X4 architecture is the injection layers, after the attention residual add, the block applies:

text
a     = RMSNorm(attn_out.detach())              # read attention as a signal
e     = RMSNorm(e0)                              # original token embedding
gate  = gate_proj(a) + causal_depthwise_conv(a) # kernel-9, depthwise
value = value_proj(e)
z     = RMSNorm(out_proj(SiLU(gate) * value))
x     = x + alpha * z                            # alpha is a learned scalar

e0 is the token embedding from the input layer, re-injected at every gate. The depthwise conv is strictly causal, so the gate is compatible with KV-cache generation (the conv state is carried alongside the attention cache).

Benchmarks

Zero-shot, evaluated in bf16 with an internal harness modeled on EleutherAI/lm-eval-harness; normalized accuracy where available.

HellaswagARC-EasyARC-ChallengePIQAArithmark-2
27.87%33.92%22.87%57.56%28.04%

Comparison

GPT-S2-5M against other small base models on the same evaluation suite. Achieving the highest avg score in the sub 10M category on the Open SLM Leaderboard

#ModelParamsHellaSwagARC-EasyARC-ChallengePIQAArithmark-2
1GPT-S2-5M (Axiomic Labs)5.4M27.87%33.92%22.87%57.56%28.04%
2SLM-10M (Liodon AI)10M27.40%35.52%23.46%57.07%26.40%
3GPT-S-5M (Axiomic Labs)5.2M27.46%33.21%21.16%57.24%27.12%
4michel-nano-v2 (finnianx)9.9M27.36%36.07%21.84%56.96%25.04%
5michel-nano (finnianx)6M27.12%33.29%22.70%54.79%26.00%
6Tenete-8M (Harley ML)8M26.75%31.69%21.84%55.66%26.72%

Training

HyperparameterValue
OptimizersAdamW (embeddings / LM head / norms / conv) + Muon (2D hidden weights)
Adam betas0.9 / 0.95
Adam peak LR2.5e-3
Muon peak LR0.03
Muon momentum0.95
Weight decay0.01
Minimum LR0
LR scheduleWarmup-stable-decay
Warmup steps1,500
Decay start85% of training
Training tokens75B
Total batch size262,144 tokens
Microbatch128 × 512 tokens
Gradient accumulation steps4
Gradient clipping1.0
Precisionbfloat16 autocast

Trained on a mixture of filtered web text (DCLM) and synthetic "finephrase" data (FAQ / math / table / tutorial)

Usage

python
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch

model_name = "AxiomicLabs/GPT-S2-5M"

tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
    model_name,
    trust_remote_code=True,
    torch_dtype=torch.bfloat16,
    device_map="auto",
)

prompt = "The future of AI is"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)

with torch.inference_mode():
    output = model.generate(
        **inputs,
        max_new_tokens=120,
        do_sample=True,
        temperature=0.8,
        top_p=0.95,
        repetition_penalty=1.1,
        no_repeat_ngram_size=4,
    )

print(tokenizer.decode(output[0], skip_special_tokens=True))

Limitations

This is a small base language model. It is not instruction tuned, has limited factual capacity, and uses a 512-token context window.