NVIDIA-NeMo/RL #3638 — links pin head 83c655cb and vLLM v0.29.0.
reset_encoder_cache_after_weight_update, which clears both of vLLM's records through the engine.reset_encoder_cache(). That clears only the worker's record.Two pages on this PR — this one: the bug in the new per-refit cache reset.
This PR added
_reset_model_runner_caches_after_refit
to both refit finalizers
(native,
default).
It calls model_runner.reset_encoder_cache(), which only does
self.encoder_cache.clear().
The scheduler's record is untouched; only
EngineCore.reset_encoder_cache
clears both.
Who hits it: runs where the engine does not pause with a full cache clear before the refit, and an image comes back after it.
recompute_kv_cache_after_weight_updates: false: a later turn of a multi-turn episode, or a sibling rollout, sends the same image. The shipped
async video recipe is set up exactly this way.🔴 review comment C1 — vllm_backend.py:1741
Where the fix lands: RL only, two files. Nothing below is implemented. Delete the helper and its two calls.
No vLLM change needed for this PR: vLLM's own reload_weights does the same worker-only clear
(L5686),
which is worth an upstream report, but this PR only has to stop calling it on every refit.
@@ vllm_backend.py L1727-L1741 · VllmInternalWorkerExtension._reset_model_runner_caches_after_refit - def _reset_model_runner_caches_after_refit(self) -> None: - """Mirror the cache invalidation performed by vLLM reload_weights.""" - for method_name in ( - "reset_lora_state", - "reset_encoder_cache", - "reset_mm_cache", - ): - ... - reset() @@ vllm_backend.py L1803-L1804 · native finalize() self._maybe_process_mtp_drafter_after_loading() - self._reset_model_runner_caches_after_refit() @@ vllm_backend.py L1849-L1850 · default finalize() self._maybe_process_mtp_drafter_after_loading() - self._reset_model_runner_caches_after_refit() @@ test_vllm_backend.py L1872-L1874 · test_mxfp8_native_linear_refit_uses_vllm_layerwise_reload ("finalize", model, extension.model_config), - "reset_encoder_cache", - "reset_mm_cache", ]
reset_lora_state
returns at once
without LoRA enabled, and native LoRA never reaches this code. reset_mm_cache clears only a profiling cache.reset_encoder_cache_after_weight_update,
which clears both records and is documented as safe only when generation is paused.RuntimeError: Encoder cache miss for … on the first image that comes back after a weight update.
None of the GB200 tests use images, so CI does not catch it. The fix is three deletions.