Skip to content

fix(examples): disable prefix caching in multimodal QA and document the symptom - #577

Open
Ming (shuming-dev) wants to merge 2 commits into
microsoft:mainfrom
shuming-dev:multimodal-prefix-caching-note
Open

fix(examples): disable prefix caching in multimodal QA and document the symptom#577
Ming (shuming-dev) wants to merge 2 commits into
microsoft:mainfrom
shuming-dev:multimodal-prefix-caching-note

Conversation

@shuming-dev

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #560. The trainer sleeps and wakes the vLLM replicas around each update step. For multimodal rollouts, vLLM's prefix cache can desync from the multimodal receiver cache across those sleep/wake cycles (vllm#42995), surfacing as:

  • AssertionError: Expected a cached item for mm_hash='...' in the vLLM engine log, or
  • a silent rollout hang (0% GPU, requests stuck).

We hit this repeatedly in a real multimodal GRPO run; disabling prefix caching avoids it.

Changes

  • examples/multimodal_qa/train_multimodal_qa.py: set actor_rollout_ref.rollout.enable_prefix_caching: False with an explanatory comment.
  • docs/80-example-multimodal-qa.md: add a Troubleshooting entry describing the symptom and the workaround.

Text-only training is unaffected; this is scoped to the multimodal example.

…he symptom

vLLM's prefix cache desyncs from the multimodal receiver cache across the
trainer's sleep/wake cycles (vllm#42995), surfacing as
'AssertionError: Expected a cached item for mm_hash=...' or a silent
rollout hang. Turn it off in the example config and add a
troubleshooting note to the example doc.
Copilot AI balanced review requested due to automatic review settings August 31, 2026 01:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Disables vLLM prefix caching for multimodal QA and documents the related cache-desynchronization failure.

Changes:

  • Disables prefix caching in the multimodal rollout configuration.
  • Adds troubleshooting guidance for cache assertions and rollout hangs.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
examples/multimodal_qa/train_multimodal_qa.py Disables prefix caching.
docs/80-example-multimodal-qa.md Documents symptoms and mitigation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread docs/80-example-multimodal-qa.md Outdated

## Troubleshooting

- **`AssertionError: Expected a cached item for mm_hash=...`, or rollouts hanging after a sleep/wake cycle**: this is a vLLM multimodal prefix-cache desync ([vllm#42995](https://github.com/vllm-project/vllm/issues/42995)), not an Agent Lightning bug. The trainer sleeps and wakes the vLLM replicas around each update step, which is exactly what triggers it. Set `actor_rollout_ref.rollout.enable_prefix_caching: False` (already the default in this example) and restart from the latest checkpoint.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good points, both fixed in 3c3534c: the note is now scoped to vLLM < 0.22.0 (crediting the upstream fix vllm#43001), and the advice reads "restart the run — resuming from the latest checkpoint if you have checkpointing enabled" instead of assuming a checkpoint exists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants