Model forgets earlier messages or long documents
Symptom
Long prompts are partly ignored; the model acts as if the beginning of the chat never happened.
Likely causes
- Default context size is small (common in Ollama)
- Silent truncation or context shifting
- Parallel slots divide the context
How to fix it
- Set the context explicitly (num_ctx in Ollama, -c in llama.cpp).
- In llama-server, remember -c is split across -np slots.
- Count tokens to confirm the prompt fits.
- Use RAG or summarization instead of stuffing everything in.
bash
# Modelfile
FROM llama3.1:8b
PARAMETER num_ctx 16384Still stuck? Check the lessons or measure first with the benchmark lab.