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pretability
|
| 7 |
+
- recall-then-assemble
|
| 8 |
+
- grpo
|
| 9 |
+
language:
|
| 10 |
+
- en
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# Compositional-generalization checkpoints (recall-then-assemble, Qwen3-4B-Base)
|
| 14 |
+
|
| 15 |
+
Research checkpoints for interpretability work on **why a model does or does not compose skills it has
|
| 16 |
+
only ever seen in isolation**. Every checkpoint below is one cell of a controlled study in which cells
|
| 17 |
+
differ from each other in exactly one training variable. All weights are stored as saved by the trainer
|
| 18 |
+
(`model.safetensors`, fp32, ~16 GB each; architecture `qwen3`, 4B parameters). Each subfolder is a
|
| 19 |
+
complete Hugging Face model directory (config, tokenizer, chat template).
|
| 20 |
+
|
| 21 |
+
```python
|
| 22 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 23 |
+
import torch
|
| 24 |
+
repo = "Physicsru/compgen-checkpoints"
|
| 25 |
+
sub = "sft-eco-s1" # any folder name from the table below
|
| 26 |
+
tok = AutoTokenizer.from_pretrained(repo, subfolder=sub)
|
| 27 |
+
model = AutoModelForCausalLM.from_pretrained(repo, subfolder=sub, torch_dtype=torch.float32)
|
| 28 |
+
```
|
| 29 |
+
|
| 30 |
+
## The task in one paragraph
|
| 31 |
+
|
| 32 |
+
A library of 25 string operators with opaque names `func_0` β¦ `func_24` (e.g. `func_3` = sort the
|
| 33 |
+
characters, `func_24` = a backtracking palindrome transform with an unused `depth` parameter). The model
|
| 34 |
+
first learns every operator **as an atomic skill** (closed-book: given `def main_solution(x): return
|
| 35 |
+
func_3(x)` and an input, recall the body of `func_3` and write a program). Then it is trained on
|
| 36 |
+
**compositions** (`func_5(func_3(func_1(x, 2)), 'ab')`) built **only from the 13 train operators**. The
|
| 37 |
+
12 **held-out operators** are never composed in any training data. The test question is whether the
|
| 38 |
+
model can compose the held-out operators anyway. The answer format is *recall-then-assemble* (RA):
|
| 39 |
+
|
| 40 |
+
```
|
| 41 |
+
Recall func_3: Sort the characters in the string.
|
| 42 |
+
```python
|
| 43 |
+
def func_3(s): ...
|
| 44 |
+
```
|
| 45 |
+
Recall func_1: Repeat the string s exactly n times.
|
| 46 |
+
```python
|
| 47 |
+
def func_1(s, n): ...
|
| 48 |
+
```
|
| 49 |
+
Assemble:
|
| 50 |
+
```python
|
| 51 |
+
<all recalled definitions> + def main_solution(x): return func_3(func_1(x, 2))
|
| 52 |
+
```
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
Metrics used in the tables: **held-out d4 / d8** = program accuracy on held-out-operator programs of
|
| 56 |
+
expression depth 4 / 8 (256 programs per depth, `eval/heldout_trees_d1-8.parquet`); **serial d8 / d12 /
|
| 57 |
+
d20** = accuracy on pure nesting chains f1(f2(β¦fd(x))) over held-out operators
|
| 58 |
+
(`eval/heldout_chains_d1-20.parquet`); **one-parameter rate** = fraction of `Recall func_24` blocks whose
|
| 59 |
+
signature drops the second parameter (`def func_24(s):`), the single failure mode that separates good and
|
| 60 |
+
bad RL outcomes.
|
| 61 |
+
|
| 62 |
+
## Lineage
|
| 63 |
+
|
| 64 |
+
```
|
| 65 |
+
Qwen3-4B-Base
|
| 66 |
+
ββ stage 1: atomic skills with bodies shown (RFT on code execution)
|
| 67 |
+
ββ stage 1.5 "closed-book": 20k depth-1 atomic tasks over all 25 ops + 12k depth-2..4 TRAIN-op
|
| 68 |
+
compositions, prose + one code block (no RA format) β stage15b-init
|
| 69 |
+
ββ RA bootstrap SFT cells (2 epochs, batch 128, LR 2e-5, seed 1) β sft-*
|
| 70 |
+
β all cells share the SAME 10,000 atomic tasks (400 per op, all 25 ops)
|
| 71 |
+
β and differ in (a) how atomic tasks are packed into answers and (b) which
|
| 72 |
+
β composition rows are added
|
| 73 |
+
ββ (from sft-eco-s1) GRPO, KL 0.01 to the init, 100 steps β rl-*
|
| 74 |
+
```
|
| 75 |
+
|
| 76 |
+
## Checkpoints
|
| 77 |
+
|
| 78 |
+
| folder | init | atomic side (10k single-op tasks) | composition side | RL pool | steps | held-out numbers | status |
|
| 79 |
+
|---|---|---|---|---|---|---|---|
|
| 80 |
+
| `stage15b-init` | stage 1 | 20k closed-book depth-1 rows, prose + one code block | 12k depth-2..4 train-op comps (same format) | β | 500 | d4 / d8 = 0.03 / 0.00 (no RA format yet) | pending |
|
| 81 |
+
| `sft-d1-s1` | stage15b-init | **single-task**: one op per answer | **none** | β | 152 | 0.00 / 0.00 | pending |
|
| 82 |
+
| `sft-v1-s1` | stage15b-init | single-task | 15,979 mixed-structure train-op comps, depth 2-4 | β | 400 | 0.53Β±0.15 / 0.09Β±0.05 (3 seeds; this seed 0.75 / 0.15) | pending |
|
| 83 |
+
| `sft-c1-s1` | stage15b-init | **co-occurrence groups**: 1-4 independent single-op tasks in one answer (all ops) | **none** | β | 58 | 0.66Β±0.14 / 0.08Β±0.04 | pending |
|
| 84 |
+
| `sft-eco-s1` ("E-co") | stage15b-init | co-occurrence groups | the same 15,979 comps | β | 308 | 0.97Β±0.02 / 0.73Β±0.15 (this seed 0.98 / 0.83); serial d20 0.50 | uploaded |
|
| 85 |
+
| `sft-c4-s1` | stage15b-init | co-occurrence groups | 12,452 mixed comps, **depth 2 only** | β | 252 | 0.70Β±0.03 / 0.12Β±0.05 | pending |
|
| 86 |
+
| `sft-c4b-s1` | stage15b-init | co-occurrence groups | 12,436 mixed comps, **depth 2-4** (same count as c4) | β | 252 | 0.90Β±0.04 / 0.62Β±0.13 | pending |
|
| 87 |
+
| `sft-matched-isolated-s1` | stage15b-init | per step: 48 atomic tasks as 48 single-task rows | per step: 76 comps (same stream as grouped) | β | 400 | 0.65Β±0.08 / 0.16Β±0.02 (3 paired seeds) | pending |
|
| 88 |
+
| `sft-matched-grouped-s1` | stage15b-init | per step: the SAME 48 atomic tasks packed into 20 grouped rows | the same 76 comps | β | 400 | 0.93Β±0.03 / 0.47Β±0.04 | pending |
|
| 89 |
+
| `rl-r1a-step100` | sft-eco-s1 | β | β | 1:1 mix of train-op serial chains d10-20 and all-op multi-task atomic prompts (widths 1-12) | 100 | serial d8/d12/d20 0.85 / 0.63 / 0.61; func_24 one-parameter 226/903 = 25% | pending |
|
| 90 |
+
| `rl-r1b-step100` | sft-eco-s1 | β | β | same pool, different seed | 100 | 0.94 / 0.97 / 0.89; one-parameter 9/903 = 1% | pending |
|
| 91 |
+
| `rl-mda-step5` | sft-eco-s1 | β | β | **mixed-depth pool**: chains + prompts holding one deep train-op chain task followed by 1-2 long-literal atomic tasks over all ops | 5 | 0.95 / 0.92 / 0.82; one-parameter 57/903 = 6% | pending |
|
| 92 |
+
| `rl-mda-step50` | sft-eco-s1 | β | β | same run | 50 | 0.91 / 0.63 / 0.57; one-parameter 396/903 = **44%** | pending |
|
| 93 |
+
| `rl-mda-step100` | sft-eco-s1 | β | β | same run | 100 | 0.97 / 0.97 / 0.93; one-parameter 3/903 = 0.3% | pending |
|
| 94 |
+
| `rl-mdb-step100` | sft-eco-s1 | β | β | mixed-depth pool, second replicate | 100 | 0.99 / 0.98 / 0.95; one-parameter 33/903 = 3.7% | pending |
|
| 95 |
+
|
| 96 |
+
"mixed-structure comps" = train-op compositions whose expression trees mix unary nesting, binary
|
| 97 |
+
operators and literals (the benchmark's native generator); "co-occurrence groups" put several
|
| 98 |
+
*independent* atomic tasks into one prompt/answer so that each definition is recalled next to others
|
| 99 |
+
(no data flow between them). Held-out operators appear in every cell only as depth-1 atomic tasks.
|
| 100 |
+
|
| 101 |
+
## What each pair isolates
|
| 102 |
+
|
| 103 |
+
| pair | the one difference | effect (held-out d4 / d8 unless stated) | what to look for |
|
| 104 |
+
|---|---|---|---|
|
| 105 |
+
| `sft-v1-s1` vs `sft-eco-s1` | atomic tasks single-task vs in co-occurrence groups (same comps; E-co has fewer rows, 308 vs 400 steps) | 0.53 / 0.09 β 0.97 / 0.73 | the headline effect: nameβdefinition binding under multi-definition load. v1's failures are *chimeras* (a held-out name written with a train operator's body; 1,102 of 1,175 wrong bodies). Decomposed inference (each helper recalled in its own forward pass, then assembled mechanically) scores 1.00 for v1, so the whole gap is retrieval under load, not missing knowledge. |
|
| 106 |
+
| `sft-matched-isolated-s1` vs `sft-matched-grouped-s1` | identical task stream, identical 400 steps, per-token loss; only the packing differs | 0.65 / 0.16 β 0.93 / 0.47 | the same effect with every confound removed (row count, steps, task order). The gap opens from step 100. |
|
| 107 |
+
| `sft-d1-s1` vs `sft-v1-s1` | composition demos added (no co-occurrence) | 0.00 β 0.53 | what the demos install when atomics are single-task: d1 never produces a multi-helper program at all (format never seen with k β₯ 2). |
|
| 108 |
+
| `sft-c1-s1` vs `sft-eco-s1` | composition demos added (with co-occurrence) | 0.66 / 0.08 β 0.97 / 0.73 | with co-occurrence the model composes without any demo at mid depth; the demos buy depth (d8). |
|
| 109 |
+
| 2Γ2: `sft-d1-s1`, `sft-v1-s1`, `sft-c1-s1`, `sft-eco-s1` | co-occurrence Γ composition demos | 0.00 / 0.53 / 0.66 / 0.97 (d4) | interaction: co-occurrence is worth more than demos, and the two are super-additive at depth. |
|
| 110 |
+
| `sft-c4-s1` vs `sft-c4b-s1` | comp depth range 2 vs 2-4 at the same row count | 0.70 / 0.12 β 0.90 / 0.62 | depth diversity of demos (not volume: 2k vs 12k depth-2 demos are equal, 0.77 vs 0.70). |
|
| 111 |
+
| `stage15b-init` vs any `sft-*` | the RA format itself | 0.03 β β¦ | what "recall then assemble" adds on top of the closed-book atomic knowledge. |
|
| 112 |
+
| `sft-eco-s1` vs `rl-mdb-step100` | RL (GRPO on train-op chains + atomic prompts; held-out ops never composed) | serial d20 0.50 β 0.95 | what RL on *train-op* chains changes for *held-out* chains: deep serial execution improves for every operator. KL 0.01 keeps weights close to the init, so weight-difference analyses are meaningful. |
|
| 113 |
+
| `rl-r1a-step100` vs `rl-r1b-step100` | seed only (same pool, same init) | d20 0.61 vs 0.89; func_24 one-parameter 25% vs 1% | the bistable outcome: one held-out operator (`func_24`, whose dropped parameter is semantically inert) either keeps or loses its second parameter when its call is nested among other library calls. Everything else is β₯ 0.95 in both. |
|
| 114 |
+
| `rl-mda-step5` β `step50` β `step100` | same run, time only | one-parameter 6% β 44% β 0.3%; d20 0.82 β 0.57 β 0.93 | the drift switching on and off inside one run: weights change little between 50 and 100, one operator's signature flips. Compare `func_24` with its train twin `func_23` (same structure, never fails). |
|
| 115 |
+
| `sft-eco-s1` vs `rl-r1a-step100` | RL, drifted outcome | d20 0.50 β 0.61 with the func_24 drift | the failure is latent in the SFT init (E-co writes `func_24(s)` in 0 / 5 / 18% of blocks at nameβargument distance <40 / 40-150 / 150+ chars) and RL amplifies it in some seeds. |
|
| 116 |
+
|
| 117 |
+
Things established about the failure mode that may help target an analysis: the drift tracks the number of
|
| 118 |
+
*other library calls' argument tails* standing between the operator's name and its own argument in the
|
| 119 |
+
skeleton (r1a, d β₯ 10: 0 tails 1%, one 15%, two 34%); builtin-method tails, long literals, definition
|
| 120 |
+
load and a preceding chain in the same prompt do not trigger it (probe families 1b, 1d, 1f, 1g in `eval/`,
|
| 121 |
+
which are teacher-forced prefixes usable as fixed inputs across checkpoints); the RL reward never sees the
|
| 122 |
+
error in a legal (held-out-free) context, so RL acts through rewarded correct samples.
|
| 123 |
+
|
| 124 |
+
## Evaluation inputs (`eval/`)
|
| 125 |
+
|
| 126 |
+
| file | rows | what |
|
| 127 |
+
|---|---|---|
|
| 128 |
+
| `heldout_trees_d1-8.parquet` | 2,048 | held-out-operator programs, depths 1-8 Γ 256 (the d4 / d8 numbers) |
|
| 129 |
+
| `trainop_trees_d1-8.parquet` | 2,048 | the same over the 13 train operators |
|
| 130 |
+
| `heldout_chains_d1-20.parquet` | 2,816 | pure nesting chains over held-out operators, d β {1,2,4,β¦,20} Γ 256, outputs β€ 1,000 chars |
|
| 131 |
+
| `trainop_chains_d1-20.parquet` | 2,816 | the same over train operators |
|
| 132 |
+
| `probe_1b.parquet` | 6,912 | definition-load probe: target op recalled after r other recalls (teacher-forced prefix) |
|
| 133 |
+
| `probe_1d.parquet` | 1,792 | chain-position probe: target op at the outer / middle / inner position of a deep chain |
|
| 134 |
+
| `probe_1f.parquet` | 2,048 | builtin-method argument tails in front of the op's own argument |
|
| 135 |
+
| `probe_1g.parquet` | 1,280 | long literal (8-200 chars) as the op's first argument |
|
| 136 |
+
|
| 137 |
+
Rows are in the verl code-execution format: `prompt` (chat messages), `reward_model.ground_truth`
|
| 138 |
+
(JSON with `ref_code`, `ref_input`, `ref_output`), `extra_info` (depth, k = distinct ops, probe
|
| 139 |
+
condition). Greedy decoding, 3,072 new tokens, was used for every number above.
|
| 140 |
+
|
| 141 |
+
## Provenance
|
| 142 |
+
|
| 143 |
+
Every number here is traceable in the project ledger `verl/analysis/RESULTS_PROVENANCE.md` (sections MAIN
|
| 144 |
+
RESULT, C1βC5 CAUSAL TABLE, MATCHED SFT, DEEP CHAINS, Mixed-depth arm RESULT, PROBES) to a job id, a
|
| 145 |
+
sweep directory and a CI/classification report; 3-seed bands are mean Β± sd over trainer seeds 1 / 7 / 123.
|
| 146 |
+
Checkpoints marked *pending* in the table are not yet uploaded (storage-quota decision pending).
|