Second size review of NVIDIA-NeMo/RL #4612, PR 8 of 11 in the prefix-recovery stack. Line counts are from git diff 3821aa8 f47c6b4 (the PR against its real base, #4583). Permalinks pin the head f47c6b48. Review comments are in a pending review; their links work once it is published.
Four pages on this PR. This one covers what is still too big after the author's fixes.
With router replay on, each cut saves the expert route rows for the tokens decoded since the last cut. vLLM keeps a running request's routes as a list of small pieces that it only appends to. A cut takes that list from the same read that copies the tokens. Commit 352f46c4 then adds a buffer that doubles when full, so a cut copies only the new pieces (absorb_engine_route_pieces). One function later, frozen_cut_routed_experts joins every row into a cumulative tensor that its only caller unpacks and never reads.
The buffer is worth having only once the unused copy is gone. Until then it adds ~55 source and ~90 test lines with no time saved. It has no timing numbers, and the PR description says this stack goes "correctness first, optimization last". So the review asks for the copy to go here, the buffer to go to #4508 (the stack's I/O speed-up PR), and timing numbers for it there. #4508 is already rebased on this PR and still carries both.
| What the PR writes | Replace with | lines |
|---|---|---|
A cumulative route tensor built on every cut and never read (frozen_cut_routed_experts) | Return only the chunk, sliced straight from the engine rows. Checked equal to today's output on 20,000 random cases. | ~15 src |
The buffer that doubles when full, its join helper, its 4 fields and 4 tests (commit 352f46c4) | One np.concatenate(pieces). The buffer comes back in #4508 with timing numbers. | ~70 src ~95 test |
_merge_generation_cut_routed_experts runs right after _delta_align_routed_experts, unpacks the same message again, and decodes and re-encodes the same routes | A restored= argument on the align step | ~45 src |
| A route hash logged at restore and at completion. Both come from the same tensor in the same worker, so they can only differ if the routes were dropped. | Log prefix_routes=kept|dropped once | ~30 net |
A prompt_routed_experts lookup that vLLM 0.29 never fills | Read routed_experts only | ~8 src |
Three checks that cannot fire, a second builder for the -1 row, and one test that folds into another | Delete / reuse _final_route_placeholder / fold | ~14 src ~14 test |
Worth keeping: the route read inside the token read (f47c6b48, −108 lines), the shared phase helpers in the functional scripts (the Omni test drops 124 lines), and decode_routed_experts(dtype=None), which deletes two copied dtype tables.