-
Notifications
You must be signed in to change notification settings - Fork 343
QA eval pipeline for retrieval #1754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jperez999
merged 19 commits into
NVIDIA:main
from
KyleZheng1284:feature/qa-harness-fullpage-pipeline
Apr 16, 2026
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
426e262
QA eval pipeline with full-page markdown and multi-tier scoring
8ccadbb
removed stale ref
c4ca836
fixing ci/cd issues
3621da0
style: black formatting for QA harness files
4827f3f
update readme
4c3e0ab
migrate eval framework to graph pipeline and also added new changes w…
d550108
add support for multi run sweep w/ support for multiple different mod…
12f9f2e
updated eval sweep to correct model name
3edeb81
add scripts for running retrieval_bench
cb3b6c2
priortize bo767 as dataset in retrieval bench in readme
864ef03
refactor scripts
0d9c8df
add agentic retrieval example
ba6b576
refactor and consolidate into retriever cli
8e5d9a8
update to support only plural + remove cli entry point for retrievalb…
ec71193
bug fixes
b43fa50
remove case
db7ede2
restored singular column names for test
15df147
clean up harness, implmentation exists in retriever
881eb64
add reference to harness readme + minor style fix
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| # QA Evaluation Sweep Configuration | ||
| # | ||
| # Usage (from repo root): | ||
| # export GEN_API_KEY="your-api-key" # for generator-b (any OpenAI-compatible provider) | ||
| # export GEN_API_BASE="https://your-endpoint/v1" | ||
| # export NVIDIA_API_KEY="nvapi-..." # for NIM models (judge, nemotron generators) | ||
| # retriever eval run --config nemo_retriever/examples/eval_sweep.yaml | ||
| # | ||
| # Secrets use ${VAR} expansion -- they are resolved from environment | ||
| # variables at load time. Never commit real keys in this file. | ||
| # | ||
| # All paths below are relative to the working directory (repo root). | ||
|
|
||
| dataset: | ||
| source: "csv:data/bo767_annotations.csv" | ||
|
|
||
| retrieval: | ||
| type: "file" | ||
| file_path: "data/eval/bo767_retrieval_fullpage.json" | ||
|
|
||
| # Define models once, reference by name in evaluations. | ||
| # Any model can serve as generator or judge. | ||
| # api_base is any OpenAI-compatible endpoint (NIM, vLLM, Ollama, etc.). | ||
| models: | ||
| nemotron-super-49b: | ||
| model: "nvidia_nim/nvidia/llama-3.3-nemotron-super-49b-v1.5" | ||
| api_key: "${NVIDIA_API_KEY}" | ||
|
|
||
| generator-b: | ||
| model: "openai/my-org/my-model" | ||
| api_base: "${GEN_API_BASE}" | ||
| api_key: "${GEN_API_KEY}" | ||
|
|
||
| nemotron-nano-30b: | ||
| model: "nvidia_nim/nvidia/nemotron-3-nano-30b-a3b" | ||
| api_key: "${NVIDIA_API_KEY}" | ||
|
|
||
| mixtral-judge: | ||
| model: "nvidia_nim/mistralai/mixtral-8x22b-instruct-v0.1" | ||
| api_key: "${NVIDIA_API_KEY}" | ||
|
|
||
| # Each evaluation picks a generator + judge by name. | ||
| # "runs" is optional (defaults to execution.runs, then 1). | ||
| evaluations: | ||
| - generator: "nemotron-nano-30b" | ||
| judge: "mixtral-judge" | ||
| runs: 1 | ||
|
|
||
| # Uncomment below to add more evaluations to the sweep. | ||
| # - generator: "generator-b" | ||
| # judge: "mixtral-judge" | ||
| # runs: 2 | ||
| # | ||
| # - generator: "nemotron-super-49b" | ||
| # judge: "mixtral-judge" | ||
| # runs: 5 | ||
|
|
||
| execution: | ||
| top_k: 5 | ||
| max_workers: 8 | ||
| # timeout: 120 # per-request timeout in seconds (default: 120) | ||
| # min_coverage: 0.8 # abort if retrieval file covers < 80% of queries (default: 0.0 = no check) | ||
|
|
||
| output: | ||
| results_dir: "data/eval" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1,000 changes: 1,000 additions & 0 deletions
1,000
nemo_retriever/src/nemo_retriever/evaluation/README.md
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2024-25, NVIDIA CORPORATION & AFFILIATES. | ||
| # All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| """QA evaluation framework for nemo_retriever. | ||
|
|
||
| Provides pluggable retrieval, generation, judging, and orchestration | ||
| components for measuring LLM answer quality given retrieved context. | ||
|
|
||
| The ``EvalOperator`` base class bridges ``graph.AbstractOperator`` into the | ||
| evaluation domain, enabling ``>>`` chaining, ``Graph.execute()``, and | ||
| executor compatibility for all evaluation operators. | ||
|
|
||
| Types, scoring, and ``EvalOperator`` are always available. | ||
| Modules that depend on ``litellm`` (generators, judges, generation, | ||
| judging, orchestrator, config) are lazy-loaded so that lightweight | ||
| consumers can use scoring without installing the ``[eval]`` extra:: | ||
|
|
||
| pip install nemo-retriever[eval] | ||
| """ | ||
|
|
||
| from nemo_retriever.evaluation.eval_operator import EvalOperator | ||
| from nemo_retriever.evaluation.scoring import score_dataframe | ||
| from nemo_retriever.evaluation.types import ( | ||
| AnswerJudge, | ||
| GenerationResult, | ||
| JudgeResult, | ||
| LLMClient, | ||
| RetrievalResult, | ||
| RetrieverStrategy, | ||
| ) | ||
|
|
||
| _LAZY_IMPORTS = { | ||
| "QAGenerationOperator": "nemo_retriever.evaluation.generation", | ||
| "JudgingOperator": "nemo_retriever.evaluation.judging", | ||
| "ScoringOperator": "nemo_retriever.evaluation.scoring_operator", | ||
| "RetrievalLoaderOperator": "nemo_retriever.evaluation.retrieval_loader", | ||
| "LiteLLMClient": "nemo_retriever.evaluation.generators", | ||
| "LLMJudge": "nemo_retriever.evaluation.judges", | ||
| "QAEvalPipeline": "nemo_retriever.evaluation.orchestrator", | ||
| "load_eval_config": "nemo_retriever.evaluation.config", | ||
| "build_eval_chain": "nemo_retriever.evaluation.config", | ||
| "build_eval_pipeline": "nemo_retriever.evaluation.config", | ||
| "run_eval_sweep": "nemo_retriever.evaluation.runner", | ||
| } | ||
|
|
||
|
|
||
| def __getattr__(name: str): | ||
| if name in _LAZY_IMPORTS: | ||
| import importlib | ||
|
|
||
| module = importlib.import_module(_LAZY_IMPORTS[name]) | ||
| return getattr(module, name) | ||
| raise AttributeError(f"module {__name__!r} has no attribute {name!r}") | ||
|
|
||
|
|
||
| __all__ = [ | ||
| "AnswerJudge", | ||
| "EvalOperator", | ||
| "GenerationResult", | ||
| "JudgeResult", | ||
| "JudgingOperator", | ||
| "LLMClient", | ||
| "LLMJudge", | ||
| "LiteLLMClient", | ||
| "QAEvalPipeline", | ||
| "QAGenerationOperator", | ||
| "RetrievalLoaderOperator", | ||
| "RetrievalResult", | ||
| "RetrieverStrategy", | ||
| "ScoringOperator", | ||
| "build_eval_chain", | ||
| "build_eval_pipeline", | ||
| "load_eval_config", | ||
| "run_eval_sweep", | ||
| "score_dataframe", | ||
| ] |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean, if we dont do pip install nemo-retriever[eval] we wont be able to use the LLM generator or judge operators? I don't think that is what we want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This concern is mainly due to the fact that we want to use llm generator or judge operators outside of the pure eval scope for now right?
I can look into refactoring that later alongside this issue (#1769) but the only need for it now seems to be in the evals