Skip to content

feat(client): decode opaque routed expert payloads - #2408

Open
biswapanda wants to merge 12 commits into
PrimeIntellect-ai:mainfrom
biswapanda:feat/native-routed-experts-0820
Open

feat(client): decode opaque routed expert payloads#2408
biswapanda wants to merge 12 commits into
PrimeIntellect-ai:mainfrom
biswapanda:feat/native-routed-experts-0820

Conversation

@biswapanda

@biswapanda biswapanda commented Aug 20, 2026

Copy link
Copy Markdown

Summary

  • preserve routed-expert response strings as opaque payloads at the Generate client boundary
  • associate the request-local prompt offset without adding it to the transport schema
  • decode native vLLM Base64 NumPy data during graph attribution
  • decode Prime-RL's JSON tensor envelope at the same client-owned boundary
  • preserve the existing structured representation during migration
  • promote cache_salt from sampling extras to the native Generate API field

Dynamo and vLLM do not need to know Prime-RL's routed-expert representation. Verifiers owns interpretation because it consumes the data for trajectory attribution and router replay.

Validation

  • uv run pytest tests/v1/test_train_client.py tests/v1/test_graph.py -q: 11 passed
  • uv run ruff format and uv run ruff check passed on touched files
  • Kubernetes Qwen3-MoE end-to-end run on 2026-08-26: two-step Prime-RL GRPO completed with exit code 0
  • direct decoder proof: _decode_routed_experts consumed the opaque wire value and returned shape [14, 2, 2], dtype uint8, prompt start 1, and experts [0,1,2,3,4,6,7]
  • actual training-path proof: the attributed routed data reached Prime-RL's conditional tensor conversion and router replay, producing Routing Conf. 0.3212 and 0.3233 on steps 1 and 2
  • end-to-end marker: PRIME_ROUTED_EXPERTS_PATH_EXECUTED, request 977f27f8-dd7d-411e-b98a-c5cf4971e22f, OpaquePayload.bytes=184

The integration run used vLLM #52723 with merged #53204, Dynamo #13531 plus its existing request/control and worker-metadata dependencies, and Prime-RL #3296.

mikasenghaas and others added 8 commits August 18, 2026 18:08
Cancelling the EnvClient's awaiting task previously orphaned the
server-side rollout: ZMQ multiplexes every request over one socket,
so abandonment is invisible without an explicit message. On
CancelledError for a run, the client now fire-and-forgets a 'cancel'
carrying the run's request_id; the pool broker routes it to the
worker holding that run (answering unknown/finished targets inline),
and the worker cancels the rollout's asyncio task. An aborted run
still replies (error='Cancelled') so broker and client accounting
stay exact. Callers keep implicit semantics: cancelling the client
task is all it takes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Shield sandbox creation through the id capture: a cancel that aborts
  the create POST mid-flight left the platform building a sandbox this
  side never learned the id of, so teardown could not delete it and
  the sandbox leaked to the reconciler. Youngest-first overload sheds
  cancel exactly the episodes still provisioning, making this common.
- Hold strong references to fire-and-forget cancel tasks: the loop
  only keeps weak refs, so an unreferenced task could be garbage
  collected before the cancel was ever sent.
close() could tear down the ZMQ socket before a scheduled
fire-and-forget cancel ran, leaving the server-side rollout running.
Also apply repo formatting to the touched files.
- Register run tasks in the dispatch loop, not the handler: a cancel
  scheduled ahead of the run's handler task found no entry and the
  rollout kept running. ZMQ preserves per-client frame order, so the
  run frame always lands first and dispatch-time registration is race
  free.
- Tolerate unparseable cancel payloads in the pool broker: the unpack
  ran on the broker loop with no error handling, so one bad frame tore
  down every in-flight rollout behind it.
- Drain cancel tasks after the receiver stops and loop until empty: a
  run cancelled in the same shutdown wave could schedule its cancel
  after a single early drain and lose it to the socket close.
# Conflicts:
#	verifiers/v1/runtimes/prime.py
@biswapanda biswapanda changed the title feat(client): accept native routed expert arrays feat(client): decode opaque routed expert payloads Aug 26, 2026
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