READ THE FRAMEWORK · UNDERSTAND EVERY LAYER

Learn DeepInfer.

Understand DeepInfer. Follow the request.

Start at request entry and trace each scheduling and execution round. Explore how DeepInfer connects caching, sampling, state updates, and experts.

Framework guide12 core mechanismsGrounded in source
01 / THE REQUEST FLOW

One request. A connected framework.

LLMEngine.step coordinates scheduling, execution, sampling, and state updates. Follow inputs, outputs, and shared state to understand each module boundary.

framework_flow.py
# Framework pseudocode for reading responsibilities.
for request in inputs:
    llm_engine.add_request(request)

while llm_engine.has_unfinished_requests():
    ready_outputs = llm_engine.step()
    collect(ready_outputs)

collect(llm_engine.flush_inflight_reqs())
# step: schedule -> execute -> sample -> state updates
# ZOS may commit a prior round and defer current state.
# One round may involve multiple requests and token positions.

Framework pseudocode · a round may cover several requests and token positions

Mechanism demo · preset framework states01 / 07

One request, step by step

engine.step()
01Prepare
02Execute
03Sample
04Commit
Preset token sequenceIllustrative IDs
41872330··
Input · 3 tokensSelected · 0 tokens

Prepare: preset token IDs are in request state, waiting for an execution plan.

KV cache 0 positions
02 / THE LEARNING PATH

One mechanism at a time.

12 progressive lessons that follow requests through DeepInfer’s architecture and mechanisms.

Your progress0 / 12
s0115 min

Follow a Request

Start at LLM.generate and trace scheduling, execution, sampling, and state updates.

s0222 min

Inside an Execution Step

Understand how Worker and ModelRunner pass input metadata, cache references, and sampling results.

s0318 min

Remember with KV

Follow CacheEngine and request lifetimes to see how historical state is retained, located, and released.

s0416 min

Choose the Next Token

Trace model output through sampling into request state that can be committed.

s0518 min

Work in Batches

Use static batching to understand request identity, input layouts, and independent stopping conditions.

s0622 min

Schedule Every Step

Understand continuous batching through waiting and running queues plus token budgets.

s0720 min

Page the KV Cache

Use a block table to separate logical token positions from physical cache blocks.

s0820 min

Reuse a Prefix

Use request forks to understand prefix reuse, reference counts, and copy-on-write.

s0925 min

Draft, Then Verify

Separate drafting, target verification, and confidence budgets to advance several tokens at once.

s1024 min

Overlap the Pipeline

Read ZOS forward, postprocess, and sampling order, including one-step-late state correction.

s1124 min

Route to Experts

Follow a MoE pass through gating, dispatch, expert computation, and combine.

s1225 min

Balance the Hot Experts

Understand EPLB through historical token counts, then evaluate placement on the next window.

Every lesson is open. Reading progress stays in your browser.

03 / THE BIG PICTURE

Put each mechanism in context.

Understand DeepInfer through four layers of responsibilities and state.

01

Inference core

Connect request entry, sampling, and state updates through the framework.

02

State & memory

Understand cache ownership, block mappings, and prefix reuse.

03

Batching & scheduling

Plan each round under request, token-budget, and execution dependencies.

04

Distribution & experts

Trace expert routes, physical replicas, and distributed coordination.

Keep reading: official system design and source map

FOLLOW THE REQUEST

Understand it through the source.

Chapter 1: map entry, scheduling, execution, and state updates.

Open Chapter 1