Skip to main content

Experimaestro IR (xpmir)

A modular, reproducible Information Retrieval framework for modern neural ranking, dense/sparse retrieval, and distillation.

PyPI version Documentation Status Python 3.11+ uv Code style: ruff License: GPL-3.0


📌 Overview

experimaestro-ir (xpmir) is the Information Retrieval extension for Experimaestro. It provides a composable, type-safe library of IR primitives for designing, training, and benchmarking neural and classical retrieval pipelines.

Built on top of xpm-torch and datamaestro, xpmir bridges research experiments and distributed production pipelines:

  • Reproducible by Design: Every dataset preparation, index, training run, and evaluation metric is a declared Experimaestro task with content-based caching and dependency tracking.
  • Modern Neural IR Architectures: Native support for Cross-Encoders, Learned Sparse Retrieval (SPLADE, SEISMIC), Late-Interaction / Multi-Vector (ColBERT, PLAID), and Dense Bi-Encoders, as well as direct sentence-transformers loading, evaluation and export.
  • Advanced LETOR & Distillation: Pointwise, Pairwise (MarginMSE, RankNet), and Listwise (InfoNCE) training objectives, hard negative sampling, and teacher-student distillation.
  • Scalable Evaluation: Automated benchmarking against MS MARCO, TREC-DL, BEIR, NanoBEIR, and Robust04 using ir-measures, featuring multi-GPU distributed evaluation.

💡 Ecosystem & Projects: Explore research papers, models, and benchmarks built on top of XPMIR in the xpmir GitHub organization.


📦 Installation

xpmir supports both uv and pip.

# Core package (includes impact-index: BM25 and learned sparse retrieval)
uv add experimaestro-ir

# With Neural IR (PyTorch, Hugging Face Transformers, Sentence Transformers)
uv add "experimaestro-ir[neural]"

# With Classical Search (Anserini / Pyserini)
uv add "experimaestro-ir[anserini]"

# With fast PLAID multi-vector indexing
uv add "experimaestro-ir[fast-plaid]"

Using pip

pip install "experimaestro-ir[neural]"

Note: the Anserini backend also needs a Java runtime (11+), and FAISS is not installed by any extra: add faiss-cpu (or faiss-gpu) yourself for dense retrieval.


🧩 Core Architecture & Modules

xpmir/
├── neural/         # Neural IR architectures (CrossEncoder, ColBERT, SPLADE, BiEncoders)
├── rankers/        # Scorers, TwoStageRetriever, MonolithicRetriever, Fusion
├── letor/          # Learning-to-Rank: trainers, batchers, samplers (MarginMSE, InfoNCE)
├── index/          # Index interfaces: dense (FAISS), sparse inverted index, SEISMIC
├── evaluation.py   # Benchmark evaluation pipelines powered by ir-measures
├── interfaces/     # External integrations: Anserini, Hugging Face, SentenceTransformers
└── datasets/       # Dataset adapters for datamaestro-ir and ir-datasets
Component Capabilities
Scorers & Encoders Cross-Encoders, Dual-Encoders, ColBERT late interaction, SPLADE sparse activations, DRMM.
Samplers & Training Dynamic batching, hard negative mining (BM25, SPLADE, ColBERT negatives), pairwise/listwise distillation.
Retrievers & Indices TwoStageRetriever, BM25 (Anserini), FAISS dense index, Rust-accelerated sparse inverted index, PLAID.
Evaluation & Benchmarks Turnkey evaluation on standard collections: MS MARCO, BEIR, NanoBEIR, LoTTE, Robust04, TREC-DL via ir-measures.
Datasets & Collections Datamaestro and ir-datasets adapters, document tokenization, collection partitioning.
Experiments & Distributed Declarative pipelines, multi-GPU Lightning Fabric training, SLURM cluster scheduling.

⚡ Quickstart: Evaluating a Two-Stage Pipeline

The following minimal example sets up a complete two-stage re-ranking experiment (Lightweigh NanoBEIR FEVER dataset from Datamaestro, BM25 first-stage candidate retrieval, and cross-encoder re-ranking using MiniLM reranker loaded trough sentence-transformers):

(Its light enough so you can run it locally with uv run examples/bm25_miniLM.py)

import logging
from pathlib import Path
from datamaestro import prepare_dataset
from experimaestro import experiment

from xpmir.rankers.standard import BM25
from xpmir.index.bow import BOWSparseRetrieverIndexBuilder, BOWRetriever
from xpmir.neural.sentence_transformers import STCrossEncoder
from xpmir.rankers import TwoStageRetriever
from xpmir.evaluation import Evaluate

logging.basicConfig(level=logging.INFO)

# Define experiment plan
with experiment(Path("./experiments/demo"), "nano_fever_bm25_minilm") as xp:
    # 1. Load benchmark dataset from Datamaestro
    dataset = prepare_dataset("co.huggingface.nano-beir.fever")

    # 2. Index documents (This experimaestro Task writes de BoW index)
    index = BOWSparseRetrieverIndexBuilder.C(documents=dataset.documents).submit()

    # 3. Define First stage BM25 retriever
    first_stage = BOWRetriever.C(
        index=index,
        model=BM25.C(),
        topk=100,
    ).tag("first_stage", "bm25")

    # 4. Define neural cross-encoder re-ranker
    scorer = STCrossEncoder.C(
        model_id="microsoft/MiniLM-L12-H384-uncased"
    )

    # 4. Compose two-stage retriever: rerank top 50 with Cross-Encoder
    retriever = TwoStageRetriever.C(
        retriever=first_stage,
        scorer=scorer,
        top_k=50,
        batchsize=32,
    ).tag("model", "bm25_minilm_reranker")

    # 5. Submit evaluation task (computes nDCG@20, RR, AP via ir-measures)
    eval_task = Evaluate.C(dataset=dataset, retriever=retriever).submit()

print(f"Results written to: {eval_task.results}")
with open(eval_task.results) as f:
    metrics = f.read()
    print(f"Evaluation Metrics for \"microsoft/MiniLM-L12-H384-uncased\":\n{metrics}")

When executed, Experimaestro prepares the dataset, indexes the documents with BM25, re-ranks candidate passages with the Cross-Encoder, and computes standard IR evaluation metrics:

Evaluation Metrics for "microsoft/MiniLM-L12-H384-uncased":
P@20                      all        0.0070
nDCG@20                   all        0.0386
RR                        all        0.0239
AP                        all        0.0218
nDCG                      all        0.0869

🛠️ CLI & Experiment Management

xpmir rely on Experimaestro's command line to run declarative YAML or Python experiments:

# Validate task dependencies and launchers before running (Dry Run)
uv run experimaestro run configs/experiment.yaml --run-mode DRY_RUN

# Launch locally or submit to a SLURM cluster
uv run experimaestro run configs/experiment.yaml

To inspect running tasks, monitors, and outputs in real time:

experimaestro monitor

📖 Documentation & Resources


📑 Citation

If you use xpmir in your research, please cite:

@software{piwowarski2023xpmir,
  author = {Benjamin Piwowarski and contributors},
  title = {Experimaestro IR: A Modular Framework for Information Retrieval Research},
  url = {https://github.com/xpmir/experimaestro-ir},
  year = {2023}
}

📄 License

This project is licensed under the GNU General Public License v3.0 (GPL-3.0).

Metadata

Release files for experimaestro-ir 1.7.0

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

Source distribution (sdist)

Source distribution for experimaestro-ir 1.7.0
File Size Uploaded Provenance Actions
experimaestro_ir-1.7.0.tar.gz 152.5 kB With provenance Details for experimaestro_ir-1.7.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for experimaestro-ir 1.7.0
File Interpreter ABI Platform Actions
experimaestro_ir-1.7.0-py3-none-any.whl Python 3 none any Details for experimaestro_ir-1.7.0-py3-none-any.whl

Total release size: 345.4 kB

Release files / experimaestro_ir-1.7.0.tar.gz

Download URL experimaestro_ir-1.7.0.tar.gz
Size 152.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f5420eb91bd42ed1bb0255ec7846d8b9e29ae2baf2941473994cf3ac3e717633
BLAKE2b-256 checksum
How to use checksums
1cd7699998c2db8689751bdf57b5e56999ea64bffb20e7e71b2626b5d4cae120
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

Release files / experimaestro_ir-1.7.0-py3-none-any.whl

Download URL experimaestro_ir-1.7.0-py3-none-any.whl
Size 192.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c9ab81358a2af734a35f093f267b731d282ebbde613c2fbf474a678d041c9646
BLAKE2b-256 checksum
How to use checksums
9e0e1f58d2a5c85823c60527107d6b83cdedb225581d2ba079c030e6d0bf0ce6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

Security for experimaestro-ir 1.7.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for experimaestro_ir-1.7.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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