bfuzzy1 commited on
Commit
b743d9d
·
verified ·
1 Parent(s): c8e6fd8

Upload folder using huggingface_hub

Browse files
README.md ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ library_name: mlx
6
+ pipeline_tag: text-generation
7
+ tags:
8
+ - rodan
9
+ - tiny-language-model
10
+ - mlx
11
+ - reasoning
12
+ - chain-of-thought
13
+ - dpo
14
+ base_model: bfuzzy1/Rodan-Chat
15
+ ---
16
+
17
+ # Rodan-10M-Reasoning
18
+
19
+ A 10.41M-parameter reasoning model trained on a single Apple M2 with MLX. It stacks on the chat model and
20
+ adds **recurrent depth**: the same 8 transformer blocks run twice per forward pass, giving the effective
21
+ depth of a 16-layer network at **zero extra parameters**. The idea is to spend more compute per token on
22
+ hard problems without growing the model.
23
+
24
+ > What it is, honestly. The recurrence *mechanism* works, the probes show the second pass doing real
25
+ > compositional computation, and the activation-patching maps a genuine arithmetic circuit. The model does
26
+ > **accurate single-step arithmetic** and reads **natural-language word problems** into the right operation.
27
+ > A final **DPO** pass (verifiable preference pairs, KL-leashed) then fixed its restraint: it now answers
28
+ > simple facts directly instead of doing arithmetic on them (math-on-non-math prompts dropped from ~half to
29
+ > ~1 in 8), at no board cost. On the board it sits at **35.41**, about level with the base (35.80), because
30
+ > recurrent depth doesn't move discrimination benchmarks. The win is in *what it does*, not the board number.
31
+
32
+ > Part of the Rodan-10M series. Lineage: base v6 → v9 (PLE-free) → Chat (instruction fold) → **Reasoning
33
+ > (this model)**. Warm-started from Chat, so it keeps instruction-following and ChatML.
34
+
35
+ ## Architecture
36
+
37
+ Same as the base/chat stack, dim 320, 8 layers, 8 heads, MQA (1 KV head), SwiGLU 768, RMSNorm, RoPE base
38
+ 200k, QK-norm, tied embeddings, value-residual, LRM, no PLE, with two changes:
39
+
40
+ - **`recurse=2`**: the 8 blocks run twice over the residual stream (16 effective layers, still 10.41M params).
41
+ - **ChatML + `<think>` template** for reasoning turns; direct answers for simple ones.
42
+
43
+ Trained in **bfloat16** (~8× faster than fp32 on this M2 at this depth/length), seq 512.
44
+
45
+ ## Training recipe
46
+
47
+ Warm-started from Chat, then trained at `recurse=2` on a natural-language-reasoning mix. The key lesson from
48
+ the first attempt: an arithmetic-symbol-heavy fold made the model narrow (it tried to compute *everything*).
49
+ This version leads with word problems and adds a slice of direct-answer examples to teach restraint.
50
+
51
+ | share | source | mode |
52
+ |---|---|---|
53
+ | 24% | natural-language word problems (synthesized) | `<think>` → answer |
54
+ | 21% | symbolic arithmetic CoT | `<think>` → answer |
55
+ | 8% | answer-only facts | direct, no `<think>` |
56
+ | 2% | GSM8K | `<think>` → answer |
57
+ | 45% | replay (smol-smoltalk + curated: Cosmopedia / dolmino / FineMath / sci-QA) | mixed |
58
+
59
+ No web data anywhere, the curated-only lineage held since v6. Optimizer: Muon + AdamW, LR 1.8e-3 / Muon 9e-3,
60
+ seq 512, 7000 steps, bf16.
61
+
62
+ ![Reasoning loss & data mix](loss_datamix.png)
63
+
64
+ ## Does the recursion work?
65
+
66
+ Measured directly, the same way we probed value-residual and LRM on the base. The second pass earns its keep:
67
+
68
+ ![Recursion probes](reasoning_probes.png)
69
+
70
+ The model leans hard on the second pass, run it at recurse 1 and held-out loss is much worse (ppl 5.72 vs
71
+ 4.29). It flips the predicted token on ~23% of positions, and raises the probability of the correct next token
72
+ almost everywhere (+0.26 log-prob on average). It sharpens digits (entropy drops 0.14) and, unlike the first
73
+ attempt, the **quantitative-language words recovered** (+0.23), the natural-language word problems taught it
74
+ to handle "more / less / total / twice", which symbolic arithmetic alone never did.
75
+
76
+ Activation patching maps the arithmetic circuit causally: operands bind early, the computation resolves around
77
+ block 5, the answer is written at block 6, and multi-step problems unroll across depth (step 2 binds deeper
78
+ than step 1). Factual recall has a different shape, a single late lookup at block 6 with no early work. The
79
+ full circuit atlas is in `circuit.html`.
80
+
81
+ ## Evaluation
82
+
83
+ Zero-shot lm-eval, limit 1000, recurse 2, raw.
84
+
85
+ | Task | Metric | Reasoning | Chat | v9 base | v6 base |
86
+ |---|---|---|---|---|---|
87
+ | HellaSwag | acc_norm | 31.9 | 30.1 | 30.1 | 31.8 |
88
+ | ARC-Easy | acc_norm | 36.7 | 35.3 | 35.4 | 35.6 |
89
+ | ARC-Challenge | acc_norm | 21.2 | 23.2 | 22.2 | 22.4 |
90
+ | PIQA | acc | 54.4 | 53.8 | 55.5 | 56.0 |
91
+ | ArithMark-2 | acc | 26.4 | 25.8 | 28.4 | 26.4 |
92
+ | LogicMark | acc | 43.3 | 48.5 | 44.8 | 44.8 |
93
+ | SciQ | acc | 67.4 | — | 67.8 | 67.5 |
94
+ | Winogrande | acc | 50.4 | — | 49.4 | 49.8 |
95
+ | **Board avg (÷4)** | | **35.41** | 35.04 | 35.70 | 35.80 |
96
+
97
+ (Numbers are the final DPO'd model. The pre-DPO fold scored 35.53; DPO held the board at 35.41, a noise-level
98
+ change, while fixing the restraint.)
99
+
100
+ Board 35.41, level with the base (v6 35.80) and above Chat. Recurrent depth doesn't move the board; that's
101
+ expected. What changed is behaviour, which the board can't see:
102
+
103
+ - **Arithmetic is accurate**, 4-5 of 6 on held-out single-step problems (`5+9=14`, `7×6=42`, `40−13=27`),
104
+ one step, stops cleanly. The earlier version mis-computed and over-reasoned.
105
+ - **Word problems translate**, "Sara has 12 apples and buys 7 more" → it sets up `12 + 7` and solves it.
106
+ - **Sometimes answers directly**, "capital of France → Paris", "opposite of hot → cold", no `<think>`.
107
+
108
+ **The restraint fix (DPO).** The fold alone left restraint unstable, it opened a `<think>` and did arithmetic
109
+ on ~half of non-math prompts (the 8% answer-only data couldn't settle it). A final DPO pass on synthesized,
110
+ verifiable preference pairs fixed it: *mode* pairs (non-math → direct answer ≻ spurious `<think>` math) and
111
+ *process* pairs (correct concise chain ≻ wrong/over-reasoned). LR 5e-7, β 0.1, 1 epoch, KL-leashed to the
112
+ frozen fold checkpoint. Result: **math-on-non-math dropped from ~4/8 to ~1/8**, board unchanged (35.53 → 35.41).
113
+ DPO steered the *behaviour* it had; it did not fix the residual 2-digit arithmetic slips (e.g. 25−9), which are
114
+ a capability limit, not a preference one, that needs more/harder arithmetic data, not preference tuning.
115
+
116
+ ![DPO effect, restraint fixed, board held](dpo_effect.png)
117
+
118
+ The arithmetic-compute slips on harder problems (multi-digit carry) remain the honest weak point.
119
+
120
+ ## Usage
121
+
122
+ ```python
123
+ ctx = f"<|im_start|>user\n{question}<|im_end|>\n<|im_start|>assistant\n"
124
+ # greedy, NO repetition penalty (it breaks the <think> format) ; stop on <|im_end|>
125
+ ```
126
+
127
+ Load at `recurse=2`. It emits `<think>` reasoning then the answer for math, and often answers directly for
128
+ simple facts. Trade quality for speed by lowering `recurse` at inference.
129
+
130
+ ## Limitations
131
+
132
+ - ~10M params, English only, research/education. Not for production, facts, or advice.
133
+ - DPO fixed most of the over-reasoning, but it still opens a `<think>` on roughly 1 in 8 non-math prompts.
134
+ - Thin world knowledge. It answers directly now, but can be wrong on the fact itself.
135
+ - Arithmetic is reliable on simple problems and slips on harder multi-digit ones.
136
+ - No safety alignment.
137
+
138
+ ## License
139
+
140
+ Weights open. Data under the respective dataset licenses (smol-smoltalk, GSM8K, Cosmopedia, dolmino-mix
141
+ ODC-By, AllenAI QA sets, FineMath).
config.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model_type": "rodan-modern",
3
+ "architecture": "ModernLM",
4
+ "framework": "mlx",
5
+ "stage": "reasoning + DPO",
6
+ "base_model": "Rodan-10M-Chat (warm-start)",
7
+ "params": 10410000,
8
+ "vocab_size": 8194,
9
+ "dim": 320,
10
+ "n_layers": 8,
11
+ "n_heads": 8,
12
+ "n_kv_heads": 1,
13
+ "head_dim": 40,
14
+ "ffn_hidden": 768,
15
+ "max_len": 512,
16
+ "rope_base": 200000.0,
17
+ "norm": "rmsnorm",
18
+ "norm_eps": 1e-05,
19
+ "activation": "swiglu",
20
+ "qk_norm": true,
21
+ "tied_embeddings": true,
22
+ "value_residual": true,
23
+ "ple_rank": 0,
24
+ "lrm": true,
25
+ "recurse": 2,
26
+ "dtype": "bfloat16",
27
+ "attention": "mqa",
28
+ "chat_template": "chatml",
29
+ "chat_tokens": {
30
+ "im_start": 8192,
31
+ "im_end": 8193
32
+ },
33
+ "eot_id": 0,
34
+ "recommended_decode": "greedy, NO repetition penalty (it breaks the <think> format); stop on <|im_end|>",
35
+ "board_avg": 35.41,
36
+ "recipe": "v2 NL-balanced fold: 24% word-problems / 21% symbolic arith / 8% answer-only / 2% GSM8K / 45% replay",
37
+ "notes": "Warm-start from Rodan-10M-Chat, retrofitted recurrence (recurse=2 = 16 effective layers, 0 extra params). ChatML + <think> CoT. Load with ModernLM(ModernConfig(**fields, recurse=2)) + load_weights('model.safetensors'). Prompt: <|im_start|>user\\n{q}<|im_end|>\\n<|im_start|>assistant\\n ; emits <think>steps</think> then answer for math, often direct for simple facts. Board 35.41 (level w/ base v6 35.80) \u2014 value is reasoning BEHAVIOUR (accurate arith, word-problem translation, answers facts directly after DPO), not board rank. Final stage = DPO (see dpo field).",
38
+ "dpo": "verifiable preference pairs (mode: direct\u227bneedless-think ; process: correct\u227bwrong-chain), KL-leashed beta=0.1 lr=5e-7 1ep \u2014 fixed restraint (math-on-non-math ~4/8\u2192~1/8), board held"
39
+ }
dpo_effect.png ADDED
flops_efficiency.png ADDED
intelligence_per_param.png ADDED
loss_datamix.png ADDED
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:242a15653c283c89c0b1834a775eeaabf68ba07d53631c797904333faf90c248
3
+ size 20841178
reasoning_probes.png ADDED
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff