{"slug": "pvm-give-any-llm-long-term-memory-no-api-keys-no-gpu-800-lines-python", "title": "PVM:Give any LLM long-term memory.No API keys,no GPU,~800 lines Python.", "summary": "A developer created PVM (Persistent Vector Memory), an open-source Python library (~800 lines) that gives LLMs long-term memory without requiring API keys or GPUs. PVM replaces traditional RAG's similarity search with temporal weight decay, feedback-based weight calibration, and fuzzy attribution, enabling AI systems to remember and adapt to changing information across sessions.", "body_md": "Every LLM you've ever used is an amnesiac.\n\nChatGPT forgets your name between sessions. Cursor forgets your project conventions overnight. Claude forgets the decision your team made three conversations ago. This isn't a bug — it's architecture. LLMs are stateless. Every conversation starts from zero.\n\nThe industry's answer has been **RAG** — retrieve relevant context, stuff it into the prompt, hope the model figures it out. It mostly works for simple Q&A. It falls apart when information *changes*.\n\nRAG treats memory as a search problem: encode everything into vectors, find the most \"similar\" ones, return them.\n\nThis breaks in three ways that anyone who's used AI seriously has felt:\n\n**1. Information rots, but vectors don't know that.**\n\nYour company changed its API policy three months ago. The old policy document is still in the vector database, semantically similar to \"API policy,\" and gets returned alongside the new one. Which one should the LLM trust? RAG shrugs.\n\n**2. You correct it, it forgets the correction.**\n\nYou tell the AI \"no, that's outdated.\" It apologizes. Next session, same query, same outdated result. There's no feedback loop. The vector database never learns.\n\n**3. When multiple things match, it guesses.**\n\nThree memories all look relevant. The system picks the highest cosine similarity score and presents it as fact. Wrong choice? Too bad. The user's trust erodes one guess at a time.\n\nPVM (Persistent Vector Memory) replaces similarity with **evolution**.\n\nEvery memory carries a **weight** that changes over time. Every memory records **when** it was stored, **when** it was last accessed, and **what** it's connected to. The system doesn't just find things — it tracks how their importance changes.\n\nThree mechanisms make this work:\n\n**Temporal weight decay.**\n\nA memory not accessed for 69 days has its weight halved. Not accessed for a year? It sinks to the bottom. You don't write expiration rules. Time handles it.\n\n**Delta Rule calibration.**\n\nUser confirms a memory → weight moves up. User corrects it → weight moves down. This is the Widrow-Hoff Delta Rule from 1960 — one subtraction, one multiplication, one addition. O(1). No GPU. No batch training. Five confirmations moves a weight from 0.50 to 0.61. Five corrections drops it to 0.39.\n\n**Fuzzy attribution.**\n\nWhen multiple memories match and no single one is clearly right, PVM doesn't guess. It tells you: *\"I found a pattern across three memories spanning 180 days. Here's what they share.\"* Then when you pick the right one, the weight updates. Next time it knows.\n\nAI that actually gets better the more you use it.\n\nA writer who's been drafting a novel for six months — PVM remembers every character detail, every plot thread, every abandoned idea, and surfaces the *relevant* ones without flooding the context window. The AI stops contradicting itself in Chapter 12 about a detail from Chapter 3.\n\nA development team using Cursor — their coding conventions, architectural decisions, and bug histories persist across sessions. New team members onboard by querying the team's memory, not by reading a wiki that's already stale.\n\nA customer support agent — user preferences evolve. Someone who loved blue last year now only buys black. PVM's weights track the shift automatically. The AI recommends black, not blue.\n\n| Mem0 | Letta | Pinecone/RAG | PVM | |\n|---|---|---|---|---|\n| Learns from feedback | ❌ | ❌ | ❌ | ✅ |\n| Temporal weight decay | ❌ | ❌ | ❌ | ✅ |\n| Fuzzy attribution | ❌ | ❌ | ❌ | ✅ |\n| Needs API keys | 2 keys | 1 key | 1+ keys | 0 |\n| Needs GPU | Yes | Yes | Cloud | No |\n| Data leaves your machine | Yes | Yes | Yes | No |\n| Lines of code | ~10K+ | ~10K+ | Varies | ~800 |\n\n```\npip install pvm-memory\npython\nfrom pvm import PVMEngine\n\nengine = PVMEngine()\n\n# Store a memory\nfp = engine.store(\"User prefers dark mode in all editors\", \n                   keywords=[\"preference\", \"dark mode\", \"editor\"])\n\n# Query later — weights have evolved\nresults = engine.query(\"What UI preferences does the user have?\")\n\n# User confirms — weight goes up\nengine.calibrate(fp, signal=1.0)\n\n# User corrects — weight goes down  \nengine.calibrate(fp, signal=0.0)\n```\n\nThat's the entire API. Three methods.\n\nI built this alone. It's not a company. There's no sales team, no funding, no enterprise support. The code is open source (BSL → MIT 2030). If it's useful to you, use it. If you find bugs, open an issue. If you want to build something on top of it, go ahead.\n\nThe paper explaining the architecture is on [SSRN](https://ssrn.com/xxxx) and in the [GitHub repo](https://github.com/rocky007cn/vector-as-memory/blob/main/paper/paper-en.md).\n\n*Wenhui Tian is an independent researcher. He works on causal inference, memory systems, and the intersection of economics and AI. He can be reached at rocky007cn@outlook.com.*", "url": "https://wpnews.pro/news/pvm-give-any-llm-long-term-memory-no-api-keys-no-gpu-800-lines-python", "canonical_source": "https://dev.to/rocky007cn/pvmgive-any-llm-long-term-memoryno-api-keysno-gpu800-lines-python-42p3", "published_at": "2026-07-13 19:38:25+00:00", "updated_at": "2026-07-13 20:16:06.144610+00:00", "lang": "en", "topics": ["artificial-intelligence", "large-language-models", "developer-tools", "ai-agents", "machine-learning"], "entities": ["PVM", "Mem0", "Letta", "Pinecone", "ChatGPT", "Cursor", "Claude"], "alternates": {"html": "https://wpnews.pro/news/pvm-give-any-llm-long-term-memory-no-api-keys-no-gpu-800-lines-python", "markdown": "https://wpnews.pro/news/pvm-give-any-llm-long-term-memory-no-api-keys-no-gpu-800-lines-python.md", "text": "https://wpnews.pro/news/pvm-give-any-llm-long-term-memory-no-api-keys-no-gpu-800-lines-python.txt", "jsonld": "https://wpnews.pro/news/pvm-give-any-llm-long-term-memory-no-api-keys-no-gpu-800-lines-python.jsonld"}}