MemoRAG is a Python-based RAG framework emphasizing a memory-based data interface. It supports long-context memory, lite mode, and optional long-context LLM memory models, with installation via pip and source install options.
Collecting history — the radar snapshots this repo daily. The trend line appears after 3 days of data (1 so far).
What it is
MemoRAG is a Python framework that enhances retrieval-augmented generation by using a memory-based data interface to provide global memory across large datasets. It aims to allow memory-augmented RAG processing and supports long-context memory models, including Lite mode for easier usage. The project has a wiki-like emphasis on memory capabilities and long-context handling.
How it works
The repository describes a Memory model that builds a global memory over long input contexts. It supports memorization of contexts, saving and loading encoded KV caches, Faiss indexes, and chunked passages. It also enables memory-augmented retrieval where clues recalled from memory are used to retrieve relevant passages. It can use a separate memory model and a generation model, and can optionally use long-context LLMs as memory models via MInference to optimize context prefilling.
Getting started
Installation options shown in the README include:
pip install torch==2.3.1
conda install -c pytorch -c nvidia faiss-gpu=1.8.0
# clone this repo first
cd MemoRAG
pip install -e .
pip install memorag
Usage examples demonstrate initializing MemoRAG with memory and generation models, memorizing a context, and querying the pipeline. Lite mode examples show using MemoRAGLite with a few lines of code and a small memory footprint.
Getting started (continued)
Usage sections provide multiple code snippets for:
- Initializing MemoRAG with mem_model_name_or_path and ret_model_name_or_path, and optional cache_dir or access_token, including beacon_ratio parameter to adjust context handling.
- Loading cached weights and using memorized contexts for faster responses.
- Using long LLMs as memory models via MInference, with example mem_model_name_or_path values for Chinese and English models.
- Running summarization via task_type="summarize" and showing how to obtain a summary.
- Using APIs as generators via an Agent class, including API configurations for openai and deepseek sources.
- Memory model usage via Memory class showing memorize, save, answer, recall, and rewrite methods.
- Memory-augmented retrieval using MemoRAG to recall clues and retrieve passages with _retrieve.
Recent releases
Latest releases:
- v0.1.5 v0.1.5 (2024-09-24): add MemoRAGLite
- v0.1.4 v0.1.4 (2024-09-13): - support using long LLMs as memory models
- support Chinese
Traction
Repo has 2262 stars and 156 forks, with 23 open issues. Language is Python and license is Apache-2.0. Created 2024-09-04; last push 2025-09-11.
Behind the repo
The README references arXiv link for MemoRAG paper and HuggingFace model pages, including memoization and long-context memory models, with examples pointing to notebooks and Colab.
Caveats
License: Apache-2.0. Open issues: 23. Age: created 2024-09-04; last_push 2025-09-11. The README notes Lite mode and long-context memory model support, with examples indicating large context handling (up to 1 million tokens in global memory) and specific model tokens limits (e.g., 400K tokens default in some examples, up to 1 million with beacon_ratio adjustments).






