Skip to main content

Framework to evaluate vespa configurations and retrieval strategies

Project description

Vespa Evaluation Framework

Purpose

This project provides a lightweight evaluation framework for comparing retrieval and ranking strategies in Vespa. It helps you benchmark approaches such as BM25, dense vector search, multi-vector retrieval, and hybrid lexical + semantic retrieval on a small, reproducible dataset.

The framework can be used to:

  • compare retrieval quality across multiple strategies
  • evaluate relevance metrics such as precision, recall, nDCG, MRR, and MAP
  • generate a human-readable benchmark report
  • explore how Vespa performs relative to Elasticsearch for search and ranking workloads

Project structure

The repository contains:

  • src/ with the evaluation, indexing, embedding, and reporting logic
  • docs/ with supplementary notes on Vespa features and comparisons
  • tests/ with unit tests for the core modules
  • sample datasets in src/vespa_test_dataset.json and src/vespa_hard_test_dataset.json

How to run the evaluator

Prerequisites

  • Python 3.10+
  • a running Vespa application reachable at http://localhost:8080 by default
  • dependencies installed from the project configuration

Installation

From the project root:

pip install -e .

Execute the benchmark

For a notebook-based getting-started example, see the example notebook.

Run the evaluator from the package source directory:

cd vespa_eval_framework/src
python vespa_eval_framework.py

The script will:

  1. load the default dataset
  2. connect to Vespa
  3. index documents
  4. run the configured strategies
  5. write a benchmark report to vespa_benchmark_results.md

You can also inspect runtime logs in vespa_eval.log.

Test data examples

The framework ships with example datasets that include both documents and relevance-labeled queries. The default dataset is the harder variant, but the simpler example dataset is also available.

Example documents

The sample documents cover topics such as:

  • Vespa search and ranking
  • BM25 configuration
  • dense embeddings
  • hybrid retrieval
  • question answering and passage retrieval
  • evaluation metrics

Example queries

Example queries in the bundled data include:

  • "What is hybrid search?"
  • "How do I configure BM25 in Vespa?"
  • "semantic retrieval using embeddings"
  • "phrase queries exact match support"
  • "How do I bake sourdough bread?"

Each query contains one or more relevant document IDs, which allow the evaluation framework to compute ranking metrics.

Retrieval strategies

The framework evaluates a broad set of retrieval strategies, including:

  • BM25 on title and body
  • BM25 over title, body, and semantic fields
  • dense embedding search
  • multi-vector semantic search
  • hybrid BM25 + embedding search
  • hybrid multi-vector search
  • weighted and phrase-boosted variants
  • deeper or wider candidate-pool variants for reranking scenarios

These strategies are defined in src/strategies.py and are executed by the benchmark runner.

Generated report

After a run, the framework writes a Markdown report named vespa_benchmark_results.md.

The report includes:

  • a summary table of strategy performance
  • metric definitions for precision, recall, nDCG, MRR, and MAP
  • Mermaid-based comparison charts
  • per-strategy query results

Typical metrics included in the report are:

  • Precision@10
  • Recall@10
  • Precision@1
  • Precision@3
  • Recall@5
  • nDCG@10
  • MRR
  • MAP

Vespa vs. Elasticsearch

For a deeper comparison, see docs/vespa_vs_elasticsearch.md.

Vespa and Elasticsearch both support full-text search, but they emphasize different strengths.

Elasticsearch strengths

  • rich analyzer and token-filter pipelines
  • mature aggregation and analytics capabilities
  • strong support for custom text-analysis workflows

Vespa strengths

  • native hybrid lexical + vector retrieval
  • ranking pipelines that combine sparse and dense signals
  • built-in support for multi-stage ranking and ONNX-based reranking
  • strong fit for low-latency production recommendation and retrieval systems

Quick comparison

Capability Elasticsearch Vespa
Text analysis flexibility Excellent Good
Hybrid lexical + vector search Good Excellent
ML / ONNX ranking Limited Native
Large-scale low-latency retrieval Good Excellent
Ranking pipeline sophistication Moderate Strong

In short, Elasticsearch is often the better fit when you need highly configurable analyzers and analytics, while Vespa is often the better fit when you need advanced retrieval and ranking pipelines with semantic search and ML integration.

Notes

The framework is intentionally simple and focused on experimentation. It is a good starting point for benchmarking Vespa retrieval strategies before moving to a larger production setup.

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

vespa_eval_framework-0.1.1.tar.gz (18.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vespa_eval_framework-0.1.1-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file vespa_eval_framework-0.1.1.tar.gz.

File metadata

  • Download URL: vespa_eval_framework-0.1.1.tar.gz
  • Upload date:
  • Size: 18.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for vespa_eval_framework-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f6acaefaf94b0c9f1b97e96e9bbcf2f9811fd50dd99cd26599f0bf12d8ebb0ce
MD5 6d1257d64b930671b6c96a87ee00c6e2
BLAKE2b-256 0acb503361e1c6900cc2412efc047cfcbc9ad4406c1ad046a596cfda6e434f88

See more details on using hashes here.

File details

Details for the file vespa_eval_framework-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for vespa_eval_framework-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a96c2396432020d208ee5b7bbc5ff920afdc7f30fa0f36900ff8b9d9f9c6001d
MD5 beea909247ecdf6da330dd19b76ceed8
BLAKE2b-256 d75a93ddbc618790c4f82ee1eebf2a0c2f4bc1efcc8ecc7c40f4c80a416e773e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page