Interactive Speculative Planning: Enhance Agent Efficiency through Co-design of System and User Interface

## Abstract

Abstract Agents, as user-centric tools, are increasingly deployed for human task delegation, assisting with a broad spectrum of requests by generating thoughts, engaging with user proxies, and producing action plans. However, agents based on large language models (LLMs) often face substantial planning latency due to two primary factors: the efficiency limitations of the underlying LLMs due to their large size and high demand, and the structural complexity of the agents due to the extensive generation of intermediate thoughts to produce the final output. Given that inefficiency in service provision can undermine the value of automation for users, this paper presents a human-centered efficient agent planning method – Interactive Speculative Planning – aiming at enhancing the efficiency of agent planning through both system design and human-AI interaction. Our approach advocates for the co-design of the agent system and user interface, underscoring the importance of an agent system that can fluidly manage user interactions and interruptions. By integrating human interruptions as a fundamental component of the system, we not only make it more user-centric but also expedite the entire process by leveraging human-in-the-loop interactions to provide accurate intermediate steps. Code and data will be released.

## 1 Introduction

Large language models (LLMs) have demonstrated strong reasoning abilities (Zhang et al., ; Qiao et al., ; Fan et al., ; ; Jin et al., ), enabling them to plan and interact with external tools and the real world. This has led to the development of LLM-based agents, which have become popular as task solvers and human assistants. Various agent frameworks have been created to facilitate these applications, including single-agent systems such as Langchain (Topsakal & Akinci, ), OpenAGI (Ge et al., ), and HuggingGPT (Shen et al., ), as well as multi-agent systems like AutoGen (Wu et al., ), MetaGPT (Hong et al., ), BabyAGI (Nakajima, ), and Camel (Li et al., ). Numerous methods have also been proposed to enhance the performance of LLM-based agents, ranging from chain-of-thought (Wei et al., ), tree-of-thought (Yao et al., ), ReAct (Yao et al., ), Reflexion (Shinn et al., ), to multi-agent discussion (Chan et al., ) systems.

However, these high-performing advancements in agents often come at the expense of time efficiency (Zhou et al., ; Ding et al., ; Zhang et al., ), which can be attributed to three main reasons: (1) the underlying backbone language model can be inefficient due to its increasingly large size and high request volume, (2) the complex agent structure, such as tree-of-thought and ReAct, which requires generating prolonged thought before the final answer, leading to extended waiting time and increased token generation costs, and (3) the sequential nature of action steps in plans, where one action must be completed before the next can begin. But notice that not all steps in agent planning necessitate computationally intensive thought processes, making the universal application of complex agent architectures or agents with advanced backbone LLMs inefficient.

Moreover, latency is a critical factor for user experience. Many studies (Horvitz, ; Barron et al., ; Simpson et al., ; Carr et al., ) have demonstrated the physiological and psychological impacts from interaction delays during human-computer interaction on users. While agents are designed to assist users, few designers have prioritized user experience, which should be of high importance. In addition, numerous studies have discussed the role of automation in human-computer interaction (Lubars & Tan, ; Hemmer et al., ), highlighting a low preference for full AI control in task delegation and a strong preference for machine-in-the-loop or human-in-the-loop designs where humans maintain a central role. Thus, a fully automated agent system with long intermediate delays is suboptimal for user experience, a feature that is, however, prevalent in most LLM-based agent systems today.

Figure: Figure 1: Interactive Speculative Planning: user query is handled by speculative planning with approximation and target agent. Then a rescheduling mechanism serializes the computed result on UI and enables the user to actively interact with the system for further acceleration. Finger-pointed action is the action intervened by the user.
Refer to caption: x1.png

Therefore, this work aims to address the latency issue from both aspects of system design and human interaction by introducing an interactive efficient planning algorithm, representing the first system for agent latency efficiency and management of human interactions and interruptions: Interactive Speculative Planning. Figure 1 is a simple domonstration of the system. This approach seamlessly integrates temporal efficiency and human-in-the-loop interaction, anticipating user engagement during periods of long latency. By treating user input as intermediate results, the system accelerates the overall process, thereby enhancing both temporal efficiency and user experience. Consequently, this system offers a more user-centric and efficient solution for agents as human delegates.

The system-level algorithm is speculative planning, which is inspired by speculative decoding (Leviathan et al., ; Liu et al., ; Chen et al., ; Spector & Re, ; Liu et al., ; Cai et al., ). It leverages two agent systems: an efficient but less capable approximation agent, and a slower but more powerful target agent. For each task, the approximation agent generates action steps sequentially. Simultaneously, for every step the approximation agent produces, the target agent is asynchronously called to generate the next step, using the current trajectory from the approximation agent as a provisional prefix. In this process, the calls to the approximation agent are sequential, while those to the target agent are asynchronous. For each action step, if the outputs of the approximation agent and the target agent match, the process continues. However, if there is a mismatch, the approximation agent is halted, and its output is replaced by the target agent’s output to ensure performance is not compromised. Figure 2 presents the process.

This strategy potentially reduces the time a target agent takes for to complete the task to that of the approximation agent, thereby enhancing time efficiency. It should be noted that while we consider a single user interface of the agent system, the system backend can be built with various architectures, including a multi-agent design.

Figure: Figure 2: Speculative Planning Algorithm Demonstration, where the cross symbol indicates the step where the $\mathcal{A}$’s computed result differs from that of $\mathcal{T}$.
Refer to caption: x2.png

Figure: Figure 3: User interface which guarantees a sequential presentation of approximation agent’s output and target agent’s output with minimum perceived latency.
Refer to caption: x3.png

Note that under the speculative planning algorithm, target agent calls are asynchronous, leading to non-sequential outputs. To facilitate user interaction, we design a UI-level rescheduling algorithm (Oh et al., ; Cheng et al., ; Mei et al., ; Jawahar et al., ; Srivatsa et al., ) that presents both the approximation agent’s results and the target agent’s results sequentially and clearly, as illustrated in Figure 3. The sequential presentation of the outputs enables users to accurately perceive the computation latency imposed by the target agent. Consequently, users may intervene in the process at their discretion, such as when a computation step is prolonged or yields erroneous results. This approach differs from traditional speculative decoding, where an algorithm judges whether to accept the results from an approximation agent, often based on probability distributions. In contrast, Interactive Speculative Planning enables active human engagement in the decision-making process, allowing them to interrupt lengthy processes and evaluate whether to accept or complement the algorithm’s results. This human-in-the-loop approach makes the system user-centric and efficient.

In summary, with active user intervention, Interactive Speculative Planning can be viewed as an interactive framework involving three agents: the approximation agent, the target agent and the human agent. These three agents collaborate and interleave their operations to collectively accelerate the overall agent planning process.

In the rest of the paper, Section 2 will introduce related work in agent and agent efficiency, Section 3 introduces the algorithm, Section 4 provides theoretical analysis on the time, rate limit, and total token generated, as well as simulation experiment, Section 5 provides empirical experiment result on actual datasets, Section 6 discusses the current limitations and potential future work of the algorithm, and Section 7 concludes the paper.

## 2 Related Work

Various agent systems (Xi et al., ; Liu et al., ; Ge et al., ) have been developed, including single agent such as Hugginggpt (Shen et al., ), OpenAGI (Ge et al., ), and BabyAGI (Nakajima, ), and multi-agent systems (Du et al., ) such as AutoGen (Wu et al., ; Zhang et al., ) and Camel (Li et al., ), based on the strong reasoning ability (Wu et al., ; Zhang et al., ) and common sense knowledge (Kwon et al., ) encoded in LLMs. To improve the performance of LLM-based agents, various methods have been proposed. The most basic approach is the chain-of-thought (Wei et al., ), where the LLM generates a step-by-step thought process for each action. More advanced methods include ReAct (Yao et al., ), where the agent thinks before acting, and Reflexion (Shinn et al., ), where the agent thinks, acts, and reflects on its decisions. The tree-of-thoughts (Yao et al., ) method involves the agent thinking several steps ahead before acting. In addition, multi-agent discussion systems (Du et al., ; Hua et al., ; Lin et al., ; Wu et al., ) have been developed in which multiple agents discuss and debate to improve performance. In general, it is observed that stronger backbone models and more complex multi-LLM interaction usually lead to better agents (Wang et al., ; Li et al., ; Chen et al., ).

However, these improvements in agent performance often come at the expense of time efficiency, as longer thought processes result in extended waiting times. Although the agent task can be intricate and sometimes only the most powerful models may be capable of executing them effectively as suggested by (Xie et al., ), not all steps within a task are equally challenging to plan and generate (Zhang et al., ; Saha et al., ). Therefore, a dynamic selection of appropriate LLMs for specific tasks can be a viable strategy to balance performance and efficiency/cost.

Numerous methods have been developed to enhance either cost or time efficiency (Zhang et al., ; Ding et al., ; Saha et al., ). EcoAssistant (Zhang et al., ) is the first system aimed at cost-efficient agents, initiating tasks with the most economical agent and switching to more capable and expensive agents only upon failure of the cheaper alternative. The System-1.x Planner (Saha et al., ) introduced a controllable planning framework using language models, capable of generating hybrid plans and balancing between complex and simple agent planning strategies based on problem difficulty, potentially offering both time and cost efficiency. However, the System-1.x Planner is limited to specific planning strategies and requires extensive training. In contrast, our proposed Interactive Speculative Planning can adopt any combination of approximation and target agent in a training-free manner, guaranteeing performance that is at least equivalent to, and potentially superior to (with user interventions) that of the target agent alone.

## 3 Interactive Speculative Planning

Interactive Speculative Planning is a collaborative framework that enhances the efficiency and accuracy of agent planning by integrating the efforts of three agents: the approximation agent, the target agent and the human agent. The approximation agent generates quick but potentially inaccurate steps, while the target agent verifies and refines these steps. The human agent intervenes to correct or optimize the latency of the planning process, ensuring that the final plan meets user expectations. This interactive approach accelerates the overall planning process and improves user experience by reducing latency and allowing for real-time adjustments.

In this section, we delves into the algorithm: Section 3.1 introduces speculative planning and Section 3.2 introduces what user interactions are expected and how the system incorporates user interactions. Let us denote the approximation agent by $\mathcal{A}$ and the target agent by $\mathcal{T}$.

### 3.1 Speculative Planning

Figure: Figure 4: Comparing the time taken to generate the first two steps of a task by agent system using speculative planning and normal agent planning.
Refer to caption: x4.png

The core concept of how time is saved by speculative planning is to expedite agent planning by employing a fast and efficient approximation agent $\mathcal{A}$ to resolve the task sequentially. For every length-$i$ prefix of the step generated by $\mathcal{A}$, both $\mathcal{A}$ and $\mathcal{T}$ are run simultaneously to generate the $i+1$th step based on $\mathcal{A}$’s action history, without waiting for $\mathcal{T}$ to finish the
$i$th step. If the $i$th step of the plan generated by both agents matches after $\mathcal{T}$ finishes it, then the more efficient but less capable agent $\mathcal{A}$ is deemed to have correctly computed the step, and $\mathcal{T}$’s $i+1$th step computed based on it is usable. Time is thus saved because the time for $\mathcal{T}$ to compute steps $i$ and $i+1$ is reduced to the time taken by $\mathcal{A}$ to compute step $i$ and $\mathcal{T}$ to compute step $i+1$. However, if there is a mismatch, it implies that $\mathcal{A}$ has erred at the $i$th step, and its output is replaced with $\mathcal{T}$’s result. Furthermore, all concurrent calls of $\mathcal{A}$ and $\mathcal{T}$ with prefixes longer than $i$ must be halted and discarded, as they are based on an incorrect prefix and their results are unusable. In short, this algorithm achieves time savings by having $\mathcal{T}$ utilize the result generated by the fast $\mathcal{A}$ as a prefix to generate the next step, rather than waiting for prefix steps from the slower $\mathcal{T}$ to be completed.

This algorithm achieves time savings by having $\mathcal{T}$ utilizes the result generated by the fast $\mathcal{A}$ as a prefix to generate the next step, rather than waiting for prefix steps from the slower $\mathcal{T}$ to be completed. An example comparison of the time taken to generate the first two steps of a task using speculative planning and normal agent planning is illustrated in Figure 4:

Figure 2 presents a scenario where one person with their friends A, B, C went to a restaurant and they paid the bill, and now they need to split the money with their friends. When initiating speculative planning, both $\mathcal{A}$ and $\mathcal{T}$ are started simultaneously to generate the first step. Upon $\mathcal{A}$’s completion of the first step (“split money”), both agents are called again simultaneously, utilizing “split money” as the current action trajectory to generate next step. This process is repeated for subsequent steps. Once $\mathcal{T}$ completes its first call, generating the first step (“split money”), the correctness of $\mathcal{A}$’s first step can be confirmed. Since the first step is correct, the second step from $\mathcal{A}$ is potentially correct waiting to be confirmed by the second step from $\mathcal{T}$, which is definitively usable. However, if $\mathcal{A}$’s output mismatches with $\mathcal{T}$’s output, all subsequent steps are deemed incorrect. In this example, $\mathcal{T}$ completes its second call (“verify A’s Venmo”) before the first call which verifies the second step from $\mathcal{A}$ to be incorrect (“request money from A”). Consequently, all subsequent steps based on the action trajectory containing the second step are rendered useless. This includes the third call of $\mathcal{T}$ and the third step of $\mathcal{A}$ and so on.

To prevent an excessive number of concurrent target agent processes, the Interactive Speculative Planning algorithm introduces a hyperparameter $k$. This parameter sets a limit on the maximum number of steps that $\mathcal{A}$ that can sequentially propose and being executed before all corresponding target agent processes are completed. By controlling the value of $k$, users can flexibly manage the maximum number of concurrent target agent processes. A very simplified version of the speculative planning algorithm is presented in Algorithm 1:

Figure: Algorithm 1 Speculative Planning Algorithm.

### 3.2 UI Interaction Algorithm

Figure: Figure 5: UI interface issues stemming from immediate presentation of computed action steps.
Refer to caption: x5.png

Now we present the interaction component of Interactive Speculative Planning. The user interface (UI) serves a two-fold goal: (1) from the aspect of perception, it aims to provide the user with an easy-to-follow result and a basic understanding of the algorithm’s inner workings, allowing the user to see $\mathcal{T}$’s computation time for each step and how $\mathcal{A}$ is saving time; (2) from the aspect of interaction, it aims to provide system support for the user to actively interact with or interrupt the ongoing agent processes – when $\mathcal{T}$ is taking too long for a step or neither $\mathcal{A}$ nor $\mathcal{T}$ provides a satisfying step proposal during generation. Therefore, the UI interface, together with the underlying system mechanism design, primarily addresses two key aspects: (1) what the users should see and (2) how the system can handle user interactions.

For the first goal, notice that immediately printing the outputs of $\mathcal{A}$ and $\mathcal{T}$ upon generation can be very confusing for two reasons: (1) some outputs of $\mathcal{A}$ and $\mathcal{T}$ should not be shown to the user at all, and (2) the outputs of $\mathcal{T}$ are misordered. Figure 5 presents an example scenario for the two issue. For issue 1: $\mathcal{A}$’s output on the second step of the plan mismatches with $\mathcal{T}$’s output, and thus all results generated by $\mathcal{A}$ based on the mistaken “step 2” will ultimately be discarded. However, an immediate output of the agent’s generation will present $\mathcal{A}$’s computed steps “step 3, 4, 5” and $\mathcal{T}$’s computed steps “step 3, 4” which are generated based on the wrong prefix. For issue 2: as all $\mathcal{T}$’s calls are asynchronous, the time for each step to finish will not follow a sequential order, and thus an immediate printing out of the generated output will not be sequential either. Therefore, a rescheduling mechanism is needed to provide a clear presentation of the algorithm.

To ensure an understandable user interface to track the agents’ progress and facilitate user intervention, the presented output is rescheduled by a Reschedule Mechanism. This mechanism allows the user to view verified and to-be-verified computed steps of $\mathcal{A}$ and $\mathcal{T}$ with minimal perceived latency. The Reschedule Mechanism, shown in Algorithm 2, takes the queue of $\mathcal{A}$ processes and the queue of $\mathcal{T}$ processes as input, tracing the last printed out message from either $\mathcal{A}$ and $\mathcal{T}$, and then decide which message to present next to the user: (1) it presents the $i$th step from $\mathcal{A}$ only after all preceding steps from $\mathcal{A}$ have been confirmed to be consistent with $\mathcal{T}$, ensuring that no steps computed based on unverified prefixes are presented (2) it presents the $i$th step from $\mathcal{T}$ only after all preceding steps from $\mathcal{T}$ have been presented, ensuring a sequential order. This design not only ensures a sequential presentation but also highlights the time difference between $\mathcal{A}$ and $\mathcal{T}$, allowing the user to identify which action is bottlenecking the program.

Figure: Figure 6: How to handle user interruption during $\mathcal{T}$’s computation of step 1 due to excessive latency.
Refer to caption: x6.png

For the second goal, we enable users to actively interrupt the program at any time. Unlike current user interface designs in various agent systems (Wu et al., ) where users are allowed to interact with the system when being passively prompted to input information or opinions, we believe that users are more inclined to actively engage in the agent task delegation process (Lubars & Tan, ). We handle user interaction in two common scenarios: (1) when noticing excessive perceived latency between the last presented output of $\mathcal{A}$ and the next output of $\mathcal{T}$ (assuming $\mathcal{A}$’s generation speed is sufficiently fast that users would not typically interrupt it), and (2) when dissatisfied with the outputs of $\mathcal{T}$ for a given step.

For the first scenario, since the UI interface presentation for the $i$-th step of the plan can indicate the latency $l_{i}$ between the presentation of the $i$-th approximation output $a_{i}$ computed by $i$-th process of $\mathcal{A}$ and the $i$-th target output $t_{i}$ computed by $i$-th process of $\mathcal{T}$, users can choose to interrupt during the time of $l_{i}$ and input their own value. The underlying system will handle this keyboard interruption by halting the $i$-th process of $\mathcal{T}$, incorporating the user’s input into the agent action trajectory, while allowing all other concurrent processes to continue. Figure 6 demonstrates an example where the user interrupts the process after the presentation of $a_{1}$ due to excessive waiting time for $t_{1}$.

In the second scenario, users are able to interrupt the program if they deem the results from $\mathcal{T}$ unsatisfactory for a given step. During the brief presentation of the output $t_{i}$ for any step $i$, users can intervene and input their preferred optimal step for step $i$ as an oracle. Additional user interruption features, such as handling user suggestions instead of oracle results, or backtracking to previous steps rather than focusing on the current step, are potential avenues for future research.

Figure: Algorithm 2 Rescheduling Mechanism with User Interruption.

## 4 Efficiency Analysis

In this section, we will provide a theoretical analysis of the time savings (latency), total token generation requirement, and concurrent API call rate required by the speculative planning approach. Additionally, we will present simulated experiment results to support our analysis and demonstrate the effectiveness of the proposed method.

**Table 1: Notation Summary**
| $n$ | the number of planning steps for a task |
| --- | --- |
| [.4pt/1pt]<br>$time(\mathcal{A},s)$ | the time the approximation agent $\mathcal{A}$ takes to generate step $s$ in the plan |
| [.4pt/1pt]<br>$time(\mathcal{T},s)$ | the time the target agent $\mathcal{T}$ takes to generate step $s$ in the plan |
| [.4pt/1pt]<br>$e(s)$ | the time to execute a step $s$ in the plan and return an observation |
| [.4pt/1pt]<br>$token(\mathcal{A},s)$ | the token the approximation agent $A$ requires to generate step $s$ in the plan |
| [.4pt/1pt]<br>$token(\mathcal{T},s)$ | the token the target agent $T$ requires to generate step $s$ in the plan |
| [.4pt/1pt]<br>$start_time(\mathcal{A},s_{i})$ | it equals to $\Sigma_{j=b+1}^{j=i-1}(time(\mathcal{A},s_{j})+e(s_{j}))$, which indicates |
| the start time of $\mathcal{A}$ to generate step $s_{i}$ since the one previous breaking point $b$ |  |
| [.4pt/1pt]<br>$start_time(\mathcal{T},s_{i})$ | it equals to $\Sigma_{j=b+1}^{j=i-1}(time(\mathcal{A},s_{j})+e(s_{j}))$ which indicates |
| the start time of $\mathcal{T}$ to generate step $s_{i}$ since the one previous breaking point $b$. |  |
| Notice that $start_time(\mathcal{T},s_{i})=start_time(\mathcal{A},s_{i})$ |  |
| [.4pt/1pt]<br>$end_time(\mathcal{A},s_{i})$ | it equals to $\Sigma_{j=b+1}^{j=i}(time(\mathcal{A},s_{j})+e(s_{j}))$, which indicates |
| the end time of $\mathcal{A}$ of generate step $s_{i}$ since the one previous breaking point $b$ |  |
| [.4pt/1pt]<br>$end_time(\mathcal{T},s_{i})$ | it equals to $\Sigma_{j=b+1}^{j=i-1}(time(\mathcal{A},s_{j})+e(s_{j}))+time(\mathcal{T},s_{i})$, which indicates |
| the end time of $\mathcal{T}$ of generate step $s_{i}$ since the one previous breaking point $b$ |  |

### 4.1 Latency Analysis

This subsection analyzes the latency improvement brought by the speculative planning algorithm. We summarize the notations in Notation Summary 1.

When we do not utilize speculative planning, the time taken to generate and execute the whole plan is $\Sigma_{i\leq n}(time(\mathcal{T},s_{i})+e(s_{i}))$. To compute the time when employing speculative planning, we first define the list of breaking steps $B$, which consists of indices $i$ of steps $s$ in the plan where the sequential generation of $\mathcal{A}$ is halted, *i.e.* when $\mathcal{A}$’s prediction $a_{i}=\mathcal{A}(i)$ differs from $\mathcal{T}$’s prediction $t_{i}=\mathcal{T}(i)$ for the $i$-th step in the planning, as well as when the number of continuous speculative steps generated by the approximation process reaches the hyperparameter $k$. For notational convenience, let’s add $-1$ as the first element and $n-1$ as the last element in the list $B$.

The time taken to generate and execute the entire plan is then determined by the following equation, where the time to compute each sequence of steps between two consecutive elements $B_{i}$ and $B_{i+1}$ in $B$, which is determined by step $i$ that takes longest time to compute for the target agent $\mathcal{T}$:

$$ $\displaystyle\Sigma_{B_{i}\in B[:-1]}(\max\{({end_time(\mathcal{T},s_{j})}\mid B_{i}+1\leq j\leq B_{i+1}\})$ (1) $$

Figure: Figure 7: Best case scenario, assuming $k=n$
Refer to caption: x7.png

Best case scenario is that no step generated by $\mathcal{A}$ differs from the step generated by $\mathcal{T}$, as shown in Figure 7. Thus in this specific case, the breaking points $B$ is simply all numbers $i$ smaller than $n$ such that $i\;\mathbf{mod}\;k$ = 0, and the computing time for the best case is:

$$ $\displaystyle\Sigma_{i\in\{i\;\mathbf{mod}\;k=0\mid i<n\}}(\max_{i\leq j<i+k}end_time(\mathcal{T},s_{j})))$ (2) $$

Worst case scenario is that all steps generated by $\mathcal{A}$ are rejected by $\mathcal{A}$. A partial example is presented in Figure 8. In this extreme case, the set of breaking steps, $B$ comprises all integers from 0 to $n-1$.

Under these circumstances, the time taken to generate and execute the plan downgrades to normal agent planning. This equation calculates the sum of the time taken to generate and execute each step in the plan sequentially, without any speculative planning. The total time can be expressed as:

$$ $\displaystyle\Sigma_{0\leq i\leq n-1}(time(\mathcal{T},s_{i})+e(s_{i}))$ (3) $$

The aforementioned worst-case scenario demonstrates that, in terms of time efficiency, speculative planning is upper-bounded by the time taken in non-speculative planning. This implies that the maximum time required for speculative planning will not exceed the time taken by the traditional, non-speculative approach.

Figure: Figure 8: Worst case scenario
Refer to caption: x8.png

### 4.2 Total token required

In this subsection, we analyze the total token generation when using the speculative planning algorithm.

When not utilizing speculative planning, the total number of tokens used to generate and execute the plan is $\Sigma_{i<n}token(\mathcal{T},s_{i})$. Speculative planning requires more tokens, as both $\mathcal{A}$ and $\mathcal{T}$ go through the entire plan at least once, potentially generating “wasted” tokens – proposed steps that are not used in the final plan which are computed based on incorrect prefix. Between any two breaking points $B_{i}$ and $B_{i+1}$, the number of tokens generated is the sum of tokens generated by $\mathcal{A}$ and $\mathcal{T}$ for steps $s_{j}$ in between as well as “unused/wasted” tokens generated by both $\mathcal{A}$ and $\mathcal{T}$ for any step $s_{j}$ such that $j\geq B_{i+1}$, where the process ends before $\mathcal{T}$ finishes all the process between any two breaking points $B_{i}$ and $B_{i+1}$. Thus, we represent the tokens generated $T_{B_{i}}$ between two consecutive breaking points $B_{i}$ and $B_{i+1}$ as below:

$$ $\displaystyle T_{B_{i}}$ $\displaystyle=\underbrace{\Sigma_{j=B_{i}+1}^{j=B_{i+1}}(token(\mathcal{A},s_{j})+token(\mathcal{T},s_{j}))}_{\text{ sum of tokens generated by }\mathcal{A}\text{ and }\mathcal{T}\text{ in between }B_{i}\text{ and }B_{i+1}}+\underbrace{\Sigma_{j=B_{i+1}+1}^{M_{i}}(token(\mathcal{A},s_{j})+token(\mathcal{T},s_{j}))}_{\text{wasted tokens}}$ (4) $$

where $Q=\max_{B_{i}<l\leq B_{i+1}}\{end_time(\mathcal{T},s_{l})\}$ is the ending time for all steps between $B_{i}$ and $B_{i+1}$ to be computed, and $M_{i}=\min\{\max\{l<n\mid end_time(\mathcal{A},s_{l})\leq Q\},k+B_{i}\}-B_{i+1}$ is the number of wasted steps initiated by $\mathcal{A}$, that is, all processes that ends before $Q$ but are computed based on incorrect prefix.

Thus, the ultimate total number of tokens generated is the summation of $T_{B_{i}}$s:

$$ $\displaystyle\Sigma_{B_{i}\in B[:-1]}T_{B_{i}}$ (5) $$

Best case scenario is that all steps generated by $\mathcal{A}$ matches those generated by $\mathcal{T}$, and therefore we do not have any “wasted” tokens, and then both $\mathcal{A}$ and $\mathcal{T}$ go through the agent generation plan. In this situation, $M_{i}=0$ in the best case scenario for all $i$ corresponding to $B_{i}$ in $B$.

$$ $\displaystyle\Sigma_{0\leq i\leq n-1}(token(\mathcal{A},s_{i})+token(\mathcal{T},s_{i}))$ (6) $$

Worst case scenario is that none of the steps generated by $\mathcal{A}$ matches with those generated by $\mathcal{T}$. Additionally, each $\mathcal{T}$ process finishes after all $\mathcal{A}$ processes are completed, and the earliest called $\mathcal{T}$ process always finishes the last. Figure 8 represents a partial example. Formally, the worst case scenario will occur under the condition which can be expressed as:

$$ $\displaystyle\forall B_{i}\in B,$ $\displaystyle\,end_time(\mathcal{T},s_{B_{i}+1})\geq end_time(\mathcal{A},s_{B_{i+1}})\text{ and }$ (7) $\displaystyle\forall B_{i}<l\leq B_{i+1},$ $\displaystyle\,end_time(\mathcal{T},s_{B_{i}+1})\geq end_time(\mathcal{T},s_{l})\text{ and }$ (8) $\displaystyle\forall i\leq n-1,$ $\displaystyle\,a_{i}\text{ does not match }t_{i}$ (9) $$

In such a case, $Q=end_time(B_{i}+1)$ and $M_{i}=k-1$ in the worst case scenario. Each $\mathcal{A}$ process $i$ will run for $(i\mod k)+1$ times (for example, the first process where $i=0$ runs for 1 time, the $k$-th process where $i=k-1$ will run for $k$ times, and the $k+1$-th process where $i=k$ will run for 1 time), and each $\mathcal{T}$ process $i$ is run for $i$ times. Consequently, the total number of tokens generated in this worst-case scenario is:

$$ $\displaystyle\Sigma_{i=0}^{n-1}((i\mod k)+1)*(token(\mathcal{A},s_{i})+token(\mathcal{T},s_{i}))$ (10) $$

### 4.3 Rate Required

This subsection focuses on analyzing the rate required to run the speculative planning algorithm, which is determined by the maximum number of concurrently running agent calls.

When not utilizing speculative planning, all agent calls are executed sequentially. Consequently, the required rate, which is the maximum number of concurrently running agent calls, is 1. When using speculative planning, we naturally have at least 2 concurrent calls: 1 for $\mathcal{A}$ and 1 for $\mathcal{T}$. But it can be more than 2, as shown in Figure 2 where we can have many $\mathcal{T}$ processes running at the same moment. To determine the maximum concurrent $\mathcal{C}$ processes, we identify the target agent process that overlaps with the most other target processes and add 1 for the additional approximation process. For all $\mathcal{T}_{l}$ processes for $B_{i}<l\leq B_{i+1}$, we find the $j$-th process $\mathcal{T}_{j}$ that overlaps with the most other $\mathcal{T}$ processes by:

$$ $\displaystyle\mathcal{T}_{j}=\max_{B_{i}<j\leq B_{i+1}}|\underbrace{\{l<n\mid start_time(\mathcal{T},s_{l})\leq start_time(\mathcal{T},s_{j})\leq end_time(\mathcal{T},s_{l})\}}_{\text{count the number of target processes overlapping with process }j}|$ (11) $$

We denote the number of overlapping processes to be $C_{T_{i}}$. Notice that we have a hyperparameter $k$ set up which controls the number of sequential $\mathcal{A}$ calls can be conducted without waiting for all corresponding $\mathcal{T}$ calls to be finished. Therefore, Note that $C_{T_{i}}$ is upper-bounded by $k$. Since the concurrent processes are the overlapping target process plus the approximation process, $\mathcal{C}_{B_{i}}=C_{T_{i}}+1$ which is upper-bounded by $k+1$ between any consecutive $B_{i}$ and $B_{i+1}$.

Thus, the maximum concurrent $\mathcal{C}$ processes is the maximum of all $\mathcal{C}_{B_{i}}$:

$$ $\displaystyle\mathcal{C}=\max_{B_{i}\in B[:-1]}\mathcal{C}_{B_{i}}$ (12) $$

Best case scenario is where there is exactly 2 concurrent processes running, 1 $\mathcal{A}$ process and 1 $\mathcal{T}$ process and there is no time overlap between any two $\mathcal{T}$ processes. This may only occur when for each step $s_{i}$, $time(\mathcal{T},s_{i})\leq time(\mathcal{A},s_{i})$.

Worst case scenario is when there is a sequence of steps $i$ to $i+k$ such that $\forall i<j\leq i+k,end_time(\mathcal{T},s_{i})>start_time(\mathcal{T},s_{j})$. In this case, there exists a time point where $k$ target processes are running concurrently, resulting in a total of $k+1$ concurrent processes.

### 4.4 Simulation Experiment for Speculative Planning

To elucidate the relationship between the performance of the Interactive Speculative Planning system and various hyperparameter configurations, we conducted three series of simulation experiments. Two experiments aimed to investigate the impact of different settings in speculative planning, specifically: (1) the choice of approximation agent $\mathcal{A}$, (2) the parameter $k$; and the third experiment investigates the impact of the number of user interruptions on overall latency. For the impact of $\mathcal{A}$, we examined $\mathcal{A}$’s accuracy relative to that of $\mathcal{T}$ (accuracy computed by treating $\mathcal{T}$’s result as ground truth), as well as $\mathcal{A}$’s computational speed. In the rest of the paper, we use $\mathcal{A}$’s accuracy to refer to the relative accuracy of $\mathcal{A}$ with respect to the result of $\mathcal{T}$.

For the simulation experiments, we set the following parameters unchanged: (1) the plan consists of 10 steps, (2) the generation speed of $\mathcal{T}$ is 8 seconds per action ($time(\mathcal{T},s)=8$) (3) for each step, $\mathcal{A}$ generates 10 tokens ($time(\mathcal{T},s)=10$) , (4) for each step, $\mathcal{T}$ generates 20 tokens ($time(\mathcal{T},s)=20$), and (5) for clarity, we set execution time to be 0 ($e(s)=0$).

The first series of experiments explores the impact of $\mathcal{A}$’s accuracy with respect to $\mathcal{T}$ and the hyperparameter of $k$ planning time and total tokens generated. We fix the speed of $\mathcal{A}$ ($time(\mathcal{A},s)=2$) to be 2 seconds per action and vary $\mathcal{A}$’s accuracy in $\{0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0\}$ and the hyperparameter of $k$ in $\{1,2,3,4,5,6,7,8,9,10\}$.

Figure 9 (a) provides a visual representation of the impact of accuracy and the hyperparameter $k$ on the planning time. For each pair of accuracy and $k$, we run 10 experiments with different random seeds. The mean time and standard deviation of the average step are plotted in the figure, providing a comprehensive view of how these factors influence the planning time. We also present the time required for the agent planning when using $\mathcal{A}$ only and $\mathcal{T}$ only as in normal agent planning to show the lower bound and upper bound of speculative planning.

It is evident that higher accuracy in $\mathcal{A}$ results in shorter planning time. Very low $k$ (such as $k=1,2,3$) leads to slower agent planning, regardless of $\mathcal{A}$’s accuracy. For other $k$ values, as the accuracy increases, the impact of $k$ becomes more clear: higher $k$ leads to shorter agent planning time. However, when the accuracy is low, the impact is less clear.

Figure: Figure 9: (a) Relationship between agent planning time, $\mathcal{A}$’s accuracy, and $k$ (b) Relationship between total token generated, $\mathcal{A}$’s accuracy, and $k$
Refer to caption: x9.png

Figure 9 (b) showcases the impact of accuracy and the hyperparameter $k$ on the total number of tokens generated during the planning process. In addition, the figure presents the tokens generated when using only $\mathcal{A}$ and when using only $\mathcal{T}$. There are two obvious trend: (1) higher accuracy in $\mathcal{A}$ generally results in a smaller number of tokens generated regardless of $k$ except in the trivial case when $k=1$ (2) lower $k$ leads to a smaller number of tokens to be generated, especially when $k$ is small in the value range of $\{1,2,3,4\}$; otherwise is impact is less clear.

In the second series of experiments, we study the impact of $\mathcal{A}$’s speed and accuracy on planning time and generated tokens: We experiment on speed in different values: $\{1,2,3,4,5,6,7,8\}$ and accuracy in values $\{0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0\}$. Here we set $k$ to be 5. Figure 10 (a) demonstrates the change of planning time: (1) smaller speed values lead to smaller planning time, *i.e.*, quicker planning, regardless of the accuracy of $\mathcal{A}$, and (2) better accuracy also leads to quicker planning, regardless of speed.

Figure: Figure 10: (a) Relationship between time and $\mathcal{A}$’s accuracy and speed (b) Relationship between time and $\mathcal{A}$’s accuracy and speed
Refer to caption: x10.png

Figure 10 (b) demonstrates the effect on total token generated. When the speed is very quick, higher accuracy monotonically reduces the total token generated. When the speed is around half of the speed of $\mathcal{T}$, accuracy does not have much impact on total tokens until it gets very high. When the speed is very slow (more than half of that of the target process), the total token generated first increases and then decreases as accuracy improves.

Figure: Figure 11: Relationship between maximum concurrent rate required and $\mathcal{A}$’s speed and $k$
Refer to caption: x11.png

In the third series of experiments, we investigate the impact of user interruptions on time efficiency. We conduct simulations with varying interruption times. We assume that the user is actively monitoring the agent planning process and has a patience level between the speeds of the approximation agent $\mathcal{A}$ and the target agent $\mathcal{T}$, which assumption is made based on (1) $\mathcal{A}$ is designed to be an efficient agent (2) if the user’s patience exceeds the speed of $\mathcal{T}$, no interruptions would occur.

For this simulation experiment, we set $k=n=10$ and the accuracy of $\mathcal{A}$ to be 0.5. The user is permitted to interrupt between 0 and 10 times. Each user interruption may occur randomly after waiting periods ranging from 1 to 5 seconds following the presentation of $\mathcal{A}$’s result. For each number of user interruptions, we conduct 5 simulations.

Figure: Figure 12: Relationship between the number of user interruption simulation and stepwise generation time
Refer to caption: x12.png

The results of this simulation are presented in Figure 12, which displays the mean stepwise generation time along with the standard deviation. As anticipated, an increase in user interruptions reduces the overall latency of the system.

## 5 Experiment

This section presents the results on two agent planning benchmarks: OpenAGI (Ge et al., ) and TravelPlanner validation (Xie et al., ). For each benchmark, we attempt to implement four settings. We will briefly introduce the benchmarks and the settings in the below two subsections.

### 5.1 Benchmarks

OpenAGI is a benchmark designed for agent planning with complex tasks, built on computer vision and natural language processing-related tasks. Tools accessible to the agents include “Sentiment Analysis”“Machine Translation”“Object Detection”“Visual Question Answering,,” etc. An example task in the benchmark is “Restore noisy, low-resolution, blurry, and grayscale images to regular images,” whose solution is a sequence of tool usage: “Image Super-resolution, Image Denoising, Image Deblurring, Colorization.” This benchmark contains 117 multi-step tasks.

TravelPlanner is a planning benchmark that focuses on travel planning. It provides a rich sandbox environment, various tools for accessing nearly four million data records, and meticulously curated planning intents and reference plans. These plans also involve many constraints, including budget constraints, environmental constraints, etc. An example task is “Please plan a travel itinerary for me. I’m departing from Cincinnati and heading to Norfolk for three days. The dates of travel are from March 10th to March 12th, 2022. I have a budget of $1,400 for this trip.” whose solution contains a sequence of actions such as “FlightSearch[Cincinnati, Norfolk, 2023-03-12]” where “FlightSearch” is the function name while “Cincinnati, Norfolk, 2023-03-12” are the natural language free-form parameters.

### 5.2 Speculative Planning Settings

To experiment with Interactive Speculative Planning in real-life scenarios, we demonstrate the performance using four different settings: four different combinations of the approximation agent $\mathcal{A}$ and the target agent $\mathcal{T}$.

#### Setting 1

$\mathcal{A}$ employs direct-generation-based planning with a GPT-4-turbo backbone, while $\mathcal{T}$ utilizes ReAct-based planning (Yao et al., ) with the same backbone. For each step in the plan, $\mathcal{T}$ uses ReAct to first deliberate on the action and then generate it through two separate API calls, whereas $\mathcal{A}$ directly generates the action for that step.

#### Setting 2

$\mathcal{A}$ uses direct-generation-based planning with a GPT-4-turbo backbone, and $\mathcal{T}$ employs chain-of-thought (CoT)-based planning with the same backbone. For each step in the plan, $\mathcal{T}$ uses CoT to first reason and then generate the result in a single API call, while $\mathcal{A}$ directly generates the action for that step.

#### Setting 3

$\mathcal{A}$ uses CoT-based planning with a GPT-4-turbo backbone, and $\mathcal{T}$ system uses multi-agent-debate (MAD) including 2 agents with 2 rounds of discussion on every step of the plan with a GPT-4-turbo backbone. For each step in the plan, $\mathcal{T}$ system has two agents discuss with each other and finalize the action to take for the current step, and the while $\mathcal{A}$ uses CoT to first reason and then generate the result in a single API call for the step.

#### Setting 4

$\mathcal{A}$ uses direct-generation-based planning (DG) with a GPT-3.5-turbo backbone, and $\mathcal{T}$ uses direct-generation-based planning with a GPT-4-turbo backbone. In this setting, both $\mathcal{A}$ and $\mathcal{T}$ directly generate the result for each step. Notice that we cannot provide results for TravelPlanner in this setting, as direction generation using GPT-3.5-turbo fail to provide a valid action in many cases.

In all experiments, we set $k=4$. We utilized one OpenAI API for experiments under Settings 1, 2, and 4, and two OpenAI APIs (one API for each agent in the multi-agent system) for experiments under Setting 3.

For the OpenAGI benchmark, given its limited action space, we used exact match to verify the correctness of the output generated by $\mathcal{A}$ against the output of $\mathcal{T}$. This ensured that the output of the speculative planning is the same as that of normal agent planning. For the TravelPlanner benchmark, which contains a much larger action space, each action is a combination of a function name from a fixed set and natural language free-form parameters. We verified the consistency between the output of $\mathcal{A}$ and the output of $\mathcal{T}$ based on an exact match of the function name and a soft match of the natural language parameters. The soft match is implemented by computing the Levenshtein distance: if the function name matched and the Levenshtein distance is smaller than 0.3, then the action is verified. As we leverage soft match to verify the output of $\mathcal{A}$, it is not guaranteed that the result from speculative planning remains the same as the result from normal agent planning and therefore we also provide the performance result of normal agent planning and speculative agent planning. Details in AppendixImplementation Details on TravelPlanner.

### 5.3 Evaluation Metrics

In terms of latency, we report the average and minimum total generation time, as well as the stepwise generation time, for all planning tasks across each benchmark and experimental setting, compared with the normal planning setting. It is important to note that the total generation time heavily depends on the number of steps in the plan, which can be influenced by randomness. Therefore, we also report the stepwise generation time, which mitigates the effect of randomness related to the number of steps. To provide a comprehensive understanding of the algorithm, we also include metrics related to the total number of tokens generated during the process and the total API cost.

Therefore, in total there are 11 metrics: (1) total time (TT), (2) the minimum total time across the dataset (min-TT), (3) stepwise time (ST), (4) the minimum stepwise time across the dataset (min-ST), (5) Total tokens generated (TO), (6) the minimum total tokens generated across the dataset (min-TO), (7) stepwise tokens generated (SO), (8) the minimum stepwise tokens generated across the dataset (min-SO), (9) maximum concurrent API calls (MC) (10) the minimum maximum concurrent API calls across the dataset (min-MC), (11) the average total cost used to finish the plan (cost).

### 5.4 Main Experiment Result

**Table 2: Main experiment results on OpenAGI benchmark.**
| Metrics | Settings |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
|  | Setting 1 | ReAct | Setting 2 | CoT | Setting 3 | MAD | Setting 4 | DG |
| TT | 33.91±30.38 | 43.63±25.39 | 28.64±25.49 | 39.96±27.25 | 105.42±50.84 | 182.70±421.49 | 4.63±1.78 | 5.77±1.83 |
| Min-TT | 6.80 | 9.16 | 3.53 | 8.60 | 28.24 | 50.89 | 1.70 | 2.23 |
| ST | 5.92±3.00 | 8.69±2.75 | 5.52±3.71 | 7.98±2.72 | 21.50±6.69 | 34.84±58.94 | 1.14±0.25 | 1.49±0.43 |
| Min-ST | 2.33 | 4.41 | 0.50 | 3.81 | 11.70 | 19.21 | 0.75 | 1.03 |
| TO | 1920±879.79 | 1812.89±832.30 | 1770.61±1010.44 | 1397.90±794.55 | 6781.43±3159.84 | 4075.4±1603.54 | 107.05±38.76 | 40.13±13.39 |
| Min-TO | 760 | 652 | 455 | 352 | 1754 | 1441 | 47 | 17 |
| SO | 288.72±65.29 | 266±44.37 | 281.92±88.77 | 229.45±44.23 | 1385±391.77 | 836.65±112.06 | 26.47±5.06 | 10.14±1.98 |
| Min-SO | 190.00 | 166.58 | 143.83 | 162.8 | 877 | 558.33 | 19.25 | 8.5 |
| MC | 4.66±0.59 | 1±0.00 | 4.49±0.82 | 1±0.00 | 4.53±0.56 | 1±0.00 | 4.05±0.21 | 1±0.00 |
| Min-MC | 3 | 1 | 3 | 1 | 3 | 1 | 4 | 1 |
| cost | 0.122±0.072 | 0.0713±0.026 | 0.074±0.040 | 0.044±0.018 | 0.2973±0.1387 | 0.2160±0.0795 | 0.0012±0.0011 | 0.0012±0.0004 |

Table.2 presents the results on OpenAGI dataset. In Setting 1 where $\mathcal{T}$ utilizes ReAct, we cut the total running time on average by 22.27% percentage and the stepwise running time on average by about 31.87%. In Setting 2 where $\mathcal{T}$ utilizes CoT, we cut the total running time on average by 28.32% and the stepwise running time on average by about 30.83%. In Setting 4 where both $\mathcal{A}$ and $\mathcal{T}$ uses direct generation but with different backbone models, we cut the total running time on average about 20.37% percentage and the stepwise running time on average by about 23.50%. Setting 3 includes a very slow $\mathcal{T}$ using a multi-agent debate; we obtain the largest efficiency improvement: this setting can cut the total time by 42.30% and the stepwise running time on average by 38.29%.

Table.3 presents the results on TravelPlanner validation dataset. Similar to the experiment on OpenAGI dataset, we can find noticeable latency improvement when using speculative planning: in Setting 1, the average latency on total generation time has decreased for 21.43% while the stepwise generation time has decreased for 29.52%; Setting 2 has decreased average total time by 19.18% and the stepwise generation time by 32.53%; Setting 3 has decreased average total time by 25.46% and the stepwise generation time by 31.69%.

**Table 3: Main experiment results on TravelPlanner benchmark.**
| Metrics | Settings |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Setting 1 | ReAct | Setting 2 | CoT | Setting 3 | MAD | Setting 4 | DG |  |
| TT | 137.33±66.39 | 176.28±77.18 | 98.09±45.02 | 121.37±32.18 | 568.10±292.99 | 733.12±290.51 | - | - |
| Min-TT | 40.78 | 55.18 | 29.22 | 42.09 | 149.00 | 127.59 | - | - |
| ST | 11.16±5.49 | 14.13±3.61 | 10.71±5.50 | 12.75±4.33 | 27.53±8.67 | 40.03±8.74 | - | - |
| Min-ST | 4.53 | 7.04 | 2.65 | 4.92 | 12.33 | 23.06 | - | - |
| TO | 3751.94±853.86 | 2460.95±332.07 | 3082±235.09 | 2002.93±276.54 | 12353.84±5872.86 | 8976.39±5371.31 | - | - |
| Min-TO | 1389 | 1762 | 833 | 1329 | 3443 | 2049 | - | - |
| SO | 298.84±128.97 | 246.13±56.34 | 220.79±56.19 | 197.08±87.68 | 733.18±477.72 | 591.65±467.82 | - | - |
| Min-SO | 128.13 | 108.30 | 85.42 | 68.06 | 189.00 | 186.27 | - | - |
| MC | 5±0.00 | 1±0.00 | 5±0.00 | 1±0.00 | 5.00±0.00 | 1±0.00 | - | - |
| Min-MC | 5 | 1 | 5 | 1 | 5 | 1 | - | - |
| cost | 0.1583±0.0367 | 0.1038±0.0033 | 0.1393±0.0241 | 0.0874±0.0125 | 0.5941±0.2871 | 0.3990±0.2309 | - | - |

Notice that our experiments in this section do not indicate the upper bound of efficiency improvement in the two datasets but rather the performance based on the current settings.

### 5.5 Analysis of Latency Improvement Breakdown

Having observed the average latency improvement for the two datasets across the four settings, we now turn our attention to a more granular analysis of the latency improvement based on the accuracy of the approximation agent $\mathcal{A}$. Specifically, we aim to examine how much time is saved given a specific level of $\mathcal{A}$’s accuracy. This analysis will allow us to identify the sources of time savings and determine which datapoints, at which levels of accuracy, contribute to latency improvement and which do not.

Thus, in this section, for each dataset and each setting, we present two figures: one displaying the distribution of datapoints with different levels of accuracy, and the other displaying the average stepwise latency improvement proportion for all levels of accuracy.

Figure: Figure 13: Distribution of $\mathcal{A}$’s accuracy in Setting 1 and corresponding latency improvement
Refer to caption: x13.png

Figure: Figure 14: Distribution of $\mathcal{A}$’s accuracy in Setting 2 and corresponding latency improvement
Refer to caption: x14.png

Figure: Figure 15: Distribution of $\mathcal{A}$’s accuracy in Setting 3 and corresponding latency improvement
Refer to caption: x15.png

Figure: Figure 16: Distribution of $\mathcal{A}$’s accuracy in Setting 4 and corresponding latency improvement
Refer to caption: x16.png

Figure 13, 14, 16 and 15 demonstrate the breaking-down results on OpenAGI dataset. Notably, Setting 1, 2, and 3 contain a significant proportion of datapoints that exhibit a perfect accuracy of $\mathcal{A}$. Such datapoints also correspond to the largest latency improvement. Nevertheless, even with lower accuracy approximations, a substantial reduction in stepwise generation time can also be observed. This trend is consistent across all settings. And notice that in Setting 3, stepwise time saving proportion can achieve almost 60% when $\mathcal{A}$’s accuracy achieves higher then 80%.

Figure 17, 18, and 19 present the results for the TravelPlanner dataset. In TravelPlanner, the distribution of datapoints based on accuracy is flatter (we only show accuracy levels where the proportion of datapoints exceeds 2% to avoid excessive randomness). In all three settings, the latency improvement can achieve more than 40% when the accuracy exceeds approximately 0.4.

Figure: Figure 17: Distribution of $\mathcal{A}$’s accuracy in Setting 1 and corresponding latency improvement
Refer to caption: x17.png

Figure: Figure 18: Distribution of $\mathcal{A}$’s accuracy in Setting 2 and corresponding latency improvement
Refer to caption: x18.png

Figure: Figure 19: Distribution of $\mathcal{A}$’s accuracy in Setting 3 and corresponding latency improvement
Refer to caption: x19.png

However, it is important to note that in almost all settings for both datasets, there are data points exhibiting “negative” latency improvement, i.e., longer stepwise running times when applying speculative planning compared to normal agent planning. Most of these cases occur when the accuracy of $\mathcal{A}$ is relatively low, a scenario in which latency efficiency analysis suggests limited latency improvement but no worse than normal agent planning, contrary to what we observe. This discrepancy can be attributed to two assumptions in the theoretical analysis: (1) The speeds of $\mathcal{A}$ and $\mathcal{T}$ are constant across different runs on the same data points. However, in actual usage, there is significant randomness involved due to the number of tokens generated in each step, causing variations in the speed of both $\mathcal{A}$ and $\mathcal{T}$ even for the same data point. (2) The speeds of $\mathcal{A}$ and $\mathcal{T}$ are not affected by multiple concurrent queries. In practice, $\mathcal{T}$ runs in parallel, meaning the API for $\mathcal{T}$ must process multiple concurrent queries, which may also slow down the overall speed for each individual call of $\mathcal{T}$.

### 5.6 Analysis of User Interaction

One of the motivations behind Interactive Speculative Planning is users’ patience. Numerous studies (Horvitz, ; Barron et al., ; Simpson et al., ; Carr et al., ) have demonstrated the physiological and psychological impacts of interaction delays on human-computer interaction. Therefore, we aim to quantitatively study how speculative planning enhances user experience by analyzing the frequency with which a user may become impatient and desire to interact with or interrupt the system.

Figure: Figure 20: Number of Potential User Interruptions with Setting 1 on OpenAGI dataset and corresponding normal agent planning
Refer to caption: x20.png

For the quantitative study, we use the OpenAGI dataset with Setting 1, 2, and 3 as examples(^1^11We do not adopt Setting 4 here as the average stepwise time for both normal agent planning and speculative planning is too short.). We collect statistics, including the mean and variance, on the number of user interruptions that may occur due to impatience by simulating users with different impatience thresholds. For Settings 1 and 2, we simulate users with impatience thresholds of 5, 6, 7, 8, 9, and 10 seconds. For Setting 3, which takes a much longer time to run, we simulate users with impatience thresholds of 11, 13, 17, 19, and 21 seconds. We also collect statistics for normal agent planning for comparison. For each setting, we provide a series of six figures. In each figure, the x-axis represents $\mathcal{A}$’s accuracy, and the y-axis represents the proportion of steps for which the user may become impatient. Each figure demonstrates the number of times the user may become impatient and interact with the system under Interactive Speculative Planning and normal agent planning, with respect to groups of data points with different levels of $\mathcal{A}$’s accuracy.

Figures 20, 21, and 22 represent the results for Settings 1, 2, and 3, respectively. As expected, Interactive Speculative Planning exhibits more observable differences for more impatient users.

Figure: Figure 21: Number of Potential User Interruptions with Setting 2 on OpenAGI dataset and corresponding normal agent planning
Refer to caption: x21.png

Figure: Figure 22: Number of Potential User Interruptions with Setting 3 on OpenAGI dataset and corresponding normal agent planning
Refer to caption: x22.png

## 6 Limitations and Future Directions

Interactive Speculative Planning represents the first attempt at co-designing an efficient agent system alongside an active user interface. Consequently, it is imperfect in many aspects, and there are numerous future directions to be explored:

#### Spectre

Spectre (Mcilroy et al., ; Kocher et al., ) refers to vulnerabilities and attacks involved in speculative execution (Kocher et al., ; Gabbay & Mendelson, ; Nightingale et al., ), a hardware feature that improves processor performance by predicting a program’s future execution and executing instructions ahead of the current instruction pointer. This concept is analogous to speculative planning. However, speculative execution is known to create security vulnerabilities that allow attackers to access sensitive data. In our algorithm, the execution of $\mathcal{A}$’s steps that are unverified or inconsistent with $\mathcal{T}$’s steps also introduces vulnerabilities. Studies (Hua et al., ) have shown that smaller and weaker models are more prone to unsafe and untrustworthy actions. Therefore, the applicability of Interactive Speculative Planning in its current form should be constrained to non-high-stakes areas.

To address the security vulnerabilities associated with speculative execution in Interactive Speculative Planning, several solutions can be implemented:

- 1.
Human-in-the-Loop Verification: Incorporate human-in-the-loop mechanisms to double-check the security of $\mathcal{A}$’s actions before execution. This approach leverages human oversight to ensure that potentially unsafe actions are identified and mitigated before they can cause harm.
- 2.
Isolated Execution Environments: Execute $\mathcal{A}$’s actions in isolated environments, such as Docker containers. This isolation ensures that any potentially malicious or untrustworthy actions are contained and do not affect the broader system or access sensitive data.

By implementing these solutions, we can enhance the security of Interactive Speculative Planning, making it more robust and suitable for a wider range of applications, including those in high-stakes environments.

#### Effectiveness of step-by-step comparison

In the current version of speculative planning, we employ a simple and straightforward method to determine whether an action proposed by $\mathcal{A}$ can be accepted: exact match. However, it is widely recognized that completing a task often involves multiple different paths and plans, and “difference” does not necessarily imply “incorrect.” There are two types of differences to consider: (1) different surface strings may refer to the same step, and (2) different steps may refer to two acceptable paths for the planning. Therefore, a step-by-step exact match judgment for whether $\mathcal{A}$’s output is accepted is overly aggressive and inefficient, as it essentially decreases the accuracy of $\mathcal{A}$.

Consequently, there is a need for more sophisticated methods to relax the conditions for accepting actions from $\mathcal{A}$. Potential solutions may include:

- 1.
Step-by-Step Relaxed Exact Match: While still performing step-by-step checks, this approach does not enforce an exact match between $\mathcal{A}$’s result and $\mathcal{T}$’s result. Instead, it allows for some degree of flexibility in what constitutes a match.
- 2.
Postponed Judgment: Instead of performing step-by-step checks, $\mathcal{T}$ will judge whether a sequence of $n$ steps proposed by $\mathcal{A}$ is within an acceptable range. This approach allows for a more holistic evaluation of $\mathcal{A}$’s proposals.

By implementing these solutions, we can enhance the effectiveness and efficiency of speculative planning, making it more adaptable to the variability inherent in task completion.

#### Balancing time and cost efficiency in speculative planning

The current version of speculative planning may incur a high additional cost. Therefore, balancing time efficiency and cost efficiency becomes a critical topic. Several methods can be employed to reduce the cost effectively:

- 1.
Utilize a Cost-Effective $\mathcal{A}$: Employ a cheaper yet well-functioning $\mathcal{A}$. This agent can be trained through knowledge distillation from $\mathcal{T}$, thereby improving performance while maintaining a smaller size.
- 2.
Enhance the Approximation-Target Judgment Method: Implement a more sophisticated approximation-target judgment method to improve the perceived accuracy of $\mathcal{A}$. This approach ensures that $\mathcal{A}$’s outputs are more reliably accepted, reducing the need for costly re-evaluations by $\mathcal{T}$.

By implementing these methods, we can achieve a better balance between time efficiency and cost efficiency in speculative planning.

#### Limitations of the Current User Interface

As mentioned in the algorithm design section, although the current user interface can handle active user input, these interactions and interruptions must be made “on time.” Specifically, users cannot change the result once it is fully presented in the user interface. This limitation means that users must closely monitor the algorithm’s progress, and if they miss the opportunity to intervene, there is no way to go back and make modifications. In the future, the user interface should support backtracing to allow users to revisit and modify previous steps, enhancing the flexibility and usability of the system.

## 7 Conclusion

This paper introduces Interactive Speculative Planning, a novel approach that co-designs an efficient agent system with an active user interface to enhance the efficiency of agent planning while involving human interaction to further accelerate the system. By treating human interruptions as an integral part of the system, we not only make the planning process more user-centric but also accelerate the entire system by providing correct intermediate steps. Our experimental results on two benchmarks, OpenAGI and TravelPlanner, demonstrate the effectiveness of our approach in improving time efficiency and cost efficiency.

However, our work also highlights several limitations and future directions. The current system does not support backtracing, and the exact match method for accepting $\mathcal{A}$ actions is overly aggressive. Future work should focus on developing more sophisticated methods for relaxing the conditions for accepting actions from $\mathcal{A}$, enhancing security measures to mitigate the risks associated with speculative execution, and improving the user interface to support backtracing and provide greater flexibility for user interactions.

## Appendix

### Implementation Details on TravelPlanner

To evaluate the final plans generated by normal agent planning and speculative planning, we adopt the metrics Delivery Rate and Commonsense Constraint Micro Pass Rate (the only two metrics with non-trivial results):

#### Delivery Rate

assesses whether agents can successfully deliver a final plan within a limited number of steps. Falling into dead loops, experiencing numerous failed attempts, or reaching the maximum number of steps (30 steps in our experimental setting) will result in failure.

#### Commonsense Constraint Micro Pass Rate

Commonsense Constraint Pass Rate comprises eight commonsense dimensions, which evaluates whether a language agent can incorporate commonsense into their plan without explicit instructions. The Macro Pass Rate indicates the ratio of passed constraints to the total number of constraints.

Below are the three set of results:

#### Setting 1

normal agent planning:
Delivery Rate: 55.6%
Commonsense Constraint Micro Pass Rate: 48.6%

speculative planning:
Delivery Rate: 55.6%
Commonsense Constraint Micro Pass Rate: 41.7%

#### Setting 2

normal agent planning:
Delivery Rate: 55.6%
Commonsense Constraint Micro Pass Rate: 41.7%

speculative planning:
Delivery Rate: 55.6%
Commonsense Constraint Micro Pass Rate: 34.7%

#### Setting 3

normal agent planning:
Delivery Rate: 55.6%
Commonsense Constraint Micro Pass Rate: 54.3%

speculative planning:
Delivery Rate: 55.6%
Commonsense Constraint Micro Pass Rate: 48.6%

## Peer Reviews

confidence: 4
contribution: 3
initial_rating: 8
presentation: 3
questions: The evaluation could be improved by comparing a smaller and larger model from a particular model family, i.e. 8b vs. 70b llama using the same approach. 

Are there more efficient approaches to validating the approximate models plan without comparing directly to the target models plan?

If the user interrupts the plan, do you envision that they edit the agents trajectory directly? or provide feedback and have the agent regenerate the step?
soundness: 3
strengths: The problem is relevant, agents are slow and we should try to make them more responsive.

The approach is novel afaik.

The algorithm itself is clearly described.
summary: Describes a speculative planning algorithm for LLM agents that assumes an approximate model and a target model. It is assumed that the target model is more capable but slower than the approximate model. Planning is performed by the approximate model until it is deemed to deviate from the target model, at which time the approximate model is corrected. Human interaction is also addressed via a rescheduling algorithm and the ability to interrupt and modify the plan.
weaknesses: The algorithm trades off time with efficiency. Are there ideas to also improve efficiency?

The selection of an approximate model and the target model may be difficult to satisfy, and increase system complexity in practical applications.

---

confidence: 3
contribution: 2
initial_rating: 5
presentation: 2
questions: 1. Could a theoretical focus on system latency lead to newer issues in the human-AI interaction? 
2. Is this approach suitable for all tasks? A more detailed discussion would be useful.
soundness: 3
strengths: Overall, the architecture of using a faster (but potentially inaccurate) agent and a slower (but possibly more accurate) in order to reduce the latency of the system is an interesting idea and can potentially work well for certain tasks with careful UI considerations.
summary: The paper presents an interesting approach to reduce the potential latency of LLM-based systems and an approach where user and user interruptions are build into system design. The approach involves two different agents: an faster but more error-prone approximation agent and a slower but more accurate target agent. Depending on the accuracy of approximation agent, the speed of system can be significantly faster , and in the worst case, comparable to a non-speculative planning agent.
weaknesses: 1. The method applies to synchronous Human-AI interaction where a human is in the loop and waiting for agent response in real time. An entirely different application of Agents is asynchronous interaction (where a human may not be in the loop in real-time, e.g. perform this action every day at this time ..). I would encourage the authors to highlight this in order to position their work better. 

2. I vehemently agree with the statement "A fully automated “blackbox” agent system with prolonged response delays is suboptimal for user experience". However, I believe the paper uses the term "user-centric" a bit loosely, I am not quite sure how the current method is more "user-centric". There are many places of contention:

a) Given approximation agent and target agent can (often) disagree, it means initial responses may be overwritten or multiple intermediate responses shown to user. Without careful UI design, this can lead to user confusion and lack of transparency on what is going on. 
b) User in the loop workflow where user can actively take part in the decision making is absolutely necessary. However, in the current system, the window for interruption is basically the time for target agent to execute. The user can potentially take time to read the response from approximation agent, process it, decide if it needs to be revised manually and then potentially frame the revision in text or voice, all of which can take some amount of time.  I am failing to see how this is "user-centric" when user is hurried to interrupt within a window of short time.
c) I did not fully understand how this mechanism can work when the action execution can be anything of consequence in the user interaction (e.g. sending an email or request for money to split bill on a mobile pay application). This in practice would mean, if the approximation agent is wrong, the system would perform tons of incorrect actions that can not be reversed. I would like a more detailed limitations of where this approach can work and where it should not be applied. 
 
More generally, there are established ways to study human factors aspects of Human-AI interaction, employing carefully controlled user studies. The current "theoretical approach" to human factors  is an interesting first step but leave a lot of questions unanswered that could potentially make or break the interaction.

---

confidence: 4
contribution: 2
initial_rating: 5
presentation: 2
questions: Since the cost is one of the main issues:

1) Under what circumstances should each evaluation metric (e.g., accuracy vs. speed vs. cost) be prioritised, and how might these impact the framework's configuration, e.g., in terms of k? The cost increase is above 60% in some cases. For example, do the authors believe there is a case for solely focusing on cost and not efficiency and vice versa?

2) Do the authors have insight into reducing costs to make the approach more appealing? The appendix states: "...Implement a more sophisticated approximation-target judgment method..." --- What does this look like?

Regarding the ability of the users to intervene, etc.:

3) How do you envision training end-users on the speculative planning interface, particularly in complex tasks where they may need to understand and manage concurrent agent processes?

4) Also, given that user intervention is integral to your framework, how would you design the interface to facilitate timely and accurate user decisions?

Regarding resource-constrained environments:

5) What considerations should be explored for scaling the speculative planning framework in resource-constrained environments, especially where concurrent instances of T may lead to bottlenecks? 
6) Since the approach's success largely depends on the accuracy of A, what do the results and analysis of k (in the appendix) indicate in terms of any minimum thresholds for A's accuracy?
soundness: 3
strengths: 1) In terms of writing, the paper is well-organised and engaging. The planning algorithm is discussed well -- the speculative planning process is generally explained well. However, a more detailed discussion with a specific k-value around Fig 1 would be helpful in understanding the various scenarios and how these result due to the accuracy of A. For example, it will help the reader speculate how A's accuracy may impact the number of times replanning may be needed, etc.

2) The paper evaluates various settings (e.g., ReAct, CoT, MAD, and DG), revealing a good level of depth in its potential impacts. The experiments are thorough, with 4 settings and 2 planning benchmarks (OpenAGI and TravelPlanner). Metrics such as time efficiency, API costs, and stepwise validation provide a good depth of analysis, both positive and negative aspects.

3) In terms of novelty, while speculative planning may not be universally applicable, its potential to accelerate high-latency planning tasks is valuable for the AI community, especially for applications requiring real-time or near-real-time responses.
summary: The paper introduces a speculative planning framework to improve the time efficiency of agent-based task planning. The paper tackles reducing latency by implementing two agent types. An approximation agent generates initial, potentially incorrect steps, which the more accurate target agent validates. This setup allows speculative planning to proceed concurrently, ideally saving time without sacrificing accuracy. Through experiments with two agent planning benchmarks, OpenAGI and TravelPlanner validation and metrics such as time efficiency, API costs, etc, the paper demonstrates the efficiency gains. It also allows users to get involved in the planning process. However, this aspect is speculative and has not been tested.
weaknesses: 1) One downside, not fully addressed or discussed in the paper, is the increased cost. The paper largely supports its claims of time efficiency gains, presenting results indicating speculative planning can save time, especially in complex planning settings. However, cost savings are not fully supported, as all speculative settings incur higher costs. While this increase is expected, as A and T operate concurrently, the paper only highlights positives and does not discuss costs. To balance the discussion, the authors must discuss both sides: pros and cons in Sections 4.1 and 4.2. While time savings are the focus, I assume real-world deployments must balance cost and efficiency, particularly if A has very low accuracy and frequently diverges from the steps produced by T, which increases wasted resources. Therefore, an open discussion about this limitation must be expressed in the same units as efficiency is justified (%) and possibly what strategies may allow users to reduce the cost.

2) Although the title suggests a "co-design" with user interface considerations, the paper provides limited insights into UI and user interactions. I find this aspect genuinely troublesome. The paper is technical. Even the UI elements, such as producing the steps in the correct order etc., are technical contributions. This is not co-design from an HCI perspective. I also have a few more questions on this aspect, which are provided in the Questions section later.

3) The framework relies on hyperparameter k. In the experiments, the authors used k=4 -- why? The appendix does provide some insight into the sensitivity of this parameter. Still, since k is central to the scheme, providing some guidance on selecting k would be beneficial. For example, could we employ dynamic tuning of k, etc?


Minor issues:
- 048: and The sequential
- In Figure 1, please briefly state the reason for using Venmo as an example.
- Line 100: Statements like "This strategy [[potentially]] reduces the time a target agent" suggests either that this gain is not universal or that the authors have doubts about their results. If there are caveats regarding when we expect reduced time, then that needs to be made explicit.
- I did not find the Venmo case study or the diagrams helpful.

Meta-review: The paper focuses on proposing a new method for designing an agent system as well as a user interface together - placing user interactions in the center. As agents begin to automate more and more tasks, such methods will become very relevant. All reviewers are also unanimous in their agreement about the merits of the paper.

Decision: Accept (Poster)