All lessons in Vision-Language Models: Build, Evaluate, and Adapt
Define a Useful Vision-Language Task
Specify visual evidence, permitted answers, baselines, and acceptance criteria.
40 minutes · Free lesson
What you will learn
- Turn an image-language feature request into an observable task with explicit exclusions.
- Select a useful baseline and define what evidence would justify using a VLM.
- Specify the artifacts required to defend the course application.
A team asks for an assistant that can look at inspection images and explain what is happening. That request could mean finding a mark, reading a label, comparing two views, or deciding whether equipment is safe to use. These tasks need different evidence and have different failure costs. Your first job is to identify the decision the image is supposed to support.
You will build Meridian Visual Desk, a local application that answers bounded questions about original synthetic inspection cards. You will run a real pretrained image–text model and a small generative VLM, compare them with an ordinary pixel rule, and retain outputs that expose their limitations. Later lessons examine documents, charts, operational constraints, and a final evaluation. All course scenarios and numerical examples are invented unless explicitly identified as measured workbook results.
Start with the evidence and the decision
A useful task statement names the user, the supplied information, the output, and a stopping condition. “Given this inspection card, report the square's visible color or say that the image does not support an answer” is testable. “Understand the scene” does not tell you whether a plausible description is correct or useful.
Write down what the image can establish. A photograph can show an exterior mark; it may not establish the state behind a panel. A chart can show a plotted value; it may not establish how its underlying data were collected. A model's background knowledge can help interpret an object, but it cannot turn absent visual evidence into an observed fact.
Separate perception from the downstream decision. Reading a displayed temperature is perception. Deciding whether a process should stop depends on the unit, allowable range, operating context, and authority to act. The course application returns evidence for review and performs no equipment control. That boundary also makes failures easier to diagnose.
Choose the output interface before the model
For a finite label set, the application can return one label or unknown. For retrieval, it can return ranked image or page identifiers. For an explanation, it can return a short answer and references to supplied visual evidence. For a region, it must also state the coordinate convention.
These outputs have different evaluation units. A top-ranked page can be correct even if a subsequent answer is wrong. A generated sentence can have correct grammar and unsupported content. A rectangle can be inside image bounds and still point at the wrong object. Choose metrics for the actual user task, then choose a model interface that can produce the needed evidence.
| Request | Useful output | Essential check |
|---|---|---|
| Find the card matching a description | Ranked card IDs | Is a relevant card retrieved within the allowed depth? |
| Identify a visible color | One allowed color or unknown | Does it match the visible target, including difficult views? |
| Explain a chart comparison | Values, units, calculation, and page reference | Were the right series and scale read before arithmetic? |
| Locate a mark | Region and coordinate frame | Does the transformed region overlap the actual evidence? |
The workbook uses short answers because they are inspectable. It does not silently extract a color word from a paragraph. “The mark is not red” must never be accepted as red merely because a parser finds that substring. Formatting errors remain visible in the evaluation.
Demand a simpler comparison
A VLM is one candidate. If the input is a controlled diagram with a known color palette, a deterministic rule may solve much of the task at lower cost. If a document has reliable text, ordinary extraction may preserve numbers more accurately than image generation. If the task is ranking fixed descriptions, a paired encoder may avoid the cost and variability of free-form generation.
Use the same task contract for every candidate. Comparing a pixel rule on simple cards with a VLM on messy photographs would confound method and input difficulty. Comparing one candidate's first-token latency with another's full-answer latency would confound the resource measure. Retain the candidate's supported scope as well as its measured outcome.
Worked example
Decide whether an added model earns its complexity
- In an invented development set, 80 of 100 cards are easy and 20 are difficult. The existing rule answers 76 easy cards correctly and abstains on all difficult cards.
- Its whole-set exact accuracy is 76 ÷ 100 = 76%. Its answer coverage is 80%, assuming it attempted every easy card. Four of its 80 answers are wrong, so selective risk is 4 ÷ 80 = 5%.
- A VLM answers all 100 cards, with 78 correct on easy cards and 12 correct on difficult cards. Whole-set exact accuracy is 90%; coverage is 100%; selective risk is 10%.
- The model improves coverage and total correct answers but doubles the error fraction among answers. Whether that is useful depends on the cost of an incorrect claim and the review process.
- Suppose an incorrect answer costs five fictional review units and an abstention costs one. The rule costs 4 × 5 + 20 × 1 = 40 units. The model costs 10 × 5 = 50 units.
- Under that declared cost model, higher accuracy does not establish a better workflow. Investigate a selective or hybrid system and measure it separately rather than announcing a win.
The costs in this example are assumptions. Real operational costs require evidence from the actual workflow. Their purpose here is to make the tradeoff explicit before a headline score influences the decision.
Define the course's implementation boundary
The required workbook runs locally on CPU. Model libraries download public checkpoint files; images are processed locally. The supplied synthetic collection contains exact ground truth for color, simple spatial relations, and object-presence questions. This makes failures reproducible and answers checkable, while deliberately leaving a large gap to real photographs and documents.
Required completion includes executing an image-conditioned model, preserving image/model/processor identities, performing negative controls, and producing an honest evaluation. A list of model names or a saved conversation is insufficient. If your machine cannot run the model, you can complete the mathematical exercises and inspect supplied evidence, but you must label the implementation requirement as unexecuted until you run it in a suitable environment.
Optional programmes extend the application through adapter training, timestamped video evidence, or embodied interfaces. None is needed to complete the core. The small adapter exercise checks training mechanics; even a falling training loss does not prove improved application quality.
Write a brief another engineer can challenge
Your brief should name the accepted input formats and size limits, question types, answer schema, evidence references, permitted operations, unknown behavior, baseline, development split, final assessment, and resource budget. Include one example of a correct answer and one example of a successful refusal or abstention.
State what would cause you to reject the system. A budget can be violated by a slow tail even when the average looks acceptable. A task can fail on the rare class the user most cares about. Define critical slices and forbidden actions separately from aggregate accuracy. Otherwise a score can conceal the exact failure the contract was meant to prevent.
Exercise
A stakeholder asks the system to read any industrial photograph and determine whether equipment can operate. Rewrite this as a bounded first-stage task and identify three facts the image may not establish.
Check your answer
One defensible task is to transcribe a visible gauge value and unit from an approved image format, retain the gauge region, and return unknown when unreadable. It does not authorize operating decisions. Hidden internal condition, calibration history, and the permitted operating range may be absent from the image and need separate evidence.
Exercise
A candidate answers 45 of 60 cards, with 42 correct answers. Calculate exact accuracy, answer coverage, and selective risk. State why the three quantities should be reported together.
Check your answer
Exact accuracy is 42 ÷ 60 = 70%. Coverage is 45 ÷ 60 = 75%. Selective risk is 3 ÷ 45, approximately 6.67%. Reporting only answered-case accuracy would hide the 15 unanswered cases; reporting only whole-set accuracy would hide the risk among accepted answers.
Exercise
Your brief claims that the prototype can handle arbitrary documents because it passes 24 synthetic image questions. Replace the claim with an honest capability statement and a next validation step.
Check your answer
The prototype executes a bounded image-question pipeline and has measured results on 24 original synthetic cases under a specified configuration. It has not established arbitrary-document performance. The next step is an authorized document sample with source-group separation, task-specific labels, acquisition variation, and a declared acceptance rule.
Sources and further reading
An Introduction to Vision-Language Modeling distinguishes model families and training approaches. CLIP and LLaVA supply concrete examples of compatibility scoring and image-conditioned generation. The task contract and cost example here are original course material.
Summary
Start with a decision, evidence, and output contract. Compare against an appropriate simpler method and preserve unknowns as outcomes. Course completion requires an executed visual pipeline and a defensible result, including a justified rejection when the model does not meet the task.
Next action
Write the one-page Meridian task contract, then trace how source pixels and coordinates reach the model before generating your test collection.