[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-72541":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":15,"forks30d":15,"starsTrendScore":18,"compositeScore":19,"rankGlobal":10,"rankLanguage":10,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":23,"hasPages":21,"topics":24,"createdAt":10,"pushedAt":10,"updatedAt":28,"readmeContent":29,"aiSummary":30,"trendingCount":15,"starSnapshotCount":15,"syncStatus":16,"lastSyncTime":31,"discoverSource":32},72541,"MemoRAG","qhjqhj00\u002FMemoRAG","qhjqhj00","Empowering RAG with a memory-based data interface for all-purpose applications!","",null,"Python",2244,156,22,0,2,3,6,28.59,"Apache License 2.0",false,"main",true,[25,26,27],"long-llm","memory","rag","2026-06-12 02:03:04","\n# \u003Cdiv align=\"center\">MemoRAG: Moving Towards Next-Gen RAG Via Memory-Inspired Knowledge Discovery\u003Cdiv>\n\n\u003Cdiv align=\"center\">\n\u003Cp>\u003Cstrong>Empowering RAG with a memory-based data interface for all-purpose applications!\u003C\u002Fstrong>\u003C\u002Fp>\n\u003Ca href=\"https:\u002F\u002Farxiv.org\u002Fabs\u002F2409.05591\" target=\"_blank\">\u003Cimg src=https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FarXiv-b5212f.svg?logo=arxiv>\u003C\u002Fa>\n\u003Ca href=\"https:\u002F\u002Fhuggingface.co\u002FTommyChien\u002Fmemorag-qwen2-7b-inst\" target=\"_blank\">\u003Cimg src=https:\u002F\u002Fimg.shields.io\u002Fbadge\u002F%F0%9F%A4%97%20HuggingFace%20Model-27b3b4.svg>\u003C\u002Fa>\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002F\">\u003Cimg alt=\"License\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FApache-2.0-green\">\u003C\u002Fa>\n\u003Ca>\u003Cimg alt=\"Static Badge\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fmade_with-Python-blue\">\u003C\u002Fa>\n\u003C\u002Fdiv>\n\n\u003Ch4 align=\"center\">\n\n\u003Cp>\n\u003Ca href=\"#rocket-quick-start\">Quick-Start\u003C\u002Fa> |\n\u003Ca href=\"#mag_right-roadmap\">Roadmap\u003C\u002Fa> |\n\u003Ca href=\"#notebook-usage\">Usage\u003C\u002Fa> |\n\u003Ca href=\"#memorag-demo\"> Demo\u003C\u002Fa> |\n\u003Ca href=\"#dataset\">Dataset\u003C\u002Fa> |\n\u003Ca href=\"#raised_hands-faqs\"> FAQs\u003C\u002Fa> \n\u003C\u002Fp>\n\n## Overview\n\n**MemoRAG** is an innovative RAG framework built on top of a highly efficient, super-long memory model. Unlike standard RAG, which primarily handles queries with explicit information needs, MemoRAG leverages its memory model to achieve a global understanding of the entire database. By recalling query-specific clues from memory, MemoRAG enhances evidence retrieval, resulting in more accurate and contextually rich response generation.​ The paper for MemoRAG is accepted by [theWebConf 2025](https:\u002F\u002Farxiv.org\u002Fabs\u002F2409.05591). \n\n\u003Cp align=\"center\">\n\u003Cimg src=\"asset\u002Ftech_case.jpg\">\n\u003C\u002Fp>\n\n## :page_with_curl: Changelog\n[23\u002F04\u002F25] We release the training scripts and [training dataset](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FTommyChien\u002FMemoRAG-Training) for MemoRAG. And we will continue to improve this repository in the near future.\n\n[21\u002F09\u002F24] MemoRAG introduces Lite mode, enabling memory-augmented RAG processing for millions of tokens with just a few lines of code. For more details, refer to the [`examples`](https:\u002F\u002Fgithub.com\u002Fqhjqhj00\u002FMemoRAG\u002Fblob\u002Ftommy-dev-lite\u002Fexamples\u002Fmemorag_lite.ipynb) notebook.\n\n[13\u002F09\u002F24] MemoRAG adds `Meta-Llama-3.1-8B-Instruct` and `Llama3.1-8B-Chinese-Chat` as the Memory Model, see [`examples`](https:\u002F\u002Fgithub.com\u002Fqhjqhj00\u002FMemoRAG\u002Fblob\u002Fmain\u002Fexamples\u002Flongllm_as_memory.ipynb). \n\n[10\u002F09\u002F24] We release MemoRAG's [`Technical Report`](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2409.05591).\n\n[09\u002F09\u002F24] You can try MemoRAG on [`Google Colab`](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1fPMXKyi4AwWSBkC7Xr5vBdpPpx9gDeFX?usp=sharing) for free.\n\n[05\u002F09\u002F24] A Qwen2-based memory model is available at [`TommyChien\u002Fmemorag-qwen2-7b-inst`](https:\u002F\u002Fhuggingface.co\u002FTommyChien\u002Fmemorag-qwen2-7b-inst).\n\n[03\u002F09\u002F24] A Mistral-based memory model is available at [`TommyChien\u002Fmemorag-mistral-7b-inst`](https:\u002F\u002Fhuggingface.co\u002FTommyChien\u002Fmemorag-mistral-7b-inst).\n\n[01\u002F09\u002F24] The project launched! \n\n## :sparkles: Features\n\n\n- **Global Memory**: Handles up to **1 million tokens** in a single context, providing comprehensive understanding across massive datasets.\n- **Optimizable & Flexible**: Adapts to new tasks with ease, achieving optimized performance with just a few hours of additional training.\n- **Contextual Clues**: Generates precise clues from global memory, bridging raw input to answers and unlocking **hidden insights** from complex data.\n- **Efficient Caching**: Speeds up context pre-filling by **up to 30x**, with support for caching chunking, indexing, and encoding.\n- **Context Reuse**: Encodes long contexts **once** and supports repeated usage, boosting efficiency in tasks that require recurring data access.\n\n## :mag_right: Roadmap\n**MemoRAG**  is currently under active development, with resources and prototypes continuously being published at this repository.\n- [x] Codes \u002F Models \u002F Dataset Release \n- [x] Support OpenAI\u002FAzure models\n- [x] Technical Report Release\n- [x] Support Chinese \n- [ ] Demo Codes Release\n- [ ] Training Codes for Memory model Release\n- [ ] **Speed Up Inference**\n- [ ] **Integrate Any Retrieval Methods**\n- [ ] **Enrich the Memory Ability**\n\nNote: The **recent goals** of MemoRAG are to achieve **light-weight optimization** through engineering improvements and to **enhance its memory capabilities**, enabling it to adapt to a wider range of applications and **support longer context** (e.g., more than one million tokens). \n\n\n## :rocket: Quick Start\n:free: **You can directly try MemoRAG on [`Google Colab`](https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1fPMXKyi4AwWSBkC7Xr5vBdpPpx9gDeFX?usp=sharing) for free.**\n\nIn this notebook, we run the complete MemoRAG pipeline (Memory Model + Retriever + Generation Model) on a single T4 GPU with 15GiB of memory provided by Google Colab. Despite the limited resources, MemoRAG can process half of the content from [the example book](https:\u002F\u002Fgithub.com\u002Fqhjqhj00\u002FMemoRAG\u002Fblob\u002Fmain\u002Fexamples\u002Fharry_potter.txt) (~68K tokens) and perform all of its functions.\n\n### Installation\n\nTo use Memorizer and MemoRAG, you need to have Python installed along with the required libraries. You can install the necessary dependencies using the following command:\n\n**Install Dependencies**\n```bash\npip install torch==2.3.1\nconda install -c pytorch -c nvidia faiss-gpu=1.8.0\n```\n\n**Install from source**\n\n```shell\n# clone this repo first\ncd MemoRAG\npip install -e .\n```\n\n**Install via pip**\n```\npip install memorag\n```\n\nFor **Quick Start**,\nWe provide a notebook to illustrate all functions of MemoRAG [here](https:\u002F\u002Fgithub.com\u002Fqhjqhj00\u002FMemoRAG\u002Fblob\u002Fmain\u002Fexamples\u002Fexample.ipynb).\n\n\n## :notebook: Usage\n\n### Lite Mode of MemoRAG :new: :new: :new: \nWe introduce the Lite Mode of MemoRAG, designed to offer a quick and user-friendly experience with the MemoRAG pipeline. With just a few lines of code, you can easily try MemoRAG. While we recommend starting with a GPU that has 24GiB of memory, a 16GiB GPU can also handle the pipeline under default settings in most cases.\n\n\n```python\nfrom memorag import MemoRAGLite\npipe = MemoRAGLite()\ncontext = open(\"examples\u002Fharry_potter.txt\").read()\npipe.memorize(context, save_dir=\"harry_potter\", print_stats=True)\n\nquery = \"What's the book's main theme?\"\nprint(pipe(query))\n```\nMemoRAG Lite is simple to use, supporting English or Chinese contexts of up to millions of tokens. Although it may work with other languages, performance could degrade since the default prompts are in English. For more details on MemoRAG Lite, please refer to the [`examples`](https:\u002F\u002Fgithub.com\u002Fqhjqhj00\u002FMemoRAG\u002Fblob\u002Ftommy-dev-lite\u002Fexamples\u002Fmemorag_lite.ipynb) notebook.\"\n\n\n\n### Basic Usage of MemoRAG\nMemoRAG is easy to use and can be initialized with HuggingFace models directly. By using the `MemoRAG.memorize()` method, the memory model builds a global memory over a long input context. Empirically, with default parameter settings, `TommyChien\u002Fmemorag-qwen2-7b-inst` can handle contexts of up to 400K tokens, while `TommyChien\u002Fmemorag-mistral-7b-inst` can manage contexts up to 128K tokens. By increasing the `beacon_ratio` parameter, the model’s capacity to handle longer contexts can be extended. For example, `TommyChien\u002Fmemorag-qwen2-7b-inst` can process up to one million tokens with `beacon_ratio=16`.\n\n\n```python\nfrom memorag import MemoRAG\n\n# Initialize MemoRAG pipeline\npipe = MemoRAG(\n    mem_model_name_or_path=\"TommyChien\u002Fmemorag-mistral-7b-inst\",\n    ret_model_name_or_path=\"BAAI\u002Fbge-m3\", \n    gen_model_name_or_path=\"mistralai\u002FMistral-7B-Instruct-v0.2\", # Optional: if not specify, use memery model as the generator\n    cache_dir=\"path_to_model_cache\",  # Optional: specify local model cache directory\n    access_token=\"hugging_face_access_token\",  # Optional: Hugging Face access token\n    beacon_ratio=4\n)\n\ncontext = open(\"examples\u002Fharry_potter.txt\").read()\nquery = \"How many times is the Chamber of Secrets opened in the book?\"\n\n# Memorize the context and save to cache\npipe.memorize(context, save_dir=\"cache\u002Fharry_potter\u002F\", print_stats=True)\n\n# Generate response using the memorized context\nres = pipe(context=context, query=query, task_type=\"memorag\", max_new_tokens=256)\nprint(f\"MemoRAG generated answer: \\n{res}\")\n```\n\nWhen running the above code, **the encoded key-value (KV) cache, Faiss index, and chunked passages are stored** in the specified `save_dir`. Afterward, if the same context is used again, the data can be quickly loaded from the disk:\n\n```python\npipe.load(\"cache\u002Fharry_potter\u002F\", print_stats=True)\n```\n\nTypically, loading cached weights is highly efficient. For example, **encoding, chunking, and indexing a 200K-token context takes approximately 35 seconds** using `TommyChien\u002Fmemorag-qwen2-7b-inst` as the memory model, **but only 1.5 seconds when loading from cached files.**\n\n### Using Long LLMs as Memory Model :new: :new: :new: \nRecent LLMs have become effective memory models due to their expanding context windows. MemoRAG now supports leveraging these long-context LLMs as memory models, utilizing [`MInference`](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FMInference) to optimize context prefilling. We have tested `Meta-Llama-3.1-8B-Instruct` and `Llama3.1-8B-Chinese-Chat` as memory models, both of which natively support a 128K context length. We are currently exploring additional suitable LLMs and optimizing strategies to enhance the memory mechanisms and context length further. For detailed usage instructions, please refer to the provided scripts and the [`notebook`](https:\u002F\u002Fgithub.com\u002Fqhjqhj00\u002FMemoRAG\u002Fblob\u002Fmain\u002Fexamples\u002Flongllm_as_memory.ipynb):\n\n```python\nfrom memorag import MemoRAG\nmodel = MemoRAG(\n    mem_model_name_or_path=\"shenzhi-wang\u002FLlama3.1-8B-Chinese-Chat\",    # For Chinese\n    # mem_model_name_or_path=\"meta-llama\u002FMeta-Llama-3.1-8B-Instruct\",  # For English\n    ret_model_name_or_path=\"BAAI\u002Fbge-m3\",\n    # cache_dir=\"path_to_model_cache\",  # to specify local model cache directory (optional)\n    # access_token=\"hugging_face_access_token\"  # to specify local model cache directory (optional)\n    )\n```\nAfterward, you can use MemoRAG's functions as usual. \n\n\n### Summarization Task\n\nTo perform summarization tasks, use the following script:\n\n```python\nres = pipe(context=context, task_type=\"summarize\", max_new_tokens=512)\nprint(f\"MemoRAG summary of the full book:\\n {res}\")\n```\n\n\n\n### Using APIs as Generators\n\nIf you want to use APIs as a generator, refer to the script below:\n\n```python\nfrom memorag import Agent, MemoRAG\n\n# API configuration\napi_dict = {\n    \"endpoint\": \"\",\n    \"api_version\": \"2024-02-15-preview\",\n    \"api_key\": \"\"\n}\nmodel = \"gpt-35-turbo-16k\"\nsource = \"azure\"\n\n# Initialize Agent with the API\nagent = Agent(model, source, api_dict)\nprint(agent.generate(\"hi!\"))  # Test the API\n\n# Initialize MemoRAG pipeline with a customized generator model\npipe = MemoRAG(\n    mem_model_name_or_path=\"TommyChien\u002Fmemorag-qwen2-7b-inst\",\n    ret_model_name_or_path=\"BAAI\u002Fbge-m3\",\n    cache_dir=\"path_to_model_cache\",  # Optional: specify local model cache directory\n    customized_gen_model=agent,\n)\n\n# Load previously cached context\npipe.load(\"cache\u002Fharry_potter_qwen\u002F\", print_stats=True)\n\n# Use the loaded context for question answering\nquery = \"How are the mutual relationships between the main characters?\"\ncontext = open(\"harry_potter.txt\").read()\n\nres = pipe(context=context, query=query, task_type=\"memorag\", max_new_tokens=256)\nprint(f\"MemoRAG with GPT-3.5 generated answer: \\n{res}\")\n```\n\n### Supported APIs for Generators\n\nThe built-in `Agent` object supports models from both `openai` and `deepseek`. Below are the configurations for initializing these models:\n\n```python\n# Using deepseek models\nmodel = \"\"\nsource = \"deepseek\"\napi_dict = {\n    \"base_url\": \"\",\n    \"api_key\": \"\"\n}\n\n# Using openai models\nmodel = \"\"\nsource = \"openai\"\napi_dict = {\n    \"api_key\": \"\"\n}\n```\n\n\n### Usage for Memory Model\nThe Memory model can be used independently to store, recall, and interact with the context. Here’s an example:\n\n```python\nfrom memorag import Memory\n\n# Initialize the Memory model\nmemo_model = Memory(\n    \"TommyChien\u002Fmemorag-qwen2-7b-inst\",\n    cache_dir=\"path_to_model_cache\",  # Optional: specify local model cache directory\n    beacon_ratio=4  # Adjust beacon ratio for handling longer contexts\n)\n\n# Load and memorize the context\ncontext = open(\"harry_potter.txt\").read()\nmemo_model.memorize(context)\n\n# Save the memorized context to disk\nmemo_model.save(\"cache\u002Fharry_potter\u002Fmemory.bin\")\n\n# Query the model for answers\nquery = \"How are the mutual relationships between the main characters?\"\n\nres = memo_model.answer(query)\nprint(\"Using memory to answer the query:\\n\", res)\n\n# Recall text clues for evidence retrieval\nres = memo_model.recall(query)\nprint(\"Using memory to recall text clues to support evidence retrieval:\\n\", res)\n\n# Rewrite the query into more specific surrogate queries\nres = memo_model.rewrite(query)\nprint(\"Using memory to rewrite the input query into more specific surrogate queries:\\n\", res)\n```\n\n### Usage for Memory-Augmented Retrieval\nIn addition to the standalone Memory Model, MemoRAG provides memory-augmented retrieval functionality. This allows for improved evidence retrieval based on recalled clues from memory.\n\n```python\nfrom memorag import MemoRAG\n\n# Initialize MemoRAG pipeline\npipe = MemoRAG(\n    mem_model_name_or_path=\"TommyChien\u002Fmemorag-qwen2-7b-inst\",\n    ret_model_name_or_path=\"BAAI\u002Fbge-m3\",\n    cache_dir=\"path_to_model_cache\",  # Optional: specify local model cache directory\n    access_token=\"hugging_face_access_token\"  # Optional: Hugging Face access token\n)\n\n# Load and memorize the context\ntest_txt = open(\"harry_potter.txt\").read()\npipe.memorize(test_txt, save_dir=\"cache\u002Fharry_potter\u002F\", print_stats=True)\n\n# Define the query\nquery = \"How are the mutual relationships between the main characters?\"\n\n# Recall clues from memory\nclues = pipe.mem_model.recall(query).split(\"\\n\")\nclues = [q for q in clues if len(q.split()) > 3]  # Filter out short or irrelevant clues\nprint(\"Clues generated from memory:\\n\", clues)\n\n# Retrieve relevant passages based on the recalled clues\nretrieved_passages = pipe._retrieve(clues)\nprint(\"\\n======\\n\".join(retrieved_passages[:3]))\n```\n\n### Evaluation on Benchmark\n\nBelow are experiments results for the memory model, incorporating with three generation models.\n\u003Ctable>\n    \u003Ccaption>We test MemoRAG on three benchmarks. The best results of each block are in bold.\u003C\u002Fcaption>\n    \u003Cthead>\n        \u003Ctr>\n            \u003Cth>Dataset\u003C\u002Fth>\n            \u003Cth>NarrativeQA\u003C\u002Fth>\n            \u003Cth>Qasper\u003C\u002Fth>\n            \u003Cth>MultifieldQA\u003C\u002Fth>\n            \u003Cth>Musique\u003C\u002Fth>\n            \u003Cth>2Wiki\u003C\u002Fth>\n            \u003Cth>HotpotQA\u003C\u002Fth>\n            \u003Cth>MultiNews\u003C\u002Fth>\n            \u003Cth>GovReport\u003C\u002Fth>\n            \u003Cth>En.sum\u003C\u002Fth>\n            \u003Cth>En.qa\u003C\u002Fth>\n            \u003Cth>Fin\u003C\u002Fth>\n            \u003Cth>Legal\u003C\u002Fth>\n            \u003Cth>Mix\u003C\u002Fth>\n        \u003C\u002Ftr>\n        \u003Ctr>\n            \u003Ctd>\u003C\u002Ftd>\n            \u003Ctd colspan=\"8\">\u003Cstrong>LongBench\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd colspan=\"2\">\u003Cstrong>InfBench\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd colspan=\"3\">\u003Cstrong>UltraDomain\u003C\u002Fstrong>\u003C\u002Ftd>\n        \u003C\u002Ftr>\n    \u003C\u002Fthead>\n    \u003Ctbody>\n        \u003Ctr>\n            \u003Ctd colspan=\"13\">\u003Cstrong>Generator: Llama3-8B-Instruct-8K\u003C\u002Fstrong>\u003C\u002Ftd>\n        \u003C\u002Ftr>\n        \u003Ctr>\n            \u003Ctd>Full\u003C\u002Ftd>\n            \u003Ctd>21.3\u003C\u002Ftd>\n            \u003Ctd>43.4\u003C\u002Ftd>\n            \u003Ctd>46.6\u003C\u002Ftd>\n            \u003Ctd>23.5\u003C\u002Ftd>\n            \u003Ctd>38.2\u003C\u002Ftd>\n            \u003Ctd>47.1\u003C\u002Ftd>\n            \u003Ctd>24.6\u003C\u002Ftd>\n            \u003Ctd>23.6\u003C\u002Ftd>\n            \u003Ctd>13.1\u003C\u002Ftd>\n            \u003Ctd>6.7\u003C\u002Ftd>\n            \u003Ctd>34.2\u003C\u002Ftd>\n            \u003Ctd>33.2\u003C\u002Ftd>\n            \u003Ctd>42.7\u003C\u002Ftd>\n        \u003C\u002Ftr>\n        \u003Ctr>\n            \u003Ctd>BGE-M3\u003C\u002Ftd>\n            \u003Ctd>22.1\u003C\u002Ftd>\n            \u003Ctd>44.3\u003C\u002Ftd>\n            \u003Ctd>50.2\u003C\u002Ftd>\n            \u003Ctd>22.2\u003C\u002Ftd>\n            \u003Ctd>36.7\u003C\u002Ftd>\n            \u003Ctd>48.4\u003C\u002Ftd>\n            \u003Ctd>22.1\u003C\u002Ftd>\n            \u003Ctd>20.1\u003C\u002Ftd>\n            \u003Ctd>12.1\u003C\u002Ftd>\n            \u003Ctd>15.1\u003C\u002Ftd>\n            \u003Ctd>41.4\u003C\u002Ftd>\n            \u003Ctd>40.6\u003C\u002Ftd>\n            \u003Ctd>46.4\u003C\u002Ftd>\n        \u003C\u002Ftr>\n        \u003Ctr>\n            \u003Ctd>Stella-v5\u003C\u002Ftd>\n            \u003Ctd>12.3\u003C\u002Ftd>\n            \u003Ctd>35.2\u003C\u002Ftd>\n            \u003Ctd>44.4\u003C\u002Ftd>\n            \u003Ctd>22.1\u003C\u002Ftd>\n            \u003Ctd>33.3\u003C\u002Ftd>\n            \u003Ctd>41.9\u003C\u002Ftd>\n            \u003Ctd>22.1\u003C\u002Ftd>\n            \u003Ctd>20.7\u003C\u002Ftd>\n            \u003Ctd>11.7\u003C\u002Ftd>\n            \u003Ctd>14.8\u003C\u002Ftd>\n            \u003Ctd>41.9\u003C\u002Ftd>\n            \u003Ctd>33.7\u003C\u002Ftd>\n            \u003Ctd>44.9\u003C\u002Ftd>\n        \u003C\u002Ftr>\n        \u003Ctr>\n            \u003Ctd>RQ-RAG\u003C\u002Ftd>\n            \u003Ctd>20.2\u003C\u002Ftd>\n            \u003Ctd>43.9\u003C\u002Ftd>\n            \u003Ctd>49.1\u003C\u002Ftd>\n            \u003Ctd>22.7\u003C\u002Ftd>\n            \u003Ctd>36.1\u003C\u002Ftd>\n            \u003Ctd>44.5\u003C\u002Ftd>\n            \u003Ctd>20.6\u003C\u002Ftd>\n            \u003Ctd>21.0\u003C\u002Ftd>\n            \u003Ctd>12.0\u003C\u002Ftd>\n            \u003Ctd>13.3\u003C\u002Ftd>\n            \u003Ctd>39.5\u003C\u002Ftd>\n            \u003Ctd>36.8\u003C\u002Ftd>\n            \u003Ctd>44.5\u003C\u002Ftd>\n        \u003C\u002Ftr>\n        \u003Ctr>\n            \u003Ctd>HyDE\u003C\u002Ftd>\n            \u003Ctd>22.1\u003C\u002Ftd>\n            \u003Ctd>44.3\u003C\u002Ftd>\n            \u003Ctd>50.2\u003C\u002Ftd>\n            \u003Ctd>22.2\u003C\u002Ftd>\n            \u003Ctd>36.7\u003C\u002Ftd>\n            \u003Ctd>48.4\u003C\u002Ftd>\n            \u003Ctd>-\u003C\u002Ftd>\n            \u003Ctd>-\u003C\u002Ftd>\n            \u003Ctd>-\u003C\u002Ftd>\n            \u003Ctd>\u003Cstrong>19.1\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>41.4\u003C\u002Ftd>\n            \u003Ctd>40.6\u003C\u002Ftd>\n            \u003Ctd>46.4\u003C\u002Ftd>\n        \u003C\u002Ftr>\n        \u003Ctr>\n            \u003Ctd>\u003Cstrong>MemoRAG\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>\u003Cstrong>22.8\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>\u003Cstrong>45.7\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>\u003Cstrong>50.7\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>\u003Cstrong>28.4\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>\u003Cstrong>51.4\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>\u003Cstrong>57.0\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>\u003Cstrong>27.4\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>\u003Cstrong>27.9\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>\u003Cstrong>14.1\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>16.1\u003C\u002Ftd>\n            \u003Ctd>\u003Cstrong>47.8\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>\u003Cstrong>47.9\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>\u003Cstrong>55.5\u003C\u002Fstrong>\u003C\u002Ftd>\n        \u003C\u002Ftr>\n        \u003Ctr>\n            \u003Ctd colspan=\"13\">\u003Cstrong>Generator: Phi-3-mini-128K\u003C\u002Fstrong>\u003C\u002Ftd>\n        \u003C\u002Ftr>\n        \u003Ctr>\n            \u003Ctd>Full\u003C\u002Ftd>\n            \u003Ctd>21.4\u003C\u002Ftd>\n            \u003Ctd>35.0\u003C\u002Ftd>\n            \u003Ctd>47.3\u003C\u002Ftd>\n            \u003Ctd>19.0\u003C\u002Ftd>\n            \u003Ctd>35.5\u003C\u002Ftd>\n            \u003Ctd>42.1\u003C\u002Ftd>\n            \u003Ctd>25.6\u003C\u002Ftd>\n            \u003Ctd>23.7\u003C\u002Ftd>\n            \u003Ctd>13.0\u003C\u002Ftd>\n            \u003Ctd>15.2\u003C\u002Ftd>\n            \u003Ctd>44.8\u003C\u002Ftd>\n            \u003Ctd>40.5\u003C\u002Ftd>\n            \u003Ctd>44.7\u003C\u002Ftd>\n        \u003C\u002Ftr>\n        \u003Ctr>\n            \u003Ctd>BGE-M3\u003C\u002Ftd>\n            \u003Ctd>20.3\u003C\u002Ftd>\n            \u003Ctd>33.0\u003C\u002Ftd>\n            \u003Ctd>44.3\u003C\u002Ftd>\n            \u003Ctd>21.1\u003C\u002Ftd>\n            \u003Ctd>35.4\u003C\u002Ftd>\n            \u003Ctd>42.1\u003C\u002Ftd>\n            \u003Ctd>17.7\u003C\u002Ftd>\n            \u003Ctd>19.8\u003C\u002Ftd>\n            \u003Ctd>9.6\u003C\u002Ftd>\n            \u003Ctd>16.3\u003C\u002Ftd>\n            \u003Ctd>41.7\u003C\u002Ftd>\n            \u003Ctd>41.2\u003C\u002Ftd>\n            \u003Ctd>43.7\u003C\u002Ftd>\n        \u003C\u002Ftr>\n        \u003Ctr>\n            \u003Ctd>Stella-v5\u003C\u002Ftd>\n            \u003Ctd>13.7\u003C\u002Ftd>\n            \u003Ctd>32.4\u003C\u002Ftd>\n            \u003Ctd>43.5\u003C\u002Ftd>\n            \u003Ctd>21.0\u003C\u002Ftd>\n            \u003Ctd>35.6\u003C\u002Ftd>\n            \u003Ctd>40.6\u003C\u002Ftd>\n            \u003Ctd>20.3\u003C\u002Ftd>\n            \u003Ctd>18.2\u003C\u002Ftd>\n            \u003Ctd>10.0\u003C\u002Ftd>\n            \u003Ctd>19.5\u003C\u002Ftd>\n            \u003Ctd>42.8\u003C\u002Ftd>\n            \u003Ctd>35.1\u003C\u002Ftd>\n            \u003Ctd>43.9\u003C\u002Ftd>\n        \u003C\u002Ftr>\n        \u003Ctr>\n            \u003Ctd>RQ-RAG\u003C\u002Ftd>\n            \u003Ctd>19.6\u003C\u002Ftd>\n            \u003Ctd>34.1\u003C\u002Ftd>\n            \u003Ctd>46.5\u003C\u002Ftd>\n            \u003Ctd>21.9\u003C\u002Ftd>\n            \u003Ctd>36.1\u003C\u002Ftd>\n            \u003Ctd>41.7\u003C\u002Ftd>\n            \u003Ctd>20.1\u003C\u002Ftd>\n            \u003Ctd>18.6\u003C\u002Ftd>\n            \u003Ctd>10.4\u003C\u002Ftd>\n            \u003Ctd>16.1\u003C\u002Ftd>\n            \u003Ctd>41.8\u003C\u002Ftd>\n            \u003Ctd>40.9\u003C\u002Ftd>\n            \u003Ctd>43.2\u003C\u002Ftd>\n        \u003C\u002Ftr>\n        \u003Ctr>\n            \u003Ctd>HyDE\u003C\u002Ftd>\n            \u003Ctd>18.7\u003C\u002Ftd>\n            \u003Ctd>36.0\u003C\u002Ftd>\n            \u003Ctd>47.5\u003C\u002Ftd>\n            \u003Ctd>20.5\u003C\u002Ftd>\n            \u003Ctd>36.8\u003C\u002Ftd>\n            \u003Ctd>42.7\u003C\u002Ftd>\n            \u003Ctd>-\u003C\u002Ftd>\n            \u003Ctd>-\u003C\u002Ftd>\n            \u003Ctd>-\u003C\u002Ftd>\n            \u003Ctd>19.6\u003C\u002Ftd>\n            \u003Ctd>43.1\u003C\u002Ftd>\n            \u003Ctd>41.6\u003C\u002Ftd>\n            \u003Ctd>44.2\u003C\u002Ftd>\n        \u003C\u002Ftr>\n        \u003Ctr>\n            \u003Ctd>\u003Cstrong>MemoRAG\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>\u003Cstrong>27.5\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>\u003Cstrong>43.9\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>\u003Cstrong>52.2\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>\u003Cstrong>33.9\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>\u003Cstrong>54.1\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>\u003Cstrong>54.8\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>\u003Cstrong>32.9\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>\u003Cstrong>26.3\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>\u003Cstrong>15.7\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>\u003Cstrong>22.9\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>\u003Cstrong>51.5\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>\u003Cstrong>51.0\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>\u003Cstrong>55.6\u003C\u002Fstrong>\u003C\u002Ftd>\n        \u003C\u002Ftr>\n        \u003Ctr>\n            \u003Ctd colspan=\"13\">\u003Cstrong>Generator: Mistral-7B-Instruct-v0.2-32K\u003C\u002Fstrong>\u003C\u002Ftd>\n        \u003C\u002Ftr>\n        \u003Ctr>\n            \u003Ctd>Full\u003C\u002Ftd>\n            \u003Ctd>20.8\u003C\u002Ftd>\n            \u003Ctd>29.2\u003C\u002Ftd>\n            \u003Ctd>46.3\u003C\u002Ftd>\n            \u003Ctd>18.9\u003C\u002Ftd>\n            \u003Ctd>20.6\u003C\u002Ftd>\n            \u003Ctd>37.6\u003C\u002Ftd>\n            \u003Ctd>23.0\u003C\u002Ftd>\n            \u003Ctd>20.4\u003C\u002Ftd>\n            \u003Ctd>12.4\u003C\u002Ftd>\n            \u003Ctd>12.3\u003C\u002Ftd>\n            \u003Ctd>36.5\u003C\u002Ftd>\n            \u003Ctd>35.8\u003C\u002Ftd>\n            \u003Ctd>42.1\u003C\u002Ftd>\n        \u003C\u002Ftr>\n        \u003Ctr>\n            \u003Ctd>BGE-M3\u003C\u002Ftd>\n            \u003Ctd>17.3\u003C\u002Ftd>\n            \u003Ctd>29.5\u003C\u002Ftd>\n            \u003Ctd>46.3\u003C\u002Ftd>\n            \u003Ctd>18.5\u003C\u002Ftd>\n            \u003Ctd>20.3\u003C\u002Ftd>\n            \u003Ctd>36.2\u003C\u002Ftd>\n            \u003Ctd>24.3\u003C\u002Ftd>\n            \u003Ctd>26.1\u003C\u002Ftd>\n            \u003Ctd>13.5\u003C\u002Ftd>\n            \u003Ctd>12.2\u003C\u002Ftd>\n            \u003Ctd>40.5\u003C\u002Ftd>\n            \u003Ctd>42.0\u003C\u002Ftd>\n            \u003Ctd>41.1\u003C\u002Ftd>\n        \u003C\u002Ftr>\n        \u003Ctr>\n            \u003Ctd>Stella-v5\u003C\u002Ftd>\n            \u003Ctd>13.5\u003C\u002Ftd>\n            \u003Ctd>23.7\u003C\u002Ftd>\n            \u003Ctd>42.1\u003C\u002Ftd>\n            \u003Ctd>18.6\u003C\u002Ftd>\n            \u003Ctd>22.2\u003C\u002Ftd>\n            \u003Ctd>31.9\u003C\u002Ftd>\n            \u003Ctd>21.1\u003C\u002Ftd>\n            \u003Ctd>18.5\u003C\u002Ftd>\n            \u003Ctd>13.2\u003C\u002Ftd>\n            \u003Ctd>9.7\u003C\u002Ftd>\n            \u003Ctd>40.9\u003C\u002Ftd>\n            \u003Ctd>34.9\u003C\u002Ftd>\n            \u003Ctd>42.1\u003C\u002Ftd>\n        \u003C\u002Ftr>\n        \u003Ctr>\n            \u003Ctd>RQ-RAG\u003C\u002Ftd>\n            \u003Ctd>17.1\u003C\u002Ftd>\n            \u003Ctd>29.2\u003C\u002Ftd>\n            \u003Ctd>47.0\u003C\u002Ftd>\n            \u003Ctd>19.1\u003C\u002Ftd>\n            \u003Ctd>21.5\u003C\u002Ftd>\n            \u003Ctd>37.0\u003C\u002Ftd>\n            \u003Ctd>22.1\u003C\u002Ftd>\n            \u003Ctd>18.6\u003C\u002Ftd>\n            \u003Ctd>13.1\u003C\u002Ftd>\n            \u003Ctd>12.7\u003C\u002Ftd>\n            \u003Ctd>44.3\u003C\u002Ftd>\n            \u003Ctd>44.6\u003C\u002Ftd>\n            \u003Ctd>43.4\u003C\u002Ftd>\n        \u003C\u002Ftr>\n        \u003Ctr>\n            \u003Ctd>HyDE\u003C\u002Ftd>\n            \u003Ctd>17.4\u003C\u002Ftd>\n            \u003Ctd>29.5\u003C\u002Ftd>\n            \u003Ctd>46.3\u003C\u002Ftd>\n            \u003Ctd>18.5\u003C\u002Ftd>\n            \u003Ctd>20.1\u003C\u002Ftd>\n            \u003Ctd>36.2\u003C\u002Ftd>\n            \u003Ctd>-\u003C\u002Ftd>\n            \u003Ctd>-\u003C\u002Ftd>\n            \u003Ctd>-\u003C\u002Ftd>\n            \u003Ctd>12.2\u003C\u002Ftd>\n            \u003Ctd>42.8\u003C\u002Ftd>\n            \u003Ctd>35.1\u003C\u002Ftd>\n            \u003Ctd>43.9\u003C\u002Ftd>\n        \u003C\u002Ftr>\n        \u003Ctr>\n            \u003Ctd>\u003Cstrong>MemoRAG\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>\u003Cstrong>23.1\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>31.2\u003C\u002Ftd>\n            \u003Ctd>\u003Cstrong>50.0\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>26.9\u003C\u002Ftd>\n            \u003Ctd>30.3\u003C\u002Ftd>\n            \u003Ctd>42.9\u003C\u002Ftd>\n            \u003Ctd>\u003Cstrong>27.1\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>\u003Cstrong>31.6\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>\u003Cstrong>17.9\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>15.4\u003C\u002Ftd>\n            \u003Ctd>48.0\u003C\u002Ftd>\n            \u003Ctd>51.2\u003C\u002Ftd>\n            \u003Ctd>\u003Cstrong>53.6\u003C\u002Fstrong>\u003C\u002Ftd>\n        \u003C\u002Ftr>\n        \u003Ctr>\n            \u003Ctd>\u003Cstrong>MemoRAG-qwen2\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>22.2\u003C\u002Ftd>\n            \u003Ctd>\u003Cstrong>32.7\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>49.6\u003C\u002Ftd>\n            \u003Ctd>\u003Cstrong>31.4\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>\u003Cstrong>33.7\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>\u003Cstrong>44.4\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>27.0\u003C\u002Ftd>\n            \u003Ctd>31.5\u003C\u002Ftd>\n            \u003Ctd>16.8\u003C\u002Ftd>\n            \u003Ctd>\u003Cstrong>17.6\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>\u003Cstrong>48.7\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>\u003Cstrong>52.3\u003C\u002Fstrong>\u003C\u002Ftd>\n            \u003Ctd>48.6\u003C\u002Ftd>\n        \u003C\u002Ftr>\n    \u003C\u002Ftbody>\n\u003C\u002Ftable>\n\n\n\n### Evaluation\n\nTo evaluate MemoRAG, use the following script:\n\n```bash\ncd examples\nbash longbench\u002Feval.sh\n```\nWe will update other evaluation scripts soon.\n\n### Dataset\n\nUltraDomain Benchmark: [this repo](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FTommyChien\u002FUltraDomain).\n\nOther Evaluation Data: [this repo](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002FTommyChien\u002FMemoRAG-data\u002F).\n\n## MemoRAG Demo\n\n\n\u003Cdiv style=\"display: flex; justify-content: space-around;\">\n  \u003Cdiv style=\"text-align: center;\">\n    \u003Cimg src=\".\u002Fasset\u002Fdemo.gif\" style=\"width: 100%;\">\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\n\n## :raised_hands: FAQs\n\n## :bookmark: License\n\nMemoRAG is licensed under the [\u003Cu>Apache 2.0 License\u003C\u002Fu>](.\u002FLICENSE).\n\n## Citation\n\nIf you use MemoRAG in your research, please cite our paper:\n\n```bibtex\n@inproceedings{qian2025memorag,\n  title     = {MemoRAG: Boosting Long Context Processing with Global Memory-Enhanced Retrieval Augmentation},\n  author    = {Hongjin Qian and Zheng Liu and Peitian Zhang and Kelong Mao and Defu Lian and Zhicheng Dou and Tiejun Huang},\n  booktitle = {Proceedings of the ACM Web Conference 2025 (TheWebConf 2025)},\n  year      = {2025},\n  address   = {Sydney, Australia},\n  publisher = {ACM},\n  url       = {https:\u002F\u002Farxiv.org\u002Fabs\u002F2409.05591},\n}\n```\n\n\n\n\n","MemoRAG 是一个基于记忆模型的数据接口增强的RAG框架，旨在为各种应用场景提供支持。其核心功能包括通过高效的记忆模型实现对整个数据库的全局理解，并通过从记忆中召回查询特定线索来提高证据检索的准确性与响应生成的质量。技术特点上，MemoRAG 支持处理高达1百万个token的数据量，同时引入了Lite模式以简化数百万token级别的RAG处理流程。此外，它还集成了多种预训练语言模型作为记忆模型选项。该项目非常适合需要高效、准确且上下文丰富的信息检索和生成的应用场景，如知识管理系统、智能客服等。","2026-06-11 03:42:29","high_star"]