# HippoRAG

> Knowledge-graph retrieval with Personalized PageRank, for the questions vector search misses

- Category: Retrieval & Knowledge (RAG) / RAG Frameworks & Platforms
- Language: Python
- Licence: MIT
- Repository: https://github.com/OSU-NLP-Group/HippoRAG
- Website: https://arxiv.org/abs/2502.14802
- Canonical page: https://ai-tldr.dev/tools/hipporag/

## In short

HippoRAG is a retrieval framework that treats a document collection as long-term memory rather than a flat pile of chunks. Instead of retrieving by embedding similarity alone, it runs open information extraction over your documents to build a knowledge graph, then retrieves over that graph using Personalized PageRank. It sits in the RAG Frameworks & Platforms category of the Retrieval & Knowledge (RAG) tools and is open-source, written in Python and licensed MIT.

## Overview

HippoRAG is a retrieval framework that treats a document collection as long-term memory rather than a flat pile of chunks. Instead of retrieving by embedding similarity alone, it runs open information extraction over your documents to build a knowledge graph, then retrieves over that graph using Personalized PageRank. The project frames this as mirroring how human long-term memory recognises and uses connections between new and existing knowledge.

The team reports that HippoRAG 2 improves associativity — multi-hop retrieval, where the answer requires combining facts from separate documents — and sense-making, meaning the integration of large and complex contexts, without giving up performance on simpler questions. They also position it as cheaper than other graph-based approaches: comparable cost and latency to standard RAG in the online path, with significantly fewer resources needed for offline indexing than GraphRAG, RAPTOR or LightRAG.

It comes out of the OSU NLP Group and is backed by two papers: HippoRAG at NeurIPS 2024 and "From RAG to Memory: Non-Parametric Continual Learning for Large Language Models" at ICML 2025. Despite the research lineage it installs as an ordinary Python package with a small API — construct `HippoRAG`, call `index()` on your documents, call `rag_qa()` with your queries — and it works against OpenAI or any OpenAI-compatible LLM and embedding endpoints, including local servers such as vLLM.

## What it does

- Builds a knowledge graph from your documents via open information extraction, then retrieves over it with Personalized PageRank
- Targets multi-hop retrieval and sense-making over long, complex contexts rather than single-chunk lookups
- Cheaper offline indexing than other graph RAG approaches, by the project's own comparison against GraphRAG, RAPTOR and LightRAG
- Small Python API: index documents and ask questions with `index()` and `rag_qa()`, usable as a context manager
- Works with OpenAI models or any OpenAI-compatible chat and embedding endpoint, including a local vLLM server
- Index identity is pinned: persisted vectors and extraction state are bound to the endpoint, model and components that produced them, and mismatched indexes are rejected instead of silently mixed

## Getting started

HippoRAG targets Python 3.10. Install the package, set the key for whichever model endpoint you use, then index a few documents and query them.

1. Create an environment and install

   The README uses Conda or uv with Python 3.10. Optional extras add local-model support.

```bash
conda create -n hipporag python=3.10
conda activate hipporag
pip install hipporag
```

2. Or install from source with uv

   For development, a project-local virtual environment and an editable install. Add extras such as `[vllm]` or `[gritlm]` only when needed.

```bash
uv venv --python 3.10 .venv
source .venv/bin/activate
uv pip install -e .
```

3. Set your model credentials

   Point HippoRAG at OpenAI, or at any OpenAI-compatible endpoint. The GPU variable matters only when you run local models.

```bash
export OPENAI_API_KEY=<your OpenAI API key>
export CUDA_VISIBLE_DEVICES=0,1,2,3
export HF_HOME=<path to Huggingface home directory>
```

4. Index documents and ask a question

   `save_dir` is where the graph and vectors persist, so a later run can reuse the index instead of rebuilding it.

```python
from hipporag import HippoRAG

docs = ["George Rankin is a politician."]
queries = ["What is George Rankin's occupation?"]
with HippoRAG(save_dir="outputs", llm_model_name="gpt-4o-mini", embedding_model_name="text-embedding-3-small") as hipporag:
    hipporag.index(docs=docs)
    results = hipporag.rag_qa(queries=queries)
```

5. Point it at a local or self-hosted endpoint

   Pass explicit base URLs to run the LLM and the embedding model on your own servers. Endpoints must return standard `usage` data — HippoRAG fails closed rather than cache a response whose token cost it cannot account for.

```python
hipporag = HippoRAG(
    save_dir=save_dir,
    llm_model_name="your-llm",
    llm_base_url="http://localhost:8000/v1",
    embedding_model_name="your-embedding-model",
    embedding_provider="openai",
    embedding_base_url="http://localhost:8001/v1",
)
```

## When to use it

- Reach for it when your questions need facts joined across several documents and plain vector RAG keeps returning one relevant chunk and missing the rest
- Reach for it for sense-making over a large corpus — narrative or report collections where the answer depends on integrating a lot of context
- Reach for it when you want graph-based retrieval but found GraphRAG-class indexing too expensive to run repeatedly
- Reach for it to add a persistent, reusable memory layer to an assistant that keeps accumulating documents over time
