OpenEnv icon indicating copy to clipboard operation
OpenEnv copied to clipboard

`pelican_svg_env`: the vision judge cannot use a self-hosted model

Open surajsharan opened this issue 2 months ago • 0 comments

Summary

The semantic half of the reward, weight 0.65, comes from the vision judge, and the judge can only talk to Hugging Face Inference Providers. HFVisionClient never passes a base URL to AsyncInferenceClient (envs/pelican_svg_env/server/vision_judge.py:74-86, :111-113), and _judge_from_env returns None unless an HF token is present (envs/pelican_svg_env/server/pelican_svg_environment.py:29-49). So a model served locally, or anywhere else that speaks the OpenAI-compatible API, cannot be used as the judge.

That matters most in the loop this environment was built for. examples/pelican_svg_grpo.py --judge-in-reward pays for two judge calls per sample against Qwen/Qwen2.5-VL-72B-Instruct (vision_judge.py:26), and the offline alternative drops the weight on structure from 0.35 to 1.0, which the README already identifies as the thing that changes what training teaches. Anyone with a GPU has a third option today that the environment cannot express: run a smaller vision model locally and keep the judged component in the reward.

Proposal

Thread a base URL through, keeping the hosted path exactly as it is:

  • HFVisionClient gains base_url (and an optional api_key that may be a placeholder). When set, the client is constructed with it.
  • _judge_from_env reads PELICAN_SVG_JUDGE_BASE_URL and PELICAN_SVG_JUDGE_API_KEY, and a configured base URL enables the judge without an HF token. PELICAN_SVG_DISABLE_JUDGE and PELICAN_SVG_JUDGE_MODEL keep their meaning.
  • README and the docs stub get the local recipe, including the vLLM flags a VL model needs.

This is a parameter passthrough rather than a new client: AsyncInferenceClient already accepts base_url as an alias for model, and chat_completion routes to that URL while sending the per-call model name in the payload, which is what the judge already passes (huggingface_hub 1.31).

Nothing in src/openenv/core/ changes and the hosted behaviour is untouched, so I don't think this needs an RFC. Happy to write one if you disagree.

Verification

I have this working end to end on a single 24 GB GPU: vLLM serving Qwen/Qwen3.5-4B, the environment server configured only through the two new variables, episodes driven with PelicanSvgEnv over the WebSocket. A good drawing scores 0.919 with the judge's semantic component at 0.875, a scribble scores 0, and a recording proxy in front of vLLM shows the Hugging Face token never reaching the endpoint. Two practical notes for the README: a reasoning model needs thinking turned off, or it spends the judge's token budget thinking and returns an empty caption, and huggingface_hub sends the checklist schema in TGI's format, which vLLM treats as plain JSON mode.

Happy to send the PR if this sounds right.

surajsharan avatar Sep 21 '26 07:09 surajsharan