Skill internalization offers a way for agents to learn useful behaviors from skills and use them without explicit guidance in context at inference time. A common approach is to generate demonstration trajectories with the skill in context and then fine-tune the same model on its own trajectories with the skill removed. However, this leads to the problem that the model may learn to reference the removed skill, which we named as context misalignment (CoMi). In this work, we first analyze agent behaviors related to CoMi under this common pipeline. Across ALFWorld, WebShop, and ARC-AGI-1, skill-removed fine-tuning consistently results in CoMi: 12.2-46.0% of test trajectories reference the removed skill. To address this problem, we develop Context-Grounded Skill Internalization (CGSI). CGSI uses a sentence detector to identify unsupported references and then masks or rewrites the selected sentences before fine-tuning. Experimental results demonstrate the effectiveness of CGSI and reveal two key findings. (i) Compared with directly fine-tuning with the skill removed, CGSI reduces CoMi at test time by 72.5-94.6% while preserving task success. (ii) Compared with existing reinforcement learning-based skill-internalization baselines, CGSI achieves comparable performance with substantially less training time. CGSI also significantly reduces processing costs compared with large-scale trajectory auditing and correction.
Figures & tables
Figure 1: Context misalignment. (1) A successful ARC response, sampled with the skill, references guidance that is present. (2) SFT trains on the same response with the skill removed, so the referenced guidance is absent.
Figure 2: CGSI: detector training and context-aligned SFT. (a) Detector training (top): Step 1 obtains paired sentence labels from VLM audits; Step 2 extracts sentence-level features from a frozen backbone, combining log-probability differences between the two contexts with hidden-state representations; Step 3 fits a logistic classifier to these features and labels. The resulting detector is calibrated and frozen. (b) Context-aligned SFT (bottom): Skill-guided demonstration trajectories are scored by the frozen detector. Selected sentences are loss-masked or rewritten, and the model is trained without the skill.
Model
ALFWorld
WebShop
ARC-AGI-1
4B
33.97 (412 / 1,213)
64.79 (322 / 497)
43.95 (552 / 1,256)
9B
40.28 (518 / 1,286)
18.34 (104 / 567)
75.45 (1,721 / 2,281)
Table 1: CoMi introduced by skill removal in successful teacher trajectories: CoMi (%), with positive / total trajectories in parentheses. A positive trajectory contains at least one reference that loses context support.
ALFWorld
WebShop
ARC-AGI-1
Pick (59)
Clean (58)
Heat (39)
Cool (46)
Look (31)
Pick2 (41)
All (274)
500 tasks
400 tasks
Method
sr ↑
CoMi ↓
sr ↑
CoMi ↓
sr ↑
CoMi ↓
sr ↑
CoMi ↓
sr ↑
CoMi ↓
sr ↑
CoMi ↓
sr ↑
CoMi ↓
sr ↑
Score ↑
CoMi ↓
sr ↑
CoMi ↓
Full-parameter ⋅ Qwen3.5-4B
Base
86.4
1.7
22.4
1.7
5.1
2.6
10.9
0.0
38.7
3.2
61.0
0.0
39.4
1.5
6.8
14.0
0.6
2.00
0.00
SFT (skill kept)
89.8
0.0
81.0
6.9
59.0
0.0
54.3
2.2
83.9
0.0
85.4
0.0
76.3
1.8
35.4
46.1
1.4
5.25
0.00
SFT (skill dropped)
93.2
5.1
93.1
25.9
53.8
15.4
80.4
15.2
90.3
16.1
85.4
19.5
83.9
16.1
39.2
51.4
46.0
13.25
15.75
Table 2: Capability and context alignment after SFT. Success rate ( sr ) and deployment CoMi in %; WebShop score in [0,100] . All methods train on the same skill-guided trajectories. SFT (skill kept) trains with the skill; the others train without it. CGSI variants use sentences selected by our detector; the VLM Audit baselines use sentences flagged by a full VLM audit. No method receives the skill at test time. Silver-gray text: CoMi; muted red: CoMi ≥10% . Bold black: best skill-free sr and score within each group.
4B
9B
Env.
P ↑
R ↑
F1 ↑
Word ↑
P ↑
R ↑
F1 ↑
Word ↑
ALFWorld
81.20
82.90
82.04
49.82
81.21
95.74
87.88
65.60
WebShop
78.95
93.75
85.71
5.64
85.81
93.01
89.26
5.42
ARC-AGI-1
53.80
76.73
63.25
53.27
81.66
70.02
75.39
59.88
Table 3: Sentence-level detection quality on successful SFT demonstration trajectories, measured against VLM audit labels (%). Word: F1 of word matching on the same sentences.
Method
sr ↑
CoMi ↓
Time ↓
Inference baselines
Base
39.42
1.46
–
Base + skill
67.52
–
–
Online training
GRPO [ 31 ]
91.97
0.00
5.65
Skill-SD [ 40 ]
88.32
0.00
9.26
Table 4: Skill internalization on ALFWorld with Qwen3.5-4B. Success rate ( sr ) and CoMi over all 274 tasks (%). Time: training hours, including SFT for the last two rows and excluding data processing. Details are in Supp. E and G .
Figure 3: CoMi before and after RL. Open and filled circles indicate before and after RL. In each panel, rows from top to bottom are SFT (skill dropped), VLM Audit (Rewrite), CGSI (Rewrite), and CGSI (Mask).
VLM Audit
CGSI
Benchmark
Rewrite
Mask
Rewrite
Mask
ALFWorld
182.6
174.1
9.9
0
WebShop
160.4
153.8
6.3
0
ARC-AGI-1
1,245.5
1,134.7
112.3
0
Table 5: Data-processing cost for Qwen3.5-9B: recorded external API tokens (thousands) per successful demonstration trajectory. Detector-development costs are excluded.
Figure 4: Case studies. Selected cases from Qwen3.5-9B models after full-parameter SFT. (a) ALFWorld (top): The models’ first-turn behavior. (b) ARC (bottom): All three models created rule.py to describe the inferred rule and then proceeded to create solve.py to test it. Red marks unsupported references; bold highlights task-relevant content. All three runs succeed in each case.
Appendix figures & tables25 assets
Supplementary material from the paper’s appendix.
Appendix
A(u;c+)
A(u;c−)
b
Interpretation
0
0
0
No CoMi in either context
0
1
1
Support lost after skill removal
1
0
0
Misaligned only with skill
1
1
0
Misaligned in both contexts
Appendix
Table S1 : Paired audit outcomes. An audit value of 1 denotes CoMi.
Environment
Model
Collection
Test
ALFWorld
4B
20 / 20
24 / 28
9B
20 / 20
24 / 25
WebShop
4B
20 / 20
28 / 28
9B
20 / 20
20 / 20
ARC-AGI-1
4B
20 / 20
19 / 19
9B
20 / 20
20 / 20
Appendix
Table S2 : Human confirmation of sampled Kimi-positive passages, confirmed / reviewed. Collection passages must also be supported with the skill restored.
ALFWorld-4B
ALFWorld-9B
WebShop-4B
WebShop-9B
ARC-4B
ARC-9B
Method
Main
Claim only
Claim or name
Main
Claim only
Claim or name
Main
Claim only
Claim or name
Main
Claim only
Claim or name
Main
Claim only
Claim or name
Main
Claim only
Claim or name
Base
1.5
0.0
0.0
0.4
0.4
0.4
0.6
0.6
0.6
0.0
0.0
0.0
0.00
0.00
0.00
0.00
0.00
0.00
SFT (skill kept)
1.8
0.4
1.5
2.2
0.4
1.5
1.4
1.0
1.0
0.2
0.2
0.2
0.00
0.00
0.00
0.00
0.00
0.00
SFT (skill dropped)
16.1
4.0
15.7
33.9
5.1
33.9
46.0
16.8
45.6
12.2
2.8
11.6
15.75
13.50
15.50
37.25
34.75
37.25
VLM Audit (Rewrite)
1.5
1.1
1.5
1.5
0.4
1.5
4.6
4.4
4.4
1.2
1.0
1.0
1.00
0.25
1.00
4.75
0.25
4.75
CGSI (Rewrite)
1.8
0.7
1.5
2.6
1.8
2.6
13.2
13.0
13.0
0.8
0.8
0.8
1.25
0.75
1.00
6.00
2.00
6.00
Appendix
Table S3 : CoMi under the main audit and a looser categorization , % of test trajectories, full-parameter SFT. Main: Kimi labels in Tab. 2 . Claim only: explicit claims about absent guidance, such as “The instructions say.” Claim or name: explicit claims or names of strategies from the absent skill. Only Kimi-positive trajectories were relabeled.
Environment
Model
η
P ↑
R ↑
ALFWorld
4B
2.46728
82.14
83.13
9B
−0.44498
80.20
96.43
WebShop
4B
−0.04619
80.52
92.03
9B
2.17508
80.95
79.07
ARC-AGI-1
4B
0.41163
49.02
92.59
9B
5.90948
80.60
66.67
Appendix
Table S4 : Selected detector thresholds and calibration results. η is a decision-score threshold, rounded to five decimal places; P and R are sentence-level percentages on the calibration split.
4B
9B
Env.
Method
P
R
F1
P
R
F1
ALFWorld
Word
25.75
56.58
35.39
46.34
80.85
58.91
Detector
82.43
80.26
81.33
77.98
90.43
83.74
WebShop
Word
2.50
14.11
4.25
3.05
22.92
5.38
Detector
75.65
90.60
82.45
84.09
77.08
80.43
ARC
Word
35.48
26.83
30.56
78.95
38.96
52.17
Appendix
Table S5 : Held-out sentence-level detection (%). Each benchmark has 136 development tasks, including failures. Each detector uses the threshold applied in training-data preparation.
ALFWorld
WebShop
ARC-AGI-1
Features
P ↑
R ↑
F1 ↑
P ↑
R ↑
F1 ↑
P ↑
R ↑
F1 ↑
Held-out development
Full detector
82.43
80.26
81.33
75.65
90.60
82.45
52.54
75.61
62.00
w/o peak-4
82.86
76.32
79.45
76.76
89.03
82.44
55.56
73.17
63.16
w/o mean gap
81.82
82.89
82.35
75.99
90.28
82.52
50.88
70.73
59.18
w/o hidden (gaps only)
93.33
36.84
52.83
79.93
73.67
76.67
2.50
85.37
4.85
Appendix
Table S6 : Sentence-level feature ablation across all three benchmarks. 4B P/R/F1 (%). Each variant is independently calibrated on the same task split. The full detectors use the thresholds in Tab. S4 . Held-out includes failed trajectories; SFT contains successful demonstration trajectories. Held-out sets contain 13,014, 43,370, and 89,529 sentences for ALFWorld, WebShop, and ARC; SFT sets contain 54,334, 73,394, and 418,773.
Env.
Selector
Sent.
Tok.
sr ↑
Δ sr [95% CI]
CoMi ↓
ALFWorld
SFT (skill dropped)
–
0
83.9
16.1
CGSI (Mask)
585
1.05
85.0
4.4
Hidden only
546
0.97
81.8
− 3.3 [ − 8.4, + 1.8]
1.8
WebShop
SFT (skill dropped)
–
0
39.2
46.0
CGSI (Mask)
893
1.21
41.6
3.4
Hidden only
830
1.11
38.6
− 3.0 [ − 7.6, + 1.6]
9.2
Appendix
Table S7 : CGSI (Mask) with different sentence selectors , 4B full-parameter. Sent.: selected SFT sentences; Tok.: masked target tokens (%); success rate ( sr ) and deployment CoMi in %; Δ : sr difference from CGSI (Mask) in percentage points, with paired 95% bootstrap intervals.
Full-parameter
LoRA
Epochs / batch
3 / 16
3 / 16
Optimizer
AdamW
AdamW
Learning rate
10−5
10−4
Adapter
–
r=16 , α=32
Adapter dropout
–
0
Precision
BF16
BF16
Appendix
Table S8 : SFT and downstream GRPO hyperparameters.
ALFWorld
WebShop
ARC
Inference
4B
9B
4B
9B
4B
9B
Base
39.4
48.2
6.8
6.6
2.00
7.00
Base + skill
67.5
65.3
30.2
30.6
13.25
32.50
Appendix
Table S9 : Success rate ( sr , %) of the untrained model without (Base) and with (Base + skill) the skill in its input, on the same test tasks.
Pick (59)
Clean (58)
Heat (39)
Cool (46)
Look (31)
Pick2 (41)
All (274)
Training data
sr ↑
CoMi ↓
sr ↑
CoMi ↓
sr ↑
CoMi ↓
sr ↑
CoMi ↓
sr ↑
CoMi ↓
sr ↑
CoMi ↓
sr ↑
CoMi ↓
Skill-free rollouts
83.1
0.0
36.2
0.0
53.8
0.0
37.0
0.0
54.8
0.0
61.0
0.0
54.7
0.0
SFT (skill kept)
94.9
1.7
70.7
1.7
17.9
5.1
71.7
15.2
77.4
0.0
85.4
0.0
71.5
4.0
SFT (skill dropped)
94.9
10.2
94.8
19.0
41.0
38.5
89.1
17.4
83.9
9.7
78.0
19.5
82.5
18.6
VLM Audit (Rewrite)
94.9
1.7
100.0
0.0
46.2
2.6
87.0
0.0
93.5
0.0
85.4
0.0
86.1
0.7
CGSI (Rewrite)
89.8
3.4
96.6
1.7
48.7
2.6
82.6
4.3
87.1
0.0
85.4
0.0
83.2
2.2
Appendix
Table S10 : ALFWorld-4B with 773 successful trajectories per method. Success rate ( sr ) ↑ / CoMi ↓ (%), seen and unseen tasks pooled; full-parameter SFT. Skill-free rollouts are a separate set of the same size; the six skill-derived methods share one list. Bold: highest sr in each column.
Table S11 : Paired differences on the test tasks , in percentage points with 95% bootstrap intervals; p : exact McNemar test. sr : success rate.
Qwen3.5-4B
Qwen3.5-9B
ALF seen
ALF unseen
WebShop
ARC-AGI-1
ALF seen
ALF unseen
WebShop
ARC-AGI-1
Method
sr ↑
CoMi ↓
sr ↑
CoMi ↓
sr ↑
Score ↑
CoMi ↓
sr ↑
CoMi ↓
sr ↑
CoMi ↓
sr ↑
CoMi ↓
sr ↑
Score ↑
CoMi ↓
sr ↑
CoMi ↓
Base
43.6
1.4
35.1
1.5
6.8
14.0
0.6
2.00
0.00
50.0
0.0
46.3
0.7
6.6
18.9
0.0
7.00
0.00
Full
SFT (skill kept)
74.3
2.1
78.4
1.5
35.4
46.1
1.4
5.25
0.00
74.3
2.1
75.4
2.2
43.0
63.0
0.2
20.00
0.00
SFT (skill dropped)
85.7
19.3
82.1
12.7
39.2
51.4
46.0
13.25
15.75
83.6
30.7
82.1
37.3
46.8
65.6
12.2
27.50
37.25
Weighted
84.3
10.0
85.1
14.9
40.2
51.3
28.4
8.50
5.25
81.4
12.1
85.1
11.2
46.8
67.8
6.2
26.25
28.50
Appendix
Table S13 : Seen / unseen splits and soft down-weighting. Success rate ( sr ) ↑ / CoMi ↓ in %; WebShop score in [0,100] . ARC uses all 400 tasks.
Adaptation
Method
4B
9B
Full
SFT (skill kept)
39.8 / 1.6
42.8 / 0.6
SFT (skill dropped)
43.2 / 53.0
45.4 / 14.2
CGSI (Mask)
43.2 / 6.6
44.8 / 2.2
LoRA
SFT (skill kept)
16.4 / 0.4
14.8 / 0.0
SFT (skill dropped)
37.8 / 58.8
41.8 / 12.2
CGSI (Mask)
35.4 / 8.6
43.8 / 2.0
Appendix
Table S14 : WebShop with 4,500 training tasks. Each cell gives success rate ( sr ) ↑ / CoMi ↓ in % on 500 test tasks.
Figure S1 : Task success during subsequent GRPO. On ALFWorld and WebShop, each full-parameter SFT initialization receives 60 skill-free updates with task outcome reward.
Table 24
Scan
Rewrite
Model
Method
N
Input
Cached
Output
Input
Cached
Output
Total
USD
4B
VLM Audit (Rewrite)
1,256
1.11M
937.1k
30.8k
61.9k
35.0k
1.9k
1.21M
0.51
4B
CGSI (Rewrite)
1,256
0
0
0
76.2k
40.6k
2.5k
78.6k
0.05
9B
VLM Audit (Rewrite)
2,281
1.10M
843.4k
31.7k
107.9k
57.6k
3.0k
1.25M
0.60
9B
CGSI (Rewrite)
2,281
0
0
0
109.4k
57.1k
3.0k
112.3k
0.07
Appendix
Table S17 : ARC VLM API usage per successful demonstration trajectory. N includes all successful source trajectories. Cached input is part of Input. Rewrite includes all checks, retries, rejected candidates, and reused calls; each benefiting method and stage receives the full cost. Total sums Scan and Rewrite input and output; USD uses the list price in Appendix G .
Method
Process
Startup-to-save
Online loop
Skill-SD
9.26
9.16
8.87
OPSD
3.46
3.40
3.31
Skill0 (update 120)
13.45
13.45
8.79
Skill0
19.14
19.06
12.45
Appendix
Table S18 : ALFWorld-4B time decomposition, in hours. Startup-to-save uses the target checkpoint’s completed save as the endpoint for every adopted segment.
Figure S2 : ALFWorld: collection. Red references lose support when the provided skill is removed. Quotes are verbatim; ellipses mark omissions. Turns are zero-indexed.
Figure S3 : WebShop: collection. Red references lose support when the provided skill is removed. Quotes are verbatim; ellipses mark omissions. Turns are zero-indexed.
Figure S4 : ARC: collection. All example pairs, test inputs, and model outputs are shown. Red references lose support after skill removal. Examples are numbered top to bottom; turns are zero-indexed.
Figure S5 : ALFWorld: post-SFT. Full-parameter SFT (skill dropped), with no skill at inference. Red marks unsupported references. Quotes are verbatim; ellipses mark omissions. Turns are zero-indexed.
Figure S6 : WebShop: post-SFT. Full-parameter SFT (skill dropped), with no skill at inference. Red marks unsupported references. Quotes are verbatim; ellipses mark omissions. Turns are zero-indexed.
Figure S7 : ARC: post-SFT. All example pairs, test inputs, and model outputs are shown. Red marks unsupported references during skill-free inference. Examples are numbered top to bottom; turns are zero-indexed.
Figure S8 : ALFWorld: no-mention instruction. Three successful skill-guided trajectories reference the skill (Example 1), the prohibition itself (Example 2), or a named skill rule (Example 3). Red references lose support when the skill and sampling-only prohibition are removed. Quotes are verbatim; ellipses mark omissions. Turns are zero-indexed.
Figure S9 : SFT (skill kept). Full-parameter models with no skill at inference. Three human-confirmed cases; red marks unsupported references. Quotes are verbatim; ellipses mark omissions. Turns are zero-indexed.