NeTS-lab commited on
Commit
1fe8a95
·
verified ·
1 Parent(s): 429d18d

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +190 -0
README.md ADDED
@@ -0,0 +1,190 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ language:
4
+ - en
5
+ - nl
6
+ - zh
7
+ library_name: transformers
8
+ tags:
9
+ - babylm
10
+ - babylm-2026
11
+ - multilingual
12
+ - hawk
13
+ - griffin
14
+ - rg-lru
15
+ - recurrent-lm
16
+ - morpiece
17
+ - cognitively-plausible
18
+ pipeline_tag: text-generation
19
+ ---
20
+
21
+ # babylm26_multiling_hawk_MoP16K_baseline
22
+
23
+ A multilingual (English / Dutch / Chinese) **Hawk** language model trained for the
24
+ **BabyLM 2026 Multilingual track** (EMNLP 2026). This is a *baseline* model in the
25
+ NeTS-lab BabyLM-2026 series: it pairs a recurrent **Hawk (RG-LRU)** backbone with the
26
+ morphologically-aware **MorPiece (MoP)** tokenizer (+ byte_fallback), trained on the three target
27
+ languages (`eng / nld / zho`) with a byte-premium-balanced word budget under the
28
+ `baseline` regimen.
29
+
30
+ It is the Hawk counterpart to the Transformer baseline
31
+ [`NeTS-lab/babylm26_multiling_gpt2_MoP16K_baseline`](https://huggingface.co/NeTS-lab/babylm26_multiling_gpt2_MoP16K_baseline);
32
+ the two share the **same tokenizer and the same training data**, so the comparison
33
+ isolates the architecture (linear-recurrent vs. attention).
34
+
35
+ > **Note on baselines.** These models are released as controlled reference points for
36
+ > the NeTS-lab BabyLM-2026 study. Their purpose is a clean, matched comparison across
37
+ > architectures and tokenizers — not leaderboard maximisation.
38
+
39
+ ---
40
+
41
+ ## Model details
42
+
43
+ - **Developed by:** NeTS Lab, IUSS Pavia (with Claude Opus 4.8 fixes and specific HPC optimizations)
44
+ - **Model type:** Decoder-only causal LM, **recurrent (Hawk / RG-LRU)** — no global self-attention
45
+ - **Languages:** English (`eng`), Dutch (`nld`), Chinese (`zho`)
46
+ - **Tokenizer:** MorPiece (MoP) + byte_fallback, ~39.7K vocabulary, shared multilingual
47
+ - **License:** MIT
48
+ - **Sibling models:** `*_gpt2_MoP16K_baseline` (Transformer), and the eMG / SSM-eMG variants
49
+
50
+ ### Architecture
51
+
52
+ Hawk is the gated linear-recurrent backbone from the Griffin family (De et al., 2024).
53
+ Each block uses a **Real-Gated Linear Recurrent Unit (RG-LRU)** in place of attention,
54
+ combined with a gated MLP and RMSNorm. Loading requires `trust_remote_code=True`
55
+ because the `hawk_rglru` block is provided via custom modelling code.
56
+
57
+ | Field | Value |
58
+ |---|---|
59
+ | Backbone | Hawk (RG-LRU recurrent) — **no attention** |
60
+ | `model_type` | `hawk_rglru` |
61
+ | Layers (`n_layer`) | 12 |
62
+ | Hidden size (`n_embd`) | 704 |
63
+ | Recurrent width (`rnn_width`) | 768 |
64
+ | Conv kernel | 4 |
65
+ | MLP expansion | 3 |
66
+ | RG-LRU `c` | 8.0 |
67
+ | RMSNorm eps | 1e-6 |
68
+ | Max position embeddings | 1024 |
69
+ | Tied input/output embeddings | yes |
70
+ | Vocabulary size | **39,697** |
71
+ | Total parameters | **≈ 115.3M** (115,270,528) |
72
+ | Precision | float32 |
73
+
74
+ > The model is a *pure* Hawk recurrent stack (RG-LRU + depthwise conv + gated MLP,
75
+ > RMSNorm pre-norm). There is no self-attention, so the leaderboard "attention heads"
76
+ > field is `-1`. Parameter count is with tied embeddings (`lm_head` shares `wte`).
77
+ > Note that Hawk has no learned position embeddings — `max_position_embeddings`
78
+ > is a config field, not a hard context limit.
79
+
80
+ ### Tokenizer — MorPiece (MoP)
81
+
82
+ MorPiece is a split-based tokenizer that incrementally segments words into candidate
83
+ **morphemes** by applying Yang's (2016) **Tolerance Principle** at every character as a
84
+ word traverses a dual root/inflection trie. Splits are licensed only when the TP holds
85
+ **bilaterally** (root trie *and* inflection trie). The result is a morphology-aware
86
+ vocabulary motivated by developmental linguistics rather than pure frequency. For this multilingual
87
+ experiment we used the `--boundary-discovery` option to ignore whitespaces and process zho the same way of eng and nld.
88
+
89
+ - Shared across all three languages (single multilingual MoP tokenizer)
90
+ - Exported in HuggingFace `WordPiece` format with `++` continuing-subword prefix
91
+ - **Actual vocabulary: 39,697 tokens** (the `MoP16K` in the original repo name (NeTS-lab/babylm26_multiling_hawk_MoP16K_baseline) indicates that a maximum of 16K tokens per language can be stored in the final lexicon;
92
+ - the only difference with this tokenizer is the inclusion of byte_fallback to)
93
+
94
+ See the MorPiece repository for details: <https://github.com/cristianochesi/morpiece>
95
+
96
+ ---
97
+
98
+ ## Training data
99
+
100
+ Official **BabyLM 2026 Multilingual** data for `eng / nld / zho`. Languages are
101
+ drawn in a **byte-premium round-robin** during training, and the save-point
102
+ milestones are denominated in **byte-premium-adjusted English-equivalent words**
103
+ (BP: eng 1.000, nld 1.0516, zho 0.9360), per the multilingual track's word budget.
104
+ Training **regimen: `baseline`**. Per-corpus sizes: eng 56.2M / nld 57.0M / zho
105
+ 50.0M model tokens (≈34.2M English-equivalent words each ≈ 102.6M total/epoch).
106
+
107
+ No custom corpus, no synthetic augmentation, no human-annotated preference data.
108
+ A cleaning procedure stripped metalinguistic information (e.g. `tiers`).
109
+ Preprocessing routine can be found here:
110
+ <https://github.com/cristianochesi/babylm-2026/tree/main/01-preprocess>
111
+
112
+ ## Training procedure
113
+
114
+ | Field | Value |
115
+ |---|---|
116
+ | Optimizer | AdamW (β1=0.9, β2=0.999, weight decay 0.1, fused), no-decay on norms/biases/embeddings |
117
+ | LR scheduler | cosine decay with linear warmup (warmup = 1% of steps) |
118
+ | Max learning rate | 5e-4 |
119
+ | Min learning rate | 5e-5 |
120
+ | Epochs | ~3.1 of 10 planned (run cut by a 24h cluster time limit) |
121
+ | Per-device batch | 16 sequences × 4 grad-accum = **32,768 tokens / optimizer step** |
122
+ | Training sequence length | 512 (config `max_position_embeddings` = 1024) |
123
+ | Gradient clip | 1.0 (with a non-finite-grad firewall) |
124
+ | Random seed | 42 |
125
+ | Precision | bf16 mixed precision (no GradScaler); weights stored as float32 |
126
+ | Tokens processed | ~504M model tokens (~317M eng-equiv words) at stop |
127
+ | Hardware | 1 GPU + 8 CPUs, IUSS SLURM cluster (`gp02`, `gpuq`, conda `env_py3_12_torch2_91_CUDA_12_8`) |
128
+ | GPU-hours (training) | ~24 (single GPU; throughput ~2.6k steps/h) |
129
+ | Training FLOPs (approx.) | ~1.4 × 10¹⁸ (6·N·D over executed positions) |
130
+
131
+ ---
132
+
133
+ ## Usage
134
+
135
+ ```python
136
+ from transformers import AutoModelForCausalLM, AutoTokenizer
137
+
138
+ repo = "NeTSlab/hawk_mopbf_en_nl_zh_equal"
139
+
140
+ tokenizer = AutoTokenizer.from_pretrained(repo, trust_remote_code=True)
141
+ model = AutoModelForCausalLM.from_pretrained(repo, trust_remote_code=True)
142
+
143
+ text = "the cats are"
144
+ inputs = tokenizer(text, return_tensors="pt")
145
+ out = model.generate(**inputs, max_new_tokens=20)
146
+ print(tokenizer.decode(out[0], skip_special_tokens=True))
147
+ ```
148
+
149
+ > `trust_remote_code=True` is required to load the custom `hawk_rglru` block and tokenizer.
150
+ > The repo must contain `modeling_hawk.py` alongside `config.json` (the `auto_map`
151
+ > points to it). Generation is correct but has **no KV cache** — the recurrent
152
+ > backbone recomputes the full prefix each step, so `generate()` is O(T) per token.
153
+
154
+ ---
155
+
156
+ ## Evaluation
157
+
158
+ Evaluated with the BabyLM 2026 multilingual harness (lm-eval-style), including
159
+ **BLiMP**, **MultiBLiMP** (Dutch), and **SIGMORPHON 2022** morphology, alongside the
160
+ official multilingual benchmarks.
161
+
162
+ | Benchmark | Score |
163
+ |---|---|
164
+ | BLiMP (filtered) | `0.724` |
165
+ | BLiMP-nld (nld) | `0.803` |
166
+ | BLiMP-zho (zho) | `0.803` |
167
+
168
+ ---
169
+
170
+ ## Intended use & limitations
171
+
172
+ A small, sample-efficient research LM for studying cognitively-plausible language
173
+ modelling under a constrained (developmentally motivated) data budget. It is **not**
174
+ intended for production use. As a baseline trained on a limited multilingual corpus,
175
+ outputs are not reliable for downstream generation and may reflect biases in the
176
+ training data.
177
+
178
+ ## Citation
179
+
180
+ ```bibtex
181
+ @misc{chesi2026babylm_hawk_mop,
182
+ title = {Multilingual Hawk + MorPiece baseline for BabyLM 2026},
183
+ author = {Chesi, Cristiano and {NeTS Lab, IUSS Pavia}},
184
+ year = {2026},
185
+ note = {BabyLM 2026 Multilingual track baseline},
186
+ howpublished = {\url{https://huggingface.co/NeTS-lab/babylm26_multiling_hawk_MoP16K_baseline}}
187
+ }
188
+ ```
189
+
190
+ **Contact:** cristiano.chesi@iusspavia.it · NeTS Lab, IUSS Pavia