Skip to content

[refactor] Remove legacy inference codepath#1835

Merged
SumanthRH merged 12 commits into
mainfrom
remove-old-inference
Jul 1, 2026
Merged

[refactor] Remove legacy inference codepath#1835
SumanthRH merged 12 commits into
mainfrom
remove-old-inference

Conversation

@SumanthRH

@SumanthRH SumanthRH commented Jun 26, 2026

Copy link
Copy Markdown
Member

What does this PR do?

Summary

This PR removes the old Ray actor-based inference stack and standardizes SkyRL on the HTTP/vLLM-based inference path. The _SKYRL_USE_NEW_INFERENCE flag is removed entirely, the legacy inference_engines/ module is deleted, and the remaining training, generation, examples, and docs surfaces now target the HTTP/vLLM server path.

The PR also migrates several examples and integrations that still assumed the old path, fixed/static inference ports, or the legacy custom vLLM server module.

Changes made

Core

Legacy inference stack removal

  • Deleted the legacy skyrl/backends/skyrl_train/inference_engines/ package, including the old Ray-wrapped inference client, remote inference engine, HTTP endpoint client, vLLM engine wrapper, and old custom vLLM server.
  • Deleted the old inference_servers/vllm_worker.py wrapper.
  • Removed _SKYRL_USE_NEW_INFERENCE and collapsed all old/new inference branches onto the HTTP/vLLM path.
  • Removed old-inference-only tests, scripts, and CI workflow files.
  • Moved the shared inference interface and I/O types into inference_servers/base.py.
  • Moved reusable inference helper logic into inference_servers/engine_utils.py.

Inference interface and remote client

  • Simplified InferenceEngineInterface around the methods actually used by the HTTP/vLLM path.
  • Made RemoteInferenceClient implement the interface directly so the interface and concrete client cannot drift.
  • Added interface methods/properties used by generators and integrations:
    • model_name
    • get_endpoint_url()
    • get_world_size()
    • render_chat_completion()
    • finish_session()
  • Updated generators and integrations to use InferenceEngineInterface and get_endpoint_url() instead of reaching into RemoteInferenceClient.proxy_url when possible.
  • Added coverage that served_model_name is passed into vLLM and used correctly by RemoteInferenceClient and server setup.

vLLM server entrypoint

  • Extended skyrl.backends.skyrl_train.inference_servers.vllm_server_actor so it can also be launched as a standalone module:
    • python -m skyrl.backends.skyrl_train.inference_servers.vllm_server_actor
  • The standalone entrypoint uses vLLM's OpenAI server setup while preserving SkyRL's custom endpoints needed by training and weight sync.
  • Added GPU coverage for the standalone entrypoint:
    • health check
    • OpenAI chat completion
    • SkyRL token-in/token-out generation endpoint
  • This lets external rollout-server deployments use the same SkyRL-aware vLLM server path as the Ray actor path.

Weight sync cleanup

  • Removed legacy receiver-side abstractions and the unused WeightLoader.
  • Simplified weight transfer strategy contracts around the new vLLM-native receiver path.
  • Weight loading on the inference side is handled through vLLM's native transfer engines + NewInferenceWorkerWrap.SkyRL's WeightTransferReceiver abstractions have been removed for now.
  • Added strategy-to-vLLM transfer engine mapping:
    • broadcast/NCCL -> NCCLWeightTransferEngine
    • CUDA IPC -> IPCWeightTransferEngine
  • Simplified BroadcastTransferStrategy.create_init_info by requiring the inference world size from client.get_world_size().
  • Removed stale legacy chunk-transfer branches and related tests.

Config and routing cleanup

  • Removed old fixed HTTP endpoint config knobs:
    • generator.inference_engine.http_endpoint_host
    • generator.inference_engine.http_endpoint_port
    • generator.inference_engine.enable_http_endpoint
  • Cleaned up generator.inference_engine.async_engine references across docs and examples. The config loader now tolerates/removes legacy async_engine=true overrides but rejects unsupported async_engine=false.
  • Removed old helper code that only existed for the legacy path, including route_prompts_to_engines and hash_with_sha256.
  • Updated SkyRL Agent integration code to stop depending on the removed HTTP endpoint config and old dataloader workarounds.

Tinker updates

  • Updated SkyRLTrainBackend so colocated inference engines are put to sleep after initialization, matching the colocated behavior with the python entrypoint and freeing memory before training work starts.
  • Updated Tinker E2E scripts to pin the tinker-cookbook commit for reproducibility.
  • Updated Tinker/SkyRL sample routing and related tests to work through the HTTP/vLLM path.

Examples

MiniSWE Agent example

  • Migrated MiniSWEAgentGenerator to the new inference interface.
  • The generator now gets the router URL from inference_engine_client.get_endpoint_url().
  • OPENAI_BASE_URL is set at runtime inside the Ray task that runs MiniSWE-Agent, because LiteLLM reads that environment variable from the task process.
  • Removed the fixed OPENAI_BASE_URL assumption from .env.miniswe; the router port is dynamic in the new inference path.
  • Updated MiniSWE launch scripts to remove legacy inference config overrides.

Thunder-Agent example

  • Migrated the Thunder-Agent R2EGym 32B recipe away from the legacy vLLM server module.
  • The rollout server launcher now defaults to SkyRL's new standalone vLLM server entrypoint:
    • skyrl.backends.skyrl_train.inference_servers.vllm_server_actor
  • This is intentionally not the vanilla vllm.entrypoints.openai.api_server, because SkyRL still needs custom endpoints for weight sync and inference-server control.
  • Updated the Thunder-Agent scripts and README around the new rollout-server path.
  • Added robust rollout-server process-tree cleanup in the launcher so external vLLM EngineCore / worker subprocesses do not leak GPUs after shutdown.
  • Updated Thunder-Agent generator/router handling for the new endpoint semantics and program-release flow.

Remote inference server examples

  • Migrated the old remote_inference_engine example into remote_inference_server.
  • Added a serve/vLLM-native server launch script for remote inference.
  • Updated remote inference docs and examples to point at the serve entrypoint and HTTP/vLLM server path.

Harbor, Verifiers, RLM, and OpenRouter examples

  • Updated Harbor and Verifiers generators to use get_endpoint_url() instead of removed fixed host/port config.
  • Updated RLM/OpenRouter client code for interface parity with InferenceEngineInterface.
  • Removed old enable_http_endpoint / async_engine overrides from Harbor, Verifiers, OpenEnv/OpenReward, RLM, and related integration scripts.

General training scripts

  • Removed obsolete generator.inference_engine.async_engine=true and old HTTP endpoint overrides from the example training scripts.
  • Migrated the algorithm, Megatron, LoRA, GSM8K, text-to-SQL, search, VisGym, fully async, router replay, and integration launch scripts to the new default inference behavior.
  • Updated Tinker example server scripts to use the current serve/vLLM path.

Removed obsolete examples

  • Removed the old FlashRL example and docs that depended on the old inference stack.
  • Removed old helper scripts that compared old-vs-new inference or launched multiple legacy remote servers.

Docs

Architecture and configuration docs

  • Updated the inference architecture docs to describe the HTTP/vLLM path as the standard path.
  • Removed references to _SKYRL_USE_NEW_INFERENCE, the old Ray actor inference stack, and deleted legacy classes.
  • Updated configuration docs to remove the deprecated HTTP endpoint host/port, enable_http_endpoint, and async_engine knobs.
  • Updated placement and Tinker architecture docs for the new colocated inference behavior.

Example docs

  • Updated example pages for PPO, Geometry3K, Search, VisGym, multi-turn text-to-SQL, remote inference, and fully async training.
  • Removed the FlashRL example page and metadata entry.
  • Updated Harbor and agent-integration docs to use the new inference endpoint behavior.

Internal contributor docs

  • Updated .claude/docs architecture, inference, contributing, and weight-sync notes to match the new inference and weight-sync structure.
  • Updated API/sidebar metadata after deleting or moving example pages.

Tests and CI cleanup

  • Deleted legacy-only tests under tests/backends/skyrl_train/inference_engines/.
  • Removed old GPU CI workflow/scripts for the legacy inference stack.
  • Updated shared tests to run directly against the new inference path.
  • Added GPU coverage for the standalone SkyRL vLLM server entrypoint.
  • Added/updated coverage for:
    • RemoteInferenceClient
    • served_model_name
    • prompt/chat rendering
    • VLM generation
    • LoRA serving/reload
    • weight sync
    • generator endpoint routing
    • Tinker sample routing

Validation

  • ruff and black pass.
  • CPU test coverage passes for weight sync, transfer strategies, prompt routing, generators, trainer, config migration, and Tinker sample routing.
  • GPU CI workflows pass locally:
    • SkyRL-Train-GPU
    • SkyRL-Train-Megatron-GPU
    • Megatron-Model-GPU-CI
    • SkyRL-GPU-E2E-CI
    • H100 GPU CI
    • SkyRL-GPU-E2E-CI-Tinker-Fully-Async sanity run

Removes the legacy Ray-actor inference implementation, leaving only the
HTTP-based path (formerly gated by _SKYRL_USE_NEW_INFERENCE=1, now the only
path). The private feature flag is deleted entirely.

- Delete skyrl/backends/skyrl_train/inference_engines/ (legacy client,
  remote/ray-wrapped engines, vLLM server/engine) and the legacy
  inference_servers/vllm_worker.py (WorkerWrap).
- Relocate the still-shared pieces out of inference_engines/ before deleting
  it: the InferenceEngineInterface + I/O types move to
  inference_servers/base.py, and the shared helpers (build_engine_runtime_env,
  route_prompts_to_engines, get_sampling_params_for_backend, ...) move to a new
  lightweight inference_servers/engine_utils.py (kept import-light to avoid a
  cycle with server_group.py). All import sites repointed.
- Weight sync: drop the legacy _send_chunks_legacy branches and the now-dead
  receiver side (Broadcast/CudaIpc WeightTransferReceiver, create_receiver,
  WeightTransferReceiver ABC, strategy_type/for_engine). The receive side is
  vLLM's native weight-transfer engine driven by NewInferenceWorkerWrap.
- Collapse every _SKYRL_USE_NEW_INFERENCE branch to the new path across
  entrypoints, generators, workers, the Tinker backend, and train utils;
  remove the env var and its Ray runtime-env propagation.
- Tests: delete legacy-only suites (http endpoint, transfer-strategies-e2e,
  pause/continue, weight_sync_moe, remote_weight_loader, new-vs-old); de-gate
  shared fixtures/tests; move test_route_prompts_to_engines into
  inference_servers/.
- CI: remove the gpu_skyrl_train_old_inference workflow and its two scripts.
- Examples/docs: remove the flash_rl example; migrate the remote_inference
  example and r2egym rollout scripts to the serve entrypoint / vLLM-native
  server; scrub legacy references across docs.

Verified: ruff/black clean; CPU suites (weight_sync, transfer strategies,
route-prompts, generators, trainer, Tinker sample-routing) all pass; GPU CI
inference_servers/ (32 passed) and test_policy_local_engines_e2e.py (6 passed)
pass on H100.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: SumanthRH <sumanthrh99@gmail.com>
SumanthRH and others added 2 commits June 29, 2026 21:41
Follow up to removing the legacy inference codepath. Moves the last pieces
that still assumed the old path over to the HTTP based inference client and
server.

- RemoteInferenceClient now inherits from InferenceEngineInterface. Trimmed the
  interface down to what the client actually implements and added a
  get_endpoint_url method so the generators can resolve the endpoint without
  depending on the concrete client type.
- The mini swe agent, harbor and verifiers generators read the endpoint url at
  runtime instead of a fixed host and port. The mini swe agent sets the base
  url inside the Ray task that runs the trajectory.
- Removed the http_endpoint_host and http_endpoint_port options along with
  every reference to them in scripts, tests and docs.
- The tinker backend now puts the inference engines to sleep at initialization
  when training and inference are colocated, matching the old behaviour.
- Added a standalone entrypoint to the vllm server actor module so it can be
  launched directly with python -m, serving the vllm openai server together
  with our custom endpoints, and pointed the thunder agent at it.
- Removed route_prompts_to_engines and hash_with_sha256, which only the old
  path used.

Also makes the gsm8k end to end test run name unique so that concurrent runs
in the shared weights and biases project do not collide.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: SumanthRH <sumanthrh99@gmail.com>
Signed-off-by: SumanthRH <sumanthrh99@gmail.com>
@erictang000 erictang000 mentioned this pull request Jun 29, 2026
39 tasks
SumanthRH and others added 7 commits June 30, 2026 01:35
A round of cleanups on top of the new inference path, after merging vllm 0.23.0.

- Weight sync: remove the unused WeightLoader; make
  BroadcastTransferStrategy.create_init_info take a required inference_world_size
  and drop the None branch; add a get_vllm_transfer_engine reference method to
  each strategy (NCCL and CUDA IPC); and drop the dead torch.distributed era
  fields from BroadcastInitInfo.
- InferenceEngineInterface: add get_world_size, finish_session,
  render_chat_completion and a model_name property so the interface covers every
  client member the generators rely on. RemoteInferenceClient and
  OpenRouterInferenceClient already satisfy these.
- Thunder agent: kill the whole process tree of each rollout server on cleanup so
  the vLLM engine core is not orphaned on the GPU.
- Standalone server entrypoint test: tear down the server process tree so the
  test never leaks a GPU, and check a SkyRL specific endpoint.
- Docs: update the weight sync layout and the inference architecture endpoint
  names.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: SumanthRH <sumanthrh99@gmail.com>
- weight sync GPU test: drop the BroadcastInitInfo fields removed in the cleanup
  (group_name / backend / model_dtype_str) so the broadcast weight-sync test stops
  crashing.
- mini-swe: append /v1 to OPENAI_BASE_URL so LiteLLM's openai provider hits the
  router's OpenAI routes instead of 404ing.
- OpenRouterInferenceClient.generate now accepts the model arg from the interface;
  harbor generator type-hints InferenceEngineInterface.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: SumanthRH <sumanthrh99@gmail.com>
Signed-off-by: SumanthRH <sumanthrh99@gmail.com>
x
Signed-off-by: SumanthRH <sumanthrh99@gmail.com>
Signed-off-by: SumanthRH <sumanthrh99@gmail.com>
…p_endpoint

Signed-off-by: SumanthRH <sumanthrh99@gmail.com>
x
Signed-off-by: SumanthRH <sumanthrh99@gmail.com>
SumanthRH added 2 commits July 1, 2026 07:16
Signed-off-by: SumanthRH <sumanthrh99@gmail.com>
Signed-off-by: SumanthRH <sumanthrh99@gmail.com>
@SumanthRH
SumanthRH marked this pull request as ready for review July 1, 2026 17:49
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

@SumanthRH
SumanthRH merged commit 19b0e13 into main Jul 1, 2026
5 checks passed
hao-aaron added a commit to hao-aaron/SkyRL that referenced this pull request Jul 1, 2026
Reconciles our vLLM 0.23.0 native weight-sync cleanup with main's
NovaSky-AI#1835 "[refactor] Remove legacy inference codepath" (which removed the
local Ray-actor engine path and the _SKYRL_USE_NEW_INFERENCE flag).

Conflict resolutions:
- inference_engines/ray_wrapped_inference_engine.py, remote_inference_engine.py:
  deleted on main. Accepted deletion — our changes are superseded:
  the vLLM version is now hard-pinned to 0.23.0 in pyproject.toml (our
  runtime assertion is moot), and token-in-token-out is now native in
  vllm_server_actor.py's /skyrl/v1/generate (returns resp.token_ids
  directly), so our return_token_ids HTTP change is no longer needed.
- test_pause_and_continue_generation.py: deleted on main. Accepted deletion.
- new_inference_worker_wrap.py: kept our near-empty hook + #44814
  patch_numel_loaded (main had NOT done this cleanup; its version still
  carried the collective_rpc update_weights_ipc/nccl methods).
- broadcast_strategy.py / cuda_ipc_strategy.py / remote_inference_client.py:
  auto-merged — main dropped the legacy _SKYRL_USE_NEW_INFERENCE dispatch
  and _send_chunks_legacy, our native-endpoint sender edits apply on top.
  Verified coherent (no leftover refs to removed symbols).
- .claude/docs/weight_sync.md: dropped legacy WorkerWrap sections, kept
  our accurate native-endpoint lifecycle description.

Follow-up: LayerwiseReloadWorkerMixin in layerwise_reload.py is now dead
code (patch_numel_loaded/get_numel_loaded there are still used).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant