rajpdus commited on
Commit
975bd73
·
verified ·
1 Parent(s): f60015e

JugnuLM-110M-R2+ (VR+Muon+WSD, 25B tokens) — VR-aware trust_remote_code model

Browse files
README.md ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ library_name: transformers
4
+ pipeline_tag: text-generation
5
+ language:
6
+ - en
7
+ tags:
8
+ - jugnu
9
+ - tiny-lm
10
+ - value-residual
11
+ - muon
12
+ - pretrained-from-scratch
13
+ datasets:
14
+ - HuggingFaceFW/fineweb-edu
15
+ base_model: altslate/JugnuLM-110M
16
+ ---
17
+
18
+ # JugnuLM-110M-R2+ 🪰✨
19
+
20
+ A **sub-150M** language model pretrained **from scratch** by [AltSlate Labs](https://github.com/AltSlate-Labs),
21
+ for the [Tiny-ML Leaderboard](https://huggingface.co/spaces/Glint-Research/Tiny-ML-Leaderboard). The flagship of the
22
+ [Jugnu](https://github.com/AltSlate-Labs/jugnu) family: the kept **R2** recipe (Qwen3 arch + **value residuals** +
23
+ **Muon**) scaled to **25.2B tokens** under a **WSD** schedule with modest decay-phase educational upweighting.
24
+
25
+ ## ⚠️ Load with `trust_remote_code=True`
26
+
27
+ This model uses **value residuals** (a custom attention pathway: `v_i = v_proj_i(x) + λ_i·v0`). Stock
28
+ `from_pretrained` would silently drop that pathway and degrade the model (~6 pts ARC-Easy, ~0.18 byte-ppl). It ships
29
+ custom modeling code with `auto_map`, so load it VR-aware:
30
+
31
+ ```python
32
+ from transformers import AutoModelForCausalLM, AutoTokenizer
33
+ tok = AutoTokenizer.from_pretrained("altslate/JugnuLM-110M-R2plus")
34
+ model = AutoModelForCausalLM.from_pretrained("altslate/JugnuLM-110M-R2plus", trust_remote_code=True)
35
+ ```
36
+
37
+ ## Results
38
+
39
+ | metric | JugnuLM-110M-R2+ |
40
+ |---|--:|
41
+ | Params | 109.7M |
42
+ | BLiMP (acc) | **82.52** |
43
+ | ARC-Easy (acc) | 55.13 |
44
+ | WikiText-2 (byte-ppl) | **1.8735** |
45
+
46
+ Beats the JugnuLM-110M (R0) baseline on all three leaderboard metrics (BLiMP +1.3, ARC-Easy +2.65, byte-ppl
47
+ 1.8735 vs 1.95), and posts the family's best BLiMP and byte-ppl. On the leaderboard's efficiency score it ranks
48
+ **#1** (EFF ≈ 80.21) — a narrow, within-noise lead over GPT-X2-125M (80.06) and Haidass-143M (79.83), winning on the
49
+ size bonus as the smallest of the three. Numbers are from a **VR-aware** eval (BLiMP / ARC-Easy / WikiText via
50
+ `lm-eval-harness`, `acc`; wikitext `byte_perplexity`).
51
+
52
+ ## Architecture
53
+
54
+ - Qwen3 architecture (Llama + built-in QK-Norm), deep-thin **23 layers × 576 hidden**, GQA, tied embeddings.
55
+ - **Value residuals** ([ResFormer](https://arxiv.org/abs/2410.17897)): each layer's value gets a learned-gated
56
+ residual from layer 0's value; 22 learned `vr_lambda` scalars (mean ≈ 0.48 in this checkpoint).
57
+ - SmolLM2 tokenizer (49,152 vocab). z-loss for logit stability.
58
+
59
+ ## Training
60
+
61
+ - **25.2B tokens** (48,000 steps × 524,288 tok/step) on 2× NVIDIA RTX PRO 4500 Blackwell GPUs.
62
+ - **Muon** optimizer on 2D hidden matrices (attn + MLP); AdamW for embeddings / head / norms / `vr_lambda`.
63
+ - **WSD** schedule (stable → decay over the last ~21% of steps), with decay-phase upweighting of educational data
64
+ (FineWeb-Edu). Final checkpoint (step 48000) is the best; val perplexity bottomed at end of decay.
65
+
66
+ ## License
67
+
68
+ Apache-2.0. Training recipe and code: https://github.com/AltSlate-Labs/jugnu
config.json ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "JugnuVRForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "auto_map": {
8
+ "AutoConfig": "configuration_jugnu_vr.JugnuVRConfig",
9
+ "AutoModelForCausalLM": "modeling_jugnu_vr.JugnuVRForCausalLM"
10
+ },
11
+ "bos_token_id": 0,
12
+ "dtype": "float32",
13
+ "eos_token_id": 0,
14
+ "head_dim": 64,
15
+ "hidden_act": "silu",
16
+ "hidden_size": 576,
17
+ "initializer_range": 0.02,
18
+ "intermediate_size": 1536,
19
+ "layer_types": [
20
+ "full_attention",
21
+ "full_attention",
22
+ "full_attention",
23
+ "full_attention",
24
+ "full_attention",
25
+ "full_attention",
26
+ "full_attention",
27
+ "full_attention",
28
+ "full_attention",
29
+ "full_attention",
30
+ "full_attention",
31
+ "full_attention",
32
+ "full_attention",
33
+ "full_attention",
34
+ "full_attention",
35
+ "full_attention",
36
+ "full_attention",
37
+ "full_attention",
38
+ "full_attention",
39
+ "full_attention",
40
+ "full_attention",
41
+ "full_attention",
42
+ "full_attention"
43
+ ],
44
+ "max_position_embeddings": 2048,
45
+ "max_window_layers": 28,
46
+ "model_type": "jugnu_vr",
47
+ "num_attention_heads": 9,
48
+ "num_hidden_layers": 23,
49
+ "num_key_value_heads": 3,
50
+ "pad_token_id": null,
51
+ "rms_norm_eps": 1e-06,
52
+ "rope_parameters": {
53
+ "rope_theta": 10000.0,
54
+ "rope_type": "default"
55
+ },
56
+ "sliding_window": null,
57
+ "tie_word_embeddings": true,
58
+ "transformers_version": "5.16.1",
59
+ "use_cache": true,
60
+ "use_sliding_window": false,
61
+ "vocab_size": 49152
62
+ }
configuration_jugnu_vr.py ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ """JugnuLM value-residual config (Qwen3 + ResFormer value residuals)."""
2
+ from transformers import Qwen3Config
3
+
4
+ class JugnuVRConfig(Qwen3Config):
5
+ model_type = "jugnu_vr"
generation_config.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 0,
4
+ "eos_token_id": 0,
5
+ "output_attentions": false,
6
+ "output_hidden_states": false,
7
+ "transformers_version": "5.5.0",
8
+ "use_cache": true
9
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c31a34b3669ea1a5c768e7ee582aacfc1ed108ba7f7d6a2c9c150a434f66c3f4
3
+ size 438979888
modeling_jugnu_vr.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """JugnuLM value-residual model. Qwen3ForCausalLM with each layer v_proj replaced
2
+ by a value-residual linear: v_i = v_proj_i(x) + lambda_i * v0 (v0 = layer-0 value).
3
+ Loads correctly via AutoModelForCausalLM.from_pretrained(..., trust_remote_code=True);
4
+ stock Qwen3 loading would silently drop the value-residual pathway."""
5
+ import torch
6
+ import torch.nn as nn
7
+ from transformers import Qwen3ForCausalLM
8
+ from configuration_jugnu_vr import JugnuVRConfig
9
+
10
+
11
+ class VResidualLinear(nn.Linear):
12
+ def __init__(self, in_f, out_f, ctx, is_first, bias=False):
13
+ super().__init__(in_f, out_f, bias=bias)
14
+ self.vr_ctx = ctx
15
+ self.vr_is_first = is_first
16
+ if not is_first:
17
+ self.vr_lambda = nn.Parameter(torch.zeros(1))
18
+
19
+ def forward(self, x):
20
+ v = super().forward(x)
21
+ if self.vr_is_first:
22
+ self.vr_ctx["v0"] = v
23
+ else:
24
+ v0 = self.vr_ctx.get("v0")
25
+ if v0 is not None:
26
+ v = v + self.vr_lambda * v0
27
+ return v
28
+
29
+
30
+ class JugnuVRForCausalLM(Qwen3ForCausalLM):
31
+ config_class = JugnuVRConfig
32
+
33
+ def __init__(self, config):
34
+ super().__init__(config)
35
+ ctx = {}
36
+ for i, layer in enumerate(self.model.layers):
37
+ old = layer.self_attn.v_proj
38
+ new = VResidualLinear(old.in_features, old.out_features, ctx,
39
+ is_first=(i == 0), bias=(old.bias is not None))
40
+ layer.self_attn.v_proj = new
41
+ self.post_init()
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": "<|endoftext|>",
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|endoftext|>",
7
+ "errors": "replace",
8
+ "extra_special_tokens": [
9
+ "<|endoftext|>",
10
+ "<|im_start|>",
11
+ "<|im_end|>",
12
+ "<repo_name>",
13
+ "<reponame>",
14
+ "<file_sep>",
15
+ "<filename>",
16
+ "<gh_stars>",
17
+ "<issue_start>",
18
+ "<issue_comment>",
19
+ "<issue_closed>",
20
+ "<jupyter_start>",
21
+ "<jupyter_text>",
22
+ "<jupyter_code>",
23
+ "<jupyter_output>",
24
+ "<jupyter_script>",
25
+ "<empty_output>"
26
+ ],
27
+ "is_local": false,
28
+ "local_files_only": false,
29
+ "model_max_length": 8192,
30
+ "pad_token": "<|endoftext|>",
31
+ "tokenizer_class": "GPT2Tokenizer",
32
+ "unk_token": "<|endoftext|>",
33
+ "vocab_size": 49152
34
+ }