Skip to main content

Deploy with the SGLang plugin

Install the Valen plugin in the official SGLang 0.5.23 image and serve SystemOne and Decisions requests from one GPU.

Use this route when you already run SGLang: the plugin installs into its official environment. To run one prebuilt container instead, see image deployment.

Before you start
  • Linux x86-64 with an NVIDIA GPU that supports FA3 and a compatible CUDA driver.
  • Docker with NVIDIA Container Toolkit. You can also install the plugin directly in an existing SGLang Python environment.
  • The Valen source to build the kit, and a complete checkpoint such as Valen-Decision-1.5-2B.

Build the kit​

Build the wheel and kit from the root of the Valen repository, then copy serving-kit/sglang/ and a complete checkpoint to the GPU host.

Terminal
python -m pip install build
python -m build --wheel serving/sglang
python serving/sglang/build_kit.py \
serving/sglang/dist/valen_sglang-0.1.0.dev3-py3-none-any.whl \
./serving-kit/sglang

Prepare the runtime​

Start the official SGLang 0.5.23 image with the kit and the checkpoint mounted. Replace both host paths:

Terminal
docker run --rm -it --gpus device=0 --ipc=host \
-p 127.0.0.1:30000:30000 \
-v /absolute/path/to/serving-kit/sglang:/opt/valen-kit:ro \
-v /absolute/path/to/Valen-Decision-1.5-2B:/models/Valen-Decision-1.5-2B:ro \
--entrypoint bash \
docker.io/lmsysorg/sglang:v0.5.23

Inside the container, /opt/valen-kit and /models/Valen-Decision-1.5-2B refer to those mounts. In an existing Python environment, substitute the actual paths in the next step.

Install and start​

Install the plugin and start the service inside the container:

Terminal
bash /opt/valen-kit/install.sh
MODEL=/models/Valen-Decision-1.5-2B MODEL_NAME=valen HOST=0.0.0.0 \
CUDA_VISIBLE_DEVICES=0 bash /opt/valen-kit/serve.sh --dtype bfloat16
SettingExamplePurpose
MODEL/models/Valen-Decision-1.5-2BComplete checkpoint directory
MODEL_NAMEvalenModel name sent in requests
HOST / PORT0.0.0.0 / 30000Listen address and port inside the container
--dtypebfloat16Load the backbone in BF16, the precision the released weights run in. Without it the backbone can load in FP32 and take twice the GPU memory; Valen-Decision-1.5-27B has about 54 GB of weights in BF16

After startup, access the service from the host at http://127.0.0.1:30000.

Send a request​

Send a text request using SystemOne or Decisions:

ProtocolRequest structurePredicate probability in the example
SystemOnestate + questions keyed by IDanswers.on_sofa.noul
Decisionsinput + question listanswers[0].probability

The request model must match the configured served model name. temperature defaults to 1.0 and must be a finite number greater than zero.

Terminal
curl http://127.0.0.1:30000/v1/decisions \
-H 'Content-Type: application/json' \
-d '{
"model": "valen",
"input": "A cat is on the sofa.",
"questions": [
{
"name": "on_sofa",
"type": "predicate",
"instructions": "The cat is on the sofa."
}
],
"temperature": 1
}'

Send an image request​

Run python -m pip install requests in the client environment and replace cat.jpg with a local PNG, JPEG, or WebP image. The Python example reads the file, infers its MIME type from the filename, and encodes it as a data URL.

SystemOne uses image_url content blocks in state.messages; Decisions uses input_image content blocks in input. Both examples send the model name valen.

Python
import base64
import mimetypes
from pathlib import Path

import requests

image_path = Path("cat.jpg")
mime_type = mimetypes.guess_type(image_path.name)[0]
image_b64 = base64.b64encode(image_path.read_bytes()).decode("ascii")
image_url = f"data:{mime_type};base64,{image_b64}"

response = requests.post(
"http://127.0.0.1:30000/v1/decisions",
json={
"model": "valen",
"input": [
{
"role": "user",
"content": [
{
"type": "input_image",
"image_url": image_url
},
{
"type": "input_text",
"text": "Inspect this image."
}
]
}
],
"questions": [
{
"name": "animal",
"type": "choice",
"instructions": "Which animal is visible?",
"choices": [
{
"value": "cat",
"description": "A cat"
},
{
"value": "dog",
"description": "A dog"
}
]
}
],
"temperature": 1
},
timeout=120,
)
response.raise_for_status()
print(response.json()["answers"])

Supported scope​

  • Checkpoints: full Valen Qwen3.5 Mixer checkpoints with shared_state execution, on one GPU with TP=PP=1.
  • Questions: predicate, choice and score over text and images. Choice takes 1–255 candidates; score takes 2–255 ordered levels. Valen-Decision-1.5 checkpoints also answer bbox questions, which locate a described object in one input image.
  • Video: extract frames and submit them as image inputs.
  • Agreement with the native model: on Valen-Decision-1.5 0.8B and 2B, served answers match the native model within 0.02.

See SystemOne and Decisions for question and answer structures.

Next steps​