Skip to content

[core] feat: support async scheduling with structured outputs#1582

Merged
AlpinDale merged 2 commits into
mainfrom
async-sched-structured
Nov 4, 2025
Merged

[core] feat: support async scheduling with structured outputs#1582
AlpinDale merged 2 commits into
mainfrom
async-sched-structured

Conversation

@AlpinDale

Copy link
Copy Markdown
Collaborator

No description provided.

Signed-off-by: AlpinDale <alpindale@gmail.com>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a significant refactoring to support asynchronous scheduling with structured outputs. The core change involves splitting the model execution into a two-step process: execute_model for the forward pass and sample_tokens for sampling. This is a clean approach that allows for grammar bitmask computation between the two steps. The changes are consistently applied across the scheduler, engine core, executors, and model runners. I've found one critical issue that could lead to a crash in distributed setups.

Comment on lines +166 to 169
assert model_runner_output is not None
kv_output = model_runner_output.kv_connector_output
if not kv_output:
continue

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The assertion assert model_runner_output is not None can fail. The outputs list can contain None values from workers that did not produce an output, which is a valid scenario with the new changes. This assertion will cause a crash in distributed setups. You should handle None values gracefully by skipping them.

Suggested change
assert model_runner_output is not None
kv_output = model_runner_output.kv_connector_output
if not kv_output:
continue
if model_runner_output is None:
continue
kv_output = model_runner_output.kv_connector_output
if not kv_output:
continue

…Runner

Signed-off-by: AlpinDale <alpindale@gmail.com>
@AlpinDale AlpinDale merged commit a3d7b9d into main Nov 4, 2025
1 check passed
@AlpinDale AlpinDale deleted the async-sched-structured branch November 4, 2025 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant