Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Explodinggradients Ragas MultiModalFaithfulness Metric

From Leeroopedia


Field Value
source Repo
domains Metrics, Multi_Modal
last_updated 2026-02-10

Overview

MultiModalFaithfulness evaluates whether a generated response is supported by both visual (image) and textual context information, returning a binary faithfulness score.

Description

The MultiModalFaithfulness class extends the concept of faithfulness to multi-modal settings. It uses an ImageTextPrompt to determine whether the response is supported by the combination of image(s) and textual retrieved contexts. The prompt asks the LLM to answer True or False based on whether any of the images and textual context support the given information. It inherits from MetricWithLLM and SingleTurnMetric.

Key attributes:

  • faithfulness_prompt -- An ImageTextPrompt instance (default MultiModalFaithfulnessPrompt) that handles both image and text inputs.

Usage

The metric requires response and retrieved_contexts columns. The sample may include image data. An LLM capable of multi-modal input must be configured.

Code Reference

Property Value
Source Location src/ragas/metrics/_multi_modal_faithfulness.py L60-104
Class Signature class MultiModalFaithfulness(MetricWithLLM, SingleTurnMetric)
Import from ragas.metrics import MultiModalFaithfulness

I/O Contract

Inputs

Parameter Type Required Description
response str Yes The generated response to evaluate
retrieved_contexts List[str] Yes The textual (and image) contexts retrieved

Outputs

Output Type Description
score float 1.0 if faithful, 0.0 if not, or NaN on failure

Usage Examples

from ragas.metrics import MultiModalFaithfulness
from ragas.dataset_schema import SingleTurnSample

metric = MultiModalFaithfulness()
# metric.llm = ...  # Set your multi-modal LLM

sample = SingleTurnSample(
    response="Apple pie is generally double-crusted.",
    retrieved_contexts=[
        "An apple pie is a fruit pie in which the principal filling ingredient is apples.",
        "It is generally double-crusted, with pastry both above and below the filling."
    ]
)
# score = await metric.single_turn_ascore(sample)

A pre-configured instance is available:

from ragas.metrics._multi_modal_faithfulness import multimodal_faithness

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment