惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

G
Google Developers Blog
阮一峰的网络日志
阮一峰的网络日志
A
About on SuperTechFans
大猫的无限游戏
大猫的无限游戏
Engineering at Meta
Engineering at Meta
V
Visual Studio Blog
Martin Fowler
Martin Fowler
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 叶小钗
I
InfoQ
B
Blog RSS Feed
aimingoo的专栏
aimingoo的专栏
Y
Y Combinator Blog
Blog — PlanetScale
Blog — PlanetScale
IT之家
IT之家
P
Proofpoint News Feed
WordPress大学
WordPress大学
小众软件
小众软件
B
Blog
MongoDB | Blog
MongoDB | Blog
人人都是产品经理
人人都是产品经理
量子位
Hugging Face - Blog
Hugging Face - Blog
月光博客
月光博客

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
The Memory Illusion: Why Your LLM "Remembers" (And Why It...
Raghavendra · 2026-05-03 · via DEV Community
Cover image for The Memory Illusion: Why Your LLM "Remembers" (And Why It Actually Doesn't)

Raghavendra Govindu

If you use ChatGPT, Claude, Grok, Copilot, or Gemini daily, it feels like you're talking to a person. It remembers what you said three messages ago. It references the project details you shared yesterday. It feels like the model has a persistent brain that is learning about you.

But it’s a lie.

From an architectural standpoint, an LLM is the most "forgetful" piece of software you will ever use. Every time you hit "Send," the model starts at a blank slate.

So, how does it maintain your chat history? The answer lies in the Context Window and the engineering that happens outside the model’s weights.

The Reality: LLMs Are Stateless
Large Language Models (Transformers) are stateless functions. In computer science terms, a stateless service processes a request based solely on the input provided at that moment.

When you send a prompt:

  • The model receives your current message.
  • It generates a response.
  • It then discards everything. The model’s internal weights—the "brain" that was trained for months—do not change based on your conversation. It does not update its database, and it does not store your name or your preferences in its parameters. If you close the chat and start a new one, the model has absolutely no idea who you are.

The Solution: The Context Window "Buffer"
If the model is stateless, why does it seem to remember? Because of the Context Window.
Your UI (the chat interface) acts as a high-speed messenger. Behind the scenes, the UI maintains an array of your conversation history.
Every time you send a new message, the UI application does the following:

  • Retrieves your current input.
  • Fetches the previous $N$ messages from your chat history.
  • Packages the entire conversation—your prompt plus the last 10-20 turns of history—into one giant, concatenated string.
  • Sends that entire bundle to the LLM as the "context.

"When the LLM receives this bundle, it "reads" the entire conversation from the top down. It generates the next token based on the entire history provided in that specific prompt.

The LLM isn't remembering your past; the UI is just resending the past to the LLM every single time you speak.

The Engineering Trade-offs
This "resend everything" approach is why we have the concept of a Context Limit:

  • Token Costs: Since you are resending the entire history with every prompt, the number of tokens processed grows significantly as the chat gets longer. This increases latency and API costs.
  • The "Lost in the Middle" Phenomenon: As the context window fills up, the model’s performance can degrade. Models sometimes struggle to "attend" to information buried in the middle of a massive context block, focusing instead on the beginning or the very end.
  • Context Management: Modern AI applications use advanced techniques like RAG (Retrieval-Augmented Generation) or Summarization/Memory Buffers to decide which parts of your history are relevant enough to be included in the context bundle, ensuring the model stays focused without exceeding token limits.

For the Software Professional: The "Stateless" Mindset
Understanding this distinction is vital for anyone building AI-native applications:

  • Don't rely on the model for storage: If you need to store user preferences, conversation logs, or specific facts, do it in a traditional database (e.g., PostgreSQL, Redis, or a Vector DB).
  • Manage your own context: When building an API, you are responsible for the "memory." You must manage the conversation array, truncate old messages, or summarize long sessions before sending them to the LLM.
  • Scalability: Treat the LLM as the processing engine, not the data store. Your application layer should handle the "state."

The Big Takeaway
The feeling that an LLM has a "memory" is a masterclass in Application Layer Engineering. We have essentially built a sophisticated "stateful wrapper" around a "stateless core."

The next time you chat with an AI, remember: it’s not remembering you—it’s just reading the notes your interface handed it, seconds before it replied.

This makes it very clear to your readers that the "Memory" lives in the Application Layer, not the Model Layer.