DM-GDNGQA-9.3B-LR2.4e-3-DM
A 9.27 B-parameter GatedDeltaNet : GQA hybrid, pretrained from scratch on 30 B tokens at peak learning rate 2.4e-3 with
DeltaMatching: Delta-Matching FP8 attention with the matched delta (dm_mode=matched). It is the DM (match) arm of a study in which three models were trained from the same initialization, on the same data in the same order, with the same recipe, except for the attention's training precision (the MP arm was trained with the study's native PyTorch trainer, the SD and DM arms with its Megatron-LM port, which starts from the native trainer's step-0 weights and reads its data order):
| repo | arm | attention in training | FP8 GEMMs |
|---|---|---|---|
| DM-GDNGQA-9.3B-LR2.4e-3-MP | clean | bf16 FlashAttention-3 (standard BF16/FP32 mixed precision) | FFN |
| DM-GDNGQA-9.3B-LR2.4e-3-SD | stale | Delta-Matching FP8 attention, stale delta (naive FP8) | FFN + attention q/k/v/o |
| DM-GDNGQA-9.3B-LR2.4e-3-DM | match | Delta-Matching FP8 attention, DeltaMatching (matched delta) | FFN + attention q/k/v/o |
The same three arms at the other learning-rate variant, peak LR 1.2e-3: DM-GDNGQA-9.3B-LR1.2e-3-MP, DM-GDNGQA-9.3B-LR1.2e-3-SD, DM-GDNGQA-9.3B-LR1.2e-3-DM.
Both variants are reported in the paper, Appendix C.8.1.
Model
| layers | 36 = [GatedDeltaNet, GatedDeltaNet, GatedDeltaNet, GQA] × 9 |
| width | d_model 4096, SwiGLU FFN 12,288, tied embeddings |
| GatedDeltaNet | 16 query / key heads × 128, 32 value heads × 256, gated, short convolution (flash-linear-attention, chunk mode) |
| attention | GQA, 16 query / 4 KV heads × 256, qk-norm, partial RoPE 0.25 (θ = 1e7), gated output |
| vocabulary, context | Llama-2 32k tokenizer, 8,192 tokens |
| parameters | 9,274,983,360 (bf16 safetensors) |
The export runs attention through bf16 SDPA in every arm, so the three repos share one architecture and differ only in
their weights. config.train.json records the training-time layer config in the study's native config schema (the FP8
arms train their attention layers through the dm Delta-Matching mixer, dm_mode matched or stale; the MP arm through
FlashAttention-3, attn_impl flash). The GatedDeltaNet layers are bf16 in all three arms.
Training
| data | Nemotron-CC (nemotron_cc_v2d1_hq_dqa), packed 8,192-token sequences |
| budget | 28,610 steps × global batch 128 × 8,192 tokens = 30.0 B tokens |
| optimizer | AdamW, β (0.9, 0.95), ε 1e-8, weight decay 0.1, gradient clip 1.0, z-loss 1e-4 |
| schedule | WSD: 3.33 % warmup to 2.4e-3, constant, linear decay to 0 over the last 20 % |
| seed | 11785 (initialization only; every run in the study reads the same data in the same order) |
| trainer, hardware | the study's Megatron-LM port (Megatron-Core 0.20, Megatron-FSDP), 4 × 8 H200 |
Evaluation (seed 11785)
| model | val CE | RULER | CSense-9 | Extract | TriviaQA | MMLU | MQAR |
|---|---|---|---|---|---|---|---|
| MP (clean) | 1.3141 | 60.51 | 0.6433 | 0.7140 | 0.2418 | 0.4291 | 0.1766 |
| SD (stale) | 1.8728 | 22.18 | 0.4681 | 0.3848 | 0.0281 | 0.2633 | 0.0655 |
| DM (match) | 1.3152 | 58.22 | 0.6395 | 0.6933 | 0.2414 | 0.4175 | 0.1247 |
val CE: nats/token on 2,000 held-out 8,192-token windows (lower is better). RULER: 13 tasks at 4k and 8k, mean of the two lengths. CSense-9: LAMBADA, HellaSwag, PIQA, ARC-e, ARC-c, SciQ, OpenBookQA, WinoGrande, COPA. Extract: SWDE, FDA, SQuAD completion. TriviaQA: 5-shot exact match. MQAR: synthetic multi-query key-value recall. Each arm was trained once (seed 11785), so the table has no seed-to-seed error bar. At peak LR 2.4e-3 the stale arm ends +0.5587 nats/token from clean on val CE (RULER 22.18 against 60.51), while the match arm ends +0.0011 from it (RULER 58.22). The MP row was evaluated on H100 with the same evaluation code, data and settings as the other rows; its val CE reproduces on H200 to the reported precision.
Usage
The model code ships with this repo (modeling_bqalm.py, configuration_bqalm.py), so no other codebase is needed.
It needs a CUDA GPU with torch, transformers >= 5 and flash-linear-attention (tested with torch 2.12,
transformers 5.9.0, flash-linear-attention 0.5.2). In bf16 the weights take 18.6 GB of GPU memory.
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "haok1402/DM-GDNGQA-9.3B-LR2.4e-3-DM"
model = AutoModelForCausalLM.from_pretrained(repo, dtype=torch.bfloat16, trust_remote_code=True).cuda()
tokenizer = AutoTokenizer.from_pretrained(repo, trust_remote_code=True)
inputs = tokenizer("The capital of France is", return_tensors="pt").to("cuda")
print(tokenizer.decode(model.generate(**inputs, max_new_tokens=32)[0], skip_special_tokens=True))
- Inference.
generate()keeps a cache (the GQA layers' K/V and the GatedDeltaNet recurrent and conv states), so each new token costs one step. Greedy decoding and sampling are supported (num_beams=1); prompts batched together must share one length, since the GatedDeltaNet layers have no padding mask. - Fine-tuning.
model(input_ids=ids, labels=ids).lossis the next-token cross-entropy, so the model trains with thetransformersTrainerin bf16. The FP8 Delta-Matching attention the SD and DM arms were trained with needs a compiled CUDA kernel that is not shipped; the exported weights are bf16 and run bf16 SDPA attention. - Fidelity. The shipped code is the study's evaluation path: its logits match the original loader bit for bit, on the
default SDPA attention and with
attn_implementation="flash_attention_2", the path the study's evaluation ran.
- Downloads last month
- 22