Source-linked AI summary

SkillGrad: Optimizing Agent Skills Like Gradient Descent

Hanyu Wang, Yifan Lan, Bochuan Cao, Lu Lin, Jinghui Chen

arXiv:2605.27760v1cs.AI

TL;DR

Agent skills can be unreliable, incomplete, or outdated, motivating systematic ways to improve them after initialization. SkillGrad optimizes skills through execution-based diagnosis, momentum, and layer-aware patching, consistently outperforming training-free and training-based baselines across evaluated tasks and backbones.

  • Problem

    Existing skill packages can omit edge cases, become misaligned, or encode brittle assumptions, leaving systematic post-initialization optimization an open question.

  • Method

    SkillGrad treats structured skill packages as optimizable artifacts, using execution evidence, textual diagnoses, momentum memory, and layer-aware patches to update them.

  • Results

    SkillGrad consistently outperforms training-free and training-based baselines across SpreadsheetBench Verified and WikiTableQuestions evaluations and two backbone LLMs.

  • Takeaways & Limitations

    The results suggest structured optimization is a practical path for improving skills initialized from both LLM-generated and third-party sources.

  • Takeaways & Limitations

    Evaluation is primarily spreadsheet-centered, and the framework’s stability conditions for textual diagnoses and momentum states remain formally uncharacterized.

Abstract

from arXiv · show

Agent skills provide a lightweight way to adapt LLM agents to specialized domains by storing reusable procedural knowledge in structured files. However, whether downloaded from third parties or self-generated, these skills are often unreliable, incomplete, or outdated. Existing skill-evolution methods often address these deficiencies through heuristic reflections without an explicit optimization formulation. In this paper, we propose SkillGrad, a gradient-descent-inspired framework for optimizing agent skills. SkillGrad treats the skill package as a structured parameter to optimize in a gradient descent fashion: task executions provide trajectory-level loss evidence, automatic diagnoses then provide text-based gradients that indicate the correction directions. To stabilize optimization across iterations, a momentum agent accumulates recurring diagnostic patterns into a persistent memory overlay. Finally, an LLM-based patcher executes the parameter update by applying layer-aware edits to the skill package. Evaluated on SpreadsheetBench Verified and WikiTableQuestions, SkillGrad consistently outperforms training-based skill evolution baselines across two backbone LLMs, improving over the strongest training-based baseline by $6.7$ percentage points on average. Ablations further show that momentum and contrastive diagnosis both contribute to the final skill quality.

1 Introduction

SkillGrad frames agent-skill improvement as gradient-descent-inspired optimization over a structured skill package, using execution evidence, textual diagnoses, momentum, and layer-aware patches. It targets unreliable adaptation in specialized, procedure-heavy domains and improves performance across spreadsheet and table-question answering evaluations.

  • Motivation: Specialized agents must follow domain-specific workflows, use tools correctly, and handle recurring edge cases beyond general problem-solving ability.The introduction highlights spreadsheet manipulation, document editing, and codebase maintenance as procedure-heavy domains requiring specialized adaptation.
  • Problem: Automatically generated or fixed skill packages can underperform expert-written skills, degrade agents relative to no skill, omit edge cases, or encode brittle assumptions.Skill quality is presented as a critical limitation because packages may misalign with task distributions or tool use.
  • Method: SkillGrad treats the structured skill package as an optimizable parameter, with task trajectories providing loss evidence and diagnoses providing textual update signals.Failed trajectories expose corrections, while contrastive successful trajectories identify behaviors to preserve.
  • Method: A momentum agent accumulates recurring diagnostic patterns, and a layer-aware patcher applies the resulting updates to the skill package.The framework is described as a multi-agent process that diagnoses executions, accumulates patterns, and patches skill layers.
  • Evaluation: SkillGrad outperforms training-free and training-based skill-improvement baselines on SpreadsheetBench Verified and WikiTableQuestions across two backbone LLMs.Experiments use both LLM-generated and third-party initial xlsx skills, with gains reported under in-domain and out-of-domain evaluations.

2 Related Work

Related work develops reusable agent skills through training-based evolution, skill knowledge bases, collective ecosystems, and lifelong personalization. SkillGrad’s baselines are EvoSkill and Trace2Skill, evaluated under matched experimental conditions, while EvoSkill uses failure-driven updates with validation-based selection.

  • Training-based skill evolution: EvoSkill and Trace2Skill produce standalone skill artifacts, enabling evaluation with identical initialization, training tasks, backbone model, and held-out split.These are the training-based baselines used in the experiments.
  • Training-based skill evolution: EvoSkill analyzes failed executions, converts diagnoses into revised or new skills, and selects candidates using held-out validation performance.Its approach corresponds to failure-driven updating with validation-based selection.
  • Broader skill acquisition and reuse: SkillX organizes experience into multi-level skills, refines them through execution feedback, and expands a plug-and-play skill knowledge base.This represents broader work on skill acquisition, memory, and reuse.
  • Broader skill acquisition and reuse: SkillClaw studies collective skill evolution across multi-user agent ecosystems, while AutoSkill derives, maintains, and reuses skills from lifelong user interactions.Together, these systems extend skill learning toward shared repositories and lifelong personalization.

3 Methodology

SkillGrad optimizes a layered skill package through an iterative loop that turns task outcomes and trajectories into diagnoses, momentum memory, and layer-aware patches. Its evidence design combines failures with contrastive successes, while updates decide both what behavior to change and where it belongs.

  • Skill representation: The optimizable parameter is a structured skill package with metadata, an always-loaded SKILL.md body, and conditionally loaded resources.The layered structure requires deciding not only what knowledge to add, but also where it should live.
  • Execution outcomes and trajectory evidence: SkillGrad uses binary task success as terminal evaluation but enriches it with trajectory-level evidence from failed and contrastive successful executions.Failed trajectories support corrective diagnoses, while successful trajectories reveal changes such as inspection, robust coding, or verification behaviors.
  • Framework overview: SkillGrad iteratively executes the current skill on task mini-batches, converts outcomes and trajectories into loss evidence and diagnoses, and applies a layer-aware patch.Failed executions expose missing or incorrect guidance, while contrastive successful executions identify behaviors to preserve.
  • Diagnosis as gradient-like signal: Because natural-language skill packages lack numeric derivatives, SkillGrad uses evidence-grounded diagnoses as textual gradients that identify behaviors to repair or preserve.The diagnoser produces one diagnosis per task and aggregates them into a mini-batch diagnosis set.
  • Cross-iteration momentum: Textual momentum maintains persistent cross-iteration memory of recurring semantic directions, their evidence, and their coverage or failure within the skill.Tracked patterns include missing inspection, wrong lookup direction, fragile formulas, and repeatedly successful verification behaviors.
  • Layer-aware skill update: Layer-aware updates must organize learned behavior within the skill hierarchy so future executions can retrieve and apply it under appropriate conditions.This distinguishes SkillGrad from optimizing a flat prompt by coupling behavioral changes with their placement.

4 Experiments

Across SpreadsheetBench Verified and WikiTableQuestions, SkillGrad outperforms training-free and training-based baselines with both gpt-5.4 and gpt-4.1. Its gains persist across skill initializations and weaken when momentum or contrastive diagnosis is removed.

  • Main results: SkillGrad reaches 71.11% with gpt-5.4 on SpreadsheetBench, improving over the average of Trace2Skill and EvoSkill by 4.44 percentage points.With gpt-4.1, it reaches 54.17%, while Trace2Skill and EvoSkill each reach 37.22%.
  • Training-free comparison: The LLM-generated base skill lowers SpreadsheetBench accuracy from 62.50% to 55.83% with gpt-5.4 and from 44.17% to 36.67% with gpt-4.1.SkillGrad reverses this degradation by optimizing the skill rather than using it only once.
  • Initialization robustness: SkillGrad improves the third-party skill from 60.00% to 69.44% on SpreadsheetBench and from 78.57% to 83.34% on WikiTQ with gpt-5.4.With gpt-4.1, the corresponding improvements are 33.33% to 45.83% and 42.86% to 53.81%.
  • Out-of-distribution evaluation: SkillGrad achieves the best OOD accuracy in every WikiTQ initialization and backbone block, including gains of 3.81 pp over the training-based average with gpt-5.4.With gpt-4.1, it improves over Trace2Skill by 13.65 pp and over EvoSkill by 20.32 pp.
  • Ablations: Removing momentum reduces held-out accuracy from 72.50% to 65.83%, while removing contrastive diagnosis decreases it to 68.33%.Both ablations still receive training trajectories and edit a skill, and the full update loop benefits from recurring evidence and successful recoveries.

5 Analysis

SkillGrad is relatively robust to tested batch sizes, with batch size 4 achieving the best observed balance and accuracy. Its fixed ten-iteration budget avoids non-monotonic textual updates, while the full run costs USD 6.40 ± 0.38 on average without fine-tuning model weights.

  • Batch size: 72.5% accuracy is achieved with batch size 4, versus 70.0% with batch size 2 and 70.8% with batch size 6 under 10 fixed textual updates.Batch size 4 corresponds to one pass over the 40-task training pool; batch size 6 includes repeated tasks after the first pass.
  • Batch size: Batch size 4 provides the best observed balance between evidence per update and update frequency, while larger batches require one patch to compress more diagnoses.Small batches under-sample the training pool under the fixed update budget, whereas larger batches do not automatically improve the optimized skill.
  • Checkpoint selection: Accuracy reaches its best observed checkpoint at the one-pass setting, then declines after iteration 10, showing that textual updates are not monotonic.Later edits can trade off against earlier general rules, motivating the fixed iteration budget rather than post-evaluation checkpoint selection.
  • Training cost: USD 6.40 ± 0.38 is the average cost of a full ten-iteration SkillGrad run across three gpt-5.4 training seeds.Per-iteration cost rises from about USD 0.35 at iteration 1 to about USD 0.85 at iteration 10.
  • Training cost: Momentum and patch stages mainly drive cost growth because their prompts include skill improvement instructions and accumulated pattern state.Execution and diagnosis remain roughly flat with fixed mini-batch size; SkillGrad produces a reusable artifact without fine-tuning model weights or a large validation sweep.

6 Conclusion

SkillGrad presents an optimization-inspired framework that treats agent skills as structured artifacts and improves them through an optimization loop. Across two benchmarks, it improves skills initialized from both LLM-generated and third-party sources.

  • 6 Conclusion: SkillGrad provides an optimization-inspired framework for agent skill improvement.It maps execution evidence, diagnosis, momentum, and layer-aware patching to the main stages of an optimization loop.
  • 6 Conclusion: SkillGrad treats a structured skill package as the optimizable artifact.The framework uses execution evidence, diagnosis, momentum, and layer-aware patching as optimization-loop stages.
  • 6 Conclusion: Across SpreadsheetBench Verified and WikiTableQuestions, SkillGrad improves skills initialized from LLM-generated and third-party sources.The results suggest a practical path for improving agent skills through structured optimization.

Limitations

The evaluation centers on spreadsheet tasks, while the framework’s transferability to other skill domains remains untested. The analysis is also empirical and qualitative, leaving the stability of diagnosis- and momentum-driven updates without a formal account.

  • Evaluation scope: SkillGrad is evaluated primarily on spreadsheet-centered tasks, with WikiTableQuestions serving as an out-of-domain transfer setting.The passage identifies the current evaluation scope and transfer setting.
  • Future work: Future work should test transfer to web automation, document editing, and codebase maintenance, and formally characterize when textual diagnoses and momentum states yield stable updates.The passage presents both broader-domain evaluation and formal analysis as future directions.

A Experimental Details · A.1 Configurations · A.2 Skill Instantiation

The appendix fixes the evaluation and optimization protocol across SpreadsheetBench and WikiTableQuestions, while defining default and alternative skill initializations for SkillGrad. It also preserves a three-layer skill structure and a consistent resource layout across methods and initializations.

  • A.1 Configurations: SpreadsheetBench uses one canonical split with 200 training candidates, 20 validation tasks for EvoSkill, and 120 fixed test tasks.The remaining held-out tasks are unused, and the held-out tasks are shuffled once with a fixed seed.
  • A.1 Configurations: WikiTableQuestions evaluation uses a fixed randomly sampled subset of 70 examples shared across methods and backbone models.The subset is used only for evaluation.
  • A.1 Configurations: Training sets contain 40 tasks sampled from initialization failures on the 200-task SpreadsheetBench candidate pool for each backbone, initialization, and training seed.Tasks are selected after executing the initialization skill on the candidate pool.
  • A.1 Configurations: SkillGrad’s default optimization uses batch size 4, 10 iterations, and a maximum of 30 agent turns per training example.With 40 training tasks, this default performs one pass over the sampled training set and does not use validation for model selection or discarding optimization artifacts.
  • A.1 Configurations: SpreadsheetBench reports hard accuracy, requiring all required cells to match, whereas WikiTableQuestions reports denotation accuracy under its standard protocol.All WikiTableQuestions methods use the same fixed sampled subset.
  • A.2 Skill Instantiation: The study optimizes a given agent skill while maintaining its three-layer structure, using an LLM-generated xlsx skill with a concise SKILL.md as the default initialization.This initialization supports the main analysis, hyperparameter studies, and component ablations.
  • A.2 Skill Instantiation: A third-party xlsx skill downloaded from a public repository serves as an alternative initialization only in the main results table.This tests improvement from a more comprehensive starting skill while keeping the rest of the analysis tied to the default initialization.
  • A.2 Skill Instantiation: Additional skill resources are placed under references/*.md, keeping the format consistent across methods and initializations.This arrangement applies to files other than SKILL.md.

B L3 Resource Usage · C Qualitative Training Dynamics

SkillGrad creates and retrieves conditional L3 reference files during held-out evaluation, with usage varying across optimization seeds. Qualitative diagnostics examine the resulting skill structure, momentum state, and patch magnitude as descriptive indicators of training behavior.

  • B L3 Resource Usage: A task is L3-activated when its trajectory contains at least one read_reference tool call.
  • B L3 Resource Usage: SkillGrad evaluates L3 activation on the held-out SpreadsheetBench Verified test split with gpt-5.4.The evaluations use three LLM-generated-initialization runs solving 87, 83, and 86 tasks.
  • B L3 Resource Usage: The LLM-generated base skill contains only SKILL.md, whereas optimization creates conditional reference files for retrieval.
  • B L3 Resource Usage: Seed 0 and seed 2 place narrower mapping and formula procedures in L3 and retrieve them for about half of held-out tasks.
  • B L3 Resource Usage: Seed 1 places a broader non-target-change check in L3 and retrieves it on almost every task.
  • B L3 Resource Usage: The variation in L3 retrieval reflects independently produced L3 files across optimization runs.
  • B L3 Resource Usage: Across runs, the executor retrieves learned L3 resources during evaluation, exercising the extra hierarchy on held-out tasks.
  • C Qualitative Training Dynamics: Qualitative training dynamics are descriptive rather than a formal convergence analysis because SkillGrad optimizes discrete text files instead of differentiable parameters.The diagnostics examine changes in skill structure, momentum state, and patch magnitude.

C.1 Skill Structure … D Qualitative Ablation Analysis

SkillGrad’s layer-aware updates stabilize broadly reusable guidance while expanding conditional procedures, and its momentum and patching dynamics become increasingly incremental across iterations. Qualitative ablation analysis compares these intermediate behaviors and final artifacts with the full SkillGrad run.

  • C.1 Skill Structure: Iteration 1 expands SKILL.md from 40 to roughly 120 lines, mainly adding workbook classification and mapping shape rules.The L2 layer then remains between roughly 130 and 155 lines, with a final mean of 154 lines.
  • C.1 Skill Structure: The L3 layer grows almost monotonically from zero to roughly 13k characters by iteration 10.This conditional layer stores algorithmic and edge-case material, loaded when its L2 pointer is relevant, while L2 plateaus.
  • C.2 Momentum Dynamics: The cumulative momentum pattern count reaches roughly 10 by iteration 7 and changes little through iteration 10.The new-pattern rate decays from roughly three patterns in iteration 1 to zero or one during iterations 5–9.
  • C.2 Momentum Dynamics: From iteration 3 onward, the active pattern count stays in a stable 4 ∼5 band, preserving recurring evidence for later patches.Together with saturation and declining novelty, this aligns with momentum’s intended stabilizing role.
  • C.3 Patcher Magnitude Behavior: Iteration 1 adds roughly 1170 words and removes about 80 across the xlsx/ tree, making it qualitatively different from later patches.Because SkillGrad edits text rather than numeric parameters, word-level diffs provide a descriptive proxy for patch magnitude.
  • C.3 Patcher Magnitude Behavior: From iteration 2 onward, mean added word count drops to about 330 per iteration and remains in a 240–410 band through iteration 10.Removed words remain consistently low, indicating smaller and more incremental post-bootstrap patches.
  • D Qualitative Ablation Analysis: The ablation analysis examines intermediate training behavior and final skill artifacts from the same runs to distinguish ablated optimizers from full SkillGrad.Section 4.3 reports component ablations only by held-out hard accuracy, whereas this analysis inspects additional diagnostics.

D.1 Momentum Ablation

Momentum improved late-training task performance and changed how evidence was organized in the final skill tree. With momentum, recurring evidence was more consolidated into conditional L3 references and training solved two mini-batches completely.

  • D.1 Momentum Ablation: 2416 vs. 1863 words were placed in the always-loaded L2 file without versus with momentum, while conditional L3 references contained 1894 vs. 2786 words.The final skill trees had nearly the same total line count, but no momentum placed more text in L2 and less in conditional L3 references.
  • D.1 Momentum Ablation: 2.67/4 vs. 1.83/4 correct tasks was the late-training average with versus without momentum.The momentum run solved two mini-batches completely, whereas the no-momentum run solved none completely.
  • D.1 Momentum Ablation: Momentum carried recurring evidence across iterations, consistent with stronger consolidation into the conditional hierarchy.Without momentum, no mini-batch was solved completely, and the late-training average was lower.

D.2 Contrastive Diagnosis Ablation

The failure-only ablation remains strong but solves fewer held-out tasks than the full contrastive-diagnosis method. Contrastive diagnosis adds workflow-oriented patterns alongside operation-level corrections, capturing broader execution habits.

  • D.2 Contrastive Diagnosis Ablation: 82/120 held-out tasks are solved by the failure-only ablation.Its final record contains 5 operation patterns and 0 workflow patterns.
  • D.2 Contrastive Diagnosis Ablation: Failure analysis converts local trajectory mistakes into triggered corrective rules for concrete spreadsheet mechanisms.The conditional references address formula materialization, formula return ranges, and grouped block transfers.
  • D.2 Contrastive Diagnosis Ablation: The full method solves five additional held-out tasks and records both operation-character and workflow-character patterns.Workflow patterns include artifact classification, output-channel selection, trusting workbook structure, and verifying final placement at the appropriate abstraction level.

E Qualitative Comparison of Skills · F Prompts

The qualitative comparison shows SkillGrad transforms spreadsheet skills from generic or broad toolkits into hierarchical, task-conditioned artifacts with explicit inspection, routing, verification, and structural-edit procedures. The prompts operationalize execution, failure and contrastive diagnosis, momentum-based pattern tracking, and patch-oriented skill improvement.

  • E Qualitative Comparison of Skills: The optimized default skill expands a short generic SKILL.md into a hierarchical artifact with a 157-line always-loaded file and 277 total lines across two conditional L3 references.The artifact adds workbook inspection, routing decisions, explicit verification, and conditional L3 procedures.
  • E Qualitative Comparison of Skills: The optimized third-party skill preserves broad spreadsheet coverage while adding task-conditioned rules for workbook inspection, destination semantics, formula safety, and structural edits.Its structural-edit procedure is conditionally loaded as an L3 reference.
  • F.1 Executor Prompt: The executor prompt requires activating SKILL.md before coding, loading referenced materials before implementation, and executing code through the shell while saving to the specified output path.The prompt uses progressive disclosure across metadata, SKILL.md, and on-demand bundled resources.
  • F.2 Failure Diagnoser Prompt: The failure diagnoser reconstructs errors from cell comparisons and execution traces, identifies omitted reasoning steps, and states a general error label and corrective approach inside a diagnosis block.Its example explains that formula strings saved by openpyxl remain unevaluated and recommends computing values in Python.
  • F Prompts: The contrastive diagnoser compares failed and successful executions to identify differing approaches, assess robustness, and detect reasoning steps such as inspection before coding or output verification.Its worked example treats Python computation and direct value writing as robust because they avoid formula-evaluation failures.
  • Momentum Prompt: The momentum prompt records recurring mistake or success patterns with stable anchors, accumulated remedies, per-task overlays, and workflow themes, while merging signals that share decision rules and corrective actions.It requires omitting gap and proposed_change for no-actionable-signal entries and preserves remedy history across iterations.
  • Momentum Prompt: The momentum quality gates require every task to receive an overlay, restrict workflow themes to recurring evidence, and prevent fabricated iterations or compressed remedy histories.Workflow themes require at least two successful entries in the iteration or support from a prior iteration.
Loading 2605.27760v1…