Parametric memory enables large language models (LLMs) to retain information from past experience and reuse it in subsequent tasks. Yet how training data supports the internalization of reusable task rules remains unclear. We introduce FSMem (Finite-State Machine Memory), a state-transition framework for constructing training data and studying how data content and organization shape memory formation. We evaluate rule reuse across synthetic worlds, classical planning, and code execution through valid-action identification and execution-outcome prediction, complemented by next-operation prediction in code. Our experiments reveal several systematic learning patterns. Under matched training conditions, even unchanged task rules become harder to internalize when learned alongside a larger variety of action types; by contrast, scaling the training data to provide broader state-action coverage generally improves rule learning. We further find that training at a single execution depth produces depth-specialized behavior, with models performing best when training and test executions have similar lengths. Motivated by this finding, we construct cumulative corpora that combine short and long trajectories, which can outperform long-trajectory-only training while using fewer training tokens. Together, these results demonstrate that the same task rules can be internalized differently depending on how execution experience is constructed, and that understanding these learning patterns can guide the design of more effective training data for parametric memory.
Figures & tables
Figure 1: An illustration of FSMem in Blocksworld. (a) Recalling facts about specific entities. (b) Constructing training data from execution trajectories. (c) Identifying valid actions and predicting execution outcomes on held-out instances, without access to training records.
Figure 2: Valid-action identification as action complexity A increases. (a) Synthetic order-robust accuracy: light curves show individual settings and the green curve their mean. (b) Exact-set accuracy in 13 planning domains; the gray curve is an exponential fit. (c) Exact-set accuracy as more action types are included in training within each of seven planning domains.
Figure 3: Next-state and next-operation prediction as action complexity increases.
Figure 4
Depth
BW
Dep.
Ferry
Grip.
Sat.
Grid
GM
Swap
VA
Avg.
6 -only
35.2
6.4
50.2
22.5
55.3
36.2
69.1
35.9
75.3
42.90
2
31.5
6.7
33.7
9.8
32.7
31.1
37.6
35.4
46.8
29.47
2+4
62.3
11.4
55.8
24.0
66.0
45.2
77.3
91.8
79.3
57.01
2+4+6
77.0
11.8
67.8
31.1
95.9
47.1
99.4
99.7
80.0
67.76
Δ Tok
−2.9
−3.5
−3.4
−4.3
−4.9
−3.2
−4.3
−2.6
−5.6
−3.79
Table 2: Planning exact-set accuracy (%) and token use.
Figure 8: Synthetic accuracy by evaluation depth.
Training
Avg. acc.
Tokens
depths
(%)
(M)
16-only
64.4
6.86
1
32.3
3.34
1+4
91.6
3.67
1+4+8
98.3
4.09
1+4+8+16
99.0
4.78
Table 3: Synthetic Results.
Figure 9: Code Execution on long executions.
Appendix figures & tables10 assets
Supplementary material from the paper’s appendix.
Appendix
Exact-set accuracy (%)
Training tokens
Domain
2
2+4
C
L
Δ Acc (pp)
C (M)
L (M)
Δ Tok (%)
Blocksworld
31.50
62.28
77.00
35.17
+41.83
1.424
1.466
−2.9
Depots
6.72
11.44
11.83
6.39
+5.44
2.972
3.080
−3.5
Ferry
33.72
55.78
67.78
50.17
+17.61
2.342
2.424
−3.4
FloorTile
0.11
0.06
0.00
0.11
−0.11
5.142
5.212
−1.3
GoldMiner
37.56
77.28
99.44
69.06
+30.39
3.953
4.132
−4.3
Appendix
Table 4: Full planning depth results. Exact-set accuracy (%) averages evaluation depths 2, 4, and 6. C denotes training on depths 2+4+6 ; L denotes 6-only training. Δ Acc and Δ Tok compare C with L . Tokens are mean non-padding training tokens in millions.
Training corpus
Step t
N=50
N=200
N=800
N=1600
Valid-action identification (depth 4)
1
50
193
683
1,191
2
49
180
602
982
3
47
149
399
604
4
35
97
192
291
Next-state prediction (depth 1)
1
50
200
800
1,600
Appendix
Table 5: Measured breadth bt in synthetic training corpora ( A=20 ); N counts distinct sources.
Setting
Value
Optimizer
AdamW
LoRA rank / alpha / dropout
8 / 16 / 0
LoRA target modules
q_proj , v_proj
Peak learning rate
2×10−4
Example presentations per optimizer update
16
Appendix
Table 6: Fine-tuning settings for synthetic valid-action identification.
Figure 10: Action complexity and breadth across models. Top: synthetic accuracy; gray lines show individual settings, green their mean, and dashed brown the 0.5B reference. Bottom: planning gains relative to N=50 , where N counts distinct training sources; colors identify domains.
Figure 11: Depth specialization and cumulative training. Top: Blocksworld training–test matrices; numbers show accuracy (%), colors show deviations from column means, and outlines mark matched depths. Bottom: cumulative-training gains over 6-only training (dashed zero line). Each condition uses 300 steps; colors identify domains.
Train depth 2
Train depth 4
Train depth 6
Test depth
2
4
6
2
4
6
2
4
6
Δ
Qwen2.5-3B-Instruct
Logistics
86.6
72.5
70.0
81.9
77.4
79.7
76.7
77.0
75.2
+3.4
Depots
99.1
92.8
84.0
97.8
98.7
97.5
96.9
98.1
99.0
+4.5
Ferry
100.0
95.0
79.6
99.9
99.8
97.9
99.8
100.0
100.0
+4.6
Grippers
99.9
93.4
82.8
96.4
99.5
95.5
99.1
99.8
99.3
+5.1
Appendix
Table 7: Training–test depth matrices for the remaining planning domains. Values are order-robust accuracy (%); bold marks matched depths. Δ is the matching gain in percentage points. Blocksworld appears in Figure 11 .
Figure 12: Planning gains by candidate count. Top: N=1600 minus N=50 . Bottom: cumulative 2+4+6 minus 6-only training. All comparisons use 300 training steps. The dashed line marks zero gain; colors identify domains.
Figure 13: Cumulative-training gains at each evaluation depth. Curves show 2+4+6 minus 6-only order-robust accuracy in all complete planning comparisons. The dashed line marks zero gain; colors identify domains.
Domain
Qwen2.5-3B
Qwen2.5-7B
Qwen3-8B
Blocksworld
68.00
88.17
86.00
Depots
56.00
65.00
68.33
Ferry
67.83
92.00
92.33
FloorTile
0.50
0.00
4.17
GoldMiner
47.83
71.83
64.33
Grid
67.00
71.17
69.83
Appendix
Table 8: Complete valid-action-set accuracy (%) in 11 planning domains.
2+4
2+4+6
Domain
300 steps
600 steps
300 steps
900 steps
Qwen2.5-3B-Instruct
Blocksworld
95.08
96.15
97.32
98.03
Logistics
90.62
92.03
95.55
95.96
Depots
98.76
99.33
99.28
99.64
Ferry
99.24
99.39
99.96
99.96
Appendix
Table 9: Order-robust accuracy (%) with 300 total steps or 300 steps per included depth.