20/41
Part 4 of 7 · Sharing the fleetLearn and do

Bring evicted sequences back, but cap the evictions

vLLM brings an evicted sequence back in one of two ways. It can swap the cache out to CPU memory and back in, or it can recompute it.

Recompute is cheaper than it sounds. The tokens generated so far join the prompt, and the whole thing runs as one prefill pass. That can take much less time than generating those tokens did.

Preemption needs a guard. A sequence evicted ten times pays for a prefill on every resume, and may never finish. Cap evictions per request. When interactive load stays high, move batch to dedicated replicas.

Name the hardware trade:

LayoutUtilizationRisk to interactiveCost
Shared replicas with preemptionhighestlong batch prompts and cache pressure interfere with interactive stepsa priority-aware engine and careful reserves
Dedicated batch replicaslowestnoneidle when batch is empty, no help at interactive peaks
Replicas that move between tiers by hourin betweenlowminutes of model loading on every move

In the editor, write evict(running, need_gib). Each running batch sequence has an id, its cache in GiB, the tokens it has generated, and how many times it was already evicted. Evict the ones with the fewest generated tokens first, since they are cheapest to recompute, until need_gib is free. Skip any sequence already evicted cap times.