feat(server): per-request ignore_eos via extra_body (vendor extension) - #252
Open
Andrewxu313 wants to merge 2 commits into
Open
feat(server): per-request ignore_eos via extra_body (vendor extension)#252Andrewxu313 wants to merge 2 commits into
Andrewxu313 wants to merge 2 commits into
Conversation
added 2 commits
June 6, 2026 14:10
ignore_eos was only a batch-level CreateBatchRequest field, and pool mode (the production path) never threaded it to the worker — the init message and IntakeEntry.raw_request both omitted it and the pool init handler never called set_ignore_eos — so ignore_eos silently never held (sequences stopped at real EOS even when the client requested ignore_eos). It was also not a per-request field and not an env var. Make ignore_eos a per-request vendor extension (OpenAI SDK extra_body / a top-level key in a Batch JSONL body), honored per-sequence: - io_struct: add ignore_eos to ChatCompletionRequest + CompletionRequest. - batch_scheduler: extract per-request ignore_eos in pool mode (req.body) with batch-level CreateBatchRequest.ignore_eos as fallback; thread through raw_request -> admit entry. (Also un-hardcode the legacy infer() path's ignore_eos.) - worker: set seq.ignore_eos on admission; honor it per-sequence at the decode EOS boundary (eos_flags) OR'd with the global flag. - completion: is_sequence_completed / get_finish_reason OR in seq.ignore_eos. Because the per-request value falls back to the batch-level field, this also fixes the previously-dropped batch-level ignore_eos in pool mode (backward compatible).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Make
ignore_eosa per-request vendor extension — passed via the OpenAI SDK'sextra_body(or a top-level key in a Batch JSONLbody), the same convention vLLM/SGLanguse — and honor it per-sequence.
server/io_struct.pyignore_eos: Optional[bool]toChatCompletionRequest+CompletionRequestserver/batch_scheduler.pyreq.body.ignore_eoswith batch-level fallback, threaded viaraw_request→ admit entry; un-hardcode the legacyinfer()pathbatchgen_worker.pyseq.ignore_eoson admission; honor it per-sequence at the decode EOS boundary (eos_flags), OR'd with the global flagworker/completion.pyis_sequence_completed/get_finish_reasonOR inseq.ignore_eos(the completion gates)sequence.pyignore_eostoSequenceEntry.__slots__+ init (defaultFalse)tests/worker/test_completion.pyignore_eosoverrides EOS completion / finish_reasonMotivation
ignore_eoswas only a batch-levelCreateBatchRequestfield, and pool mode (theproduction path) never threaded it to the worker — the pool
initmessage andIntakeEntry.raw_requestboth omitted it, and the pool init handler never calledset_ignore_eos. Soignore_eossilently never held: sequences stopped at their realEOS even when requested (observed:
throughput_test.py→ignore_eos held: False, 707k of8.39M expected tokens on a 2k→8k / 1024-seq run). It was also not a per-request field
and not an env var (
BATCHGEN_IGNORE_EOShas zero readers).The per-request
extra_bodyform is the clean, extensible home for this and future vendorflags (
min_p,repetition_penalty, …). Backward compatible: the per-request valuefalls back to the batch-level field, so this also fixes the previously-dropped batch-level
ignore_eosin pool mode — existing clients (incl.throughput_test.py) work unchanged.Type of Change
Checklist
Validation
tests/worker/test_completion.py: per-sequenceignore_eosunit tests (CPU-only).ignore_eos held: Trueandsum_completion_tokens == n*out_tokens.