snap-stanford/memorilla
🦍 Memorilla: Latent Semantic Memory for LLMs
Thành tựu nổi bật
Những danh hiệu mới nhất của dự án
#1 Repository Của Tuần
#1 Repository Của Tuần
#1 Repository Của Tuần
🧠 Memorilla: Latent Semantic Memory for LLMs
A memory system that turns any document collection into just 16 query‑dependent tokens for a frozen LLM.
Memorilla is a memory system developed by Snap Stanford that reads an entire document collection—such as a user's past chats, a book, or a set of articles—and compresses it into a fixed number of query‑dependent memory tokens (default 16). These tokens are passed to a frozen LLM, allowing it to answer questions about the collection while using dramatically fewer tokens than the full context. The method is described in the paper Memorilla: Latent Semantic Memory for LLMs and outperforms existing approaches such as Mem0 and MemoRAG.
✨ Highlights
- Fixed‑size memory: Compresses any document collection into 16 memory tokens, regardless of total length.
- Query‑dependent: Memory tokens are generated per query, capturing relevant information.
- Frozen LLM: Works with off‑the‑shelf LLMs (e.g., Qwen3‑8B) without fine‑tuning.
- State‑of‑the‑art accuracy: Achieves best average performance vs Mem0 and MemoRAG; on FactKG beats using all documents (84.33% vs 80.43%) with 108× fewer tokens.
- Agent learning: Improves TextWorld game success rate from 18.6% to 24.2%.
- Efficient scaling: Handles up to 512 documents (≈128K tokens) in 0.74 s on one H100, while full‑context prompting takes 19.9 s.
- Open source: Apache‑2.0 licensed, with code for training and evaluation.
💡 Why it matters
Memorilla tackles the context‑window bottleneck by learning to extract only the semantic gist needed for each question. Unlike retrieval‑augmented generation that returns large passages, it produces a compact representation that fits into any LLM, dramatically reducing token usage and latency. This makes it viable for long‑term personalization, large document QA, and agent memory without retraining the base model.
#LLM #Memory #ContextCompression #TiniX
Similar Projects
Discover other similar projects and AI models.
The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.
Knowledge infrastructure to make your agents smarter. Search, scrape and access 550+ data providers through one API.
The best-benchmarked open-source AI memory system. And it's free.
all-MiniLM-L6-v2 This is a sentence-transformers(https://www.SBERT.net) model: It maps sentences & paragraphs to a 384 dimensional dense vector space and can be used for tasks like clustering or semantic search. Usage (Sentence-Transformers) Using t...