Skip to content

feat: SGLang support #976

Open

Description

@cmunley1

Use cases, pain points, and background
Several RL training frameworks (e,g, VeRL, Slime) offer SGLang as a generation backend. If Gym doesn't support SGLang, users whose training loop runs on SGLang must either stand up a separate vLLM instance just for Gym, or manually proxy requests — adding latency and operational complexity. A first-class sglang_model server would let these frameworks plug into Gym directly.

Description:
Add a new responses_api_models/sglang_model/ model server that targets a remote SGLang OpenAI-compatible endpoint, analogous to the existing vllm_model

Design:
i think there are a few key requirements we would need to translate from vllm to sglang side:

  1. on policy corrections in vllm (just need to find the cleanest way to insert this logic for sglang) https://github.com/NVIDIA-NeMo/RL/blob/cd54f8f492d013f19f3bfa3af6ba5d3aab530e52/nemo_rl/models/generation/vllm/vllm_worker_async.py#L41
  2. getting the logprobs and token IDs for a chat completion request
    if self.config.return_token_id_information and "prompt_token_ids" not in choice_dict["message"]:
  3. applying the responses <> chat completions converter
    chat_completion_create_params = self._converter.responses_to_chat_completion_create_params(body)
  4. max seq len hit error handling (might be specific to vllm)
    except ClientResponseError as e:

Out of scope:
What are some items that this issue could be mistaken to cover that this issue should explicitly NOT cover?

Acceptance Criteria:

  • sglang_model server starts, passes health checks, and serves /v1/chat/completions and /v1/responses
  • Responses ↔ ChatCompletions conversion works correctly (tool calls, reasoning, multi-turn)
  • Token ID information (prompt_token_ids, generation_token_ids, generation_log_probs) is returned when return_token_id_information: true
  • ng_collect_rollouts completes successfully against an SGLang endpoint using sglang_model
  • Unit tests pass with ≥ 95% coverage
  • Config and dogs updated
  • End-to-end RL training run (e.g. GRPO) using sglang_model converges comparably to the same run using vllm_model on the same benchmark and model checkpoint.
  • Reward curves and pass@1 metrics match within acceptable variance (< 1%) across identical ng_collect_rollouts runs against both backends.
  • Token IDs returned by SGLang are consistent with the tokenizer — round-tripping through create_tokenize, generate, and the returned prompt_token_ids / generation_token_ids produces the same token sequences as vLLM, with no re-tokenization drift.
  • Log-probs from SGLang match vLLM's to within numerical precision (fp16/bf16 tolerance) for the same prompt and greedy decoding, confirming the training signal is equivalent.

Activity

  1. changed the title [-]SGLang support[/-] [+]feat: SGLang support[/+] on Apr 2, 2026
  2. added
    models
    on Apr 2, 2026
  3. added
    needs-design
    on Apr 3, 2026
  4. removed
    needs-design
    on Jun 1, 2026
  5. removed their assignment
    on Jun 1, 2026
  6. moved this from Dev WIP to Review WIP in NeMo Gym 0.6.0 - Sept 2on Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

models

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions