Skip to content

armgit / sie

Public Imported from GitHub
0

Open-source inference server and production cluster for all the models your agent needs.

perf(models): compile compact JSON grammars on every Qwen3.6-35B-A3B profile (#636)

svonavad8f58cb85dbe
diff --git a/packages/sie_server/models/Qwen__Qwen3.6-35B-A3B.yaml b/packages/sie_server/models/Qwen__Qwen3.6-35B-A3B.yaml
index 320d39165..3b9f8889f 100644
--- a/packages/sie_server/models/Qwen__Qwen3.6-35B-A3B.yaml
+++ b/packages/sie_server/models/Qwen__Qwen3.6-35B-A3B.yaml
@@ -23,6 +23,12 @@ tasks:
chat_template_kwargs:
enable_thinking: false
max_sequence_length: 8192
+# Every profile compiles JSON-schema grammars without free whitespace
+# (--constrained-json-disable-any-whitespace, which sglang 0.5.10.post1
+# declares and applies to the xgrammar backend). With free whitespace the model
+# pretty-prints a json_schema reply, so indentation spends output tokens and
+# pushes dense replies toward max_output_tokens, where a truncated reply is not
+# valid JSON. Compact replies remain valid under the same schema.
profiles:
# Correctness-first H100 FP8 bootstrap: no NEXTN and no CUDA graphs until
# the online-FP8 smoke validates the MoE kernels and memory envelope.
@@ -47,6 +53,7 @@ profiles:
extra_launch_args:
- "--mm-process-config"
- '{"image":{"min_pixels":65536,"max_pixels":1003520}}'
+ - "--constrained-json-disable-any-whitespace"
- "--quantization"
- "fp8"
runtime:
@@ -112,6 +119,7 @@ profiles:
extra_launch_args:
- "--mm-process-config"
- '{"image":{"min_pixels":65536,"max_pixels":1003520}}'
+ - "--constrained-json-disable-any-whitespace"
- "--quantization"
- "fp8"
runtime:
diff --git a/packages/sie_server/tests/config/test_h100_fp8_generation_profiles.py b/packages/sie_server/tests/config/test_h100_fp8_generation_profiles.py
index c5e008b8d..aa753f60b 100644
--- a/packages/sie_server/tests/config/test_h100_fp8_generation_profiles.py
+++ b/packages/sie_server/tests/config/test_h100_fp8_generation_profiles.py
@@ -32,6 +32,7 @@ MODELS_DIR = Path(__file__).resolve().parents[2] / "models"
[
"--mm-process-config",
'{"image":{"min_pixels":65536,"max_pixels":1003520}}',
+ "--constrained-json-disable-any-whitespace",
"--quantization",
"fp8",
],
diff --git a/packages/sie_server/tests/config/test_qwen_generation_profiles.py b/packages/sie_server/tests/config/test_qwen_generation_profiles.py
index df95be2d0..4aac4b9fc 100644
--- a/packages/sie_server/tests/config/test_qwen_generation_profiles.py
+++ b/packages/sie_server/tests/config/test_qwen_generation_profiles.py
@@ -6,6 +6,7 @@ from pathlib import Path
import yaml
from PIL import Image
from sie_server.config.model import ModelConfig, ResolvedProfile
+from sie_server.core.loader import expand_profile_variants, load_model_config
from transformers import Qwen2VLImageProcessorFast
_QWEN35_MODEL_PATH = Path(__file__).resolve().parents[2] / "models" / "Qwen__Qwen3.5-4B.yaml"
@@ -212,6 +213,25 @@ def test_all_qwen_vlm_profiles_pair_pinned_image_bounds() -> None:
}
+def test_qwen36_35b_profiles_compile_compact_json_grammars() -> None:
+ # Pretty-printed json_schema replies spent about a quarter of their
+ # characters on indentation and neared the output cap on dense screens.
+ configs = expand_profile_variants([load_model_config(_QWEN36_35B_MODEL_PATH)])
+ variants = {name for name in configs if name.startswith("Qwen/Qwen3.6-35B-A3B")}
+ assert {
+ "Qwen/Qwen3.6-35B-A3B",
+ "Qwen/Qwen3.6-35B-A3B:h100-fp8",
+ "Qwen/Qwen3.6-35B-A3B:long-context",
+ "Qwen/Qwen3.6-35B-A3B:h100-256k",
+ } <= variants
+ for name in variants:
+ loadtime = configs[name].resolve_profile("default").loadtime
+ # sglang 0.5.10.post1 applies the flag on the xgrammar and llguidance
+ # backends only.
+ assert loadtime["grammar_backend"] == "xgrammar", name
+ assert loadtime["extra_launch_args"].count("--constrained-json-disable-any-whitespace") == 1, name
+
+
def test_qwen36_native_window_uses_measured_cuda13_eagle_shape() -> None:
config = ModelConfig.model_validate(yaml.safe_load(_QWEN36_MODEL_PATH.read_text()))
profile = config.resolve_profile("long-context")