Skip to content
derpx06Notes on systems, models & learning
6. Memory & State Management · lesson 47 of 68 · 1 min · January 10, 2026

Why Memory Breaks Systems

LLMs are stateless. The illusion of continuity is your job.

When you talk to ChatGPT, it feels like a continuous conversation. But the model does not remember you. It does not remember what you said 2 seconds ago.

LLMs are Stateless Sequence Predictors. Every time you send a message, you are actually resending the entire conversation history up to that point.

Turn 1: Input: [User: Hi] Output: [AI: Hello]

Turn 2: Input: [User: Hi, AI: Hello, User: My name is Bob] Output: [AI: Nice to meet you Bob]

If you drop the history, the model forgets who Bob is instantly.

New engineers think: "Easy! I'll just append every message to a list string." This works for 5 minutes. Then it breaks.

Models have a hard limit (e.g., 8k tokens). If your history is 9k tokens, the API throws an error. You must delete something. But what?

Sending 100 words takes 100ms. Sending 10,000 words takes 2s. Infinite memory = Infinite latency.

As history grows, the model's attention dilutes. It starts ignoring instructions buried in the middle of the chat logs.

Memory is not a feature of the model. It is a feature of the Application Layer. You are building a "State Engine" that sits in front of a "Stateless Processor."

If this engine fails, you get:

  1. Hallucination: The AI invents facts because it forgot the retrieved docs.
  2. Privacy Leaks: User B sees User A's history because you messed up session isolation.

To build a chatbot, you must become a State Architect. You must decide what to remember, what to forget, and where to store it.

Key Intuition: "The model lives in the eternal Now. Only the System has a Past."