Agents on vLLM¶
An agent that runs on vLLM can ask Flide questions about its conversation at every step. Flide reads the keys and
values vLLM already holds for that conversation, so it computes only the questions. With Qwen2.5 and Qwen3 dense
models, Flide also runs on vLLM's copy of the weights, so the model sits on the GPU once. Both servers run on the same
GPU. This is tested with vLLM 0.33.0 and chat models read through their next token (next_token).
1. Start vLLM with the Flide connector¶
Install Flide in vLLM's environment: vLLM loads its connector from the flide package. Give both servers a directory
they share, and leave part of the GPU's memory to Flide.
DIR=$PWD/flide-vllm && mkdir -p $DIR
vllm serve Qwen/Qwen3-8B --gpu-memory-utilization 0.45 --kv-transfer-config '{"kv_connector": "FlideConnector",
"kv_connector_module_path": "flide.integrations.vllm_connector", "kv_role": "kv_both",
"kv_connector_extra_config": {"dir": "'$DIR'"}}'
At start the connector writes to that directory where vLLM keeps its keys and values and its weights. It changes nothing else in vLLM: requests that do not ask for Flide run as before.
2. Start Flide on the same GPU¶
Once vLLM is up, start Flide in another shell in the same working directory, with the same model and directory.
flide serve --model Qwen/Qwen3-8B --vllm-kv $PWD/flide-vllm --port 8001
--vllm-kv turns the session cache on, since vLLM's keys and values go there. For a Qwen2.5 or Qwen3 dense model,
Flide builds its model on vLLM's weights instead of reading the files, and its log says
weights shared with vLLM ... none loaded. It first compares rows of several weights with the checkpoint on disk bit
for bit, so the two servers must run the same checkpoint. With --quantize, a mixture of experts or another
architecture, Flide reads its own copy of the weights and its log says why.
Flide reads vLLM's memory while it runs: stop Flide before vLLM, and start it again after vLLM restarts.
3. Ask about a vLLM request¶
A request to vLLM opts in with "kv_transfer_params": {"flide": true}. When it finishes, vLLM keeps its keys and
values for Flide, and the response names them.
curl -s localhost:8000/v1/chat/completions -H 'Content-Type: application/json' -d '{
"model": "Qwen/Qwen3-8B",
"messages": [{"role": "user", "content": "Fix the failing test in utils.py."}],
"kv_transfer_params": {"flide": true}}'
{"choices": [...], "kv_transfer_params": {"flide_ref": "chatcmpl-8702affff8c7f8a3"}}
A /v1/systemone request with that vllm_ref in place of a state asks its questions after the conversation, the
reply included.
curl -s localhost:8001/v1/systemone -H 'Content-Type: application/json' -d '{
"vllm_ref": "chatcmpl-8702affff8c7f8a3",
"questions": {
"done": {"type": "noul", "instructions": "Is the task finished?"},
"next": {"type": "choice", "instructions": "What should the agent do next?",
"criteria": {"test": "run the tests", "edit": "edit a file", "ask": "ask the user"}}}}'
Flide copies the conversation's keys and values into its session cache and gives the blocks back to vLLM at once. The
same vllm_ref can be asked about again while its entry stays in the cache; after that, Flide computes the
conversation from its tokens. The answers follow vLLM's rounding of the conversation, so they can differ from Flide's
own at rounding level.
One copy of the weights¶
Flide on vLLM's weights answers with the same bits as Flide reading the files, and vLLM's own completions stay the same. What Flide still holds on the GPU is its CUDA graphs' work space and the session cache. Measured with vLLM 0.33.0 on 32 requests each, without a session cache:
| Model | GPU | Flide on vLLM's weights | of which CUDA graphs | Flide from the files | Same bits |
|---|---|---|---|---|---|
| Qwen2.5-1.5B-Instruct | A40 | 0.44 GiB | 0.42 GiB | 3.54 GiB | 32 / 32 |
| Qwen3-1.7B | A40 | 0.49 GiB | 0.47 GiB | 4.19 GiB | 32 / 32 |
| Qwen3-8B | H200 | 0.83 GiB | 0.81 GiB | 16.31 GiB | 32 / 32 |