Fill-Mask
Transformers
Safetensors
English
modernbert_small
babylm
babylm-2026
modernbert
masked-language-model
strict-small
custom_code
Instructions to use remg1997/modernbert-small-phase6-composition-frequency-shuffled-babylm2026 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use remg1997/modernbert-small-phase6-composition-frequency-shuffled-babylm2026 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("fill-mask", model="remg1997/modernbert-small-phase6-composition-frequency-shuffled-babylm2026", trust_remote_code=True)# Load model directly from transformers import AutoModelForMaskedLM model = AutoModelForMaskedLM.from_pretrained("remg1997/modernbert-small-phase6-composition-frequency-shuffled-babylm2026", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- babylm
|
| 5 |
+
- babylm-2026
|
| 6 |
+
- modernbert
|
| 7 |
+
- masked-language-model
|
| 8 |
+
- strict-small
|
| 9 |
+
language:
|
| 10 |
+
- en
|
| 11 |
+
library_name: transformers
|
| 12 |
+
pipeline_tag: fill-mask
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# ModernBERT-Small (Compositional + Shuffled-Frequency Residual, Control) — BabyLM 2026 Strict-Small
|
| 16 |
+
|
| 17 |
+
This model is a `ModernBERT-Small` masked language model (RoPE, GeGLU, alternating local/global
|
| 18 |
+
attention, 384 hidden size, 16 layers, 6 attention heads) trained from scratch on the
|
| 19 |
+
**BabyLM 2026 Strict-Small** 10M-word corpus, as part of an ablation study on
|
| 20 |
+
parameter-efficient token embedding layers for developmentally-plausible pretraining under the
|
| 21 |
+
BabyLM Challenge's strict-small compute and data budget.
|
| 22 |
+
|
| 23 |
+
## Embedding design
|
| 24 |
+
|
| 25 |
+
Standard transformer token embedding tables scale as `vocab_size x hidden_size`, which for this
|
| 26 |
+
model's 30,522-token vocabulary and 384 hidden size would be an 11.7M-parameter dense lookup
|
| 27 |
+
table. This checkpoint's base representation is the same **compositional byte-n-gram embedding**
|
| 28 |
+
used across this ablation sweep: each vocabulary token is decomposed into its raw UTF-8 byte
|
| 29 |
+
sequence, every byte n-gram (n = 1 to 4) is extracted and hashed into one of 8,192 shared
|
| 30 |
+
buckets, and the token's representation is the mean of its buckets' embeddings (a
|
| 31 |
+
128-dimensional `EmbeddingBag` table, ~1.0M parameters) rather than a dedicated per-token row.
|
| 32 |
+
|
| 33 |
+
On top of that shared composed representation, this variant adds a **frequency-gated per-token
|
| 34 |
+
residual** -- a learned `vocab_size x 128` embedding added to the composed vector, scaled per
|
| 35 |
+
token by `frequency / (frequency + tau)` (tau = 100) so common tokens lean more on their own
|
| 36 |
+
residual and rare tokens rely mostly on the composition. Critically, this checkpoint is the
|
| 37 |
+
**shuffled-frequency control**: the frequency values used to compute each token's gating weight
|
| 38 |
+
are randomly permuted across the vocabulary (fixed seed 42) before being applied, so a token's
|
| 39 |
+
residual is gated by an unrelated token's frequency rather than its own. This isolates whether
|
| 40 |
+
any benefit from the frequency-gated residual comes from the *correct* frequency signal, or
|
| 41 |
+
merely from having *some* per-token residual-plus-gating mechanism -- a null-effect control
|
| 42 |
+
against the true frequency-gated variant in this sweep.
|
| 43 |
+
|
| 44 |
+
This is one variant in a broader comparison of embedding-layer parameterizations (dense, linear
|
| 45 |
+
and MLP-style factorization, tensor-train decomposition, deterministic Fourier expansion, and
|
| 46 |
+
compositional/frequency-adaptive variants) evaluated under identical data, tokenizer, optimizer,
|
| 47 |
+
and training budget, to isolate the effect of the embedding layer's parameterization on
|
| 48 |
+
downstream BabyLM evaluation performance.
|
| 49 |
+
|
| 50 |
+
## Training data
|
| 51 |
+
|
| 52 |
+
BabyLM 2026 Strict-Small corpus (~10M words), tokenized with a byte-level BPE tokenizer trained
|
| 53 |
+
on the same corpus (vocab size 30,522). No external data, synthetic augmentation, or human
|
| 54 |
+
annotation beyond the corpus as officially released.
|
| 55 |
+
|
| 56 |
+
## Usage
|
| 57 |
+
|
| 58 |
+
```python
|
| 59 |
+
from transformers import AutoModelForMaskedLM, AutoTokenizer
|
| 60 |
+
|
| 61 |
+
model = AutoModelForMaskedLM.from_pretrained(
|
| 62 |
+
"remg1997/modernbert-small-phase6-composition-frequency-shuffled-babylm2026",
|
| 63 |
+
trust_remote_code=True,
|
| 64 |
+
)
|
| 65 |
+
tokenizer = AutoTokenizer.from_pretrained(
|
| 66 |
+
"remg1997/modernbert-small-phase6-composition-frequency-shuffled-babylm2026"
|
| 67 |
+
)
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
Each `chck_{N}M` branch of this repository corresponds to a BabyLM-Challenge compliance
|
| 71 |
+
checkpoint (one per `N` million words of training data seen); `main` points at the final,
|
| 72 |
+
fully-trained checkpoint.
|
| 73 |
+
|
| 74 |
+
## Evaluation
|
| 75 |
+
|
| 76 |
+
Evaluated with the official [`babylm-eval`](https://github.com/babylm-org/babylm-eval) harness
|
| 77 |
+
(BLiMP, EWoK, entity tracking, COMPS, Global PIQA, reading-time correlation, GLUE/SuperGLUE
|
| 78 |
+
fine-tuning, and Age-of-Acquisition word-surprisal correlation) under the strict-small track.
|