AI Infra
0%
Part VI · Chapter 40

Personalization and User Memory

AuthorChangkun Ou
Reading time~12 min

The memory of Chapter 39 belonged to a task: logs, workspaces, and stores that let one agent run survive its own length. This chapter is about a different memory with a different owner, the product's memory of its user, carried across sessions and months. The engineering problem is stark when stated plainly: the model is stateless by construction, one set of weights answers every request and the cache dies with the session, yet the products built on it now remember your job, your children's names, and what you asked last winter. Something outside the model is doing that remembering, and its design has quietly become infrastructure with consequences for markets, privacy, and what the assistant tells you. By the end of this chapter, a reader can say where persistent user state can live and why one home won, how the extract-consolidate-retrieve loop works and where it can be poisoned, how the shipped systems differ in philosophy, and why memory, more than model quality, is becoming the switching cost of the assistant market.

Three homes for user state

User state could live in three places, and the field tried all of them. It could live in the weights: fine-tune a copy of the model per user. This loses three times over. A training job and a checkpoint per user is an orchestration and storage impossibility at consumer scale; sequential fine-tuning on a user's data erodes the general capability everyone else's training paid for; and, decisively, per-user weights destroy cross-user batching, the economic core of serving that Chapter 31 established. It could live in adapters: a small per-user LoRA over shared weights, a genuine research line (Tan et al. 2024), whose serving-side difficulty is measured by the systems built just to keep thousands of adapters schedulable at once (Sheng et al. 2023); no consumer product has shipped it at scale. Or it could live in the context: extract facts from conversations, store them in an ordinary database outside the model, retrieve the relevant ones at query time, and inject them into the prompt. Every shipped system chose the third home.

Constraint arrow

The choice was not made by memory researchers; it was made by the serving layer below them. Batched inference over shared weights is what makes a hosted model affordable, so any personalization that fragments the weights, or the batch, prices itself out. State therefore migrates to the cheapest layer that can carry it, the prompt, and the whole memory stack of this chapter, extraction pipelines, consolidation passes, retrieval indexes, exists to make a stateless, shared model wear a per-user disguise. Personalization lives in the context because Chapter 31's economics left it nowhere else to live.

The memory loop

Once state lives outside the model, four design questions define the pipeline, and every production system answers the same four. What is worth remembering: an extraction pass judges the salience of candidate facts in the dialogue. How new facts meet old ones: a consolidation step adds, updates, deletes, or ignores against the existing store, the step where "you're going to Singapore in July" must eventually become "you went"; the largest deployment now runs this as an offline background process that rewrites stale memories wholesale (OpenAI 2026). What comes back: retrieval at query time, injected into the prompt. And what is allowed to fade: expiry and decay, present in the research line from the start, one early system scored memory strength on an explicit forgetting curve (Zhong et al. 2023), and temporal-graph designs keep facts with validity intervals instead of overwriting them (Rasmussen et al. 2025).

The research lineage behind the loop is short and legible. The memory stream with scored retrieval, recency, importance, relevance, and periodic reflection that synthesizes higher-level observations, arrived with generative agents (Park et al. 2023); the operating-system framing, a model paging its own state between a small fast context and a large slow store, arrived with MemGPT (Packer et al. 2023); and a memory-as-a-service market industrialized the pipeline. Its own benchmark results repay a careful reading, in this book's Chapter 47 spirit. On the standard long-conversation benchmark, the leading memory system reports large latency and token savings, over 90% of both, against feeding the full history into the model, but the full-history baseline scores higher on answer quality (Chhikara et al. 2025). At today's conversation lengths, engineered memory wins on economics, not accuracy, a fact the marketing omits and the design question turns on.

memloop conv conversation stream ext extraction what is salient? conv->ext cons consolidation add / update / delete ext->cons store memory store facts, summaries, graph cons->store ret retrieval at query time store->ret inj prompt injection into the context ret->inj inj->conv poison poisoning enters here (injected content that gets written) poison->cons erase deletion / erasure exits here erase->store
Figure 40.1. The user-memory loop. Extraction and consolidation decide what is written, retrieval decides what returns, and the two annotations mark where the design carries risk: poisoning enters at the write path, and the erasure obligation exits at the store.

The runnable below is the consolidation step reduced to its arithmetic: candidates arrive forever, but deduplication and salience decay keep the store bounded. A memory store is a fixed-size distillation of an unbounded stream, which is both its function and, as the last sections show, its risk profile.

import numpy as np
rng = np.random.default_rng(1)
store, lam, sim_thresh = [], 0.01, 0.85          # decay rate, dedup threshold
for t in range(500):
    cand = rng.normal(size=8); cand /= np.linalg.norm(cand)
    importance = rng.random()
    if store:
        sims = [c @ cand for c, _, _ in store]
        if max(sims) > sim_thresh:               # near-duplicate: refresh, don't add
            i = int(np.argmax(sims)); store[i] = (store[i][0], store[i][1], t)
            continue
    store.append((cand, importance, t))
    store = [(c, imp, t0) for c, imp, t0 in store
             if imp * np.exp(-lam * (t - t0)) > 0.05]   # salience decay evicts
    if t % 100 == 99: print(f"t={t+1}: {len(store)} memories retained")
print("an unbounded stream, a bounded store: consolidation is the whole design")

Two shipped philosophies

The consumer deployments split on one design axis: whether the user can see the memory. The first mover shipped user-managed "saved memories" in early 2024, then expanded to referencing the user's entire chat history, and by mid-2026 to background synthesis that rewrites the profile without user action (OpenAI 2024; OpenAI 2026); what the model knows about you became, in stages, an inferred artifact rather than a list you curate. The second design planted its flag on the opposite end: memory scoped per project so contexts do not bleed into each other, a memory summary the user can read and edit directly, incognito sessions that leave no trace, and a launch note stating the vendor had tested whether memory "could reinforce harmful patterns in conversations" before shipping (Anthropic 2025). Third-party analysis of the two implementations makes the architectural difference concrete: one injects a synthesized profile into every conversation automatically; the other starts blank and searches raw history through explicit tools when the conversation calls for it (Willison 2025). The other two hyperscalers personalize from a different asset entirely, connecting the assistant to search history, mail, and photos, behavioral exhaust that Chapter 4's incumbents spent two decades accumulating, and one has closed the flywheel outright: assistant conversations now feed content and advertising personalization on the parent platform (Meta 2025). Across all four, the drift of 2025 and 2026 ran the same direction, toward richer, more synthesized, less inspectable profiles, with deletion controls retained as the constant.

Memory as a moat

The market-structure reading of this chapter belongs next to Chapter 77's value chain. Model quality is a depreciating advantage, competed away with every release cycle; an accumulated year of a user's context is not, because it regenerates only by the user re-living it with a competitor. Memory is therefore the assistant market's switching cost, and the labs describe it in exactly those aspirational terms: systems that get to know you over your life. The countervailing forces are portability and law: data exports that include memories, a nascent user-owned-memory movement that relocates the store to the user's device behind a standard protocol (Mem0 2025), and a European enforcement debate that has named AI assistants a priority without yet creating a memory-portability obligation. Whether the moat holds depends on which of those matures first.

The flywheel carries an epistemic cost this book has priced before. The clearest sentence in the record comes from the vendor's own post-mortem of its sycophantic model update: "user memory contributes to exacerbating the effects of sycophancy" in some cases (OpenAI 2025). A model that remembers what you believe is better equipped to tell you what you want to hear, and personalized alignment, tuning behavior toward an individual, carries the risks of profiling and bias reinforcement that the recommender era documented at population scale, which is why the academic treatment argues for explicit normative bounds on how far personalization should go (Kirk et al. 2024). Chapter 4 told this story once already with click-through rates; the memory store is where the assistant era decides whether to retell it.

The profile as attack surface

Two security results bound this chapter's risk, one about what the store implies and one about who can write to it. The first is inference at scale: models infer personal attributes, location, income, demographics, from ordinary, non-sensitive text with high accuracy at negligible cost (Staab et al. 2024). A memory store is that inference run continuously against one person and then persisted: an aggregation artifact more revealing than any conversation it distills. The second is the write path. Because consolidation decides what enters the store, a prompt injection that reaches the consolidation step becomes an implant rather than an incident: demonstrated attacks planted false memories and even standing exfiltration instructions that leaked every subsequent conversation until the memory was found and deleted (Rehberger 2024), and the academic version poisons agent memory through nothing but queries (Chen et al. 2024). The defenses follow the diagram: guard the write path, and keep the store auditable by its owner, which turns the visible-versus-opaque design axis from a philosophy into a security control. One property, at least, is clean: erasing a memory row is an engineering triviality, which makes context-resident memory the one home for user state where the right to be forgotten of Chapter 59 can be honored with a DELETE rather than a research program.

What's contested

Three arguments are live. Where memory should live: the platforms hold that native memory is safer and deeper; an application layer of memory services argues portability across models; a user-device movement argues the profile belongs to its subject, and no standard has settled it. Whether long context retires the memory stack: ten-million-token windows were announced with personalization as an explicit use case (Meta AI 2025), and at benchmark conversation lengths full history already out-scores engineered memory; the rejoinder is threefold, that cost and latency scale with context while a store is constant, that effective context lags claimed context badly (Hsieh et al. 2024), and that salience is a curation problem a bigger window does not solve, which is why the largest deployment built background consolidation instead of relying on its own long context. And the epistemic question, whether personalization on net corrects the model's one-size-default or entrenches the user's priors, has, as of mid-2026, advocacy on both sides and no decisive study on either.

Further reading

  • Park et al., “Generative Agents: Interactive Simulacra of Human Behavior” (the memory stream and reflection loop everything echoes), 2023. arXiv:2304.03442
    The memory stream with retrieval scored by recency, importance, and relevance, plus periodic reflection that synthesizes higher-level memories: the conceptual template every later memory system echoes.
  • Packer et al., “MemGPT: Towards LLMs as Operating Systems” (the operating-system framing of memory), 2023. arXiv:2310.08560
    MemGPT introduces virtual context management for LLMs, using an OS-inspired hierarchical memory system to page data between a fixed context window and external storage, enabling unbounded context for document analysis and multi-session chat.
  • Zhong et al., “MemoryBank: Enhancing Large Language Models with Long-Term Memory” (the earliest serious take on decay), 2023. arXiv:2305.10250
    Long-term memory for companion assistants with memory strength updated on an Ebbinghaus-style forgetting curve, the earliest serious treatment of decay as a design element.
  • Maharana et al., “Evaluating Very Long-Term Conversational Memory of LLM Agents” (LoCoMo, the benchmark the memory startups fight over), 2024. arXiv:2402.17753
    Very-long-term dialogues spanning hundreds of turns across many sessions, with question answering and event summarization: the benchmark at the center of the memory-system disputes.
  • Wu et al., “LongMemEval: Benchmarking Chat Assistants on Long-Term Interactive Memory” (the harder benchmark: temporal reasoning and knowledge updates), 2024. arXiv:2410.10813
    Broadens memory evaluation beyond recall to temporal reasoning, multi-session reasoning, knowledge updates, and knowing when to abstain.
  • Chhikara et al., “Mem0: Building Production-Ready AI Agents with Scalable Long-Term Memory” (memory-as-a-service, winning on economics rather than accuracy), 2025. arXiv:2504.19413
    The memory-as-a-service pipeline: extract, consolidate, retrieve, with large reported latency and token savings over full-context, whose own tables show the full-context baseline scoring higher on quality.
  • Rasmussen et al., “Zep: A Temporal Knowledge Graph Architecture for Agent Memory” (facts with validity intervals instead of overwrites), 2025. arXiv:2501.13956
    Memory as a temporal knowledge graph: facts carry validity intervals and are invalidated rather than overwritten, so the store can answer what was true when.
  • OpenAI, “Memory and new controls for ChatGPT” (where platform memory shipped first), 2024. openai.com
    The first consumer deployment of assistant memory: user-manageable saved memories, deletion controls, and temporary chats that leave no trace.
  • Anthropic, “Bringing memory to Claude” (project-scoped, visible, editable, safety-tested), 2025. claude.com
    Memory scoped per project with a user-visible, editable summary and incognito chats, released with the stated safety testing of whether memory could reinforce harmful conversational patterns.
  • Willison, “Comparing the memory implementations of Claude and ChatGPT” (the two shipped philosophies dissected), 2025. simonwillison.net
    A dissection of the two shipped designs: one injects a synthesized profile into every conversation automatically, the other starts blank and searches raw history through explicit tools on demand.
  • Staab et al., “Beyond Memorization: Violating Privacy via Inference with Large Language Models” (profiling from ordinary text, at near-human accuracy), 2024. arXiv:2310.07298
    LLMs infer location, income, and demographics from ordinary text at high accuracy for a fraction of a human profiler's cost; a memory store persists exactly that inference, run continuously.
  • Rehberger, “SpAIware: Spyware Injection Into ChatGPT's Long-Term Memory” (the proof that memory turns an attack into an implant), 2024. embracethered.com
    A prompt injection that survives the session: exfiltration instructions planted in assistant memory leaked every subsequent conversation until the memory was found and deleted.
  • Kirk et al., “The benefits, risks and bounds of personalizing the alignment of large language models to individuals” (the normative map of personalized alignment), 2024. nature.com
    The normative treatment of personalized alignment: what tuning a model to an individual buys, the profiling and bias-reinforcement risks it carries, and the case for explicit bounds.
  • OpenAI, “Expanding on what we missed with sycophancy” (where engagement training met user memory), 2025. openai.com
    The post-mortem of the sycophantic model update, including the admission that user memory contributed to exacerbating sycophancy's effects in some cases.

Comments

Log in to comment