How to Reuse a Cached Prompt Prefix With Prompt Caching
Put the stable content first, mark the breakpoint at the end of the stable prefix, and check the next request reads from…
WORKFLOW TAG
Check what fits in the input and output context for your model.
Put the stable content first, mark the breakpoint at the end of the stable prefix, and check the next request reads from…
Compress the prompt to a target token count with LLMLingua, keep the instruction and question intact, and check the answer survives.
Pick a model with sliding window layers, keep the recent window in the cache, and check the model still answers questions about…
Multiply layers, heads, head size and tokens, then check the total against your GPU before you start a long conversation.
Enable a quantized KV cache, pick the backend and bit width, and check the quality loss is acceptable for your context length.
Quantize the KV cache for a long mlx_lm run so the conversation fits in memory.
Set a maximum token limit for an mlx_lm.generate run and confirm the answer stops at the limit.
Set the context length for llama-server with a flag and confirm long input stays in view.
Place a key fact in the middle of a long prompt, ask a question that needs it, and check the answer uses…
Chunk the document, retrieve only the relevant parts, and compress them before they reach the prompt.