SemanticSimilarityScorer
Computes semantic similarity between query and retrieved context using sentence embeddings. Uses cosine similarity between embeddings with fallback to text-based similarity if embedding model unavailable.
Overview
Computes semantic similarity between query and retrieved context using sentence embeddings. Uses cosine similarity between embeddings with fallback to text-based similarity if embedding model unavailable.
Use Cases
- RAG-based question answering systems
- Accuracy benchmarking and validation
How It Works
This scorer uses deterministic rule-based evaluation to validate outputs against specific criteria. It applies predefined rules and patterns to assess the response, providing consistent and reproducible results without requiring LLM inference.
Input Schema
| Parameter | Type | Required | Description |
|---|---|---|---|
| ground_truth | str | Yes | Query for similarity comparison |
| context.chunks | list[str] | Yes | Retrieved chunks |
Output Schema
| Field | Type | Description |
|---|---|---|
| similarity | float | Average semantic similarity (0-10) |
Score Interpretation
Default threshold: 7/10
Related Scorers
RetrievalRankingScorer
Computes ranking metrics for retrieved context including MRR (Mean Reciprocal Rank), NDCG, and MAP. ...
Basic RAGRetrievalF1Scorer
F1 score combining precision and recall for contextual evaluation. Computes harmonic mean of precisi...
NLP MetricsLevenshteinSimilarityScorer
Computes similarity based on Levenshtein (edit) distance between prediction and ground truth. Measur...
Basic RAGRetrievalDiversityScorer
Evaluates diversity of retrieved context chunks using cosine distance between embeddings. Higher sco...
Frequently Asked Questions
When should I use this scorer?
Use SemanticSimilarityScorer when you need to evaluate rag and accuracy aspects of your AI outputs. It's particularly useful for rag-based question answering systems.
Why doesn't this scorer need expected output?
This scorer evaluates quality aspects that don't require comparison against a reference answer. It uses the system prompt and context as the implicit ground truth.
Can I customize the threshold?
Yes, the default threshold of 7 can be customized when configuring the scorer.
Quick Info
Ready to try SemanticSimilarityScorer?
Start evaluating your AI agents with Noveum.ai's comprehensive scorer library.
Explore More Scorers
Discover 106 calibrated LLM-as-Judge scorers for comprehensive AI evaluation
