Add Retrieval-Conditioned Confidence Metric (RCCS) for RAG evaluation#782
Open
AIMindCrafter wants to merge 1 commit into
Open
Add Retrieval-Conditioned Confidence Metric (RCCS) for RAG evaluation#782AIMindCrafter wants to merge 1 commit into
AIMindCrafter wants to merge 1 commit into
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This pull request implements the Retrieval-Conditioned Confidence Score (RCCS) metric under
metrics/rccs/as proposed in issue #736.RCCS provides a lightweight, model-agnostic calibration diagnostic for Retrieval-Augmented Generation (RAG) pipelines. By evaluating the joint alignment between retrieval relevance ($R$ ), model confidence ($C$ ), and ground-truth correctness ($A$ ), this metric helps detect instances of "confident hallucinations" (i.e., high confidence in the output despite poor or missing retrieved context).
Key Components Implemented:
Inputs Accepted:
retrieval_score: The relevance/quality score (confidence_score: The model's generation confidence (correctness: Binary ground-truth correctness (Metrics Returned:
rccs_correlation: Pearson correlation betweenconfidence_calibration_error: Mean absolute errormean(|R * C - A|).mean_rc: Average ofn: Total sample count.Files Added
metrics/rccs/rccs.py: Core metric implementation inheriting fromevaluate.Metric.metrics/rccs/README.md: Comprehensive metric card documentation, installation instructions, and examples.metrics/rccs/requirements.txt: Dependencies list (scipy,numpy).metrics/rccs/app.py: Gradio app launcher script for the metric widget.Verification and Tests
Doctests:
Successfully passed using
pyteston the local module test suite:Output:
Manual verification:
Output:
{ 'rccs_correlation': 0.8290069500014531, 'confidence_calibration_error': 0.33000001311302185, 'mean_rc': 0.3766666650772095, 'n': 3 }