Skip to content

[Example] Serve Jev's /v1/systemone typed-decision API on top of /v1/score - #41210

Open
luke-edward wants to merge 4 commits into
sgl-project:mainfrom
luke-edward:feat/systemone-example
Open

luke-edward wants to merge 4 commits into
sgl-project:mainfrom
luke-edward:feat/systemone-example

Conversation

@luke-edward

@luke-edward luke-edward commented Sep 25, 2026 •

Copy link
Copy Markdown

Motivation

Jev (TypeSafe, Sept 15) exposes a typed-decision API: a state plus choice / score / noul questions, answered with probabilities and a confidence, no generated text. vLLM merged an example server for it last week (vllm-project/vllm#57250). SGLang can serve it directly: /v1/score with label_token_ids already returns the next-token distribution over label tokens, and one call scores every question of a request as a batch.

Example only, under examples/runtime/: no core changes, no new dependencies.

cc /v1/score owners @sundar24295s @chanh @fortunecookiee.

Modifications

  • examples/runtime/systemone/systemone_server.py: stdlib HTTP proxy. POST /v1/systemone validates the request (400 on schema errors, 502 upstream), builds one prompt per question ending where the answer label starts, sends one /v1/score call, and maps the distributions to Jev's answer shapes (choice argmax + probabilities; score = Σ i·pᵢ + legend; noul = P(Yes); confidence per TypeSafe's published formula). --temperature passes through for calibration.
  • README.md: usage, mapping, and differences from the hosted model.
  • examples/runtime/README.md: one line.

Accuracy Tests

Tested end to end on an M2 with Qwen/Qwen2.5-0.5B-Instruct (MLX, --mlx-enable-sampling): the request from the Jev docs returns the documented shape, probabilities sum to 1 at 3 and 26 options, 27 options → 400, schema errors → 400.

Speed Tests and Profiling

Not applicable.

Checklist


CI States

Latest PR Test (Base): ❌ Run #37502511712
Latest PR Test (Extra): ❌ Run #37502511229
Latest PR Test (AMD ROCm 10): ❌ Run #37502511594

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Sep 25, 2026
@luke-edward

Copy link
Copy Markdown
Author

@sundar24295s @fortunecookiee, as the /v1/score owners: is an example like this wanted in examples/runtime/? It adds no core code and no dependencies; it only shows /v1/score with label_token_ids serving Jev's typed-decision API shape. If yes, could one of you /tag-and-rerun-ci? If you would rather see it as a cookbook page, or not at all, that is fine too — a one-line answer is enough.

@luke-edward

Copy link
Copy Markdown
Author

@JustinTong0323, examples/ has no code owner and /v1/score lives in entrypoints/openai, which you own. Could you say whether this example is wanted, and /tag-and-rerun-ci if so? It adds no core code and no dependencies; if it belongs in the docs instead, I will move it.

@luke-edward

Copy link
Copy Markdown
Author

@JustinTong0323, could you take a look when you have a chance?

luke-edward and others added 2 commits October 1, 2026 00:10
TypeSafe's Jev API takes a state and typed questions (choice, score,
noul) and returns typed answers with probabilities and confidence, no
generated text. Any chat model on SGLang can answer the same shape of
question in one forward pass per question by reading the next-token
distribution over the answer labels, which is what /v1/score computes
with label_token_ids + apply_softmax. One /v1/score call scores every
question of a request as one batch.

examples/runtime/systemone/systemone_server.py is a small stdlib HTTP
proxy that translates /v1/systemone requests into that call and maps the
scores back to Jev's answer shapes, using TypeSafe's published confidence
formula. The README documents the mapping and the differences from the
hosted model.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread examples/runtime/systemone/systemone_server.py
@luke-edward
luke-edward force-pushed the feat/systemone-example branch from c409c3d to c867800 Compare October 3, 2026 06:04
@luke-edward

Copy link
Copy Markdown
Author

Rebased onto upstream/main at 3ed6367; the new head is c867800. Changed-file pre-commit, py_compile, and a synthetic request/response smoke test pass.

@luke-edward

Copy link
Copy Markdown
Author

On c867800, the remaining call-gate / pr-gate reds are only the maintainer-only run-ci label gate; every check-changes job passes.

luke-edward and others added 2 commits October 6, 2026 10:17
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@luke-edward

Copy link
Copy Markdown
Author

Merged current upstream/main in 468075d without rewriting the reviewed commits. The SystemOne regression test and changed-file pre-commit pass on that head.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants