Add a KV budget and scheduling policies to your simulator
CPU · your Macscript120 minrequiredGoal · A scheduler simulator with a block budget, preemption and three swappable policies, reporting TTFT p50/p99 and goodput for each.
- 1Import your BlockManager from p3-paged-attention-l1 and the request trace generator from p3-batching-l1.
- 2Implement a Scheduler with waiting and running lists and a step() that continues running sequences, then admits waiting ones while blocks and a 2048-token budget remain.
- 3On block exhaustion preempt the most recently admitted running sequence, free its blocks and requeue it at the front (recompute).
- 4Implement policies as a sort key on the waiting list; FCFS by arrival, shortest-prompt-first, and priority with 20 percent of requests marked high.
- 5Run the same 500-request trace under each policy at two arrival rates (light and overloaded).
- 6Report TTFT p50 and p99, ITL p99, preemption count and goodput with an SLO of TTFT under 2 seconds.
- 7Write a paragraph on which policy you would ship for an interactive chat product and why.
- Deliverable
- scheduler_sim.py and a results table (policy x load) with the written recommendation.
- Check
- Under overload, shortest-prompt-first has lower TTFT p50 than FCFS but its p99 for long prompts is worse; preemption count is zero at light load.