Skip to content

feat(genrm_model): serve external GenRM vLLM pools without Ray - #6056

Merged
ananthsub merged 4 commits into
mainfrom
ananthsub/genrm-external-no-ray
Nov 13, 2026
Merged

ananthsub merged 4 commits into
mainfrom
ananthsub/genrm-external-no-ray

Conversation

@ananthsub

@ananthsub ananthsub commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #6039. This PR's base is that PR's branch, so the diff shows only the genrm_model change.

What changed and why

genrm_model declares ray_enabled = True. Gym reads that flag from the entrypoint's source before any config exists. Production RL recipes point genrm_model at an external GenRM vLLM pool by injecting base_url, and that server still pays for Ray, though it launches nothing:

  • The supervisor starts or joins Ray for it.
  • The server process joins Ray itself.
  • The module imports local_vllm_model/app.py, which loads Ray and vLLM.

The NeMo RL launchers inject that base_url at genrm_model.responses_api_models.genrm_model.base_url. They launch GenRM locally instead when no pool URL is set.

This PR adds responses_api_models/genrm_model/external_app.py, a second entrypoint for the external case. It builds on the local_vllm_model external entrypoint from #6039:

  • It declares ray_enabled = False and imports neither Ray nor vLLM, so the supervisor starts no Ray cluster on its account.
  • It keeps the GenRM request handling: the response_1, response_2 and principle roles taken from metadata, and supports_principle_role.
  • It requires a non-empty base_url. It accepts every app.py key, with vllm_serve_kwargs and vllm_serve_env_vars optional. A config switches between a local launch and an external pool by changing entrypoint and base_url.
  • It keeps the /get_inner_vllm_config route and supports num_workers > 1.
  • The GenRM README documents it, including a launcher example that sets base_url and entrypoint together.

The GenRM role handling and GenRMModelConfig move from app.py to common.py, which imports neither Ray nor vLLM. app.py imports GenRMModelConfig from there, so from responses_api_models.genrm_model.app import GenRMModelConfig keeps working. The external config inherits GenRMModelConfig, so a GenRM field added there also reaches the external entrypoint.

The second commit replaces GenRMModelMixin with append_genrm_roles, a plain function on the request body. The mixin had no base class but called super(), so it worked only when listed before a VLLMModel subclass, and nothing declared that. Its get_converter repeated VLLMModel.get_converter. GenRMModel and GenRMExternalModel now each run the base preprocessing and then call the function. Code that imported GenRMModelMixin must call append_genrm_roles instead; nothing in Gym or on NeMo RL main imports it.

A later commit corrects the reason the docs give for app.py joining Ray with an external base_url: Gym decides from the entrypoint class's ray_enabled, not from base_url, and the config is already loaded at that point. The same wording came in with #6039, so the fix also touches fern/versions/latest/pages/model-server/local-vllm.mdx and a comment in local_vllm_model/app.py. The commit also notes that GenRMExternalModelConfig takes every field both bases have from LocalVLLMExternalModelConfig, and adds a test that both configs agree on every default apart from the launch settings.

Issue

No issue. This applies the #6039 approach to genrm_model, the other model server that production recipes point at an external pool.

Compatibility

Existing configs behave exactly as before: app.py still accepts base_url and skips the local launch. To opt in, a config sets entrypoint: external_app.py.

The NeMo RL launchers that inject base_url for GenRM are examples/nemo_gym/nemotron-3.5-lightning/lightning35_launch.sh and examples/nemo_gym/nemotron-3-ultra/ultra_launch.sh. For them, opting in is one more override in the branch that sets base_url. The local-launch fallback keeps using app.py:

++env.nemo_gym.genrm_model.responses_api_models.genrm_model.entrypoint=external_app.py

Validation

Run locally on a workstation. The genrm_model tests ran in this worktree's own genrm_model server venv (vLLM 0.29.0, Ray 2.58.0), because both app.py and the import check need vLLM installed:

RAY_TMPDIR=/tmp responses_api_models/genrm_model/.venv/bin/python -m pytest -o addopts="" responses_api_models/genrm_model/tests

The core checks ran in a worktree venv with the dev and ray extras:

RAY_TMPDIR=/tmp pytest -o addopts="" \
  tests/unit_tests/server_runtime/test_ray_opt_out.py \
  tests/unit_tests/test_public_api.py \
  tests/unit_tests/test_public_api_facades.py
pre-commit run --files <changed files>

The new tests check that:

  • running external_app.py in a subprocess loads neither ray nor vllm. The check first requires Ray and vLLM to be installed, so an entrypoint that imports them behind a try/except ImportError can't pass it;
  • the entrypoint's source declares ray_enabled = False. The supervisor leaves it out of the Ray server list while still listing an app.py server in the same run;
  • the server does not join Ray even when the run has a cluster address;
  • the config rejects an empty base_url, inherits every GenRMModelConfig field and its default, and accepts the shipped configs/genrm_model.yaml block once base_url is added;
  • the server still adds the GenRM roles from metadata, with and without supports_principle_role, and consumes metadata;
  • /get_inner_vllm_config reports the external pool.

The test_app.py tests check append_genrm_roles on plain request bodies, and run the role handling through a real GenRMModel and a real GenRMExternalModel. Replacing either server's append_genrm_roles call with return body_dict fails that server's role test. The genrm_compare resources server tests also pass.

Rollout evidence

N/A: no model run for this PR. The external entrypoint changes only how the server starts. Request handling is the same append_genrm_roles call that app.py makes, on the external local_vllm_model base that #6039 smoke-tested against a real vLLM server with num_workers: 2. The unit tests cover the GenRM role handling through the external server.

Like local_vllm_model, the genrm_model venv still installs vLLM and Ray, because a venv belongs to the server directory and not the entrypoint.

Docs

responses_api_models/genrm_model/README.md describes the external entrypoint.

@copy-pr-bot

copy-pr-bot Bot commented Nov 12, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@linear-code linear-code Bot mentioned this pull request Nov 12, 2026
8 of 26 tasks
@ananthsub
ananthsub force-pushed the ananthsub/local-vllm-external-no-ray branch from 3a21ea8 to 24ef1fb Compare November 12, 2026 20:39
@ananthsub
ananthsub force-pushed the ananthsub/genrm-external-no-ray branch from faeb682 to 8d3c418 Compare November 12, 2026 21:00
@ananthsub
ananthsub force-pushed the ananthsub/local-vllm-external-no-ray branch from 24ef1fb to 872ad2c Compare November 12, 2026 22:57
@ananthsub
ananthsub force-pushed the ananthsub/genrm-external-no-ray branch from 8d3c418 to 0d0716f Compare November 12, 2026 23:07
@ananthsub
ananthsub force-pushed the ananthsub/local-vllm-external-no-ray branch from 4ac1bf4 to 7fb129b Compare November 13, 2026 14:40
@ananthsub
ananthsub force-pushed the ananthsub/genrm-external-no-ray branch from 43b7b27 to adc86e8 Compare November 13, 2026 14:46
Base automatically changed from ananthsub/local-vllm-external-no-ray to main November 13, 2026 14:51
GenRMModel declares ray_enabled = True, and Gym reads that from the
entrypoint's source before any config exists. Production recipes point
genrm_model at an external GenRM vLLM pool through an injected base_url,
so that server still makes Gym start or join Ray, joins it itself, and
imports Ray and vLLM, though it never launches anything.

Add external_app.py, a sibling entrypoint for that case, built on
local_vllm_model's external_app.py. It declares ray_enabled = False,
imports neither Ray nor vLLM, requires base_url, accepts every app.py key
with the launch settings optional, and supports num_workers > 1. The GenRM
role handling and config move to common.py so external_app.py can load
them without app.py; app.py imports them from there, so existing imports
keep working.

Signed-off-by: Ananth Subramaniam <[email protected]>
GenRMModelMixin had no base class but called super(), so it worked only
when listed before a VLLMModel subclass, and nothing declared that. With
the bases swapped, or the mixin used alone, super() reached object and
every request failed. Its get_converter repeated VLLMModel.get_converter.

The role handling becomes append_genrm_roles in common.py, a plain function
on the request body. GenRMModel and GenRMExternalModel each call it after
the base preprocessing. The tests exercise the function on plain dicts,
drop the stand-in base class, and run the role handling through each real
server class.

Signed-off-by: Ananth Subramaniam <[email protected]>
- Document in the README that external_app.py supports num_workers > 1, and
  that a launcher which injects base_url should also set
  entrypoint=external_app.py there, keeping app.py for the local launch.
- Require both Ray and vLLM to be installed in the import test, so an
  entrypoint that imports vLLM behind a try/except cannot pass it.

Signed-off-by: Ananth Subramaniam <[email protected]>
@ananthsub
ananthsub force-pushed the ananthsub/genrm-external-no-ray branch from 6475371 to 22bec46 Compare November 13, 2026 14:53
@ananthsub
ananthsub marked this pull request as ready for review November 13, 2026 14:53
@nemo-automation-bot
nemo-automation-bot Bot requested review from a team November 13, 2026 14:54
@ananthsub
ananthsub requested review from snivertynv, yfw and zyzhou5 and removed request for a team November 13, 2026 14:57

@svcnvidia-nemo-ci svcnvidia-nemo-ci 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.

SHIP

LGTM — no concerns found.

I reviewed all eight changed files and traced the affected request, configuration, startup, multiworker, and proxy-route contracts. The shared helper preserves the existing GenRM role handling. The external entrypoint retains GenRM configuration and preprocessing while using the Ray-free external base.

This was static inspection only; I didn't execute tests or start a model server.

Note: formal approval is not available for this request, so this review is posted as a comment only.

Review generated by codex. This was a full review. Request a full review with /review reset=true.

@ananthsub
ananthsub enabled auto-merge November 13, 2026 19:41
@ananthsub
ananthsub disabled auto-merge November 13, 2026 19:41
zyzhou5
zyzhou5 previously approved these changes Nov 13, 2026

@zyzhou5 zyzhou5 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.

Overall LGTM. Left some non-blocking comments.


See `configs/genrm_model.yaml`. Config key under `responses_api_models` is `genrm_model` with `entrypoint: app.py`.

To use a GenRM vLLM pool that runs elsewhere, set `base_url` to that pool and `entrypoint: external_app.py`. That entrypoint launches no vLLM and doesn't use Ray, so Gym doesn't start or join a Ray cluster for it. It accepts the same keys as `app.py`, with `vllm_serve_kwargs` and `vllm_serve_env_vars` optional. `external_app.py` also supports `num_workers > 1`, which `app.py` does not. `app.py` still accepts `base_url` and skips the local launch, but it joins Ray regardless, because Gym decides whether a server uses Ray from its entrypoint before reading the config.

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.

nit, nonblocking: regarding "before reading the config", Gym has already read the config when it decides on Ray (supervisor, server); it reads the class's ray_enabled and ignores base_url by design.

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.

Fixed in d6b9139. The README now says Gym decides from the entrypoint class's ray_enabled, not from base_url. The same wrong reason was in fern/versions/latest/pages/model-server/local-vllm.mdx and the comment in local_vllm_model/app.py start_vllm_server, both from #6039, so I corrected those too.


# LocalVLLMExternalModelConfig comes first so its required `base_url` and optional launch settings win over the
# local-launch defaults that GenRMModelConfig inherits.
class GenRMExternalModelConfig(LocalVLLMExternalModelConfig, GenRMModelConfig):

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.

Pydantic takes a field both bases share from the first base (LocalVLLMExternalModelConfig), even one it only inherited. So a default GenRMModelConfig later sets for an inherited field (e.g. uses_reasoning_parser: bool = True) would apply under app.py but be silently ignored here. Nothing is affected today; worth noting in this comment.

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 catch, fixed in d6b9139. The comment now says Pydantic takes every field both bases have from LocalVLLMExternalModelConfig, so a default GenRMModelConfig sets for an inherited field has to be redeclared on GenRMExternalModelConfig. A new test in test_external_app.py checks that both configs have the same default for every field except base_url, vllm_serve_kwargs and vllm_serve_env_vars. Adding debug: bool = True to GenRMModelConfig makes it fail.

- Say that Gym decides whether a server uses Ray from its entrypoint class's
  ray_enabled, not from base_url, in the GenRM README, the local vLLM docs
  page and local_vllm_model/app.py. The config is already loaded when that
  decision is made, so "before reading the config" was wrong.
- Note that GenRMExternalModelConfig takes every field both bases have from
  LocalVLLMExternalModelConfig, so a default GenRMModelConfig sets for an
  inherited field must be redeclared there, and test that both configs agree
  on every default apart from the launch settings.

Signed-off-by: Ananth Subramaniam <[email protected]>
@nemo-automation-bot
nemo-automation-bot Bot requested review from a team November 13, 2026 20:51
@github-actions

Copy link
Copy Markdown
Contributor

@yaoyu-33
yaoyu-33 requested a review from sephmard November 13, 2026 21:04
@ananthsub
ananthsub removed the request for review from sephmard November 13, 2026 21:10
@ananthsub
ananthsub enabled auto-merge November 13, 2026 21:10
@ananthsub
ananthsub disabled auto-merge November 13, 2026 21:10
@ananthsub
ananthsub merged commit d50f076 into main Nov 13, 2026
68 checks passed
@ananthsub
ananthsub deleted the ananthsub/genrm-external-no-ray branch November 13, 2026 21:10
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.

3 participants