SkillZip: Contract-Preserving Graph Compression for Scalable Agent Skill Libraries
让AI智能体不必每次都读完整的'技能手册',只调取所需步骤,并在压缩时保留可执行的关键约定
AI智能体依赖越来越多的程序性'技能包'来指导操作,若每次都整包加载,会浪费上下文并重复加载相互重叠的步骤。SkillZip将技能拆分为按功能分区的节点,把跨技能反复出现的流程压缩成可逆的'宏'节点,同时保留其执行约定(输入输出、执行条件、验证条件),并只在任务需要时展开相应部分。在技术型和具身智能体基准测试中,该方法比最强基线高出最多12.2个百分点,同时实现3.46倍压缩率、99.2%的依赖保留率和98.7%的验证可达率。
METAL MEDIA 解读图
SkillZip流程:从技能包到压缩后的可执行上下文
证据状态已报告实测结果
- Sec2Graph将技能包拆分为按角色分类的分区节点(意图、输入、前置条件、操作、验证器、输出),连接成可执行图。
- MotifZip寻找跨技能反复出现且边界接口、依赖关系、验证可达性一致的子图,只将这些改写为可逆的宏节点。
- PathHydrate查询到来时,只在固定上下文预算内展开该任务实际需要的压缩图部分。
- ReZip根据新加入的技能和执行成功/失败反馈持续更新压缩库,提升新流程或撤回变得有风险的宏。
他们做了什么
- 问题:随着技能库增长,整包检索会重复加载相互重叠的流程,纯文本压缩可能掩盖对执行至关重要的约定(输入输出、验证条件),而执行图通常在检索之后才构建,导致技能库本身从未以压缩形式被持久存储。
- 方法:Sec2Graph先将每个技能包拆分为按角色分类的分区节点(意图、输入、前置条件、操作、验证器、输出等),连接成可执行图;MotifZip随后在多个技能中寻找边界接口、依赖关系和验证可达性都一致的重复子图,只将这些子图改写为可逆的'宏'节点。
- 在查询时,PathHydrate只在固定上下文预算内展开任务实际需要的压缩图部分;ReZip则根据新加入的技能和执行反馈(成功或失败记录)持续更新压缩库,提升新出现的常用流程,或撤回变得有风险的宏。
- 实验在SkillsBench(技术型软件智能体基准)和ALFWorld(具身家庭智能体基准)上进行,覆盖多个大语言模型骨干模型。
- 结果:SkillZip在ALFWorld上比最强基线SkillDAG高出最多12.2个百分点,实现3.46倍压缩率,依赖保留率达99.2%,验证可达率达98.7%,且在技能库规模从200个扩展到10万个时检索优势依然保持;在1000个技能的库中,51.7%的任务只需不到2000个token的上下文,最常见区间为1000到1500个token。

| Backbone | Method | SkillsBench (19) | ALFWorld (40) | ||||||
|---|---|---|---|---|---|---|---|---|---|
| R↑ | Ret@1↑ | Ret@5↑ | MRR↑ | R↑ | Ret@1↑ | Ret@5↑ | MRR↑ | ||
| MiniMax-M2.7 | Vanilla Skills | 17.2 ↑6.8 | – | – | – | 47.1 ↓3.6 | – | – | – |
| Vector Skills | 10.4 | 3.6 | 10.8 | 5.8 | 50.7 | 37.9 | 68.6 | 49.2 | |
| GoS (24) | 18.7 ↑8.3 | 50.6 ↑47.0 | 65.5 ↑54.7 | 57.3 ↑51.5 | 54.3 ↑3.6 | 56.4 ↑18.5 | 86.4 ↑17.8 | 67.9 ↑18.7 | |
| SkillDAG (1) | 27.3 ↑16.9 | 66.7 ↑63.1 | 78.2 ↑67.4 | 71.3 ↑65.5 | 67.1 ↑16.4 | 57.9 ↑20.0 | 92.1 ↑23.5 | 71.1 ↑21.9 | |
| SkillZip | 33.3 ↑22.9 | 73.6 ↑70.0 | 92.0 ↑81.2 | 81.3 ↑75.5 | 79.3 ↑28.6 | 85.7 ↑47.8 | 98.6 ↑30.0 | 91.2 ↑42.0 | |
| gpt-5.2-codex | Vanilla Skills | 27.4 ↑5.9 | – | – | – | 89.3 ↓3.6 | – | – | – |
| Vector Skills | 21.5 | 3.6 | 10.8 | 5.8 | 92.9 | 37.9 | 68.6 | 49.2 | |
| GoS (24) | 34.4 ↑12.9 | 50.6 ↑47.0 | 65.5 ↑54.7 | 57.3 ↑51.5 | 93.6 ↑0.7 | 56.4 ↑18.5 | 86.4 ↑17.8 | 67.9 ↑18.7 | |
| SkillDAG (1) | 36.8 ↑15.3 | 70.1 ↑66.5 | 75.9 ↑65.1 | 73.0 ↑67.2 | 93.6 ↑0.7 | 60.4 ↑22.5 | 85.1 ↑16.5 | 69.6 ↑20.4 | |
| SkillZip | 43.0 ↑21.5 | 74.7 ↑71.1 | 88.5 ↑77.7 | 81.0 ↑75.2 | 96.4 ↑3.5 | 90.7 ↑52.8 | 99.3 ↑30.7 | 95.0 ↑45.8 |

| Skills | Section nodes | Graph + MotifZip↓ |
|---|---|---|
| 100 | 6,441 | 274 ms |
| 200 | 10,309 | 436 ms |
| 500 | 24,333 | 1.06 s |
| 1K | 48,838 | 1.44 s |
| 2K | 96,739 | 2.90 s |
| 5K | 240,080 | 7.78 s |
| 10K | 477,681 | 16.1 s |
| 100K | 4.77 M | 178 s |
| Method | Online (ms)↓ | Rendered Tok↓ |
|---|---|---|
| Vector Skills | 12.1 | 2,834 |
| GoS | 34.6 | 2,517 |
| SkillDAG | 41.2 | 3,103 |
| SkillZip | 27.9 | 1,941 |
| Metric | Vanilla Skills | SkillDAG | SkillZip |
|---|---|---|---|
| Total prompt↓ | 2,429,237 | 2,782,696 | 1,473,532 |
| Uncached prompt↓ | 78,081 | 76,880 | 62,526 |
| Cached prompt↓ | 2,351,156 | 2,705,816 | 1,411,006 |
| Completion↓ | 34,592 | 31,963 | 20,601 |
| Tool calls↓ | 32.9 | 36.9 | 28.9 |
| Task time (s)↓ | 464.7 | 429.7 | 339.0 |
| Reward↑ | 17.2 | 27.3 | 33.3 |
| Retrieval unit | Matching evidence | Selected context | Context consequence |
|---|---|---|---|
| Skill level | Package-level similarity to both skill descriptions | Full Clean CSV and Pivot Table packages | Includes the requested routine, but also exposes missing-value repair, pivot aggregation, and competing output rules. |
| Section level | Operation anchor (normalize headers) and verifier anchor (row count unchanged) | Mingest with file/schema dependencies and the row-count verifier | Closes the required dependencies and verifier path without loading unrelated downstream branches. |
| Occurrence | Interface | Execution | Verification | MotifZip decision |
|---|---|---|---|---|
| Clean CSV | CSV + delimiter → normalized table | Infer delimiter, parse rows, normalize headers, and preserve row identity | Schema report and reachable row-count hook | Accept into Mcsv-ingest |
| Pivot Table | CSV + delimiter → normalized table | Same ingest routine; pivot aggregation starts after the macro output port | Schema report; downstream total verifier remains occurrence-specific | Accept into Mcsv-ingest |
| Formula-Safe Workbook | XLSX → formula-preserving workbook | Use a formula-aware resource and preserve formulas during normalization | Formula-integrity and row-count verifiers | Reject from the CSV macro; retain separately |
| Reversible rewrite Mcsv-ingest keeps occurrence-specific source/port maps and downstream verifiers. |
| Stage | Incoming signal | Contract evidence | ReZip update | Resulting library state |
|---|---|---|---|---|
| Insert | A new Merge Monthly Reports skill arrives | Ingest matches Mcsv-ingest; the align–merge–balance subgraph is unmatched | Reuse the ingest macro and buffer the residual | Known structure is compressed; novel steps remain explicit |
| Promote | The merge residual recurs in later skills | Ports, dependencies, resource family, and balance verifier remain stable | Promote Mperiod-merge | Later skills reuse one verified period-merge routine |
| Revise | Formula-bearing tasks repeatedly expand or fail the generic export macro | Failures localize to the XLSX resource and formula-integrity verifier | Split by resource family; require full source for XLSX | CSV export remains compact; workbook safeguards are restored |
| Reuse | A future CSV or workbook query arrives | Task anchors identify the required resource and verification contract | Select the macro and hydration level by task contract | Compact where stable; source-expanded where evidence indicates risk |
研究结果
- 在SkillsBench和ALFWorld上的实验中,SkillZip比最强基线SkillDAG在ALFWorld上高出最多12.2个百分点(以任务奖励或情节成功率衡量)。
- SkillZip实现了3.46倍的压缩率,活跃存储减少71.0%,同时依赖保留率保持在99.2%,验证可达率保持在98.7%。
- 当技能库规模从200个扩展到10万个技能时,检索性能优势依然保持稳定。
- 在1000个技能的库中,51.7%的任务处理仅使用了不到2000个token的渲染上下文,最常见的区间是1000到1500个token。
- SkillZip作为即插即用的程序性记忆层,在六种不同的大语言模型骨干上均可应用,无需针对特定骨干模型进行微调。
可应用场景
- 拥有大量文档化流程(如表格清洗、结果验证、机器人操作步骤)的AI智能体系统,可参考此方法在节省上下文预算的同时避免重复加载相互重叠的流程。
- 技能库持续扩张且不断积累执行日志的服务,可参考ReZip的思路来维护压缩后的宏:提升新出现的可复用流程,并撤回被证明有风险的宏。
- 该框架同时在技术型编程/数据处理基准和具身家庭机器人基准上进行了测试,可为跨领域压缩方法的实验设计提供参考。
局限与待验证事项
- 实验仅限于SkillsBench(技术型软件智能体)和ALFWorld(家庭机器人智能体)两个基准,在其他领域的表现尚未单独验证。
- 宏的筛选与改写采用贪心策略,论文本身也说明该策略不保证在所有重叠模式上达到全局最优。
- 部分分区角色分类和约定提取依赖模型辅助解析,论文未详细验证解析边界或角色推断错误可能对压缩质量造成的影响。
- 论文未单独提供ReZip在长期持续运行的大规模生产环境中,对宏进行提升、拆分、退役的长期追踪实验。
为什么重要
随着技能库从几百条扩展到数万条,整包加载的成本和相互重叠流程带来的混乱会同步增加,而SkillZip提供了一种在分区级别压缩、同时不丢失保证执行安全的约定(输入输出、验证)的具体方法。这为构建大规模智能体技能库的从业者提供了同时管理上下文预算与正确性的可参考方案。
本文术语
- 技能包 · 包含指令、脚本、参考资料和验证规则的程序性知识包,供AI智能体在推理时加载使用
- 程序约定(procedural contract) · 定义一个流程接受什么输入输出、在什么条件下执行、以及结果如何被验证的规约
- 宏节点(macro node) · 将反复出现的流程子图压缩为一个节点的表示方式,必要时可无损展开回原始源内容
- 验证可达性(verifier reachability) · 从每个改变状态的操作出发,是否确实存在一条通往验证该结果的检查步骤的路径
- 依赖保留率(dependency preservation) · 压缩后各流程之间的输入、条件、资源连接关系被保持完整的程度
论文原文摘要(英文)
Large Language Models (LLMs) increasingly act as agents whose procedural knowledge is stored in reusable skill packages and loaded at inference time. As skill libraries grow, a central challenge is to expose the smallest sufficient executable context under a limited context budget. Existing systems struggle to reuse routines below the whole-skill level, preserve procedural contracts during compression, keep compressed routines executable and expandable, and update the compressed library as skills evolve. These challenges reveal a unit mismatch: skills are retrieved as packages, compressed as text, and converted into execution graphs only after retrieval, whereas reliable reuse requires a contract-bearing procedural unit. We propose SkillZip, an execution-aware procedural abstraction framework that performs contract-preserving compression over section-level graphs. SkillZip rewrites recurring contract-valid motifs into reversible ported macros while preserving boundary signatures, dependency closure, verifier reachability, and source-level expansion. At inference time, it hydrates a compact, dependency-closed context and expands macros only when required. ReZip further integrates new skills and revises risky macros using execution evidence. Comprehensive experiments1 on technical and embodied agent benchmarks show SkillZip consistently outperforms the strongest baseline by up to 12.2 points, while achieving a 3.46x compression ratio with 99.2% dependency preservation and 98.7% verifier reachability. Scaling analyses further confirm robust retrieval across skill libraries ranging from 200 to 100K skills.
在 arXiv 阅读最新论文
- SWE-bench Science: Can Coding Agents Resolve Engineering Tasks in Science?让AI编程助手去修复真实科学软件,连最强的那个也有一半以上任务没做对
- FlashPrefill V2: Block-Sparse Prefill Attention for Long-Context LLM Serving把稀疏注意力从论文原型变成能真正上线服务的加速方案
- PolicyGuide: From Guarding One Action to Guiding the Whole Workflow for Policy-Compliant LLM Agents让客服AI坐席不只是拦住一个危险动作,而是把整个流程走对
- EXIMO: VLM Guided Exploration of VLA Policies不用人工遥控演示,让会说话的AI来教机械臂做新家务
- EnvHarness: Awakening Static Worlds for Agent Learning不重新搭建训练环境,而是给现有环境套一层可插拔组件,针对每个智能体的具体弱点重新塑形
- Bounded Sovereignty and the Control Tax: Pricing AI Oversight When the Deployer Does Not Own the Model租用AI而非拥有AI的机构,安全监管能力只剩一半
- Beyond Imitation: Filtering On-Policy Distillation by Reasoning ProgressAI模仿老师模型学习时,会误伤本来推理正确的步骤,新方法专门过滤掉这种误伤
- PersonalBench: Measuring the Authorship Gap in LLM Personalization让AI模仿某人的文风,结果发现它始终摆脱不了自己的腔调
METAL MEDIA 最新报道
图片来源: Xingyu Tan et al., arXiv:2608.05604, CC BY 4.0