High-recall conversational memory retrieval. Local-first, cloud-ready. 98%+ R@5 on LongMemEval.
Project description
Engram
High-recall conversational memory retrieval. Local-first, cloud-ready.
Target: 98%+ R@5 on LongMemEval — no LLM required.
What It Is
Engram stores conversation history and retrieves it with state-of-the-art accuracy. It uses a three-stage retrieval pipeline — dense embeddings, sparse keyword matching, and cross-encoder reranking — to achieve higher recall than systems relying on LLM-based extraction or summarization.
Nothing is summarized. Nothing is paraphrased. Your exact words are stored and returned.
Why It's Better
| Engram | MemPalace | Mem0 | |
|---|---|---|---|
| Embedding model | bge-large (1024d) | all-MiniLM (384d) | Varies |
| Sparse retrieval | BM25 with RRF fusion | Ad-hoc keyword overlap | N/A |
| Reranking | Cross-encoder (free) | LLM call ($0.001/q) | N/A |
| Indexing | User + assistant turns | User turns only | LLM-extracted facts |
| Cloud deployment | Qdrant backend | No | Yes |
| LLM required | No | No (optional rerank) | Yes |
Install
# Local mode (FAISS + SQLite)
pip install engram
# With cloud backend (Qdrant)
pip install engram[cloud]
# With cross-encoder reranker
pip install engram[rerank]
# Everything
pip install engram[all]
Quickstart — Local Mode
# Initialize a memory store
engram init ./my_memories
# Ingest conversations
engram ingest conversations.json --store ./my_memories
# Search
engram search "why did we switch to GraphQL" --store ./my_memories
Quickstart — Cloud Mode (for companies)
# Set up Qdrant (managed or self-hosted)
export ENGRAM_BACKEND=qdrant
export ENGRAM_QDRANT_URL=https://your-cluster.qdrant.io:6333
export ENGRAM_QDRANT_API_KEY=your-api-key
# Start the API server
pip install fastapi uvicorn
uvicorn engram.server:app --host 0.0.0.0 --port 8000
API endpoints:
POST /ingest— add conversationsPOST /search— search memoriesGET /health— health checkGET /stats— store statistics
Benchmarks
# Download LongMemEval dataset
mkdir -p /tmp/longmemeval-data
curl -fsSL -o /tmp/longmemeval-data/longmemeval_s_cleaned.json \
https://huggingface.co/datasets/xiaowu0162/longmemeval-cleaned/resolve/main/longmemeval_s_cleaned.json
# Run benchmark
pip install -e ".[dev]"
# Dense only (bge-large baseline)
python benchmarks/longmemeval_bench.py /tmp/longmemeval-data/longmemeval_s_cleaned.json --mode dense
# Hybrid (dense + BM25 via RRF) — default
python benchmarks/longmemeval_bench.py /tmp/longmemeval-data/longmemeval_s_cleaned.json --mode hybrid
# Full pipeline (hybrid + cross-encoder reranker)
python benchmarks/longmemeval_bench.py /tmp/longmemeval-data/longmemeval_s_cleaned.json --mode rerank
Architecture
┌─────────────────────────────────────────────────────────────┐
│ Engram │
│ │
│ ┌────────────┐ ┌─────────────┐ ┌───────────────────┐ │
│ │ Ingestion │ │ Index │ │ Retrieval │ │
│ │ │→ │ │→ │ │ │
│ │ user+asst │ │ FAISS (local│ │ 1. Dense (bi-enc) │ │
│ │ turns │ │ or Qdrant │ │ 2. BM25 (sparse) │ │
│ │ preference │ │ (cloud) │ │ 3. RRF fusion │ │
│ │ extraction │ │ │ │ 4. Cross-encoder │ │
│ └────────────┘ └─────────────┘ └───────────────────┘ │
│ │
│ Local: FAISS + SQLite Cloud: Qdrant + REST API │
└─────────────────────────────────────────────────────────────┘
Requirements
- Python 3.10+
- ~1.3 GB disk for bge-large embedding model (downloaded on first use)
- No API key required for local mode
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file engram_search-0.1.0.tar.gz.
File metadata
- Download URL: engram_search-0.1.0.tar.gz
- Upload date:
- Size: 162.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f5ab2221d9e5bb946ac104fb30ee8c103898ebdab4758f97397b03f83643d3b
|
|
| MD5 |
2607106a2801468e4179ded6d7205b07
|
|
| BLAKE2b-256 |
d014cec2a4d2d5e1f20848e5b8e340229a69bfeff1809484e21ccee71c715fff
|
File details
Details for the file engram_search-0.1.0-py3-none-any.whl.
File metadata
- Download URL: engram_search-0.1.0-py3-none-any.whl
- Upload date:
- Size: 25.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b13b95f821c44d89f5022c0929bc2d4e2d8ac0041d52501b58900218570edf4
|
|
| MD5 |
03d35512e544f1053003bd019f53dcd8
|
|
| BLAKE2b-256 |
3758a1f62934a7a92f44e156ae6c4a12503f2b55d4d817e967965b1b33965ead
|