Skip to main content

Vision Metrics

The Vision metrics evaluate how accurately a Vision Language Model (VLM) describes scenes compared to human-annotated ground truth. They use a pluggable SimilarityScorer to compare free-text descriptions — no structured output required. The default scorer uses cosine similarity between sentence embeddings (all-mpnet-base-v2). Two metrics are available:

Installation

Basic Usage

Parameters

Threshold Guide

VisionSimilarity uses the threshold only for the VisionHallucination metric’s flag logic. In VisionSimilarity, the threshold parameter is stored but does not affect the similarity scores — every frame is scored regardless.

Data Requirements

Each Batch only needs two text fields:
  • assistant — free-text description produced by the VLM
  • ground_truth_assistant — human-annotated description of what actually happened
All other Batch fields (agentic, ground_truth_agentic, etc.) are ignored.
Each Dataset represents one camera session. Multiple sessions (e.g. different cameras) are returned as separate items in the list — each produces its own metric result.

Output Schema

VisionSimilarityMetric

VisionHallucinationMetric

display()

Both metric types expose a display() method for quick inspection:

Interpretation

VisionSimilarity Scores

VisionHallucination Rate

Best Practices

Use a meaningful qa_id such as "2026-03-17T14:00:00Z" or "cam1_frame_0042" so results are traceable back to the original footage.
Security surveillance descriptions tend to be terse and factual — a threshold of 0.75 works well. For rich narrative descriptions (e.g. accessibility assistance), consider lowering to 0.65 to allow more paraphrasing.
VisionSimilarity tells you the average quality across all frames. VisionHallucination tells you which specific frames are problematic. Run both to get a complete picture.
Each Dataset maps to one session result. Use session_id to identify individual cameras, shifts, or recording periods and compare performance across them.

Troubleshooting

The default model (all-mpnet-base-v2) is sensitive to domain-specific vocabulary. If your VLM uses technical terms not well represented in the model, pass a custom scorer with a domain-adapted embedder:
Your threshold may be too strict for the description style. Print the raw similarity scores from VisionSimilarity first to calibrate before running VisionHallucination.
all-mpnet-base-v2 (~420 MB) is downloaded from HuggingFace on the first run and cached locally. Subsequent runs use the cache.

Next Steps

Agentic Metric

Evaluate tool use and multi-step reasoning in AI agents

Context Metric

Measure how well responses align with a given context

AWS Lambda

Deploy Vision metrics as a serverless function