Source-linked AI summary

When Not to Imitate: Boundary-Aware Skill Memory for Reliable Tool-Use LLM Agents

Zihan Lin, Zhenyu Chen, Jiawen Wei, Xiaohan Wang, Jie Cao, Jiajun Chai, Wei Lin, Guojun Yin, Ran He

arXiv:2608.22339v1cs.CL

TL;DR

Success-distilled skill memories can trap tool-use agents into imitating procedures without checking whether they apply. BASM adds explicit boundary fields and state-conditioned enforcement, and it consistently improves performance and safety outcomes across three benchmarks and four model scales. The paper’s limitations include text-based benchmarked settings, natural-language boundary representations, and an emphasis on autonomous tool-use performance.

  • Problem

    Success-distilled skill memories lack explicit validity boundaries, so semantically relevant retrieved procedures may be inappropriate for the current state.

  • Method

    BASM stores each skill’s goal, procedure, tools, applicability, risk, avoidance, and recovery information, with budgeted retrieval, boundary checking, and runtime repair.

  • Results

    Across BFCL, AppWorld, and AgentDojo and four model scales, BASM consistently outperforms success-distilled skill-memory baselines, including up to 23.8% higher AppWorld success rate.

  • Takeaways & Limitations

    Reliable skill reuse requires explicit validity boundaries around procedures rather than simply adding more procedural memories.

  • Takeaways & Limitations

    The evaluation focuses on text-based tool-use agents in benchmarked environments, while richer interactive settings and more compact boundary representations remain future directions.

Abstract

from arXiv · show

Extracting skills from past successes is critical for the efficient evolution of Large Language Model (LLM) agents. Prevailing agent self-evolution paradigms typically rely on a core assumption: equipping LLMs with skill memories derived from successful trajectories will monotonically improve their problem-solving capabilities. However, probe analyses reveal that extracting skills solely from successful trajectories traps the model in a \textbf{Skill Imitation Trap}. For tasks that resemble past successes but require different tools, retrieving more skills paradoxically increases the model's confidence in wrong tool calls---procedure skills raise the wrong-tool margin by $47\%$ over a memory-free baseline. To overcome this limitation, we propose \textbf{Boundary-Aware Skill Memory} (BASM), which augments each skill with explicit boundary fields---applicability conditions, risk cues, avoidance rules, and recovery notes. These fields transform each retrieved skill from an unconditional action template into state-conditioned guidance: the agent applies the skill when its conditions hold, suppresses inapplicable tool calls when they do not, and issues targeted repairs when execution fails. Across three agent benchmarks and four model scales, BASM consistently outperforms success-distilled skill-memory baselines: it improves task success rate by up to $23.8\%$ on AppWorld, accuracy by up to $5.0\%$ on BFCL, and reduces attack success rate by $4.6\%$ on AgentDojo, while simultaneously reducing average AppWorld steps by up to $6.6\%$ relative to the memory-free baseline.

1 Meituan

The passage lists institutional affiliations and identifies equal-contribution and corresponding authorship notes.

  • The listed affiliations include the University of Chinese Academy of Sciences.
  • The listed affiliations include MAIS&NLPR at the Institute of Automation, Chinese Academy of Sciences.
  • The Zhongguancun Academy is also listed, alongside equal-contribution and corresponding-author notes.

1 Introduction

The paper identifies a Skill Imitation Trap in success-distilled skill memories and proposes BASM, which adds explicit boundaries to make skill reuse state-conditioned. Across three benchmarks and four model scales, BASM improves task performance and safety-related outcomes over success-distilled baselines.

  • Success-distilled skills can increase preference for semantically similar but inapplicable tools as retrieval depth grows.This failure mode occurs because procedural content is treated as an unconditional action template without assessing present-state validity.
  • BASM augments procedural knowledge with applicability, risk, avoidance, and recovery fields to guide application, suppression, and repair.Its design includes a seven-slot schema, budgeted retrieval and formatting, prompt-side boundary checking, and runtime repair.
  • 47%: wrong-tool margin increase for success-distilled memory relative to the memory-free baseline in risky states.Probe analyses attribute the effect to procedural attention at decision tokens and identify boundary fields as a causal anti-imitation channel.
  • BASM consistently improves over success-distilled skill-memory baselines across BFCL, AppWorld, and AgentDojo at four model scales.Reported gains include AppWorld success, BFCL accuracy, AgentDojo attack success rate, and average AppWorld steps relative to the memory-free baseline.

2 Related Work

Prior skill-memory approaches distill successful experience into reusable programs, lessons, or libraries, generally treating success as positive transfer. BASM instead adds explicit applicability signals so retrieved skills can be scoped by validity rather than relevance alone.

  • Skill-memory research has progressed from reusable programs and verbal lessons to online induction, hierarchical libraries, RL distillation, and cross-agent transfer.
  • Existing approaches commonly assume that skills distilled from successful experience provide positive transfer when retrieved.The paper challenges this shared premise in states where semantic similarity does not guarantee decision validity.
  • Standard retrieval measures relevance, whereas BASM adds boundary fields and boundary relevance to represent when a skill should be suppressed.This makes retrieved skills validity-scoped records rather than unconditional action templates.
  • BASM connects skill retrieval with explicit preconditions, extending retrieval from procedural similarity toward applicability-aware execution.

3 Probe Analysis

The probe analysis measures wrong-tool preference across task states and retrieval depths, then examines attention to boundary evidence and its causal role. Results show that procedural memory amplifies invalid-tool preference, while BASM reverses it through state-conditioned boundary attention.

  • Diagnostic Setup: The diagnostic partitions decisions into Tok, Twrong, and Trepair states representing application, suppression, and post-failure repair.Twrong covers semantically similar but inapplicable retrieved skills; Trepair covers local failures requiring repair rather than repetition.
  • Diagnostic Setup: The wrong-tool margin measures the model’s immediate logit preference for incorrect semantically similar tools over correct or abstention alternatives.It is measured before environment feedback, exposing local tool preference even if later repair changes the final action.
  • Retrieval-Depth Probe: 10.71 versus 2.26: at retrieval depth k = 2, Proc. Skill increases wrong-tool margin while BASM decreases it.Both configurations start at 7.31 when k = 0, then diverge as retrieved skills are added.
  • Mechanism Analysis: BASM’s boundary-to-procedure attention ratio is 0.15 in Tok, 1.23 in Twrong, and 1.81 in Trepair.Neutral-padding and extra-procedure controls do not reproduce this state-dependent pattern.
  • Mechanism Analysis: 2.26: BASM’s wrong-tool preference on Twrong examples, below same-length controls and Proc. Skill’s 10.71.The result indicates a suppression signal beyond prompt length and formatting.
  • Attention Knockout: +3.45 logits: boundary-span knockout raises wrong-tool preference on Qwen3-8B Twrong examples.The prompt remains fixed while only decision-token attention to the boundary span is ablated.

4 Method

BASM builds a boundary-aware skill-memory pipeline that stores procedural knowledge with explicit validity conditions, retrieves it under a fixed budget, checks proposed calls, and supports targeted repair after local failures.

  • Skill schema: Each skill has seven slots: goal, procedure, tools, applicability conditions, risk cues, avoidance rules, and recovery notes.The first three slots form the procedural component; the final four form the boundary component.
  • Boundary functions: Boundary fields specify when procedures are safe, flag risky states, suppress invalid actions, and prescribe one-step corrections after local failures.Together they provide each retrieved skill with an explicit validity scope enforced across retrieval, formatting, and execution.
  • Skill library construction: BASM constructs reusable skills from logged successful and failed trajectories, using successful contexts for goals, procedures, and tools and failures as boundary evidence.A deterministic validator enforces required structured fields, boundary lists, and tool-schema validity before retaining candidates.
  • Retrieval and prompt formatting: At inference time, BASM retrieves skills using semantic, tool, and step/goal overlap, then always exposes procedural fields while selectively exposing boundary text under a token budget.Boundary text is exposed when its relevance exceeds a threshold, with the budget limiting boundary tokens.
  • Boundary-conditioned execution: A boundary checker blocks or revises proposed calls that violate applicability conditions, match avoidance rules, or repeat known failed patterns.Deterministic string and schema checks run first, while LLM judgment handles ambiguous natural-language conditions.
  • Local failure repair: In stateful multi-turn environments, recovery notes trigger a repair loop that injects a targeted hint into the next decision instead of re-retrieving the full skill set.In single-turn settings, recovery notes only steer tool selection because no execution loop exists.

5 Experiments

Experiments across three benchmarks and four model configurations show that BASM improves reliability by combining boundary-conditioned prompting with runtime repair, outperforming procedural skill-memory baselines.

  • 5.1 Setup: Three benchmarks test complementary capabilities: function calling, stateful multi-step completion, and utility–safety tradeoffs under prompt-injection attacks.BFCL includes miss_func and miss_param subsets; AppWorld is the primary runtime-repair testbed; AgentDojo reports Utility and Attack Success Rate.
  • 5.1 Setup: Four memory configurations compare a memory-free agent, procedural skills, applicability-only skills, and full BASM boundary-aware skills.BASM augments retrieved procedures with applicability conditions, risk cues, avoidance rules, and recovery notes.
  • 5.2 Main Results: Proc. Skill underperforms Base on BFCL for Qwen3-8B and Qwen3-14B, exposing the Skill Imitation Trap in inapplicable states.BASM instead outperforms the strongest skill-memory baselines on BFCL and AppWorld across both model sizes.
  • 5.2 Main Results: On Qwen3-32B, BASM reaches 76.19% AppWorld success versus 66.07% for Proc. Skill and reduces average steps 6.0% relative to Base.Average steps decrease from 12.46 to 11.71.
  • 5.2 Main Results: On Qwen3.5-397B-A17B, BASM reaches 53.75 BFCL and 54.76% AppWorld success, reducing average steps 6.6% relative to Base.The corresponding Proc. Skill comparisons are 53.38 BFCL and 52.98% AppWorld success; Base steps decrease from 13.50 to 12.61.
  • 5.3 Ablation Study: Ablations show complementary roles: boundary prompting sharpens function-selection precision, while runtime repair benefits stateful multi-step recovery.Repair-Only remains at Base on BFCL and falls below Base on AppWorld, whereas Prompt-BASM falls below Base on AppWorld without runtime repair.
  • 5.3 Ablation Study: Removing avoidance rules lowers BFCL by 0.88 points, reduces AgentDojo utility from 35.93 to 30.87, and raises ASR from 5.90 to 6.95.The ablation links avoidance rules to function-selection precision and safety-sensitive suppression.

6 Conclusion

The paper identifies a failure mode in success-distilled skill memory and proposes BASM, which adds explicit validity boundaries and runtime enforcement. Across benchmarks and model scales, BASM improves task performance and safety while reducing AppWorld interaction steps.

  • 6 Conclusion: Success-distilled skill memory can amplify wrong-tool preference when retrieved procedures lack explicit validity boundaries.The problem arises when semantic relevance diverges from decision validity.
  • 6 Conclusion: BASM equips skills with applicability, risk, avoidance, and recovery fields enforced during retrieval, prompting, and execution.These fields support applying, suppressing, or locally repairing retrieved skills according to state.
  • 6 Conclusion: Knockout probes attribute wrong-tool suppression to boundary-span attention rather than prompt length or added context.Ablations also show complementary benefits from boundary-conditioned prompting and runtime repair.

Limitations

The evaluation focuses on text-based tool-use agents in natural-language benchmark environments, leaving richer interactive settings and alternative boundary representations for future work.

  • The work evaluates text-based tool-use agents whose goals, observations, and tool feedback are expressible in natural language.
  • Future studies could examine multimodal agents, changing tool APIs, delayed-feedback workflows, compact boundary representations, and human-agent collaboration.

Artifact Use

The artifacts and experiments are restricted to documented research purposes, benchmark conditions, and privacy screening rather than real user data.

  • Experiments use AppWorld, BFCL, and AgentDojo under their intended research purposes and documented access conditions.
  • Derived artifacts based on benchmark trajectories should remain within research contexts and respect the original artifacts’ licenses.
  • The study uses publicly available benchmark environments and model-generated trajectories rather than real user data.
  • Released artifacts are screened for sensitive information and offensive content, with detected fields removed, anonymized, or excluded.

A Additional Experiments

Additional probes characterize BASM as a state-conditioned attention mechanism that preserves useful procedural recall while suppressing imitation in wrong-tool states and guiding recovery.

  • Boundary fields act as a state-conditioned attention modulator across decision-token attention, next-action logits, interventions, and realized calls.
  • BASM preserves procedural recall in safe states while suppressing overconfident imitation in wrong-tool states and guiding recovery in repair states.

A.1 Mechanism Replication and Logit Evidence

Replication across Qwen3-8B and Qwen3-14B shows that BASM’s boundary attention is state-sensitive rather than a byproduct of added tokens or formatting. Logit evidence further shows explicit boundary semantics suppress inappropriate tool commitment beyond equal-length controls.

  • Equal-length controls fail to reproduce BASM’s risk-sensitive boundary/procedure attention profile across Qwen3-8B and Qwen3-14B.
  • Safe states read less boundary information, whereas risky and repair states read more under the replicated BASM pattern.
  • 10.71 is the wrong-tool margin for Proc. Skill on Twrong, versus 6.60 for irrelevant padding, 5.14 for procedure padding, and 2.26 for BASM.
  • 14.24 is the broader tool-vs-control margin under Proc. Skill, falling to 5.20 under BASM while controls remain higher.

A.2 Same-Prompt Knockout Evidence

Same-prompt knockouts show that boundary attention, rather than added context or formatting, suppresses risky imitation and remains effective across model scales. Attention analyses further localize this effect to identifiable, state-sensitive pathways rather than a static applicability feature.

  • A.2 Same-Prompt Knockout Evidence: A +3.45-logit wrong-tool-margin increase follows boundary-span knockout, while the broader tool margin rises in the same direction.The intervention masks only decision-token attention to boundary fields, keeping the rest of the prompt fixed.
  • A.2 Same-Prompt Knockout Evidence: BASM reduces both specific wrong-tool and broader tool-vs-control margins more than equal-length controls.The comparison indicates suppression of the risky action attractor beyond prompt length or formatting changes.
  • A.2 Same-Prompt Knockout Evidence: 69.4% of the Proc. Skill wrong-tool gap and 41.0% of its broader-tool gap reappear after boundary knockout.This recovery quantifies how much BASM’s anti-imitation effect depends on boundary attention.
  • A.2 Same-Prompt Knockout Evidence: Random same-length and procedure-span masks do not restore imitation, isolating the decision-token-to-boundary path as the active channel.The controls argue against generic context deletion or attention damage as explanations.
  • A.2 Same-Prompt Knockout Evidence: Qwen3-14B shows the same causal direction: boundary knockout increases Twrong wrong-tool margins while selectively affecting correct-tool margins.The smaller effect is consistent with boundary evidence being integrated through more distributed routes in the larger model.
  • A.3 Where the Boundary Signal Appears: Boundary/procedure attention is concentrated in identifiable middle and later-layer heads, consistent with a state-conditioned attention modulator.These heads alter how strongly the decision token trusts a retrieved procedure under the current state.
  • A.3 Where the Boundary Signal Appears: Heads ranked by Tok-to-Twrong boundary/procedure shifts specialize in transitions from safe to risky states, providing a mechanistic locus beyond high boundary attention alone.Span-level knockout remains the direct causal test, while head ranking makes the routing pattern observable.
  • A.4 Boundary Mechanism, Behavior, and Control Comparisons: A task-disjoint linear probe finds no uniquely stronger stable applicability feature under BASM, while behavior improves through dynamic boundary reading.BASM lowers wrong calls at risky retrieval depths without requiring a generic no-tool bias, and paired AppWorld outcomes support the value of recovery and avoidance fields.
Loading 2608.22339v1…