Short-Term and Long-Term Memory in AI.
From the publisher’s feed, collected in the ZeroLabs newsroom.
Generated by ChatGPTAsk ChatGPT what you told it five minutes ago, and it knows. Ask it what you told it last Tuesday, and unless something was explicitly saved, it has no idea you exist. If you have ever observed that at times you ask ChatGPT/Claude something but its doesn’t have any information on that, feels like it never really was asked and sometimes it remembers things which even you don’t remember when did you ask about it. No… it’s not a bug (not a feature either :) ). It’s the direct result of how memory is built into today’s AI systems.Let’t go deep into what is exactly happening here..Memory in AI isn’t like memory in a human brainOur brain doesn’t have a hard cutoff that after this no other thing can be retained. But that’s not the case with LLM’s. Everything a model “knows” about the current conversation lives inside something called a context window, and once that window is full, older information doesn’t fade gently. It gets pushed out entirely.In the AI world we have two types of memory — Short Term Memory (STM) and Long Term Memory (LTM). Short-term memory is about what fits inside a single conversation. Long-term memory is about what persists after the conversation ends. The real difference is not between the time, its more about the scope. Short Term Memory is thread scoped, it focusus on the current on going conversation, Long Term Memory instead goes beyond single conversations. It’s tries to extract the information from each of the conversation that has happened which feels important and effective for example user preferences, user’s profile, background etc.Let’s see both in depth —Short Term Memory: the context windowEvery time we send a message to an AI model, the model doesn’t actually “recall” our earlier messages the way we’d recall a conversation from yesterday. Instead the entire conversation so far whatever has been in the turns get re-fed into the model as one long block of text. That block is the context window, and it has a fixed size, measured in tokens, which are roughly chunks of words. Modern models have pushed this window from a few thousand tokens to hundreds of thousands, and some systems now handle over a million. That sounds like a lot, and for most everyday conversations it is. But it’s still finite, and it behaves less like a filing cabinet and more like a whiteboard with a size limit. As new information gets written on, older information either gets erased or, in more sophisticated systems, summarized and compressed to save space.This is why sometimes during long going conversations it feels like AI is “losing the thread”. This is not because its confused but it genuinely doesn’t have the amount of information you would expect it to have because that text has scrolled outside the window, or been summarized down to something much shorter and less precise.The context window is also why short-term memory in AI is inherently expensive. Every additional token in the window costs more computation, so there’s a real tradeoff between giving a model a longer memory and keeping it fast and affordable to run. This constraint, more than anything else, is what has pushed researchers toward long-term memory systems instead of just making context windows bigger and bigger.Long-term memory: remembering across conversationsLong-term memory solves a very different problem — how does an AI system retain information after the conversation window closes, the session ends, or when we come back the next day?The answer isn’t retraining the model in real time with the user’s conversation thats actually not practical, instead, most long-term memory systems work by storing information externally, outside the model, and then retrieving the relevant pieces back into the context window when they’re needed. This typically happens in three steps. First, something worth remembering gets identified during a conversation, a preference we stated, a fact about our project, a decision we made. Second, that information gets written into a persistent store, often as text paired with a mathematical representation called an embedding, which captures its meaning in a form that can be searched later. Third, in a future conversation, when something relevant comes up, the system searches that store, pulls out the pieces that matter, and quietly inserts them back into the context window before the model responds.It’s worth being precise about what actually lives in that external store, because it isn’t always small, embedded snippets ranked by similarity. Sometimes it’s exactly that. But it can just as easily be a raw, unprocessed preference such as always answering in bullet points, a decision made during an earlier project, or even the transcript of a past conversation kept around in full and pulled back in piece by piece. Retrieval-augmented generation describes the mechanism of getting information back into context. It doesn’t require that everything sitting in storage be some elaborate embedded fact base. Often it’s closer to a notes file than a search index.The middle ground: summarizationThe problem summarization solves is specific. Trimming or deleting old messages from the context window is fast, but it throws information away completely. Summarization instead compresses old exchanges into a shorter form and keeps that compressed version inside the same conversation. A twenty-message back-and-forth about a project’s requirements might get folded into two or three sentences capturing the decisions that were made, while the exact wording of how those decisions were reached is let go.This still counts as short-term memory, since the summary lives inside the thread and disappears once the thread ends. What changes is how the space inside the context window gets used. Instead of a hard cutoff where old messages simply vanish once the window fills, a running summary keeps getting extended as the conversation grows, folding in what’s new while preserving the gist of everything that came before. The system ends up holding a compressed record of the whole conversation rather than a raw window onto only its most recent part.Once we see the split between short-term and long-term memory, a lot of AI behavior starts making sense.It explains why some AI products feel personalized while others feel like talking to a stranger every time. The personalized ones have built a long-term memory layer on top of the model. The ones that don’t feel that way haven’t, or they’ve limited it to a single session.Where this is headingThe current trend in AI isn’t just bigger context windows or bigger memory stores. It’s smarter management of both. Systems are getting better at deciding what’s actually worth remembering long-term instead of saving everything indiscriminately, the same way a good assistant doesn’t write down every word you say but jots down the parts that matter. Beyond the kind of summarization already common inside a single conversation, some systems are pushing the same idea further, layering summaries of summaries so a conversation from months ago is represented by a single sentence while last week’s is still fairly detailed. Others are experimenting with tiered memory this way more broadly, where recent context stays detailed and older context gets progressively compressed, echoing the way human memory itself works, vivid for recent events and gradually reduced to a general impression over time.The takeawayShort-term memory in AI is the context window, everything visible to the model in the current conversation, fast but strictly limited. Long-term memory is an external system that stores and retrieves information across time, giving the illusion of a model that remembers you, when really it’s being reminded.Neither one is memory in the way we usually mean the word. But together, they’re what make the difference between an AI that feels disposable and one that feels like it actually knows you.Short-Term and Long-Term Memory in AI. was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.