RAG regression testing is essential for maintaining reliable retrieval-augmented generation (RAG) applications. A RAG system may retrieve relevant documents today but fail to retrieve the same evidence after changes to chunking, embeddings, vector databases, or retrieval configurations.
These failures are difficult to identify because the application may continue generating fluent answers even when important supporting information is missing.
LongProbe is EnDevSols' open-source Python toolkit for detecting retrieval regressions before they affect production applications. It allows developers to define golden questions, measure retrieval recall, compare results against saved baselines, and integrate automated retrieval checks into development and CI/CD workflows.
Instead of relying only on manual testing, LongProbe helps teams answer an important engineering question: Did the latest application change break document retrieval?
This guide explores LongProbe's architecture, golden-question testing, retrieval quality metrics, baseline comparisons, Python integration, automated testing, and production considerations.
Why RAG Regression Testing Matters for Production AI
A typical RAG pipeline follows this sequence:
Documents → Extraction → Chunking → Embeddings → Vector Database → Retrieval → LLM → Generated Answer
Each stage can affect the quality of information retrieved by an AI assistant.
Consider a customer-support knowledge base containing a refund policy. Before an update, the system correctly retrieves the section explaining that customers have 30 days to request a refund.
After changing its chunking strategy, the retrieval system may no longer return that section within the top five results.
The application still runs, but answer quality may deteriorate because the relevant evidence is missing.
Common Causes of Retrieval Regressions
| Change | Potential problem | Impact on RAG |
|---|---|---|
| Chunking updates | Relevant information moves into different chunks | Missing context |
| Embedding changes | Document similarity rankings change | Reduced retrieval relevance |
| Vector index updates | Previously available chunks disappear | Incomplete evidence |
| Retriever configuration | Different results appear in the top-K positions | Lower recall |
| Document updates | Important information is removed or modified | Outdated or missing answers |
| Framework upgrades | Retrieval behavior changes unexpectedly | Silent regression |
These problems demonstrate why successful API responses and working vector databases do not guarantee reliable retrieval.
LongProbe addresses this problem by comparing retrieval results against known expectations and previously recorded results.
What Is LongProbe?
LongProbe is an open-source RAG regression testing framework designed to evaluate whether important document evidence remains retrievable as an application evolves.
Developers define a collection of questions and the document chunks expected to appear in their retrieval results.
LongProbe then executes those questions against a configured retriever, evaluates the retrieved evidence, and produces quality reports.
Core Features of LongProbe
- Golden questions: Define representative questions and their required evidence.
- Retrieval recall scoring: Measure how much expected evidence appears in the top-K results.
- Regression detection: Identify previously retrieved chunks that have disappeared.
- Baseline tracking: Store reference results in SQLite for future comparisons.
- Multiple matching strategies: Evaluate chunk IDs, text content, or lexical similarity.
- Pytest integration: Include retrieval checks in existing Python test suites.
- CI/CD support: Apply configurable quality gates during development and deployment.
- Retriever adapters: Connect to supported vector databases and retrieval frameworks.
- Command-line interface: Execute checks and inspect results without building a separate dashboard.
- Watch mode: Re-run tests when golden-question files change.
LongProbe is particularly useful for teams maintaining evolving knowledge bases, document intelligence applications, and production RAG assistants.
LongProbe Architecture: From Golden Questions to Regression Detection
LongProbe uses a modular testing architecture that separates test definitions, retrieval execution, scoring, and historical comparison.
Its main workflow follows this sequence:
Golden Questions → Retriever Adapter → Top-K Retrieval → Recall Scoring → Baseline Comparison → Quality Report
Each stage contributes to detecting potential retrieval failures.

1. Golden Question Definitions
Golden questions represent known retrieval requirements.
Each test identifies a user question and the document chunks or content expected to be returned.
These questions should reflect real application requirements rather than randomly selected examples.
2. Retriever Adapter
LongProbe connects to an existing retrieval system through an adapter.
The adapter queries the configured retriever and returns the matching documents.
This allows developers to evaluate retrieval behavior without replacing their existing RAG architecture.
3. Retrieval Evaluation
LongProbe evaluates the top-K retrieved results against the evidence defined in each golden question.
It records whether the expected evidence was found and calculates retrieval recall.
4. Baseline Storage
Developers can save approved retrieval results as reference baselines.
LongProbe uses SQLite-based baseline storage to support historical comparisons.
5. Regression Comparison
After changing the retrieval pipeline, developers run the same golden questions again.
LongProbe compares the new results with the selected baseline and identifies changes in retrieved evidence.
6. Quality Reporting
The evaluation produces metrics and quality results that can be inspected locally or used in automated workflows.
These results help developers investigate retrieval failures before deploying changes.
Golden Questions: The Foundation of RAG Regression Testing
A golden question is a predefined query associated with expected supporting evidence.
For example, a company knowledge base might contain employee policies, contracts, and technical documentation.
A useful golden question could be:
Question: What is the employee leave policy?
Expected evidence: The document chunk containing the official employee leave policy.
If the retrieval system returns unrelated documents or fails to retrieve the expected section, the test can detect the problem.
Defining Golden Questions in YAML
LongProbe supports YAML-based golden-question definitions.
name: "company-rag-golden-set"
version: "1.0"
questions:
- id: "q1"
question: "What is the termination clause?"
match_mode: "id"
required_chunks:
- "contracts_chunk_42"
- "contracts_chunk_43"
top_k: 5
tags:
- "contracts"
- "critical"
- id: "q2"
question: "What are the payment terms?"
match_mode: "text"
required_chunks:
- "net 30 days from invoice"
top_k: 5In this configuration:
ididentifies the test case.questiondefines the retrieval query.match_modeselects the matching strategy.required_chunksidentifies expected evidence.top_kspecifies how many ranked retrieval results are evaluated.tagshelps categorize test cases.
Golden questions should be reviewed against actual source documents to ensure their expected evidence is accurate.
Why Golden Questions Matter
Without predefined expectations, developers may know that retrieval results have changed without knowing whether the change represents an improvement or regression.
Golden questions provide repeatable test cases.
They make it possible to evaluate retrieval quality consistently across code changes, document updates, and infrastructure modifications.
Retrieval Recall and Quality Scoring in LongProbe
Retrieval recall measures how much required evidence appears among the retrieved documents.
The basic formula is:
Recall = Number of Required Evidence Items Retrieved / Total Required Evidence Items
For example, suppose a golden question requires four document chunks.
If the retriever returns three of those chunks within the evaluated top-K results:
Recall = 3 / 4 = 0.75 (75%)
This indicates that one required evidence item is missing.
Understanding Top-K Retrieval
The
top_k parameter defines the number of ranked retrieval results considered during evaluation.If
top_k is five, LongProbe evaluates the first five retrieved results rather than treating every returned document as equally relevant.This is important because RAG applications typically provide a limited amount of retrieved context to language models.
A relevant document appearing at rank 20 may not help if the application only sends the top five chunks to the model.
Three Evidence Matching Strategies
| Match mode | How it works | Suitable use case |
|---|---|---|
| ID matching | Compares exact document or chunk identifiers | Stable document indexes |
| Text matching | Checks whether expected text appears in retrieved content | Known source passages |
| Semantic matching | Uses word-frequency cosine similarity | Lexically similar text variations |
LongProbe's semantic matching is based on lexical similarity rather than neural embedding-based semantic understanding.
Therefore, semantic matches should be validated carefully when documents contain paraphrased language or terminology changes.
Baseline Comparison and Retrieval Regression Detection
A retrieval baseline represents a previously evaluated result set used as a reference.
Baselines are important because retrieval quality must be monitored over time, not just measured once.
Consider the following example:
| Golden question | Baseline recall | Current recall | Result |
|---|---|---|---|
| Refund policy | 100% | 100% | Unchanged |
| Contract terms | 100% | 50% | Regression |
| Employee policy | 75% | 100% | Improvement |
| Product documentation | 100% | 100% | Unchanged |
Illustrative results, not measured LongProbe benchmark data.
Here, the contract-related query has lost previously retrievable evidence.
LongProbe's baseline comparison helps developers identify this change instead of discovering it through incorrect production answers.

Saving a Baseline
After configuring and verifying your retrieval tests, save a reference baseline:
longprobe baseline save --label v1.0Comparing Against a Baseline
After modifying the retrieval pipeline, run:
longprobe check --baseline v1.0To inspect the differences:
longprobe diff --baseline v1.0LongProbe can identify lost and gained evidence, making regression investigations more specific than comparing overall scores alone.
Baseline promotion should use reviewed golden questions and passing quality checks. A baseline is a trusted reference, not automatically proof that every answer is correct.
Getting Started with LongProbe: Installation and CLI
LongProbe provides a Python package and command-line interface for running retrieval regression tests.
The project documentation specifies Python 3.11 or newer.
Installation
Install the published package using pip:
pip install longprobeFor optional ChromaDB support:
pip install "longprobe[chroma]"To work directly with the repository checkout:
git clone https://github.com/ENDEVSOLS/LongProbe.git
cd LongProbe
pip install -e .A source checkout can contain features that differ from the currently published package, so developers should check the appropriate version documentation.
Initialize a Project
longprobe initThe initialization command creates starter configuration files:
goldens.yaml— Golden questions and required evidence.longprobe.yaml— Retriever and scoring configuration..longprobe/— Local baseline storage directory.
The generated questions are templates. Replace them with verified examples from your own documents.
Configure a Retriever
For a ChromaDB-backed system, a configuration can look like:
retriever:
type: "chroma"
persist_directory: "./chroma_db"
collection: "my_documents"
scoring:
recall_threshold: 0.8
fail_on_regression: true
baseline:
db_path: ".longprobe/baselines.db"
auto_compare: true
quality_gate: all_questionsThe vector collection must exist and contain the documents expected by your golden questions.
Run Your First Check
longprobe check --goldens goldens.yamlFor JSON output:
longprobe check --output jsonTo inspect the current quality without historical comparison:
longprobe check --no-compareThese commands provide a practical foundation for adding automated retrieval testing to an existing RAG application.
Integrating LongProbe with Python Applications
LongProbe also provides a Python API for developers who want to execute evaluations programmatically.
The following example uses its documented ChromaDB adapter.
from longprobe import LongProbe
from longprobe.adapters import create_adapter
adapter = create_adapter(
"chroma",
collection_name="my_documents",
persist_directory="./chroma_db"
)
probe = LongProbe(
adapter=adapter,
goldens_path="goldens.yaml",
config_path="longprobe.yaml"
)
report = probe.run()
print(f"Overall Recall: {report.overall_recall:.2%}")
print(f"Pass Rate: {report.pass_rate:.2%}")The example assumes the ChromaDB collection and golden-question configuration have already been prepared.
Integration with Existing Retrievers
LongProbe supports adapter-based integration with retrieval frameworks such as LangChain and LlamaIndex.
For example, developers can wrap an existing LangChain retriever:
from longprobe import LongProbe
from longprobe.adapters import LangChainRetrieverAdapter
adapter = LangChainRetrieverAdapter(
your_langchain_retriever
)
probe = LongProbe(
adapter=adapter,
goldens_path="goldens.yaml"
)
report = probe.run()
assert report.quality["passed"], report.quality["reasons"]This approach allows retrieval evaluation to run alongside existing application components without changing the application's language model or user interface.
Automated RAG Regression Testing with Pytest and CI/CD
Retrieval evaluation becomes more valuable when it is integrated into regular development workflows.
LongProbe includes a pytest plugin and CLI output suitable for CI/CD automation.

Pytest Integration
A simple test can evaluate the configured retrieval system:
def test_retrieval_quality(longprobe_report):
assert longprobe_report.quality["passed"], (
longprobe_report.quality["reasons"]
)Run the test suite with the relevant configuration:
pytest \
--longprobe-config tests/longprobe.yaml \
--longprobe-goldens tests/goldens.yamlThis makes retrieval quality part of the application's automated testing process.
GitHub Actions Integration
LongProbe also supports GitHub Actions output:
longprobe check \
--goldens goldens.yaml \
--output githubA properly configured CI workflow can use retrieval checks to identify regressions before changes are merged or deployed.
The CI environment must have access to the configured retriever, necessary dependencies, and any required credentials.
Benefits of Automated Retrieval Testing
Automated evaluation helps development teams identify failures introduced by changes to document ingestion, chunking, embeddings, or retrieval configuration.
It also provides repeatable evidence for investigating quality changes.
However, a passing retrieval test does not guarantee that a language model will generate a factually correct answer.
Retrieval evaluation and response verification address different stages of the RAG pipeline.
LongProbe Integration with the Long Suite Ecosystem
LongProbe is part of EnDevSols' Long Suite, an open-source collection of tools for building, operating, and evaluating RAG applications.
Each project addresses a different engineering responsibility.
| Tool | Main responsibility |
|---|---|
| LongParser | Document parsing and intelligent chunking |
| LongTrainer | RAG chatbots and application orchestration |
| LongCache | Semantic caching for repeated LLM requests |
| LongGuard | Agent loop detection and runtime safeguards |
| LongTracer | Hallucination detection and answer verification |
| LongProbe | Retrieval regression testing and quality checks |
For example, an application may use LongParser to prepare documents and LongTrainer to build a retrieval-powered chatbot.
LongCache can optimize eligible repeated requests, while LongGuard can help protect tool-enabled agents from looping behavior.
LongTracer evaluates generated answers against their supporting evidence.
LongProbe focuses on whether retrieval itself continues returning the expected evidence after system changes.
These tools can be used independently or combined according to application requirements.
Best Practices for Production RAG Regression Testing
1. Build Representative Golden Question Sets
Choose questions that reflect actual user requirements.
Include important business policies, technical documentation, frequently requested information, and difficult retrieval cases.
2. Review Golden Evidence
Ensure each expected chunk is genuinely relevant to its associated question.
Incorrect golden evidence can produce misleading regression results.
3. Save Trusted Baselines
Create reference baselines only after reviewing the retrieval configuration and evaluating the quality of the results.
4. Test After Retrieval Changes
Run checks after modifying chunking strategies, embedding models, document collections, vector databases, or retrieval parameters.
5. Monitor Both Overall and Per-Question Results
An acceptable overall recall score can hide failures affecting critical questions.
Review individual failures as well as aggregate metrics.
6. Protect Sensitive Information
Avoid exposing confidential document text through shared CI logs, reports, or pull-request comments.
LongProbe includes privacy-conscious reporting behavior, but teams should still review their own logging and artifact configuration.
7. Combine Retrieval Testing with Answer Evaluation
LongProbe helps determine whether expected evidence is retrieved.
For applications requiring stronger factual reliability, complement retrieval checks with answer verification, representative evaluation datasets, and appropriate human review.
LongProbe Limitations and Production Considerations
LongProbe provides focused retrieval regression testing rather than a complete evaluation of every component in a RAG application.
Important considerations include:
- Golden-set coverage: Missing test cases can leave important retrieval failures undetected.
- Semantic matching: The documented semantic mode uses word-frequency similarity, not neural embeddings.
- Retriever compatibility: Some vector databases require application-specific or embedding-aware adapters.
- Baseline accuracy: Comparisons depend on having reviewed and compatible reference results.
- Evaluation scope: Retrieving the right evidence does not guarantee correct answer generation.
- Performance: Sub-second execution is a goal for small golden sets; actual runtime depends on retriever latency, dataset size, and infrastructure.
These limitations reinforce the importance of combining automated checks with engineering review and broader application evaluation.
Frequently Asked Questions About LongProbe
What is LongProbe?
LongProbe is an open-source Python framework for testing RAG retrieval quality using golden questions, recall scoring, and baseline comparisons.
What is RAG regression testing?
RAG regression testing checks whether changes to a retrieval system cause previously available supporting information to disappear or become harder to retrieve.
Does LongProbe require a specific vector database?
No. LongProbe uses adapters for supported retrieval systems, including ChromaDB, Pinecone, Qdrant, HTTP endpoints, LangChain, and LlamaIndex. Configuration requirements vary by adapter.
Can LongProbe detect missing document chunks?
Yes. LongProbe compares retrieved evidence against required chunks and can identify evidence lost relative to a saved baseline.
Does LongProbe support automated testing?
Yes. It provides pytest integration, command-line quality checks, and GitHub Actions-compatible output.
Can LongProbe measure retrieval recall?
Yes. It calculates retrieval recall based on expected evidence found within the evaluated top-K results.
Does LongProbe guarantee accurate AI-generated answers?
No. LongProbe evaluates retrieval behavior. Language-model answer accuracy depends on additional factors, including evidence quality, prompting, reasoning, and verification.
Is LongProbe free and open source?
Yes. LongProbe is available on GitHub under the MIT License. Developers should review the repository's installation and licensing documentation before deployment.
Get Started with LongProbe
LongProbe helps developers move beyond manual retrieval checks by introducing repeatable regression testing into the RAG development lifecycle.
With golden questions, recall scoring, baseline comparisons, Python APIs, and CI/CD integration, teams can detect missing evidence and investigate retrieval changes before those changes reach production.
For installation instructions, configuration examples, supported adapters, and development updates, explore the LongProbe GitHub repository.
Reliable RAG systems require more than finding relevant documents once. They need to keep finding the right evidence as the application evolves.
