diff --git a/docs/DEEPSEEK41.md b/docs/DEEPSEEK41.md index 32bd2a22..7aefeec4 100644 --- a/docs/DEEPSEEK41.md +++ b/docs/DEEPSEEK41.md @@ -70,6 +70,11 @@ The server speaks to the engine as it does for the other models, so `/v1/chat/co server turns them into OpenAI `tool_calls` and Anthropic `tool_use`, including `tool_choice`, streamed arguments and calls written inside the thinking. A value marked `string="true"` stays a string. - Defaults when a request names none: temperature 1.0, top_p 1.0. +- Agents and sub-agents that take turns do not read their prompts again. When another request takes the model, the engine sets the + conversation aside (about 17 MB per 6.5K tokens) and takes it back when the next prompt continues it; the system prompt and tools shared by + an agent and its sub-agents are kept as a checkpoint too. Slots survive a restart, live in `ds4-slots` next to the run log, are capped at + 2 GB and are removed after a week. `STRATA_DS4_SLOT_KEEP=0` turns it off, `STRATA_DS4_SLOT_GB` changes the cap, `STRATA_DS4_AUTO_PIN=0` + turns off the shared-start checkpoint. The answers are the same as a fresh read of the prompt. Pictures and the DSpark drafter are in the engine (strata-dsv41 reads them from the unsloth mmproj and dspark files beside the model; the server side is not wired yet). Not in this version: several requests at once (`--parallel` is ignored with a note), tuning (`--tune` is skipped with a note). diff --git a/serve/server.py b/serve/server.py index 55a37196..fdfd5949 100644 --- a/serve/server.py +++ b/serve/server.py @@ -3477,16 +3477,18 @@ def hip_auto_devices(cfg: dict, env: dict) -> list[int] | None: return visible -DS41_SLOT_KEEP_DEFAULT = "0" # the engine keeps a displaced conversation in RAM and in the slot folder (see below) +DS41_SLOT_KEEP_DEFAULT = "1" # the engine keeps a displaced conversation in RAM and in the slot folder (see below) +DS41_SLOT_GB_DEFAULT = "2" # the folder's cap in GB (a 6.5K-token conversation is about 17 MB) def deepseek_slot_env(env: dict, cfg: dict) -> None: """DeepSeek-V4.1 only. The engine sets a conversation aside when another request takes the model and takes it back at its checkpoints (agents and sub-agents that take turns do not read their prompts again). STRATA_DS4_SLOT_KEEP switches it (the default above; a config's env or the shell wins); the folder is `ds4-slots` next to the run log, in - Strata's data folder (STRATA_DS4_SLOT_DIR names another), and the engine caps it (STRATA_DS4_SLOT_GB, 16) and - removes what is older than a week or not this model's.""" + Strata's data folder (STRATA_DS4_SLOT_DIR names another), and the engine caps it (STRATA_DS4_SLOT_GB, 2 here, 16 in the engine) and + removes what is older than a week or not this model's. On by default; STRATA_DS4_SLOT_KEEP=0 turns it off.""" env.setdefault("STRATA_DS4_SLOT_KEEP", DS41_SLOT_KEEP_DEFAULT) + env.setdefault("STRATA_DS4_SLOT_GB", DS41_SLOT_GB_DEFAULT) log = cfg.get("log") if "STRATA_DS4_SLOT_DIR" not in env and log: env["STRATA_DS4_SLOT_DIR"] = str(Path(log).parent / "ds4-slots") diff --git a/serve/test_dsv41.py b/serve/test_dsv41.py index b928e816..15315ee5 100644 --- a/serve/test_dsv41.py +++ b/serve/test_dsv41.py @@ -592,7 +592,8 @@ class SlotEnv(unittest.TestCase): def test_deepseek_gets_a_folder_in_the_data_folder_and_the_default_switch(self): env = self.env({"arch": "deepseek41", "log": str(Path("data") / "strata-deepseek.log"), "args": []}) self.assertEqual(Path(env["STRATA_DS4_SLOT_DIR"]), Path("data") / "ds4-slots") - self.assertEqual(env["STRATA_DS4_SLOT_KEEP"], server.DS41_SLOT_KEEP_DEFAULT) + self.assertEqual(env["STRATA_DS4_SLOT_KEEP"], "1") + self.assertEqual(env["STRATA_DS4_SLOT_GB"], "2") def test_the_configs_own_settings_win(self): env = self.env({"arch": "deepseek41", "log": "x/y.log",