arXiv:2606.13097cs.PLcs.AI2026-06中稿 · ICML

用缓存函数拼接,让机器人代码生成更快更稳。

Functional Cache Grafting: Robust and Rapid Code-Policy Synthesis for Embodied Agents

论文配图:Functional Cache Grafting: Robust and Rapid Code-Policy Synthesis for Embodied Agents
图 1 · 摘自论文原文
  • 从预存函数库中检索并拼接代码缓存,避免重复计算。
  • 任务成功率提升18.31%,生成速度加快2.3倍。
  • 适合需要快速可靠生成控制代码的机器人应用。

代码大语言模型(CodeLLMs)通过将自然语言目标和环境约束转换为结构化控制程序,生成可执行的代码策略以驱动具身智能体。然而,在开放域具身环境中,策略生成面临两大挑战:(i) 长提示下重复的预填充计算导致解码延迟;(ii) 完全生成式解码易引发API不匹配、缺失安全防护及控制逻辑不稳定。为此,本文提出功能性缓存嫁接框架FCGraft。FCGraft维护一个函数级验证的代码骨架及其对应的提示级Transformer键值(KV)缓存库,并在新任务到来时,通过检索相关函数并嫁接其KV缓存来合成新策略。基于检索到的函数缓存,FCGraft采用拼接(stitching)与修补(patching)两种方式:前者将缓存函数段组合成复合策略,后者仅局部适配必要代码区域以满足任务参数与约束,最大限度减少额外解码。该方法消除冗余预填充计算,显著降低生成延迟;复用经验证的控制结构,相比提示级缓存方法RAGCache,任务成功率提高18.31%,策略合成速度提升2.3倍。

原文摘要 · Abstract (English)

Code-writing large language models (CodeLLMs) generate executable code policies for embodied agents by translating natural language goals and environmental constraints into structured control programs. However, policy generation in open-domain embodied environments suffers from two fundamental limitations: (i) delayed decoding caused by repetitive prefill computation over long prompts, and (ii) limited robustness due to fully generative decoding, which often produces API mismatches, missing safety guards, and unstable control logic. To address these limitations, we present FCGraft, a Functional Cache Grafting framework. FCGraft maintains a library of function-level validated code skeletons and their associated prompt-level Transformer key-value (KV) caches, and synthesizes new policies by retrieving relevant functions and grafting their KV caches when a new task is provided. Given retrieved function caches, FCGraft performs cache grafting via stitching, which composes cached function segments into a composite policy, and patching, which locally adapts only the necessary code regions to satisfy task-specific parameters and constraints with minimal additional decoding. By eliminating redundant prefill computation, this approach reduces generation latency, while reusing validated control structures improves robustness over prompt-level caching methods RAGCache, achieving 18.31% higher task success rate and 2.3x faster policy synthesis.

代码生成具身智能缓存优化

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。