Skip to content
Functional Cache Grafting: Robust and Rapid Code-Policy Synthesis for Embodied Agents
cs.PL · · In daily digest 20260616

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

Authors: Saehun Chun, Wonje Choi, Sera Choi, Sanghyun Ahn, Honguk Woo

The authors propose the FCGraft framework, which maintains function-level verified code skeletons and their associated Transformer KV cache library to synthesize new policies using retrieval and grafting mechanisms. This method eliminates redundant prefilling computations through cache stitching and locally adapts to task parameters via cache patching, thereby reducing generation latency and improving robustness.

Paper Summary

Problem

In open-domain embodied environments, policy generation based on CodeLLMs faces two major limitations: first, repeated prefilling computations caused by long prompts lead to decoding latency; second, fully generative decoding is prone to API mismatches, lack of safety protections, and unstable control logic.

Method Overview

  • Backbone: Code-writing Large Language Models (CodeLLMs)
  • Key module: Functional Cache Grafting (FCGraft), 包含 Cache-Stitching 与 Cache-Patching
  • Loss: N/A (基于现有模型推理优化)

Takeaways

Personal understanding — corrections welcome

Experiments show that function-level cache grafting significantly improves task success rates (by 18.31%) and accelerates policy synthesis speed (2.3 times faster) compared to prompt-level caching methods (e.g., RAGCache), demonstrating the effectiveness of reusing verified control structures.

Limitations & Questions

The coverage of the cache library may limit generalization capabilities for entirely new tasks, and the long-term stability of KV cache grafting in extremely dynamic environments requires further verification.

Reading Notes

Personal reading notes. Original paper: arXiv:2606.13097v1.

arxiv_id: 2606.13097v1

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

1. Research Background and Problem Definition

With the development of Embodied Agents, generating executable code policies (Code-as-Policies, CaP) using Large Language Models (LLMs) has become an emerging paradigm. Code-writing LLMs (CodeLLMs) can translate natural language goals and environmental constraints into structured control programs. However, the paper points out that existing CaP methods face two fundamental limitations when generating policies in open-domain embodied environments:

  1. Latency Decoding Problem: Redundant prefill computation caused by long prompts leads to decoding latency, affecting response speed in time-critical scenarios.
  2. Insufficient Robustness: Fully generative decoding is prone to API mismatches, lack of safety protections, and unstable control logic, directly leading to task failure.

The paper argues that existing memory-based methods primarily operate at the text level, offering limited computational efficiency improvements; meanwhile, existing KV cache work does not support function-level adaptation, making it difficult to cope with dynamic changes in open-domain environments. To address these issues, the authors propose the FCGraft (Functional Cache Grafting) framework.

As shown in Figure 1, the paper compares the performance of traditional CaP methods and FCGraft in open-domain scenarios (such as gas management). Traditional methods require generating complete control code from scratch for each instruction, resulting in high latency and low robustness (e.g., delayed response leading to gas leaks). In contrast, FCGraft eliminates redundant prefilling through cache grafting and reuses verified control structures, achieving fast and robust policy synthesis.

2. Core Method: FCGraft Framework

The FCGraft framework proposed by the authors aims to enhance CodeLLM-based robot programming through function-level KV caching. Its core idea is to reuse previous building blocks, similar to the skill-based paradigm in robotics, but focusing on achieving efficient policy construction through the reuse and combination of cached KV states.

2.1 Function-Level KV Cache Library

FCGraft maintains a library containing function-level verified code skeletons and their associated prompt-level Transformer key-value (KV) caches. When a new task is provided, the system retrieves relevant functions and grafts their KV caches to synthesize new policies. This cache adopts a two-layer structure: providing lightweight references while retaining full implementations.

2.2 Cache Grafting Mechanism

Based on the retrieved function cache, FCGraft executes cache grafting, which mainly consists of two interdependent phases:

  1. Cache-Stitching: Combines function calls directly through KV states. This step eliminates redundant prefill computation and ensures robustness by reusing verified control structures and API call patterns.
  2. Cache-Patching: Locally locates error spans and generates only the correction parts. Compared to full regeneration, this significantly reduces decoding time, performing local adaptation only on necessary code areas that satisfy task-specific parameters and constraints.

Figure 2 illustrates the overall architecture of FCGraft. The top shows the end-to-end robot programming workflow, while the bottom details the function-level KV cache process. This architecture indicates that FCGraft leverages native KV cache mechanisms to achieve function-level code reuse, forming the foundation for cache-grafted code policy synthesis.

3. Experimental Setup and Evaluation Results

To verify the effectiveness of FCGraft, the authors conducted evaluations in diverse open-domain scenarios, including embodied benchmarks (ALFRED, TEACh, RLBench) and real-world robot manipulation tasks.

3.1 Experimental Environments and Tasks

The paper uses multiple benchmark environments to test the system’s generalization capabilities. Figure 4 shows a set of RLBench environment examples. Additionally, the experiments cover four scene types (kitchen, living room, bedroom, bathroom), as shown in Figure 5, and four task types (slice, clean, pick up, boil), as shown in Figure 6.

3.2 Performance Comparison

Experimental results show that FCGraft achieves a better trade-off between robustness and latency compared to RAGCache. Specific data is as follows:

  • Task Success Rate: Improved by 18.31% compared to RAGCache.
  • Policy Synthesis Latency: Reduced by an average of 2.3 times (i.e., 2.3 times faster).

Figure 3 shows qualitative examples of FCGraft in real-world robot manipulation, further proving its effectiveness in actual deployment. By eliminating redundant computation and reusing verified control structures, FCGraft is able to deliver fast, reliable, and consistent policy synthesis.

4. Summary and Contributions

The main contributions of this paper are summarized as follows:

  1. Proposed the FCGraft Framework: Improved CodeLLM-based robot programming through function-level KV caching, achieving behavioral consistency in open-domain environments while reducing redundant prefilling.
  2. Introduced Cache-Stitching and Cache-Patching Mechanisms: Established both as interdependent mechanisms, where stitching is used to eliminate structural errors and reduce prefilling, and patching is used to correct local errors with minimal decoding.
  3. Validated Optimal Trade-off: Demonstrated that FCGraft achieves the optimal trade-off between robustness and latency in diverse open-domain scenarios (including real-world robot manipulation).

The paper argues that ensuring robust code generation while minimizing redundant computation is crucial for practical CaP deployment. FCGraft provides new insights for solving response speed and reliability issues for embodied agents in dynamic environments by reusing verified code skeletons and KV caches.

This note was included in the arXiv daily digest 20260616. More roundups at blog archive .