A
GatedDeltaNet language model (357.8M parameters) pretrained from scratch on 15B tokens from
SlimPajama.
GatedDeltaNet combines scalar decay gating with the delta rule for selective memory writing. See
Yang et al., 2024.
1import torch
2import fla.models # registers GatedDeltaNet with HuggingFace Auto classes
3
4from transformers import AutoModelForCausalLM, AutoTokenizer
5
6model = AutoModelForCausalLM.from_pretrained(
7 "puigde/gated-deltanet-360M-15B-slimpajama",
8 trust_remote_code=True,
9 torch_dtype=torch.bfloat16,
10).cuda()
11tokenizer = AutoTokenizer.from_pretrained(
12 "puigde/gated-deltanet-360M-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))
Based on the
Flame gated_deltanet_340M.json config with two modifications:
expand_v=1 (vs 2) and
num_heads=4 (vs 6), which reduces the parameter count from ~460M to 358M.
Tokenizer: LlamaTokenizer (from
fla-hub/gla-1.3B-100B), vocab 32,000.
RULER (2k context): S1=1.00, S2=1.00, S3=0.66, MK1=0.32, avg=0.75.
1@article{yang2024gateddeltanet,
2 title={Gated Delta Networks: Improving Mamba2 with Delta Rule},
3 author={Yang, Songlin and Keller, Jan and Wang, Bailin and others},
4 journal={arXiv preprint arXiv:2412.06464},
5 year={2024}
6}