Skip to content

armgit / sie

Public Imported from GitHub
0

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

fix(models): leave page-image headroom on the Gemma 4 31B answer-only hi-res profiles (#694)

svonavac5b0d01ead10
diff --git a/packages/sie_server/models/google__gemma-4-31B-it.yaml b/packages/sie_server/models/google__gemma-4-31B-it.yaml
index 9eabe74b2..67ef3648d 100644
--- a/packages/sie_server/models/google__gemma-4-31B-it.yaml
+++ b/packages/sie_server/models/google__gemma-4-31B-it.yaml
@@ -418,6 +418,13 @@ profiles:
# with whitespace. Compact replies stay valid under the same schema; on 222
# page extractions the score was unchanged within run-to-run noise while
# output tokens fell 9% and GPU-seconds per request up to 11%.
+ # ``mem_fraction_static`` is 0.85 on the answer-only hi-res launches. SGLang's
+ # fast image processor resizes each page on the serving GPU from the
+ # tokenizer process, outside the static pool. With 32 to 64 full-page
+ # documents in flight on an 80 GB H100, those resizes hit CUDA OOM and failed
+ # requests at 0.90, and still in a 32-page burst at 0.88; at 0.85 the same
+ # bursts completed without errors. The H100 KV pool shrinks from about
+ # 107.9K to 96.5K tokens.
h100-96k-hires:
max_batch_tokens: 98304
compute_precision: bfloat16
@@ -427,7 +434,7 @@ profiles:
adapter_options:
loadtime:
max_seq_length: 98304
- mem_fraction_static: 0.90
+ mem_fraction_static: 0.85
served_model_name: google/gemma-4-31B-it
attention_backend: triton
grammar_backend: xgrammar
@@ -467,7 +474,7 @@ profiles:
adapter_options:
loadtime:
max_seq_length: 98304
- mem_fraction_static: 0.90
+ mem_fraction_static: 0.85
served_model_name: google/gemma-4-31B-it
attention_backend: triton
grammar_backend: xgrammar
@@ -502,7 +509,7 @@ profiles:
adapter_options:
loadtime:
max_seq_length: 98304
- mem_fraction_static: 0.90
+ mem_fraction_static: 0.85
served_model_name: google/gemma-4-31B-it
attention_backend: triton
grammar_backend: xgrammar
@@ -522,7 +529,7 @@ profiles:
- "--constrained-json-disable-any-whitespace"
# Repeat the full non-speculative launch because load-time overrides
# replace the parent's block rather than merging it.
- # ``mem_fraction_static`` is 0.88 here, not the family's 0.90. Thinking
+ # ``mem_fraction_static`` is 0.88 here, not the answer-only 0.85. Thinking
# requests are long, so a lane runs many at once, and a burst of screenshot
# prefills needs more activation memory than 0.90 leaves on an 80 GB H100.
# With 32 image requests in flight at 0.90, SGLang hit CUDA OOM in the vision
diff --git a/packages/sie_server/tests/config/test_gemma4_31b_hires_profile.py b/packages/sie_server/tests/config/test_gemma4_31b_hires_profile.py
index 01dcbcd61..2e09eea8d 100644
--- a/packages/sie_server/tests/config/test_gemma4_31b_hires_profile.py
+++ b/packages/sie_server/tests/config/test_gemma4_31b_hires_profile.py
@@ -51,10 +51,10 @@ def test_hires_profiles_match_h100_96k_except_the_image_budget_and_compact_json(
base = config.resolve_profile(base_name)
assert hires.loadtime["extra_launch_args"] == [*base.loadtime["extra_launch_args"], *_HIRES_ARGS]
assert "json_number_max_digits" not in base.loadtime
- assert hires.loadtime | {"extra_launch_args": None, "json_number_max_digits": None} == base.loadtime | {
- "extra_launch_args": None,
- "json_number_max_digits": None,
- }
+ assert hires.loadtime["mem_fraction_static"] == 0.85
+ assert base.loadtime["mem_fraction_static"] == 0.90
+ unchanged = {"extra_launch_args": None, "json_number_max_digits": None, "mem_fraction_static": None}
+ assert hires.loadtime | unchanged == base.loadtime | unchanged
assert hires.runtime == base.runtime
assert hires.adapter_path == base.adapter_path
assert hires.compute_precision == base.compute_precision
@@ -147,3 +147,14 @@ def test_hires_profiles_compile_compact_bounded_json_grammars() -> None:
assert loadtime["grammar_backend"] == "xgrammar", name
assert loadtime["json_number_max_digits"] == 19, name
assert loadtime["extra_launch_args"].count("--constrained-json-disable-any-whitespace") == 1, name
+
+
+def test_answer_only_hires_profiles_leave_headroom_for_page_image_resizes() -> None:
+ # SGLang's fast image processor resizes each page on the serving GPU from
+ # the tokenizer process, outside the static pool. Concurrent full-page
+ # documents on an 80 GB H100 hit CUDA OOM there at 0.90 and 0.88.
+ config = load_model_config(MODEL_FILE)
+ for name in _HIRES_PROFILES:
+ assert config.resolve_profile(name).loadtime["mem_fraction_static"] == 0.85, name
+ assert config.resolve_profile("h100-96k-hires-thinking-no-spec").loadtime["mem_fraction_static"] == 0.88
+ assert config.resolve_profile("h100-96k").loadtime["mem_fraction_static"] == 0.90
diff --git a/packages/sie_server/tests/config/test_gemma_screenshot_profile.py b/packages/sie_server/tests/config/test_gemma_screenshot_profile.py
index ce5b9f2d9..1cf73b07e 100644
--- a/packages/sie_server/tests/config/test_gemma_screenshot_profile.py
+++ b/packages/sie_server/tests/config/test_gemma_screenshot_profile.py
@@ -18,10 +18,10 @@ def test_hires_thinking_profile_preserves_the_non_speculative_document_launch()
thinking_launch = dict(thinking.loadtime)
answer_only_launch = dict(answer_only.loadtime)
- # Only the static memory fraction differs: the thinking profile leaves more
- # activation headroom for bursts of concurrent screenshot prefills.
+ # Only the static memory fraction differs: each was measured against its
+ # own burst of concurrent image prefills (screenshots, full-page documents).
assert thinking_launch.pop("mem_fraction_static") == 0.88
- assert answer_only_launch.pop("mem_fraction_static") == 0.90
+ assert answer_only_launch.pop("mem_fraction_static") == 0.85
assert thinking_launch == answer_only_launch
assert thinking.runtime == answer_only.runtime
assert thinking.adapter_path == answer_only.adapter_path