How one checkpoint cut reaches calls spread over several vLLM HTTP frontends

PR #5267 ยท based on main ยท permalinks pinned to head 67c4c0c0 (this PR) and base 488ff3b9

Before
A worker with more than one HTTP frontend refused prefix cuts at setup. Only a single frontend could cut.
This PR
The frontend that gets Gym's cut call runs the cut itself and asks every other frontend, over a private local port, to run it too. Each answers with the calls it saved, and the answers are merged into one receipt.
Status
New feature, under review. The receipt comes out right. The review asks for a fix to a flood of false warnings, a one-line fix for VLM capture, one fan-out helper shared with Dynamo, a CI run with 2 frontends, and an updated description and benchmark (links at the end).
Background. During an RL checkpoint, Gym asks each vLLM worker to save the tokens generated so far for every call still running. This is a generation cut. After a restore, a saved call resumes from those tokens instead of starting over. One worker can run several HTTP frontends that share one listening socket. Each frontend is an OpenAI-style HTTP server plus its own vLLM AsyncLLM client; the engine that schedules and runs the GPU is one separate process they all share. The tokens a call has decoded so far are kept in the frontend's own copy of vLLM's request state, so a cut reads them there without asking the engine. That is why a call's tokens live only in the frontend that took its request. Dotted words have a short explanation: hover or tap them.
Why it should be faster. All frontends cut at the same time, and each saves only the calls it holds, so the cut's wall time is about the slowest frontend's share, not the sum. What does not shrink: each frontend still walks Gym's whole list and builds a failure ack for every call it does not hold, and Gym's own prepare/commit and the TQ save stay the same. The timing tables in the PR description were measured on an earlier design, where a frontend skipped calls it did not hold, so they do not measure this code. It is slower when a frontend stalls: the cut then waits up to token_capture.control_timeout_s for it.

Same 3 calls, one frontend vs two

Gym's list names 3 calls: c1 is running on frontend A, c2 is running on frontend B, and c3 has not reached the worker yet. Gym's request lands on B. Nobody chooses this: all frontends wait on one shared socket, and the operating system hands each new connection to whichever frontend accepts it first.

legend: new in this PR โœ“saved (resumes) โœ—failure ack (regenerates) โš "cannot cut โ€ฆ this worker has no record of it" warning Before: 1 frontend Gym policy server POST /generation-cut [c1,c2,c3] vLLM worker (Ray actor, GPU), 1 frontend โ‘  route โ†’ run_cut(every call) c1 โœ“ c2 โœ“ c3 โœ—โš  holds every call it was sent, so the only โš  is a call not yet arrived โ‘ก receipt โ†’ Gym [c1 โœ“, c2 โœ“, c3 โœ—] 2+ frontends with cuts: ValueError at setup (this PR removes it) TQ (shared store) W: rows of c1, c2 This PR: 2 frontends, one engine Gym policy server POST /generation-cut [c1,c2,c3] โ†’ shared socket, B happens to accept it vLLM worker (Ray actor, GPU): 2 frontend processes, one shared socket, one engine frontend A private port 127.0.0.1:A (new) holds c1 (running) โ‘ข /generation-cut/frontend run_cut(every call) c1 โœ“ c2 โœ—โš  c3 โœ—โš  answers saved acks only: {prefixes: [c1]} frontend B (got Gym's call) private port 127.0.0.1:B holds c2 (running) โ‘  _cut_here: run_cut(every call) c1 โœ—โš  c2 โœ“ c3 โœ—โš  โ†’ saved acks [c2] โ‘ก ask A, at the same time as โ‘  one deadline for every frontend โ‘ฃ merge_cut_receipts first saved ack per call wins; a call with none โ†’ failure ack [c1 โœ“, c2 โœ“, c3 โœ—] โ‘ค one receipt โ†’ Gym POST [c1] TQ (shared store) W: A writes c1 rows, B writes c2 rows ยท R: on restore, any frontend reads by key

Count the โš  marks: one frontend logs 1 (the call not yet arrived), two frontends log 4, because each warns about the call the other one holds. With 4 frontends and about 230 live calls, that is about 690 warning lines per cut, and the one real "not arrived yet" warning is lost among them. The receipt is still right: the merge turns a call nobody saved into a failure ack.

QuestionAnswer from the code
Where do the two paths meet?Every frontend runs the same run_cut as one frontend did before. The new part is only around it: FrontendCutFanOut starts the cuts, and merge_cut_receipts merges them. That merge moved here from the Dynamo frontend, which already fans one cut out over several engines the same way.
Can the peer call go to another node?No. Each frontend binds its private port on 127.0.0.1 (L1801). All frontends of a worker live on one node.
Who learns the peers' ports?At startup the owner frontend collects every frontend's private URL and sends the full list to all of them (L821-L826), so any frontend can lead a cut.
What else is now per frontend?Cut settings go to child frontends with the capture command (L1069), so each child also starts its own prefix-writer actor (1 CPU). flush also reaches children (L2315), and prefix counts are summed over frontends (L2328).

The route, as pseudocode

Before (one frontend only)

# the frontend's serving event loop
def checkpoint_generation_cut(inventory):
    check bearer token
    return run_cut(inventory)                         # unknown call โ†’ failure ack + โš 

After

# any frontend's serving event loop
def checkpoint_generation_cut(inventory):
    check bearer token
    if not peers:                                      # 1 frontend: path unchanged
        return run_cut(inventory)
    deadline = now + control_timeout_s                # one deadline for every frontend
    cuts = [task(run_cut(inventory) โ†’ saved acks),       # mine; โš  for every call I don't hold (C5)
            *[task(POST url/frontend) for url in peers]]  # each peer runs the same run_cut
    done, late = wait(cuts, until=deadline)         # all at once
    cancel(late); warn "N of M frontends late"        # their calls regenerate
    return merge_cut_receipts(inventory, done)        # unsaved call โ†’ failure ack

Real code: checkpoint_generation_cut, FrontendCutFanOut.run_cut, frontend_generation_cut.

What the review asks

The design holds up: one merge function now serves both the native frontends and Dynamo, and Gym accepts the merged receipt. The asks: stop each frontend warning about calls it doesn't hold (C5). Send media_family to child frontends, which VLM capture needs, and test that the forwarded settings match the function (C1). Share one fan-out helper with Dynamo, so one slow frontend can't fail the whole cut (C7, with a worked draft). Add a CI run with 2 frontends (C2). Bring the description and benchmark up to this design (C6).

C6 โ€” description + benchmark ยท generation_cut_route.py:156 C5 โ€” false warnings ยท generation_cut_route.py:205 C1 โ€” media_family + settings test ยท vllm_worker_async.py:1073 C7 โ€” one shared fan-out helper ยท generation_cut_route.py:176 C2 โ€” CI run with 2 frontends ยท nemo-gym-integration.md:84

These links open for others once the review is published.