Skip to main content

Memrank

Memrank is a tool for reproducible, auditable evaluation of memory systems.

Status: v0.4, in active development. Interfaces still move between releases.

Quick start

Paste this to your agent, and it installs memrank and runs the evaluation below for you:

Install memrank in this project and run its smoke evaluation, following
https://github.com/atomicstrata/memrank/blob/main/docs/install.md. Check the prerequisites
that page lists before you change anything, install into this project only, and do not
install anything globally or edit my shell configuration. When the run finishes, show me the
`system:` and `evaluation:` lines it printed. Stop and ask me if any step fails.

Do it yourself

uv add memrank                  # or, into a virtualenv you already have: pip install memrank
from memrank.evaluations import SQuAD
from memrank.systems import TFIDF

evaluation = SQuAD()
result = evaluation.run(system=TFIDF())

print(result)

TFIDF is keyword search weighted by how rare each word is, and it ships with the package. SQuAD supplies 32 bundled passages and 64 questions. This measures full-passage retrieval recall, not answer-span or end-to-end answer correctness. Neither needs an engine, a key or the network. Installing memrank covers uv, Python versions and upgrading.

Use cases

Each snippet below runs on its own.

Evaluate a system of your own

Four methods, and the system is ready to evaluate. A memory engine you already run has a client that ships with memrank instead -- AtomicMemory, Hindsight, Mem0 and Supermemory take a base_url= where NoteBook() goes below, and adding a system is the rest.

from memrank import Memory, Recall
from memrank.evaluations import Demo


class NoteBook(Memory):
    name, version, engine_version = "notebook", "0.1", "0.1"

    def prepare(self, isolation_unit):
        self.notes = []

    def ingest(self, documents):
        self.notes.extend(documents)

    def retrieve(self, query, k, user_id, query_timestamp=None) -> Recall:
        wanted = set(query.lower().split())
        ranked = sorted(self.notes, reverse=True,
                        key=lambda note: len(wanted & set(note.content.lower().split())))
        return Recall(documents=ranked[:k])

    def cleanup(self):
        self.notes = []


result = Demo().run(system=NoteBook())

Ask your own questions

An evaluation you write by hand and one that ships are the same object: tasks, the measures that read them, and when the system is cleared.

from memrank import Clearing, Document, Evaluation, Expected, Task, WordMatch
from memrank.systems import WordOverlap

notes = (Document(id="t1", user_id="acme",
                  content="Acme moved to the enterprise plan in March."),)

tickets = Evaluation(
    name="tickets", version="internal@2026-09",
    tasks=(Task(id="q_plan", prompt="What plan is Acme on?", group="acme", context=notes,
                expected=Expected(required_spans=("enterprise",), evidence_doc_ids=("t1",))),),
    measures=(WordMatch(),), clearing=Clearing.PER_GROUP)

result = tickets.run(system=WordOverlap())

Find out why a value is what it is

Every value names the task it came from, and every task kept its trace -- what was asked, what the evaluation wanted, what came back.

from memrank.evaluations import Demo
from memrank.systems import WordOverlap

result = Demo().run(system=WordOverlap())

lowest = min(result.values_of("word-match"), key=lambda value: value.value or 0.0)
trace = result.traces_of(lowest.task_id)[0]

print(lowest.value, lowest.why)
print(trace.task.prompt, trace.task.expected.required_spans)
for document in trace.recalled.documents:
    print(document.id, document.content)

Compare two systems

memrank.paired refuses two results of different evaluations, then reads them task by task and says how often chance alone produces a gap that size. It never says "better".

import memrank
from memrank.evaluations import Demo
from memrank.systems import NoContext, WordOverlap

evaluation = Demo()

print(memrank.paired(evaluation.run(system=WordOverlap()),
                     evaluation.run(system=NoContext())))

Check the instrument

NoContext is the floor: it retrieves nothing. FullContext is the ceiling: it is given every document, unranked. A gap between them is what makes the evaluation worth running at all, and methodology states what a value does and does not license you to say.

from memrank.evaluations import Demo
from memrank.systems import FullContext, NoContext, WordOverlap

evaluation = Demo()

for system in (NoContext(), WordOverlap(), FullContext()):
    result = evaluation.run(system=system)
    scored = [value.value for value in result.values_of("word-match")
              if value.value is not None]
    print(result.system.name, sum(scored) / len(scored))

Where to read more

Systems one page per system memrank ships, and what each one needs
Evaluations one page per evaluation, its tasks and what it measures
Reference one page per word in the Python surface
Measures what a scoring rule declares, and the ones memrank ships
Methodology the axes, the budget control, the control arms, evidence classes
Installing memrank prerequisites, install, a smoke run, upgrading
Local development working on memrank itself
SPEC.md what memrank evaluates, and the governance it commits to

Memrank ships a memrank command as well, and it is not core: nothing above needs it, and it keeps an older vocabulary of its own -- the command line is where it lives.

Governance

Memrank is maintained by AtomicStrata under a vendor-neutral charter: anyone may submit a system, results are published as measured, and methodology changes go through public proposal and comment. The commitments are in SPEC.md section 7. AtomicStrata also ships a memory engine, AtomicMemory, which this tool evaluates and which has placed below a no-memory control arm in our own runs -- which is why the floor and the ceiling above are in the package rather than in a report of ours.

Licences

Memrank's code is Apache-2.0. The bundled SQuAD subset is CC BY-SA 4.0; its notice credits the creators and passage sources and records the selection and reformatting.

Methodology questions and disagreements: open an issue. Anything else: hello@atomicstrata.ai

Release files for memrank 0.4.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for memrank 0.4.6
File Interpreter ABI Platform
memrank-0.4.6-py3-none-any.whl Python 3 none any Details

Release files / memrank-0.4.6-py3-none-any.whl

Download URL memrank-0.4.6-py3-none-any.whl
Size 670.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0547efcff5c04476853d0f85fb3e008828f074e45b9c2c950232fb1ad979fd81
BLAKE2b-256 checksum
How to use checksums
953aa818ed1f0537a430f195dda818cee066a6e8c21ca20353fcba74484b7ba8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.15

Release history Release notifications | RSS feed

0.4.7

2 release files

This release

0.4.6 This release

1 release file

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page