- The paper reduces per-turn inference cost from O(n_t) to O(Δ_t) by leveraging prefix caching and delta-only computation, achieving up to 4.2× faster performance on deep multi-turn workflows.
- The approach combines nine integrated mechanisms—including a persistent KV cache, radix prefix cache, and prompt-deterministic response cache—to optimize computation reuse in multi-agent sessions.
- The architecture improves hardware utilization and halves wall time for long-running sessions, though it faces challenges like GPU memory overhead and current single-GPU limitations.
Motivation and Problem Statement
Modern LLM-based systems increasingly orchestrate multi-agent, multi-turn tool calling workflows. Each agent, such as a travel planner or code reviewer, maintains a dynamic conversation history punctuated by structured tool calls and tool results, resulting in prompts composed of a monotonically-growing prefix with small incremental updates per turn. Production inference engines like vLLM and SGLang process each tool call as a fresh request, re-encoding and forwarding the entire conversation history even when most tokens are unchanged, leading to significant wasted computation and GPU underutilization.
The dominant property exploited by this work is that in agentic workloads, the vast majority of each prompt—typically 85–95%—is unchanged from the previous turn. Re-processing this invariant prefix for every tool call results in O(nt​) per-turn cost, with nt​ being the current prompt length and Δt​ the number of new tokens. The work aims to re-architect inference to align cost with the genuinely new computation, making it O(Δt​) per turn.
Architectural Contributions
This paper proposes a fully stateful inference architecture with nine integrated systems-level mechanisms, designed to persist and share computation across agent turns and concurrent multi-agent sessions, converting full-prefix recomputation to constant-time metadata operations and delta-only computation.
Key architectural elements include:
- Stateful Sessions via Persistent KV Cache: Each agent maintains a long-lived KV cache, advanced with only the new tokens per turn.
- Unified Sequence Pool: A pre-allocated pool of sequence slots under a single inference context, partitioned into transient and session regions, enabling lock-free, high-throughput acquisition and release.
- Radix Prefix Cache: A radix trie over token prefixes, with sequence aliasing enabling constant-time reuse of long prefixes by pointing new requests' state to previously computed cache cells.
- Prompt-Deterministic Response Cache: Exact prompt repeats (such as retries or polling) trigger cache hits based on FNV-1a prompt hashing, allowing zero-GPU network-latency responses.
- Prompt-Lookup Speculative Decoding (PLD): Exploits repetitive, structured output by using n-gram suffix matches in prompt or prior output to generate token candidates speculatively, validated in batched passes, massively reducing sequential decode steps on structured tool-call formats.
- Concurrency-Capped Prefill Scheduler: Cell-budgeted, continuous batching incorporates prefix-aware grouped prefill, collapsing redundant work for requests sharing schema/tool preambles.
- Streaming Tool-Call Validator: Real-time brace-balanced JSON parsing and tool whitelist filtering enables streaming early-stop and rejection of malformed tool calls for efficient structured output termination.
- On-Device Greedy Sampling: Device-specific argmax runs directly on accelerator, avoiding host round trips even for short structured outputs.
- Robust Session Lifecycle Management: Exception-safe RAII guards for sequence acquisition and release, robust under multithreaded orchestration.
Theoretical Analysis and Efficiency
The core theoretical advance is converting per-turn inference cost from
O(nt​)(full prefill per turn)
to
O(Δt​)(delta-only prefill, via prefix aliasing)
where typically, Δt​≪nt​. The speedup on turn t rapidly approaches nt​/Δt​, especially as conversations deepen.
The radix prefix cache, in combination with grouped prefill and speculative decoding, ensures that the majority of GPU-side cost is strictly proportional to the true information-theoretic work done—processing new conversational tokens and emitting new tool calls—rather than the redundant recomputation of static prefix context.
Empirical Results
Latency and Wall Time
On realistic multi-agent tool-call workloads, including both shallow multi-turn (6-turn) and deep (35-turn) conversation scenarios, the reference LayerScale implementation is 2.1× faster per turn than vLLM and SGLang in 6-turn workflows, with the advantage widening to nt​0 on deep, 35-turn conversations.
Figure 1: Median per-turn latency on novel, fully-generated tool-call workloads (no response-cache hits). LayerScale is nt​1 faster than vLLM on the 6-turn agentic workflow and nt​2 faster on the median turn of the 35-turn deep-coding workflow; the gap widens as the reusable conversation prefix deepens.
Further, the end-to-end wall time for the 35-turn workflow is halved, with LayerScale completing in nt​3 seconds versus nt​4 seconds for competitors, reflecting the compounded savings as conversation prefixes grow.
Figure 2: LayerScale speedup over vLLM and SGLang on median per-turn latency, without any kind of caching. The multiplier roughly doubles as workflow depth increases, reflecting the gap between nt​5 and nt​6 per-turn cost.
Figure 3: Cumulative wall time over the 35-turn novel coding workflow (no response-cache hits). LayerScale's compounding advantage over vLLM and SGLang is due to processing only the per-turn delta versus full prefix each turn.
Additional Observations
- Exact Repeat Traffic: The prompt-deterministic response cache serves idempotent or retry requests at network-roundtrip latency, a capability not present in vLLM or SGLang.
- Burst-Mode Orchestration: In scenarios of concurrent tool calls, the architecture delivers order-of-magnitude better p99 tail latencies by sharing KV state through metadata aliasing, preserving efficiency even under high concurrency.
- Correctness: All engines output correct tool calls under the benchmark; the advantage is strictly in efficiency and latency, not model output quality.
Practical Implications and Limitations
This stateful inference stack is a strong architectural fit for agentic systems, where conversation structure is prefix-extending, and workloads are dominated by structured tool-call output. The reduction in redundant computation translates directly into improved hardware utilization and a decrease in effective cluster FLOPs per agent interaction, addressing a persistent utilization gap in GPU inference clusters.
Limitations include GPU memory overhead scaling linearly with conversation depth and agent concurrency, cache invalidation constraints (the system relies on strictly monotonically extended prefixes), and restriction to single-GPU contexts in the present implementation; distributed, multi-GPU coordination is reserved for future work.
Theoretical and Future Directions
This work complements, rather than replaces, the throughput-oriented advances of systems like vLLM and SGLang, addressing low-latency, multi-agent, real-time structured inferencing scenarios. While the radix prefix cache and speculative decoding directly target redundant per-request computation, integration with cross-GPU distributed KV cache management, as well as more general cache sharing and invalidation strategies for non-monotonic scenarios, remain open.
Given the prevalence of agentic, tool-oriented orchestration in deployed AI applications, further study of such prefix-delta structures and their optimization in distributed inference is likely to be an active systems research direction.
Conclusion
This architecture systematically reduces the per-turn cost of multi-agent tool calling from linear in conversation length to linear in the per-turn delta, driven by a stateful, sequence-pooled, and prefix-cached inference kernel with speculative, cache-aware decoding. On novel, non-repetitive agentic workloads, it empirically demonstrates nt​7–nt​8 latency improvement over production open-source baselines, and completes long workflows in nearly half the wall time. The approach is immediately practical for high-traffic deployment scenarios and suggests new directions for distributed, cache-centric LLM inference optimization.