Unit 6 of 13 · about 5 hours · explain

Reconstructing the engine API, tokenizer path, scheduler and request state

Build on Reconstructing a real kernel path and making one bounded change. Serving adds request identity, queues and ownership before the runner ever selects a kernel.

You'll be able to

  • Map API validation, templating, tokenization and request identity into exact source owners.
  • Reconstruct scheduler state transitions and the iteration work order without relying on class names alone.
  • Predict where Nano-vLLM responsibilities move in Mini-SGLang and vLLM V1.

Covers

Engine API and tokenizer path reconstructionScheduler and request-state reconstruction
1

Read

In this order, only the parts listed

0 of 4 done

  1. Nano-vLLM request and scheduler entryNano-vLLM and Mini-SGLang as Engine Reconstruction Bridges

    LLMEngine.add_request, step and generate; follow their calls into nanovllm/engine/sequence.py and nanovllm/engine/scheduler.py: SequenceStatus, schedule, preempt and postprocess

  2. Mini-SGLang separates the frontend and schedulerNano-vLLM and Mini-SGLang as Engine Reconstruction Bridges

    System Architecture: Key Components and Data Flow; Code Organization: server, tokenizer, message and scheduler modules; follow python/minisgl/scheduler/scheduler.py, _process_one_msg and _schedule_next_batch

  3. The production scheduling work orderHands-On LLM Serving and Optimization - Chapters 8 and 9, frameworks and optimization in practice

    Chapter 8, Generation-Request Execution Workflow and Scheduler Deep Dive, printed pp. 278 to 284

    Treat the prose as an architecture sketch, not a fairness guarantee. Use vLLM 0.31.0 source to resolve implementation details.

  4. vLLM 0.31.0 process and input boundariesvLLM V1 Architecture Overview

    V1 Process Architecture: API Server Process and Engine Core Process; compare vllm/v1/engine/input_processor.py, vllm/v1/request.py and vllm/v1/core/sched/scheduler.py in release 0.31.0

    Skip the later AsyncLLMEngine description as a V1 implementation guide. In release 0.31.0, the launcher imports AsyncLLM from vllm/v1/engine/async_llm.py; the older name is a compatibility alias.

2

Focus on

  • Reuse your earlier request-state invariants. For every arrow, record caller, callee, process, message payload, request ID and owner of terminal cleanup.
  • Nano-vLLM accepts token IDs or text but supplies no HTTP frontend. Mini-SGLang adds API, tokenizer and scheduler messages; API schema fields still need tracing to implementation.
  • At the pinned Nano-vLLM commit, the scheduler returns a prefill batch before considering decode if prefill work was scheduled. Chunked prefill alone therefore does not prove decode protection.
  • Compare the miniature phase flag with V1's token-progress scheduling. Identify admission and preemption decisions separately from batch tensor preparation.
Common mistakes · 3
  • Assuming matching class names mean matching process boundaries or scheduling policy across engines.
  • Reading only normal completion. Preemption can return a running request to waiting with a different cache state.
  • Treating continuous batching as bounded fairness. Demonstrate bounded wait under the actual arrivals and admission policy.
3

Try it yourself

Closed-book, before checking anything

Draw the three frontend-to-scheduler maps without notes. Annotate a short request, a chunked long prompt and a preempted request with state owner and token progress. Replay these transitions on CPU with your existing deterministic scheduler and check resource and request invariants; keep differences from the pinned engine explicit rather than claiming simulation is execution evidence.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.Why trace a supported API field past validation?Answer

    A schema can accept a field that is not forwarded or implemented. The actual request contract is determined by the whole path.

  2. 2.Does Nano-vLLM's chunked prefill automatically interleave decode?Answer

    Not at the pinned commit. schedule returns scheduled prefill work before the decode loop; arrivals can keep prefill taking precedence.

  3. 3.Which component should own the batch tensor layout?Answer

    The runner or its preparation layer. The scheduler determines feasible token work and ownership metadata; the runner translates that plan into execution inputs. Verify the actual split in source.

You're done when

You can locate the source owner of validation, tokenization, admission, scheduling and preemption, and predict the next state of all three replay cases.

Only when you can do this without notes.

Leads to

Notes

Resources · 3 for this unit, 11 more in the section
  • Hands-On LLM Serving and Optimization - Chapters 8 and 9, frameworks and optimization in practiceChi Wang and Peiheng Hu (O'Reilly) · primary

    Read Chapter 9 as a worked sequence from traffic generation and baseline through quantized and distributed variants, then the vLLM architecture and scheduler sections of Chapter 8. Replace its model, engine version and hardware with your own fixed contract.

  • vLLM V1 Architecture OverviewvLLM Project · required

    Map API server, EngineCore, scheduler, KV cache manager, model executor and distributed deployment from the current documentation into exact source files. Select the bounded contribution only after identifying its state and fallback boundaries.

  • Nano-vLLM and Mini-SGLang as Engine Reconstruction BridgesGeeeekExplorer and SGLang Project · required

    Reconstruct Nano-vLLM first, then compare Mini-SGLang cache, scheduler, overlap and model-runner boundaries. Move to vLLM or SGLang only when you can predict where the same responsibility lives.

Also in this section