You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Streamed responses contain replacement characters when a multibyte character is split across reads #373
When a job streams a response ("stream": true) and a multibyte UTF-8 character (accented letters, Chinese, Japanese, emoji) is split across two reads of the vLLM response, the handler yields U+FFFD in place of that character. Each half of the split character becomes its own replacement character, so the original character is lost. The streamed text is permanently wrong, and clients cannot repair it.
Reproduction
Run a local server that answers POST /v1/chat/completions with an SSE body containing héllo 😀 and writes it in two parts, with the split inside the two bytes of é.
Point VLLM_BASE_URL in src/handler.py at that server.
I also ran this against vllm serve (v0.32.0) on an RTX A5000 with Qwen/Qwen2.5-0.5B-Instruct, streaming Chinese, Japanese and emoji output. With the response re-chunked to one byte per read, 15 of 15 streams contained replacement characters (4170 in total). A direct request to vLLM contained none. With vLLM answering the handler directly on localhost, I did not see a split.
Expected behavior
The text yielded for a stream is the same text vLLM sent, regardless of where the response is split into reads. A character that spans two reads is yielded once, intact.
Activity