Skip to main content
Cognee ships a self-contained evaluation framework at cognee/eval_framework/ that lets you benchmark retrieval quality on standard multi-hop QA datasets, compare different search strategies, and inspect results in an interactive HTML dashboard — all without any third-party evaluation service.
This page covers the built-in evaluation framework. For the DeepEval integration (LLM-as-a-judge scoring), see Evaluation with DeepEval.

Overview

The pipeline has four sequential stages:

Quick Start

Before you start, complete Quickstart, make sure your corpus is already processed and indexed or let the corpus builder create it from scratch, and set LLM_API_KEY.

Basic Usage

This minimal example runs the built-in evaluation pipeline and writes an HTML dashboard:
This runs all four stages in sequence and writes my_dashboard.html to the current directory.

What just happened

  • Benchmark setupEvalConfig defines which benchmark to use, how many samples to ingest, and which retrieval and evaluation engines to run.
  • Full evaluation runmain(params=config.to_dict()) executes corpus building, answer generation, evaluation, and dashboard generation in one flow.
  • Output artifacts — the run produces metrics files and an HTML dashboard you can open locally to inspect results.
Open my_dashboard.html in any browser. You will see:
  • Distribution histograms — score distributions per metric (10 bins).
  • Confidence-interval bar chart — mean score ± 95% CI for each metric.
  • Details table — per-question breakdown with generated answer, golden answer, retrieved context, score, and LLM rationale.
For containerized runs, a Dockerfile is included at cognee/eval_framework/Dockerfile.

Token Usage Analysis

The framework ships a standalone CLI utility at cognee/eval_framework/token_usage_analysis/ that estimates the token cost of Cognee persistent memory versus full-context prompting. It chunks an input text, measures the real ingestion token usage of running a few representative chunks through Cognee, and reports the break-even query count — after how many repeated queries full-context prompting has spent more tokens than Cognee’s one-time ingestion plus per-query recall. It can optionally write cumulative-cost plots. Install the eval dependencies and run the tool from its own directory:
The script loads the repo-root .env, so it must contain a working LLM_PROVIDER, LLM_MODEL, and API key. If --llm-models is omitted, the configured LLM_MODEL is used. It always writes a JSON report; --plot additionally writes the cumulative-cost figure. You must supply exactly one input form (--file, --dir, or --text). Key options:
--plot requires matplotlib, which is included in the evals extra (installed by uv sync --dev --all-extras).
For the full cost model, sample corpora, and precomputed results, see the in-repo cognee/eval_framework/token_usage_analysis/README.md and the results/chunk_4095/ and results/chunk_8191/ folders.

Code

Each stage exposes a standalone async function you can call from your own scripts:
You can restrict which instances are evaluated using INSTANCE_FILTER:
A typical workflow for comparing two retrieval strategies:
Open both HTML files side-by-side to compare F1 and exact-match scores across retrieval strategies.

Further details

All options are read from an .env file (or environment variables) via a Pydantic BaseSettings class (EvalConfig).
All metrics return a {"score": float, "reason": str} dict. Aggregate statistics include mean and a 95% confidence interval computed with 10 000 bootstrap samples.
The TASK_GETTER_TYPE variable controls how each corpus document is processed during the corpus-building stage: