Skip to content

Develop a RAG technique and test it inside a full pipeline.

Lasagna splits a retrieval-augmented generation pipeline into eight stages. You swap one component, hold the other seven fixed, and get a verdict on whether the difference is real. The same pipeline also serves your agent over MCP and REST.

Why it exists

RAG papers report one component at a time. A new reranker is measured against a baseline with no query expansion and an old chunker. If a reranker claims +4 NDCG and a query expander claims +3, you cannot tell from the papers whether stacking them gives +7, +4 or -1.

The study behind Lasagna tested 450 configurations across eight benchmarks. The three strongest single retrieval techniques were predicted to add 47% NDCG@10 together. They added 17%. Faithfulness gains did carry over. The paper study has the detail.

8swappable pipeline stages

55built-in components

31public benchmarks

0API keys for a retrieval comparison

Install

pip install lasagna-rag
python -m nltk.downloader punkt_tab

Lasagna runs on Python 3.10 to 3.13. The speed profile downloads one 92 MB model and never calls an LLM. See installation for extras and platform notes.

Your first comparison

Put a reranker in my_ideas.py:

import lasagna

@lasagna.reranker
def keyword_overlap(query, text):
    return len(set(query.lower().split()) & set(text.lower().split()))

Save a sweep as sweep.yaml. It runs your reranker against a built-in one, with everything else fixed:

name: does keyword_overlap help
benchmarks: [{name: smoke}]
tracks: [retrieval]
pipeline:
  base_profile: speed
  rerankers: [cross_encoder, "my_ideas:keyword_overlap"]
n_runs: 1

Run it, then ask whether the gap is real:

lasagna benchmark experiment sweep.yaml
lasagna results significance results.json --all

Your first comparison walks through the output, and shows the same sweep on a real benchmark.

Where to go

What it reproduces

On the full SciFact and NFCorpus test sets, the built-in dense models land within 0.002 NDCG@10 of their MTEB results. BM25 followed by a MiniLM cross-encoder lands within 0.004 of the BEIR paper. Nothing was tuned. The reproduction guide shows the table and the command.

Cite it

If you publish work that uses Lasagna, see citing Lasagna.