Kyojin: open-source engine that runs 100 GB-class open models (GLM-5.3, Qwen3.8, DeepSeek V4.1) on one desktop machine. AMD Strix Halo, NVIDIA RTX and Apple Mac. OpenAI API, built on ExLlamaV3.
Python amdapple-siliconcudadeepseekexl3exllamav3glminferencellmllm-inferencelocal-llmnvidiaopenai-apiquantizationqwenrocmstrix-halo
Docs: the image cache policy is one switch for the three servers, so document it once
MangetsuCe580d3288f7f
diff --git a/doc/env_vars.md b/doc/env_vars.mdindex 46162b0..52d6784 100644--- a/doc/env_vars.md+++ b/doc/env_vars.md@@ -985,6 +985,12 @@ The same lane also exports `EXL3_HOST_LEAN`, `EXL3_HOST_CUTS`, `EXL3_LOAD_DEVICE| `EXL3_GLM_SLOTS` | `0` (one recurrent state slot per session) | Minimum number of recurrent state slots the GLM server allocates. The default sizes them to `--sessions`, which frees about 6 GiB of GPU memory at one session. `16` restores the earlier layout. || `EXL3_GC_FREEZE` | Qwen server `1`, GLM server `0` | Moves the loaded model and tokenizer objects out of the Python garbage collector before the first generator is built. Without it, rebuilding the generator (for example after a `cache_salt` change) pays a collector pass of about 0.5 s inside the time to first token. `0` leaves them in the collector. |+#### Image embedding cache (all three servers)++| variable | default | what it does |+|---|---|---|+| `KYOJIN_IMAGE_CACHE_POLICY` | `head` | Which pictures a full image-embedding cache gives up. The cache is one shared module (`tools/strix_halo/image_cache.py`, with `image_cache.py` symlinks in `tools/glm`, `tools/qwen` and `tools/mimo`), so this switch reaches all three servers, and it is read when a server builds its cache at start-up. `head` is the plain LRU a server always had: the picture whose last use is oldest goes first, which for a client that re-sends its whole history every turn is the earliest picture of the prompt. `tail` follows the prompt instead — a picture no remembered prompt refers to goes first, then the last pictures of the remembered prompts, and the head of the prompt is the last thing given up — which lets a history that keeps being re-sent keep the start of its prompt, so its warm turns prefill less and reach the first token sooner. Decoding is unaffected. Any other value stops the server at start-up. |+### Server state#### `KYOJIN_HEALTH_DIR` (default: `~/.cache/kyojin`)diff --git a/tools/glm/SERVE.md b/tools/glm/SERVE.mdindex dca8a11..78e6a6c 100644--- a/tools/glm/SERVE.md+++ b/tools/glm/SERVE.md@@ -52,10 +52,6 @@ collector freeze (`EXL3_GC_FREEZE`) are described in [doc/env_vars.md](../../docThe lookup code is `tools/qwen/spec_policy.py`, which the GLM server finds through its own file path, so `tools/qwen`must ship next to `tools/glm`.-The picture cache's eviction policy is an environment variable rather than a flag:-**`KYOJIN_IMAGE_CACHE_POLICY`**, `head` (the default, a plain LRU) or `tail` (keep the head of a prompt and give up its-end); anything else is an error at start-up. See [Images](#images).-### MTP sidecar (higher draft acceptance)The pack stores the MTP `eh_proj` at 2 bits. The pack also ships an unquantized copy,@@ -133,13 +129,14 @@ server keeps the decoded embeddings of recent pictures in host memory (GLM's merpicture fresh pseudo token ids and breaks the paged prefix *from that picture on*. `--image-cache-mb` sizes thecache: 1024 MiB by default, about 20 pages of 1568x1568 at 49.0 MiB each, one pool shared by all sessionslike `-c`.-Which pictures a full cache gives up is the eviction policy of the shared cache, `KYOJIN_IMAGE_CACHE_POLICY`:-`head` (the default) is a plain LRU — the same behaviour this cache always had — and it drops the *earliest*-pictures of a history, which are exactly the ones the paged prefix starts from; `tail` drops the *last* ones-instead, so a conversation a client keeps re-sending keeps its head. The request log's `img_cache` line reports-`hits`, `misses` and `first_missing`, the index the prefix could match up to; `--image-cache-items` caps the-number of pictures held (32 by default, as upstream's shared cache; `0` = no limit), which for small crops binds-before the byte budget does.+Which pictures a full cache gives up is **`KYOJIN_IMAGE_CACHE_POLICY`**+([doc/env_vars.md](../../doc/env_vars.md)). The default `head` is the plain LRU this server always had, and it+drops the *earliest* pictures of a history — exactly the ones the paged prefix starts from. **A history the client+keeps re-sending should be served with `tail`**, which keeps those earliest pictures and gives up the end of the+prompt instead: 43.5 % of a 75K-token prompt reused (82.0 s for the warm turn) against 0 % (133.6 s) under the+default. The request log's `img_cache` line reports `hits`, `misses` and `first_missing`, the index the prefix+could match up to; `--image-cache-items` caps the number of pictures held (32 by default, as upstream's shared+cache; `0` = no limit), which for small crops binds before the byte budget does.`--image-cache-format` stores those rows packed instead of as fp32 (49.0 MiB for a 1568x1568 page): `fp16` is24.5 MiB and `q8` is 12.3 MiB. Measured per picture that is actually