S.S
All posts
Soufiane Sejjari··6 min

Memory Is the Missing Layer of LLM Applications

Context windows keep growing, but they still forget. Why persistent, structured memory — not longer contexts — is what makes LLM assistants actually useful.

Memory Is the Missing Layer of LLM Applications

Every LLM assistant today has the same fundamental flaw: it meets you for the first time, every time.

Context windows have grown from 4k tokens to millions. Yet the problem isn't capacity — it's structure. Dumping an entire chat history into a prompt is not memory. It's a transcript.

What memory actually requires

Building iRemember taught me that real memory needs four distinct operations:

  1. Extraction — separating durable facts ("my sister lives in Rabat") from ephemeral context ("I'm tired today")
  2. Consolidation — merging contradictions and updates over time
  3. Retrieval — surfacing the right memory at the right moment, not the top-k most similar strings
  4. Forgetting — yes, forgetting. Relevance decays; a memory system without decay drowns in its own history.

Hybrid retrieval beats pure similarity

Semantic similarity alone retrieves memories that sound related. What you usually need are memories that are related and recent and important.

Our scoring combines three signals:

score = α · semantic_similarity
      + β · recency_decay
      + γ · importance_weight

The importance weight is learned from extraction-time signals: emotional intensity, explicit markers ("remember this"), and how often a fact gets referenced by other memories.

People are first-class entities

The insight behind iRemember: every AI remembers you. None remember the people around you. Modeling people as structured entities — with evolving profiles and sentiment over time — changes what questions the system can answer. Not "what did I say about X" but "how has my relationship with X been trending."

That's the difference between a search engine over your past and an actual assistant.

#LLM#Memory#RAG

FAQ

Do longer context windows eliminate the need for LLM memory?

No. Context windows solve capacity, not structure. Research on long-context dialogue shows models still fail to recall dispersed user-specific facts and track temporal dependencies. Persistent, structured memory with selective retrieval remains necessary.

How does hybrid memory retrieval scoring work?

Each memory is scored as a weighted combination of semantic similarity, recency decay, and an importance weight learned from extraction-time signals like emotional intensity, explicit retention markers, and reference frequency by other memories.

What is the best open-source LLM memory system in 2026?

Mem0 is the most common baseline, but 2026 research (AdaMem, PerMem-Bench, MemMachine) shows uniform remember-everything extraction causes memory bloat. Custom LangGraph pipelines with write-control policies now outperform uniform extraction on QA accuracy and memory volume.

Soufiane Sejjari

Software Engineer · AI Researcher