Skip to content

fix(pytorch): preserve routed experts during prefill scoring - #5198

Draft
qescccczmr wants to merge 1 commit into
InternLM:mainfrom
qescccczmr:fix/prefill-scoring-routed-experts
Draft

qescccczmr wants to merge 1 commit into
InternLM:mainfrom
qescccczmr:fix/prefill-scoring-routed-experts

Conversation

@qescccczmr

Copy link
Copy Markdown
Collaborator

Motivation

Agentic RL replay can use /generate with max_tokens=0 to score a fixed sequence. When the caller also requests routed experts, the prefill scoring branch currently discards the model's routes, so replay needs a separate generation request to collect them.

Changes

Carry routed experts alongside the compact input logprobs and append them to the sequence when zero-token prefill completes. The terminal response uses the existing routed-expert history and offset handling. The scoring path still finishes with zero generated tokens.

Validation

217 CPU tests passed across the model agent, prefill logprob, generate route, and session cleanup suites, with 8 CUDA cases skipped. The new regression tests cover requested and unrequested routes and terminal expert history. The generate tests check the joint response in streaming and non-streaming modes. Ruff, Markdown formatting, docstring formatting, and git diff --check passed.

The current prefill scoring constraints, including disabled speculative decoding, still apply.

This branch has not been deployed

No deployments
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.

1 participant