A CPU-only reproduction for vllm-project/vllm#64536, which addresses vllm-project/vllm#64268.
The case: llm-d's sidecar can split one generation into short chunks (--decode-chunk-size).
From the second chunk on, it continues the text so far as the final assistant message with
continue_final_message: true. With structured outputs, vLLM's grammar restarts on every chunk, so
the joined output is invalid
(llm-d/llm-d-router#3642).
What runs (docker compose up):
| Service | What | Port |
|---|---|---|
vllm-pr |
vllm/vllm-openai-cpu:v0.32.0 with the Python sources of PR #64536 at 1d9c2dd8 overlaid at startup (compiled extensions from the image), HuggingFaceTB/SmolLM2-135M-Instruct |
8202 |
sidecar-main |
llm-d sidecar built from llm-d-router e8d54cdb as is, --decode-chunk-size=5 |
8300 |
sidecar-flag |
the same plus sidecar-flag.patch (4 lines): sends structured_output_prefill: true on later chunks of constrained requests |
8301 |
The sidecars share the vLLM container's network, as they would share a pod.
docker compose up -d --build # first run: builds the sidecars, downloads the PR sources and the model
./test.sh # needs curl and jq
docker compose downtest.sh sends the same requests (temperature 0, max_tokens 60) through both sidecars and checks
the joined output: valid JSON for json_object / json_schema, a full match for choice / regex.
Expected: main is INVALID for every constraint, main+patch is VALID. Output from a clean run
(fresh build, x86_64 laptop CPU):
json_object main INVALID "{\n \"city\":{\n \"name\":{\n \"type\":{\"type\":\"string\",\"{\"typ
json_object main+patch VALID "{\n \"city\": \"Paris\",\n \"country\": \"France\"\n}\n"
json_schema main INVALID "{\n \"city\":{\n \"city\":{\n \"city\":{\n \"city\":{\n \"city\"
json_schema main+patch VALID "{\n \"city\": \"Paris\",\n \"country\": \"France\"\n}\n"
choice main INVALID "The capital of France isThe capital of France isThe capital of France isThe capital of Fr
choice main+patch VALID "The capital of France is Paris\n"
regex main INVALID "123-4567-1234-1234-1234-1234-1234-1234-1234-1234-1234-1234-1\n"
regex main+patch VALID "123-456-7890\n"
- CPU only, xgrammar backend,
VLLM_USE_V2_MODEL_RUNNER=0(same as the PR's own validation). Not covered: GPU, reasoning models, guidance and outlines backends. - To test another build of the PR (for example on GPU), run your own vLLM with the PR on port 8000
and start only the two sidecars in its network namespace, or run the sidecars on the same host
with
--model-server-portpointing at it. - The patch is an experiment, not a proposed llm-d change: it detects constrained requests with a string check. llm-d/llm-d-router#3685 skips chunking for these requests on current vLLM versions.