<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: rocky007cn</title>
    <description>The latest articles on DEV Community by rocky007cn (@rocky007cn).</description>
    <link>https://dev.to/rocky007cn</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4027757%2F0f322c23-8a6e-49e5-b343-bf01fef2e266.jpg</url>
      <title>DEV Community: rocky007cn</title>
      <link>https://dev.to/rocky007cn</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rocky007cn"/>
    <language>en</language>
    <item>
      <title>PVM:Give any LLM long-term memory.No API keys,no GPU,~800 lines Python.</title>
      <dc:creator>rocky007cn</dc:creator>
      <pubDate>Mon, 13 Jul 2026 19:38:25 +0000</pubDate>
      <link>https://dev.to/rocky007cn/pvmgive-any-llm-long-term-memoryno-api-keysno-gpu800-lines-python-42p3</link>
      <guid>https://dev.to/rocky007cn/pvmgive-any-llm-long-term-memoryno-api-keysno-gpu800-lines-python-42p3</guid>
      <description>&lt;h2&gt;
  
  
  PVM: Give any LLM long-term memory. No API keys, no GPU, ~800 lines Python.
&lt;/h2&gt;




&lt;p&gt;Every LLM you've ever used is an amnesiac.&lt;/p&gt;

&lt;p&gt;ChatGPT 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.&lt;/p&gt;

&lt;p&gt;The industry's answer has been &lt;strong&gt;RAG&lt;/strong&gt; — retrieve relevant context, stuff it into the prompt, hope the model figures it out. It mostly works for simple Q&amp;amp;A. It falls apart when information &lt;em&gt;changes&lt;/em&gt;.&lt;/p&gt;




&lt;h3&gt;
  
  
  The problem with "just search for it"
&lt;/h3&gt;

&lt;p&gt;RAG treats memory as a search problem: encode everything into vectors, find the most "similar" ones, return them.&lt;/p&gt;

&lt;p&gt;This breaks in three ways that anyone who's used AI seriously has felt:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Information rots, but vectors don't know that.&lt;/strong&gt;&lt;br&gt;
Your 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.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. You correct it, it forgets the correction.&lt;/strong&gt;&lt;br&gt;
You 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.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. When multiple things match, it guesses.&lt;/strong&gt;&lt;br&gt;
Three 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.&lt;/p&gt;




&lt;h3&gt;
  
  
  What PVM does differently
&lt;/h3&gt;

&lt;p&gt;PVM (Persistent Vector Memory) replaces similarity with &lt;strong&gt;evolution&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Every memory carries a &lt;strong&gt;weight&lt;/strong&gt; that changes over time. Every memory records &lt;strong&gt;when&lt;/strong&gt; it was stored, &lt;strong&gt;when&lt;/strong&gt; it was last accessed, and &lt;strong&gt;what&lt;/strong&gt; it's connected to. The system doesn't just find things — it tracks how their importance changes.&lt;/p&gt;

&lt;p&gt;Three mechanisms make this work:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Temporal weight decay.&lt;/strong&gt;&lt;br&gt;
A 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.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Delta Rule calibration.&lt;/strong&gt;&lt;br&gt;
User 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.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fuzzy attribution.&lt;/strong&gt;&lt;br&gt;
When multiple memories match and no single one is clearly right, PVM doesn't guess. It tells you: &lt;em&gt;"I found a pattern across three memories spanning 180 days. Here's what they share."&lt;/em&gt; Then when you pick the right one, the weight updates. Next time it knows.&lt;/p&gt;




&lt;h3&gt;
  
  
  What this enables
&lt;/h3&gt;

&lt;p&gt;AI that actually gets better the more you use it.&lt;/p&gt;

&lt;p&gt;A writer who's been drafting a novel for six months — PVM remembers every character detail, every plot thread, every abandoned idea, and surfaces the &lt;em&gt;relevant&lt;/em&gt; ones without flooding the context window. The AI stops contradicting itself in Chapter 12 about a detail from Chapter 3.&lt;/p&gt;

&lt;p&gt;A 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.&lt;/p&gt;

&lt;p&gt;A 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.&lt;/p&gt;




&lt;h3&gt;
  
  
  Compared to what's out there
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Mem0&lt;/th&gt;
&lt;th&gt;Letta&lt;/th&gt;
&lt;th&gt;Pinecone/RAG&lt;/th&gt;
&lt;th&gt;PVM&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Learns from feedback&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Temporal weight decay&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fuzzy attribution&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Needs API keys&lt;/td&gt;
&lt;td&gt;2 keys&lt;/td&gt;
&lt;td&gt;1 key&lt;/td&gt;
&lt;td&gt;1+ keys&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Needs GPU&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Cloud&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;No&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Data leaves your machine&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;No&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Lines of code&lt;/td&gt;
&lt;td&gt;~10K+&lt;/td&gt;
&lt;td&gt;~10K+&lt;/td&gt;
&lt;td&gt;Varies&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;~800&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h3&gt;
  
  
  How to use it
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;pvm-memory
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pvm&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;PVMEngine&lt;/span&gt;

&lt;span class="n"&gt;engine&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;PVMEngine&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="c1"&gt;# Store a memory
&lt;/span&gt;&lt;span class="n"&gt;fp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;engine&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;store&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;User prefers dark mode in all editors&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
                   &lt;span class="n"&gt;keywords&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;preference&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;dark mode&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;editor&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;

&lt;span class="c1"&gt;# Query later — weights have evolved
&lt;/span&gt;&lt;span class="n"&gt;results&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;engine&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;What UI preferences does the user have?&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# User confirms — weight goes up
&lt;/span&gt;&lt;span class="n"&gt;engine&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;calibrate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fp&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;signal&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# User corrects — weight goes down  
&lt;/span&gt;&lt;span class="n"&gt;engine&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;calibrate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fp&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;signal&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's the entire API. Three methods.&lt;/p&gt;




&lt;h3&gt;
  
  
  The catch
&lt;/h3&gt;

&lt;p&gt;I 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.&lt;/p&gt;

&lt;p&gt;The paper explaining the architecture is on &lt;a href="https://ssrn.com/xxxx" rel="noopener noreferrer"&gt;SSRN&lt;/a&gt; and in the &lt;a href="https://github.com/rocky007cn/vector-as-memory/blob/main/paper/paper-en.md" rel="noopener noreferrer"&gt;GitHub repo&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;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 &lt;a href="mailto:rocky007cn@outlook.com"&gt;rocky007cn@outlook.com&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;




</description>
      <category>ai</category>
      <category>memory</category>
      <category>mcp</category>
      <category>llm</category>
    </item>
  </channel>
</rss>
