A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 12, 13:30 UTC
[BugFix] bad_words filtering ineffective when n > 1 (#29313)
Signed-off-by: GOavi101 <1704178@kiit.ac.in>
Avishek Goswami committed
Nov 25, 2025 at 15:06 UTC
32c40b95e09f26fc140d442d687072d01ea9ff2b
3 files changed
+18
-6
vllm/v1/engine/__init__.py
+8
@@ -72,6 +72,14 @@ class EngineCoreRequest(
72
73
trace_headers: Mapping[str, str] | None = None
74
75
+ @property
76
+ def params(self) -> SamplingParams | PoolingParams:
77
+ """Return the processed params (sampling or pooling)."""
78
+ if self.sampling_params is not None:
79
+ return self.sampling_params
80
+ assert self.pooling_params is not None
81
+ return self.pooling_params
82
+
83
84
class EngineCoreEventType(enum.IntEnum):
85
"""The type of engine core request event."""
vllm/v1/engine/async_llm.py
+5
-4
@@ -321,14 +321,15 @@ class AsyncLLM(EngineClient):
321
elif isinstance(prompt, Mapping):
322
prompt_text = cast(str | None, prompt.get("prompt"))
323
324
+ # Use cloned params that may have been updated in process_inputs()
325
+ params = request.params
326
+
327
if is_pooling or params.n == 1:
328
await self._add_request(request, prompt_text, None, 0, queue)
329
return queue
330
328
- # Get the updated SamplingParams from the request, which
329
- # were cloned/updated in processor.process_inputs above.
330
- parent_params = request.sampling_params
331
- assert parent_params is not None
331
+ parent_params = params
332
+ assert isinstance(parent_params, SamplingParams)
333
334
# Fan out child requests (for n>1).
335
parent_request = ParentRequest(request_id, parent_params)
vllm/v1/engine/llm_engine.py
+5
-2
@@ -250,6 +250,9 @@ class LLMEngine:
250
elif isinstance(prompt, Mapping):
251
prompt_text = cast(str | None, prompt.get("prompt"))
252
253
+ # Use cloned params that may have been updated in process_inputs()
254
+ params = request.params
255
+
256
n = params.n if isinstance(params, SamplingParams) else 1
257
258
if n == 1:
@@ -262,10 +265,10 @@ class LLMEngine:
265
# Fan out child requests (for n>1).
266
parent_req = ParentRequest(request_id, params)
267
for idx in range(n):
265
- request_id, params = parent_req.get_child_info(idx)
268
+ request_id, child_params = parent_req.get_child_info(idx)
269
child_request = request if idx == n - 1 else copy(request)
270
child_request.request_id = request_id
268
- child_request.sampling_params = params
271
+ child_request.sampling_params = child_params
272
273
# Make a new RequestState and queue.
274
self.output_processor.add_request(