mlx_lm.server: streamed generations do not store prompt-cache entries (0.31.3)
On mlx-lm 0.31.3 with mlx_lm.server --prompt-cache-bytes 8GB --prompt-cache-size 16, generations requested with stream: true do not appear to create reusable prompt-cache entries.
Repro: send the same ~10k-token prefix (system + tools) with varying short user turns, all with stream: true. Every request reports usage.prompt_tokens_details.cached_tokens: 0 and pays full prefill (~23s for 9,953 tokens on an M2 Ultra with a 35B-A3B 6-bit checkpoint).
Send a single identical request with stream: false, then repeat the streamed requests: every subsequent streamed request now reports cached_tokens: 9939 and completes prefill in ~400ms. So streamed requests can READ cache entries fine; they just never seem to STORE them.
Measured while building an eval harness (https://github.com/jackhwarner/modelbake); happy to provide full request bodies or server logs.
Source: ml-explore/mlx-lm