agent memory, in 13 pages
the fix that took one setup from 26,000 tokens per query down to 1,800
your agent reads the same 12 files every morning, reaches the same conclusions and bills you again for both
the 5 layers that stop it:
> working memory - what it sees right now, gone once the window fills
> episodic memory - a timestamped log, so the deploy that died at 3am gets explained once
> semantic memory - facts in a knowledge graph, like "this user prefers TypeScript"
> procedural memory - three approaches tried, the one that worked saved as a skill
> forgetting - what to delete before contradictions pile up
the numbers:
> Mem0 - 1,800 tokens per query instead of 26,000, with 91% lower latency
> Snowflake - one ontology layer, 20% more accuracy, 39% fewer tool calls
the forgetting engine is the layer almost nobody builds, and it decides whether the other four stay worth trusting
memory cuts what your agent reads. Jev cuts what it pays to decide, and on the decision side that took one Claude bill from $765 to $3 a month 👇
4 types of LLM caching, clearly explained.
(KV, prefix, prompt, and semantic caching)
An agent can send the same system instructions, tool definitions, and conversation history on every turn. Without reuse, the model processes that shared context again.
That initial prompt processing is called prefill. It contributes to the wait before the first token appears.
The four caches in the graphic reduce repeated work at different points in this process.
𝟭) 𝗞𝗩 𝗰𝗮𝗰𝗵𝗶𝗻𝗴 𝘀𝗮𝘃𝗲𝘀 𝘄𝗼𝗿𝗸 𝗯𝗲𝘁𝘄𝗲𝗲𝗻 𝗴𝗲𝗻𝗲𝗿𝗮𝘁𝗲𝗱 𝘁𝗼𝗸𝗲𝗻𝘀.
During generation, the model stores keys and values, the vectors attention uses to retrieve information from earlier tokens. Each new token reuses those vectors and adds its own, avoiding repeated computation at the cost of memory.
𝟮) 𝗣𝗿𝗲𝗳𝗶𝘅 𝗰𝗮𝗰𝗵𝗶𝗻𝗴 𝘀𝗮𝘃𝗲𝘀 𝘄𝗼𝗿𝗸 𝗮𝗰𝗿𝗼𝘀𝘀 𝗿𝗲𝗾𝘂𝗲𝘀𝘁𝘀.
When a request begins with an already processed sequence, the server can reuse its saved attention state and process the remaining suffix. This helps when requests share instructions, documents, or conversation history.
In vLLM, each cached block’s identifier incorporates the preceding prefix, so identical text after a changed prefix is insufficient for reuse.
𝟯) 𝗣𝗿𝗼𝗺𝗽𝘁 𝗰𝗮𝗰𝗵𝗶𝗻𝗴 𝗽𝘂𝘁𝘀 𝘁𝗵𝗲 𝗽𝗿𝗼𝘃𝗶𝗱𝗲𝗿 𝗶𝗻 𝗰𝗵𝗮𝗿𝗴𝗲.
A provider manages this prefix reuse through its API, including cache lifetimes and billing rules. Eligible repeated input receives discounted pricing, while the model still generates a fresh answer.
Put stable instructions and documents at the beginning, followed by the changing question, to preserve that reusable prefix.
𝟰) 𝗦𝗲𝗺𝗮𝗻𝘁𝗶𝗰 𝗰𝗮𝗰𝗵𝗶𝗻𝗴 𝗿𝗲𝘂𝘀𝗲𝘀 𝘁𝗵𝗲 𝗮𝗻𝘀𝘄𝗲𝗿 𝗶𝘁𝘀𝗲𝗹𝗳.
The system converts a prompt into an embedding, a numerical representation of its meaning, and searches for similar stored prompts. An accepted match returns the saved answer without calling the generation model, saving output tokens too.
This suits repeated questions with stable answers, but similarity alone cannot establish that an answer applies to the current user or situation.
These techniques can work together. A semantic cache miss can still benefit from a cached prompt prefix, then use KV caching during generation.
Prefix caching and provider prompt caching share the same underlying reuse. Semantic caching adds a different decision, whether a previous answer is still valid for this request.
That said, I also wrote a full breakdown of KV caching. The article is quoted below.
Hope you enjoyed reading.
Cheers! :)
RAG is so back!
This work shows that plain RAG over raw chat history beats complex agentic memory systems on most long-term memory benchmarks.
(bookmark it)
They tested Raw-RAG, which is just dense retrieval plus reranking over the raw conversation, feeding a reader LLM.
Across LoCoMo, LongMemEval, MEME and MemoryAgentBench, it ranks first in six of seven benchmark and model settings, ahead of the strongest agentic memory system by 0.13 to 5.53 points. Ingestion on BEAM-1M takes 0.3 hours, against 3.2 to 27 hours for systems like Mem0, MemOS and Memora.
Why does it hold up? Raw history keeps more of the evidence a question needs, including the relations and dependency paths behind an answer. Rewriting history into memory entries tends to drop those important bits.
Even with complete access to the transformed memory stores, models answer less accurately than with raw evidence.
Before adding a memory layer to your agent, at least run this baseline on your own data.
https://t.co/4Fw1at4whN
Chat with Paper: https://t.co/XJyaqjw0LE
🚀 Introducing DeepInfer, our in-house inference framework, now fully open source!
Powering DeepSeek-V4.1-Flash at scale with high throughput and low latency. We’re sharing our production stack to help the community lower compute costs, reduce energy use, and make AI more affordable.
🔗 https://t.co/JGAik1kgk0
1/4