Best practice for processing batch vLLM api calls with shared prefix?

Reddit r/LocalLLaMA Tools

Summary

The author describes their agent workflow using asyncio.gather to batch vLLM API calls with shared prefixes and asks for best practices to optimize this process, proposing a pre-caching strategy for efficient decoding.

Our agent workflow is currently executing a group of 10 vllm api calls within a asyncio.gather we made them share the same prompt until the end where the queries/instruction prompts differ. These calls are hitting our vllm-router/llm-d router with production grade kv cache aware routing algo which routes traffic into our pool of vllm workers. What's the best practice for processing batches of llm prompts with a shared prefix like this? I have an idea where I try to see if I can make one call first to make sure vLLM complete a block of cache and start decoding before I send the remaining requests of the batch, our router will make sure these reach the same vllm worker, is this a good strategy?
Original Article

Similar Articles

Sparse Prefix Caching for Hybrid and Recurrent LLM Serving

arXiv cs.LG

This paper introduces sparse prefix caching for hybrid and recurrent LLMs, which stores recurrent states at a limited set of checkpoint positions to avoid dense caching while minimizing recomputation. The method outperforms standard heuristics on real-world data, especially when requests share substantial but non-identical prefixes.

Which API for general real-time LLM agents [D]

Reddit r/MachineLearning

A Hacker News discussion exploring what API/interface should be used to build general real-time asynchronous LLM agents that can react to new stimuli (interruptions, live event streams) mid-inference, referencing the AsyncLLM preprint and existing vendor real-time APIs as partial solutions.