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): set the Hy-MT2-1.8B KV budget to 32768 tokens

Shai Shmuele8fc8c99a0e3
diff --git a/packages/sie_server/models/tencent__Hy-MT2-1.8B.yaml b/packages/sie_server/models/tencent__Hy-MT2-1.8B.yaml
index 0cdfc8f60..8d2f2e693 100644
--- a/packages/sie_server/models/tencent__Hy-MT2-1.8B.yaml
+++ b/packages/sie_server/models/tencent__Hy-MT2-1.8B.yaml
@@ -28,14 +28,16 @@ profiles:
# (decaying to 0.098) of each running request's unused max_tokens
# reserved. A translation request (about 80 prompt and 110 output tokens,
# max_tokens at the 1024 cap) holds about 300 tokens under steady load, so
- # SGLang ran about 25 at 8192 and runs about 200 at 65536. One L4 still
+ # SGLang ran about 25 at 8192 and runs about 105 at 32768. One L4 still
# gains throughput from 64 to 128 in flight. This budget sets only the
# engine's limit: in queue mode the worker sidecar also caps each pull
# loop at SIE_PULL_LOOP_MAX_OUTSTANDING messages (default: the fetch
- # budget, 64), so a queue worker needs that at 128 or more to reach 128.
- # Reservation in bf16: 4.0 GiB weights + 4.0 GiB KV (64 KiB per token)
- # + 3 GiB headroom, about 11 GiB of the L4's 22.5 GiB.
- kv_budget_tokens: 65536
+ # budget, 64), so a queue worker stays at 64 per pull loop until that
+ # cap is raised.
+ # Reservation in bf16: 4.0 GiB weights + 2.0 GiB KV (64 KiB per token)
+ # + 3 GiB headroom, about 9 GiB, so a 10 GB GPU still fits it; 65536
+ # would need about 11 GiB.
+ kv_budget_tokens: 32768
compute_precision: bfloat16
adapter_path: sie_server.adapters.sglang.generation:SGLangGenerationAdapter
adapter_options:
diff --git a/packages/sie_server/tests/config/test_sglang_memory_profiles.py b/packages/sie_server/tests/config/test_sglang_memory_profiles.py
index 5c4d698ac..2bd9f1e00 100644
--- a/packages/sie_server/tests/config/test_sglang_memory_profiles.py
+++ b/packages/sie_server/tests/config/test_sglang_memory_profiles.py
@@ -34,7 +34,7 @@ def test_default_profiles_use_model_sized_memory(name):
def test_hy_mt2_pool_fits_an_l4_with_room_for_translation_batches(tmp_path, monkeypatch):
config = load_model_config(MODELS / "tencent__Hy-MT2-1.8B.yaml")
- assert config.resolve_profile("default").kv_budget_tokens == 65536
+ assert config.resolve_profile("default").kv_budget_tokens == 32768
# Geometry and bf16 parameter count of the pinned checkpoint: 64 KiB of KV per token.
(tmp_path / "config.json").write_text(
json.dumps({"num_hidden_layers": 32, "num_attention_heads": 16, "num_key_value_heads": 4, "head_dim": 128})
@@ -48,11 +48,12 @@ def test_hy_mt2_pool_fits_an_l4_with_room_for_translation_batches(tmp_path, monk
budget.model_name_or_path = str(tmp_path)
required = budget.required_bytes(device_type="cuda", device_total_bytes=L4_TOTAL_BYTES)
- assert required == math.ceil(params * 2 * 1.05) + (65536 + 512) * 65536 + 3 * GIB
- # Half of the card stays available to co-resident models.
+ assert required == math.ceil(params * 2 * 1.05) + (32768 + 512) * 65536 + 3 * GIB
+ # Half of the card stays available to co-resident models, and a 10 GB GPU still fits the reservation.
assert required < L4_TOTAL_BYTES / 2
+ assert required < 10 * GIB
monkeypatch.setattr(_memory, "device_memory", lambda _: (L4_TOTAL_BYTES - GIB, L4_TOTAL_BYTES))
- assert budget.launch_args(0)[2:] == ["--max-total-tokens", "65536"]
+ assert budget.launch_args(0)[2:] == ["--max-total-tokens", "32768"]
def test_guard_calibrated_profile_retains_explicit_override():