Local model: compact cached prompt so typed replies take ~6 s (fixes 45 s timeouts) #8
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/local-fast-prompt"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
The live demo's typed chat timed out (busy reply after 45 s) while the OpenRouter daily quota was used up.
Root cause: the local model got the full hosted prompt, about 3.1k tokens (schema + examples + catalog). On this CPU, prefill costs about 13 ms per token. So every prompt-cache miss cost about 40 s on the single llama-server slot, and any request queued behind it also waited.
Cache misses were frequent:
Fix
Compact local prompt:
LOCAL_PROMPT+_local_system_promptis about 1.2k tokens. It contains:It holds no per-visitor data, so it's identical for every visitor and the cache always hits. It only changes when the catalog changes, and the primer re-warms it then.
Per-visitor part (
_local_user, a few dozen tokens): the look overrides (if any), a keyword/budgetMATCHING LISTINGShint, andVISITOR: <message>.Lean generation:
max_tokens200, no history, no tool round. Over-budget card picks are dropped when some picks fit.Buy vs sell: the examples are separated (selling your own thing opens the listing form, never a checkout). This replaces the unfinished fix/local-sell-vs-checkout change.
Measured (gemma3:4b, 8-core CPU, -t 6, nice 10)
handle_chat: 12/12 correct, median 5.9 s, max 6.7 s.gemma3:4b passes, so smaller models weren't needed.
Staging (hosted parked on the mock daily quota, real local model)
e2e_httpwithREQUIRE_LLM=1nl_checkbrowser_e2etheme_checkwithREQUIRE_LLM=1llm_proxy_checkfake_model_browser