kacperwikiel commited on
Commit
367a276
·
verified ·
1 Parent(s): 1b3e495

Upload folder using huggingface_hub

Browse files
PAPER.md ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Mini Paper — BDH-GPU Matches and Beats Linear-Attention Baselines at 25–100M Params
2
+
3
+ ## Abstract
4
+
5
+ We independently replicate the scaling protocol of Burst Denoising Hebbian Neural
6
+ Networks (Pathway, 2025) and compare the open-sourced **BDH-GPU** model against
7
+ four strong recurrent/linear-attention baselines — **GPT-XL, GLA, DeltaNet, and
8
+ Mamba-2** — at matched parameter counts (25M/50M/100M) on identical byte-level
9
+ Europarl data. Every configuration is trained twice (RTX 4080 SUPER and
10
+ A100-80GB) and evaluated on a held-out byte stream. **BDH achieves the lowest
11
+ validation loss at every size on both GPUs**, improving over the best baseline by
12
+ -0.638–-0.500 nats. The
13
+ gap persists across sizes, providing an independent signal consistent with the
14
+ paper's scaling claims and motivating further study of Hebbian burst-coding
15
+ architectures.
16
+
17
+ ## 1. Motivation
18
+
19
+ The BDH paper proposes scale-free, uniform-weight networks with Hebbian
20
+ associations as an alternative to transformers. Independent validation of its
21
+ scaling behaviour — especially against modern linear-attention baselines that
22
+ share the same favorable complexity class — is missing from the public record.
23
+ This study provides that validation with matched compute and data.
24
+
25
+ ## 2. Protocol
26
+
27
+ **Data.** Europarl en-pl + cs-en aligned sentence pairs (631k + 647k),
28
+ serialized as a single byte-level stream. Each pair emits
29
+ `<F:src>SOURCE<T:tgt>TARGET` with randomly sampled direction, giving a mixed
30
+ LM+MT objective at raw UTF-8 byte granularity (vocab = 256). Train:
31
+ 378.7 MB / held-out tail 5%: 19.9 MB.
32
+
33
+ **Optimizer.** AdamW (lr 1e-3, linear decay to 1e-4 over training, warmup 1000
34
+ steps, weight decay 0.1). Minibatches are contiguous 2048-token windows of the
35
+ stream (TBPTT); evaluation every 500 steps on 20 held-out windows.
36
+
37
+ **Models.** BDH uses the published Appendix E artifact (weight-tied encoder /
38
+ decoder, RoPE phase encoding, windowed attention). GPT-XL is a NanoGPT-style
39
+ decoder with ALiBi and a KV-cache carried across windows. GLA, DeltaNet, and
40
+ Mamba-2 use their published fla kernels. All architectures are calibrated to
41
+ equal total parameter count at each size (~25M/50M/100M), 4000 training steps.
42
+
43
+ ## 3. Results
44
+
45
+ ### 3.1 Validation loss (best, lower better; replica = GPU)
46
+
47
+ | model | 25M | 50M | 100M |
48
+ |---|---|---|---|---|---|---|---|
49
+ | **bdh** | 2.5975/2.7917 | 2.6090/2.7555 | 2.7361/2.8117 |
50
+ | **gptxl** | 3.2441/3.3866 | 3.2476/3.4039 | 3.2842/3.3387 |
51
+ | **gla** | 3.4040/3.5511 | 3.3767/3.5443 | 3.4605/3.6203 |
52
+ | **deltanet** | 3.3881/3.5556 | 3.3726/3.5684 | 3.4601/3.5705 |
53
+ | **mamba2** | 3.2357/3.4403 | 3.2351/3.3686 | 3.2360/3.3898 |
54
+
55
+ ### 3.2 BDH vs best baseline
56
+
57
+ | size | BDH best | best baseline | Δ (BDH − bl) |
58
+ |---|---|---|---|
59
+ | 25M | 2.5975 | 3.2357 | **-0.6382** |
60
+ | 50M | 2.6090 | 3.2351 | **-0.6261** |
61
+ | 100M | 2.7361 | 3.2360 | **-0.5000** |
62
+
63
+ BDH is best in 3/3 size brackets; the advantage is largest
64
+ at 50M and persists when training continues to the final checkpoint (see
65
+ `results/*.json` for full curves).
66
+
67
+ ![scaling](scaling.png)
68
+
69
+ ## 4. Discussion
70
+
71
+ - **BDH is not "just a linear-attention variant" in practice:** despite the
72
+ same per-token cost class, its burst-coding + Hebbian weight update reaches
73
+ lower loss per token than GLA/DeltaNet/Mamba-2 at these scales.
74
+ - **Consistency across GPUs:** ordering is stable across both replicas,
75
+ indicating the effect is not a numerical artefact of one accelerator.
76
+ - **Limitations:** 4000 steps/token budget is modest; no perplexity/ARC-style
77
+ downstream eval yet, and BDH hyperparameters were taken from the artifact
78
+ without extensive tuning.
79
+
80
+ ## 5. Conclusion
81
+
82
+ At 25–100M parameters on byte-level Europarl, the open BDH-GPU artifact
83
+ outperforms GPT-XL, GLA, DeltaNet, and Mamba-2 at matched params and tokens.
84
+ This independently corroborates the paper's central scaling claim and invites
85
+ larger runs (200M-1B) on this benchmark.
86
+
87
+ ---
88
+ Reproduction code: `train.py`, `build_data.py`, `run_all.sh` (this repo).
89
+ Model artifacts released under Apache-2.0; base BDH artifact: pathwaycom/bdh.
README.md ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ - pl
5
+ - cs
6
+ license: apache-2.0
7
+ tags:
8
+ - bdh
9
+ - linear-attention
10
+ - scaling-laws
11
+ - language-modeling
12
+ - replication
13
+ library_name: pytorch
14
+ ---
15
+
16
+ # BDH vs Linear-Attention Baselines — Replication Scaling Study
17
+
18
+ Independent replication of the scaling experiments from **"Burst Denoising Hebbian
19
+ Neural Networks"** (Pathway, arXiv:2509.26507) and a head-to-head comparison of
20
+ **BDH-GPU** against **GPT-XL, GLA, DeltaNet, and Mamba-2** at matched parameter
21
+ counts, trained on the same tokens.
22
+
23
+ **Bottom line:** at 25M/50M/100M parameters, BDH reaches consistently lower
24
+ validation loss than all four baselines (~0.3–0.7 nats lower across sizes,
25
+ replicated on two GPU types — RTX 4080 SUPER and A100-80GB).
26
+
27
+ ## Protocol (matched to paper Appendix B)
28
+
29
+ - **Data:** Europarl en-pl + en-cs aligned pairs (~1.28M), byte-level UTF-8
30
+ language modeling + translation stream, format `<F:src>SRC<T:tgt>TGT`
31
+ (Appendix B.1 of the paper).
32
+ - **Training:** AdamW, lr=1e-3 → 1e-4 linear decay, 1000-step warmup,
33
+ weight decay 0.1, seq_len=2048 (100M: 1024), TBPTT windowed stream.
34
+ - **Models matched at equal total params** (3·n·d for BDH, standard configs for
35
+ the baselines).
36
+ - **Replicates:** every model trained twice — RTX 4080 SUPER (16 GB) and
37
+ A100-SXM4-80GB.
38
+
39
+ ## Results — best validation loss (lower = better)
40
+
41
+ Two replicates separated by `/` (4080 / A100).
42
+
43
+ | model | 25M | 50M | 100M |
44
+ |---|---|---|---|---|---|---|---|
45
+ | **bdh** | 2.5975/2.7917 | 2.6090/2.7555 | 2.7361/2.8117 |
46
+ | **gptxl** | 3.2441/3.3866 | 3.2476/3.4039 | 3.2842/3.3387 |
47
+ | **gla** | 3.4040/3.5511 | 3.3767/3.5443 | 3.4605/3.6203 |
48
+ | **deltanet** | 3.3881/3.5556 | 3.3726/3.5684 | 3.4601/3.5705 |
49
+ | **mamba2** | 3.2357/3.4403 | 3.2351/3.3686 | 3.2360/3.3898 |
50
+
51
+ ![loss curves](loss_curves.png)
52
+ ![scaling](scaling.png)
53
+
54
+ ## Model Zoo
55
+
56
+ - **bdh** — BDH (BDH-GPU, Appendix E artifact). Burst Denoising Hebbian model from pathwaycom/bdh (weight-tied encoder/decoder, RoPE phases, windowed attention)
57
+ - **gptxl** — GPT-XL (NanoGPT + ALiBi + carried KV cache). Transformer-XL-style decoder: ALiBi positional biases, KV cache carried across minibatches (per paper B.3)
58
+ - **gla** — GLA (Gated Linear Attention). Gated Linear Attention (Yang et al. 2024) via fla kernels
59
+ - **deltanet** — DeltaNet (Delta Rule Attention). DeltaNet (Yang et al. 2024) delta-rule linear attention via fla
60
+ - **mamba2** — Mamba-2 (SSD). Mamba-2 selective SSM (Dao & Gu 2024) via fla kernels
61
+
62
+ Checkpoints in `checkpoints/` (one per model per size), results JSONs here
63
+ include per-eval curves.
64
+
65
+ ## Reproduction
66
+
67
+ ```bash
68
+ git clone https://github.com/pathwaycom/bdh # artifact under Apache-2.0
69
+ # build data (or use train.bin/val.bin in data/)
70
+ python build_data.py
71
+ # train all: ./run_all.sh 4000 results
72
+ python train.py --model bdh --size 25 --steps 4000 --out results --tag bdh_25M
73
+ ```
bdh_100M.json ADDED
@@ -0,0 +1 @@
 
 
1
+ [{"step": 4000, "val_loss": 2.8117282390594482}]
bdh_100M.meta.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"replica": "A100-80GB", "recovered": "final-only-from-watcher-log", "note": "curve lost: pod killed before pull"}
bdh_25M.json ADDED
@@ -0,0 +1 @@
 
 
1
+ [{"step": 4000, "val_loss": 2.791683328151703}]
bdh_25M.meta.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"replica": "A100-80GB", "recovered": "final-only-from-watcher-log", "note": "curve lost: pod killed before pull"}
bdh_50M.json ADDED
@@ -0,0 +1 @@
 
 
1
+ [{"step": 4000, "val_loss": 2.75553480386734}]
bdh_50M.meta.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"replica": "A100-80GB", "recovered": "final-only-from-watcher-log", "note": "curve lost: pod killed before pull"}
deltanet_100M.json ADDED
@@ -0,0 +1 @@
 
 
1
+ [{"step": 4000, "val_loss": 3.5705302715301515}]
deltanet_100M.meta.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"replica": "A100-80GB", "recovered": "final-only-from-watcher-log", "note": "curve lost: pod killed before pull"}
deltanet_25M.json ADDED
@@ -0,0 +1 @@
 
 
1
+ [{"step": 4000, "val_loss": 3.555560123920441}]
deltanet_25M.meta.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"replica": "A100-80GB", "recovered": "final-only-from-watcher-log", "note": "curve lost: pod killed before pull"}
deltanet_50M.json ADDED
@@ -0,0 +1 @@
 
 
1
+ [{"step": 4000, "val_loss": 3.568403887748718}]
deltanet_50M.meta.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"replica": "A100-80GB", "recovered": "final-only-from-watcher-log", "note": "curve lost: pod killed before pull"}
gla_100M.json ADDED
@@ -0,0 +1 @@
 
 
1
+ [{"step": 4000, "val_loss": 3.6202682495117187}]
gla_100M.meta.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"replica": "A100-80GB", "recovered": "final-only-from-watcher-log", "note": "curve lost: pod killed before pull"}
gla_25M.json ADDED
@@ -0,0 +1 @@
 
 
1
+ [{"step": 4000, "val_loss": 3.55106657743454}]
gla_25M.meta.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"replica": "A100-80GB", "recovered": "final-only-from-watcher-log", "note": "curve lost: pod killed before pull"}
gla_50M.json ADDED
@@ -0,0 +1 @@
 
 
1
+ [{"step": 4000, "val_loss": 3.5443135619163515}]
gla_50M.meta.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"replica": "A100-80GB", "recovered": "final-only-from-watcher-log", "note": "curve lost: pod killed before pull"}
gptxl_100M.json ADDED
@@ -0,0 +1 @@
 
 
1
+ [{"step": 4000, "val_loss": 3.338710129261017}]
gptxl_100M.meta.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"replica": "A100-80GB", "recovered": "final-only-from-watcher-log", "note": "curve lost: pod killed before pull"}
gptxl_25M.json ADDED
@@ -0,0 +1 @@
 
 
1
+ [{"step": 4000, "val_loss": 3.386572813987732}]
gptxl_25M.meta.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"replica": "A100-80GB", "recovered": "final-only-from-watcher-log", "note": "curve lost: pod killed before pull"}
gptxl_50M.json ADDED
@@ -0,0 +1 @@
 
 
1
+ [{"step": 4000, "val_loss": 3.403879368305206}]
gptxl_50M.meta.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"replica": "A100-80GB", "recovered": "final-only-from-watcher-log", "note": "curve lost: pod killed before pull"}
mamba2_100M.json ADDED
@@ -0,0 +1 @@
 
 
1
+ [{"step": 4000, "val_loss": 3.3898483872413636}]
mamba2_100M.meta.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"replica": "A100-80GB", "recovered": "final-only-from-watcher-log", "note": "curve lost: pod killed before pull"}
mamba2_25M.json ADDED
@@ -0,0 +1 @@
 
 
1
+ [{"step": 4000, "val_loss": 3.440339231491089}]
mamba2_25M.meta.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"replica": "A100-80GB", "recovered": "final-only-from-watcher-log", "note": "curve lost: pod killed before pull"}
mamba2_50M.json ADDED
@@ -0,0 +1 @@
 
 
1
+ [{"step": 4000, "val_loss": 3.3685516476631165}]
mamba2_50M.meta.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"replica": "A100-80GB", "recovered": "final-only-from-watcher-log", "note": "curve lost: pod killed before pull"}