A
modern transformer language model (373.6M parameters) with Qwen3-Next-inspired architectural features, pretrained from scratch on 15B tokens from
SlimPajama.
This model incorporates several design choices from recent efficient transformer architectures: grouped-query attention (GQA), partial rotary position embeddings, output gating, QK-normalization, and zero-centered RMSNorm. It serves as a modernized attention baseline for comparison with linear attention and state-space models in the
Sequence Modeling Baselines collection.
1import torch
2import fla.models # registers the Transformer architecture with HuggingFace Auto classes
3
4from transformers import AutoModelForCausalLM, AutoTokenizer
5
6model = AutoModelForCausalLM.from_pretrained(
7 "puigde/modern-transformer-gqa-370M-15B-slimpajama",
8 trust_remote_code=True,
9 torch_dtype=torch.bfloat16,
10).cuda()
11tokenizer = AutoTokenizer.from_pretrained(
12 "puigde/modern-transformer-gqa-370M-15B-slimpajama"
13)
14
15inputs = tokenizer("The capital of France is", return_tensors="pt").to("cuda")
16output = model.generate(**inputs, max_new_tokens=50, do_sample=False)
17print(tokenizer.decode(output[0], skip_special_tokens=True))
Tokenizer: LlamaTokenizer (from
fla-hub/gla-1.3B-100B), vocab 32,000.
Note: RULER at 4K is beyond the 2K training context and collapses for GQA. The MHA variant (
modern-transformer-mha-370M-15B-slimpajama) retains partial 4K performance (S1=0.68, MK1=0.22).
1@article{yang2024fla,
2 title={Gated Linear Attention Transformers with Hardware-Efficient Training},
3 author={Yang, Songlin and Wang, Bailin and Shen, Yikang and Panda, Rameswar and Kim, Yoon},
4 journal={arXiv preprint arXiv:2312.06635},
5 year={2024}
6}