Skip to content

fix(scheduler): skip lookahead allocation for running prefill chunks - #99

Merged
lukealonso merged 1 commit into
dev/fathomless-firmamentfrom
codex/ff-prefill-lookahead-allocation-20260717
Jul 17, 2026
Merged

fix(scheduler): skip lookahead allocation for running prefill chunks#99
lukealonso merged 1 commit into
dev/fathomless-firmamentfrom
codex/ff-prefill-lookahead-allocation-20260717

Conversation

@voipmonitor

@voipmonitor voipmonitor commented Jul 17, 2026

Copy link
Copy Markdown

Problem

The scheduler allocated speculative lookahead slots to requests that were still executing a running/chunked prefill. Those slots cannot be consumed by speculative decode in that iteration and reduce usable KV capacity.

Fix

Allocate lookahead only once the scheduled request is actually in decode. New requests retain the existing behavior.

This is a standalone current-FF extraction of the scheduler fix previously carried inside #88.

Validation

  • Targeted running chunked-prefill scheduler test: 1 passed
  • Existing scheduler assertions extended to cover zero lookahead during running prefill
  • ruff check and ruff format --check on changed files
  • git diff --check

Summary by CodeRabbit

  • Bug Fixes
    • Improved chunked prefill scheduling by ensuring no lookahead tokens are allocated during prefill steps.
    • Preserved lookahead token allocation for other scheduling operations.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5f383f0d-5383-4c30-82ac-1dbec3a3231e

📥 Commits

Reviewing files that changed from the base of the PR and between e4879e1 and b1cd154.

📒 Files selected for processing (2)
  • tests/v1/core/test_scheduler.py
  • vllm/v1/core/sched/scheduler.py

📝 Walkthrough

Walkthrough

The scheduler now passes zero lookahead tokens to KV cache allocation for prefill chunks. A regression test patches allocation, records the argument, and verifies the value is zero.

Changes

Chunked prefill scheduling

Layer / File(s) Summary
Effective lookahead allocation and regression coverage
vllm/v1/core/sched/scheduler.py, tests/v1/core/test_scheduler.py
Scheduler.schedule() uses zero lookahead tokens for prefill chunks, while other requests retain the configured value; a test verifies the chunked-prefill argument.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: njhill, kl527, omerpaz95

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the scheduler fix to skip lookahead allocation for running prefill chunks.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/ff-prefill-lookahead-allocation-20260717

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

2 participants