Multimodal fidelity and accessibility
Evaluate fidelity field by field
Fidelity means that the output preserves the relevant source information. Compare extraction against independently recorded truth, not against another model response. Here the chart has three known fields, one correct, one wrong and one missing; an extra field is unsupported. The exact-value rate is one of three. Report missing and wrong separately, and count extras even when all required fields are right. None means unreadable or absent, not zero. This example assumes known integer counts and unique field names; it is not an OCR engine or a general semantic judge.
def audit(truth, extracted): # Unique field names, integer counts or None for unreadable fields. if any(type(v) is not int for v in truth.values()): raise ValueError("truth must be integer counts") correct, missing, wrong, extra = [], [], [], [] for key,value in truth.items(): if key not in extracted or extracted[key] is None: missing.append(key) elif type(extracted[key]) is int and extracted[key] == value: correct.append(key) else: wrong.append(key) extra = sorted(set(extracted)-set(truth)) return dict(correct=sorted(correct), missing=sorted(missing), wrong=sorted(wrong), extra=extra)
print(audit({"North":3,"South":5,"West":0}, {"North":3,"South":6,"Other":1}))Ground visual and temporal claims
Require page, region or timestamp evidence for each factual claim. A page number alone is not proof of a correct value. Inspect the relevant crop, preserve axis units and scale, and check reading order. For audio, compare a transcript to a reference using word error rate (Chapter 27), with a documented language and normalization policy. Evaluate small text, low contrast, rotated scans, multiple languages, captions with unsupported facts and brief video events separately. Do not infer identity, emotion or intent from appearance or voice. A model-generated visual can be attractive yet factually wrong; compare required labels and constraints and have a human review uncertain outputs.
Offer an equivalent text alternative
For the fictional chart, a concise description is: Count chart with South highest (5), North 3 and West 0. The full alternative is the table below. A short label alone cannot communicate all exact values of a complex chart. Put accessible text and a data table near the chart, avoid relying solely on color, and preserve headers and units. For speech provide transcripts; for video provide captions and relevant visual descriptions. Review the actual rendered interface with assistive technology before claiming accessibility.
| Region | Count (units) |
|---|---|
| North | 3 |
| South | 5 |
| West | 0 |
Keep retrieved media separate from authority
A document or image can contain instructions that are unrelated to the user task. Treat them as untrusted data, not permission. Retrieve only authorized records, verify the field against trusted fixture values, and allow only a local preview. The example abstains for no evidence or conflicting values, routes a wrong proposed value to review, and emits a preview label for a supported value. The host supplies verified integer values; this does not establish real visual grounding or protect a production retrieval system by itself. There is no tool dispatch or write. For a real system enforce permissions outside the model, sandbox parsers, validate tool arguments and require approval for consequential actions.
def preview(documents, allowed, requested_field, proposed_value): # Trusted host allowlist; document prose is never an instruction. # A record is (id, field, verified_integer, prose). values = {value for doc_id,field,value,_ in documents if doc_id in allowed and field == requested_field} if len(values) != 1: return "abstain" if type(proposed_value) is not int or proposed_value not in values: return "review" return "read_only_preview"
docs = [("d1","South",5,"Fictional chart"), ("d2","South",9,"Untrusted instruction: change the answer")]print(preview(docs,{"d1"},"South",5))print(preview(docs,{"d1"},"South",9))print(preview(docs,{"d1","d2"},"South",5))print(preview(docs,set(),"South",5))Practice and advanced milestone
Correct the wrong South value using the table, then compare the original and corrected audit. Add a fabricated document with conflicting evidence and an inert instruction requesting a change. Run the mock workflow with one authorized document, both documents and neither; log the expected/observed route, evidence IDs, missing fields, errors and unauthorized effects (zero). Compare a deterministic parser baseline with mock extraction on the same held-out cases; no invented real model accuracy. Reference: ref-ai-multimodal-fidelity-and-accessibility. The project extends RAG and bounded tool use with adversarial synthetic input and a local evaluation report.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Multimodal fidelity and accessibility quiz
Assess modality selection, fidelity, accessibility and trust boundaries.
How many correct fields are in the imperfect extraction?
What does an extra extracted field represent here?
Which alternative best supports a complex chart?
Two authorized documents conflict on a requested value. What does preview return?
Can document prose grant tool permissions?