Skip to content

fix(cli): let a scaled SGLang engine serve past its derived window - #265

Merged
ethan-scitix merged 2 commits into
mainfrom
fix/264-sglang-scaled-window
Oct 28, 2026
Merged

ethan-scitix merged 2 commits into
mainfrom
fix/264-sglang-scaled-window

Conversation

@ethan-scitix

@ethan-scitix ethan-scitix commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Type

  • fix — bug fix or alignment correction

Summary

  • A scaled serving group (<model>@<window>) on SGLang failed at startup when its context.scaling YaRN block named original_max_position_embeddings. With that key, SGLang derives the unscaled window (40960), and _derive_context_length refuses the larger planned --context-length unless SGLANG_ALLOW_OVERWRITE_LONGER_CONTEXT_LEN=1 is set. --dry-run passed, so the failure only showed after the GPUs were held.
  • This PR follows the issue's first suggestion: a scaled group's SGLang engines now launch with that variable. It is defined per backend in SCALING_ENV (sieval/cli/serving.py) and applied in run._serving_groups, which the dry-run also uses, so the dry-run's launch[].env matches what the run sets.
  • Trade-off: the variable turns off SGLang's derived-window check for every scaling block, not just the YaRN shape above. So context.max is now the only bound on a scaled window. If max overstates what the scaling reaches, SGLang no longer catches it at startup. docs/guide/infer.md now says this.
  • The default group is unchanged. The model's infer.env takes precedence (a user can set the variable to 0). vLLM has no entry: no failure has been observed there, and a test pins this.
  • The variable is set on the launch command only. engine_params, infer_plans*.yaml and the inference identity are unchanged, so resume is unaffected. No RESULT_SCHEMA_VERSION bump.

Related Issues

Closes #264

Test Plan

Automated

  • Lint/format clean (ruff check sieval tests && ruff format --check sieval tests)
  • Type check clean (ty check)
  • pytest tests/unit/cli tests/integration -n 8 → 1744 passed
  • TestServingGroups::test_only_a_scaled_sglang_engine_may_exceed_its_derived_window has three cases:
    • the scaled SGLang engine gets =1 and the default engine gets nothing;
    • infer.env overrides it;
    • a scaled vLLM engine gets nothing.
  • Reverse checks:
    • dropping scaled=True at the call site fails the first case;
    • adding a vllm entry to SCALING_ENV fails the third.

Manual

  • Not re-run on GPUs here. The issue reports that the same launch succeeds with this variable set (Qwen3-0.6B, context_length 64096).

Checklist

Required (all PRs)

  • PR title follows conventional format (type(scope): description)
  • No internal paths, credentials, or personal info in committed files
  • AI-generated code has AI-Generated Code - <model> (<provider>) in module docstring
  • No new upper-layer dependencies added to core/
  • Deleted code verified — no remaining call sites depend on it

🤖 Generated with Claude Code

ethan-scitix and others added 2 commits October 28, 2026 15:35
A YaRN `context.scaling` block naming `original_max_position_embeddings`
makes SGLang derive the unscaled window, so it refused the scaled group's
planned `context_length` at startup, after the dry-run had passed and the
GPUs were held. A scaled group's SGLang engines now launch with
`SGLANG_ALLOW_OVERWRITE_LONGER_CONTEXT_LEN=1` (`SCALING_ENV`); `context.max`
already states the reachable window. The model's `infer.env` overrides it.
The env is on the launch command only: plans, identities and resume are
unchanged.

Closes #264

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… engine

The variable lifts SGLang's derived-window check for every scaling block,
not only the YaRN shape from #264, so the guide now says `max` is the only
bound. A vLLM case pins that no other backend gets the variable. Comments
and docs trimmed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ethan-scitix
ethan-scitix force-pushed the fix/264-sglang-scaled-window branch from 21ca7d0 to 556fded Compare October 28, 2026 07:36
@ethan-scitix
ethan-scitix merged commit db4bb60 into main Oct 28, 2026
9 checks passed
@ethan-scitix
ethan-scitix deleted the fix/264-sglang-scaled-window branch October 28, 2026 07:46
@ethan-scitix ethan-scitix mentioned this pull request Oct 28, 2026
7 tasks done
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.

Scaled SGLang window fails at startup when the YaRN block names original_max_position_embeddings

1 participant