Cross-Modal Reasoning
Combining modalities: agents that see a chart, describe it, and answer questions about it
Overview
In the previous lessons, you learned how agents can perceive images (Lesson 02), process audio (Lesson 03), and generate visual content (Lesson 04). Each of those lessons treated a single modality in isolation -- the agent either looked at an image or listened to audio or produced a picture. But real-world tasks rarely fit neatly into one modality. A financial analyst looks at a chart, reads the axis labels, calculates percentage changes, and writes a narrative summary. A doctor reviews an X-ray, reads the patient notes, and produces a diagnosis that synthesizes both. A field engineer photographs a broken component, describes the damage, and generates a repair procedure.
Cross-modal reasoning is the ability to combine information from multiple modalities -- sight, text, structured data, and generated output -- within a single reasoning chain. Rather than processing each modality independently, the agent weaves them together, using insight from one modality to guide extraction or reasoning in another.
This lesson builds directly on the chain-of-thought reasoning techniques from Module 2. There, you learned that decomposing a problem into explicit intermediate steps improves accuracy and makes reasoning inspectable. Cross-modal reasoning applies the same principle across modality boundaries: perceive first, extract second, reason third, generate fourth. Each step externalizes intermediate results that the next step can attend to.
Grounding: Connecting What the Agent Sees to What It Knows
The foundational concept behind cross-modal reasoning is grounding -- the process of anchoring visual or auditory elements to their semantic meaning by linking information across modalities. When you look at a bar chart, grounding is what lets you connect the tallest bar to the label "Q4 Revenue" and the number "$2.3M" on the y-axis. You are linking a visual pattern (tall rectangle) to textual meaning (a specific quarter and dollar amount).
For an LLM agent, grounding is not automatic. A vision-language model can describe what it sees ("there is a tall blue bar"), but reliably extracting the precise numeric value requires the model to attend to axis labels, gridlines, and scale -- and then connect all of those pieces into a coherent interpretation. This is where chain-of-thought reasoning becomes essential.
Without grounding, the agent operates in ungrounded mode: it can describe visual patterns but cannot reliably connect them to facts. With grounding, the agent operates in grounded mode: every visual observation is anchored to a specific meaning that can be verified and reasoned about.
Key insight: Grounding is not a separate technique you bolt on. It is the natural result of applying structured, step-by-step reasoning to multi-modal inputs. When the agent explicitly describes what it sees, extracts values, and cross-checks them, grounding emerges from the process.
The Cross-Modal Pipeline
Cross-modal reasoning follows a pipeline pattern where each stage transforms the input into a more structured and actionable form. The pipeline below shows how an agent processes a chart image into a complete analytical report:
flowchart TD
IMG["📊 Input: Chart Image"] --> PERCEIVE
subgraph PERCEIVE["Stage 1: Perceive"]
P1["Identify chart type<br/>(bar, line, pie, etc.)"]
P2["Read axis labels,<br/>title, and legend"]
P3["Describe visual patterns<br/>(trends, outliers, clusters)"]
P1 --> P2 --> P3
end
PERCEIVE --> EXTRACT
subgraph EXTRACT["Stage 2: Extract"]
E1["Extract numeric values<br/>from each data point"]
E2["Structure as table<br/>(rows, columns, headers)"]
E3["Validate: do values<br/>match visual proportions?"]
E1 --> E2 --> E3
end
EXTRACT --> REASON
subgraph REASON["Stage 3: Reason"]
R1["Calculate trends<br/>(growth rates, averages)"]
R2["Identify anomalies<br/>and correlations"]
R3["Compare to context<br/>(benchmarks, history)"]
R1 --> R2 --> R3
end
REASON --> GENERATE
subgraph GENERATE["Stage 4: Generate"]
G1["Write narrative summary<br/>with key findings"]
G2["Generate comparison<br/>chart or table"]
G3["Produce final report<br/>combining text + visuals"]
G1 --> G2 --> G3
end
GENERATE --> OUTPUT["📄 Output: Analytical Report"]
style PERCEIVE fill:#ebf8ff,stroke:#3182ce,color:#1a202c
style EXTRACT fill:#e9d8fd,stroke:#805ad5,color:#1a202c
style REASON fill:#fefcbf,stroke:#d69e2e,color:#1a202c
style GENERATE fill:#c6f6d5,stroke:#38a169,color:#1a202c
style IMG fill:#fed7d7,stroke:#e53e3e,color:#1a202c
style OUTPUT fill:#c6f6d5,stroke:#38a169,color:#1a202c
Each stage in this pipeline serves a distinct purpose:
- Perceive turns raw pixels into natural language descriptions. The agent identifies what kind of chart it is looking at, reads the labels, and describes the overall shape of the data.
- Extract converts those descriptions into structured data. Instead of "the blue bar is the tallest," the agent produces
{"Q4": 2300000, "Q3": 1800000, ...}. This is the critical grounding step -- visual patterns become programmable values. - Reason applies logic and computation to the structured data. This is where the agent calculates growth rates, identifies outliers, and draws conclusions. Crucially, this step operates on the extracted numbers, not on the raw image -- the agent has crossed from the visual modality to the analytical modality.
- Generate produces the final output, which may itself be multi-modal: a written summary, a reformatted table, or even a new chart for comparison.
Visual Question Answering with Chain-of-Thought
When an agent needs to answer a specific question about a visual input, the pipeline collapses into a focused visual question answering (VQA) workflow. The sequence diagram below shows how an agent handles a user asking a question about a dashboard screenshot:
sequenceDiagram participant U as User participant A as Agent participant V as Vision Model participant R as Reasoning (CoT) U->>A: "Which region had the highest<br/>growth rate last quarter?"<br/>+ [dashboard screenshot] A->>V: Perceive: Describe this dashboard.<br/>Focus on regional data and trends. V-->>A: "Bar chart showing 4 regions.<br/>North: $1.2M→$1.5M, South: $800K→$1.1M,<br/>East: $600K→$650K, West: $900K→$950K.<br/>Title: 'Q3 vs Q4 Regional Revenue.'" A->>R: Extract + Reason (CoT):<br/>1. Parse each region's Q3→Q4 values<br/>2. Calculate growth rate per region<br/>3. Identify the highest Note over R: Step 1: North: $1.2M → $1.5M<br/>South: $800K → $1.1M<br/>East: $600K → $650K<br/>West: $900K → $950K Note over R: Step 2: Growth rates<br/>North: (1.5-1.2)/1.2 = 25.0%<br/>South: (1.1-0.8)/0.8 = 37.5%<br/>East: (0.65-0.6)/0.6 = 8.3%<br/>West: (0.95-0.9)/0.9 = 5.6% Note over R: Step 3: Highest = South at 37.5% R-->>A: South region, 37.5% growth A->>U: "The South region had the highest<br/>growth rate at 37.5%, growing from<br/>$800K to $1.1M between Q3 and Q4."
Notice the separation between perception (the Vision Model describing the chart) and reasoning (the CoT step calculating growth rates). This separation is deliberate and important. Vision models are strong at describing what they see but weak at precise arithmetic. By extracting the numbers first and then reasoning over them in a text-only chain-of-thought step, the agent plays to each modality's strengths.
This is exactly the chain-of-thought principle from Module 2 applied to a visual context: decompose the problem, externalize intermediate results, and reason step by step. The only difference is that the first step of the chain crosses a modality boundary -- from pixels to text.
Multi-Step Cross-Modal Workflows
Real-world cross-modal tasks often require multiple round trips between modalities. The agent might look at an image, extract data, realize it needs to look at a different part of the image more carefully, re-examine with a focused prompt, and then continue reasoning. This iterative pattern is what distinguishes true cross-modal reasoning from simple sequential chaining.
Consider a complex workflow where an agent analyzes a multi-page financial report:
- First pass (visual): Scan all pages and identify which ones contain charts versus tables versus text.
- Focused extraction (visual + text): For each chart, extract data points. For each table, parse rows and columns. For text sections, summarize key claims.
- Cross-reference (reasoning): Check whether the numbers in the charts match the numbers in the tables. Flag any discrepancies.
- Synthesis (generation): Write a summary that integrates findings from all sources, noting where the visual data confirms or contradicts the textual claims.
The key characteristic of this workflow is feedback between modalities. The reasoning step in phase 3 might discover that a chart shows different numbers than the accompanying table. This triggers a return to the visual modality -- the agent re-examines the chart with a more focused prompt to determine whether it misread a value or whether there is a genuine discrepancy in the document.
Building a Cross-Modal Chart Analysis Agent
Let's build a complete agent that takes a chart image, extracts data, answers questions, and generates a summary. This implementation brings together the perceive-extract-reason-generate pipeline in working code:
There are several design decisions worth highlighting in this code:
Separation of stages. Each function handles exactly one stage of the pipeline. The perceive_chart function only describes what it sees -- it does not try to calculate growth rates. The reason_about_data function only works with structured data -- it never sees the original image. This separation ensures that each stage can be tested, debugged, and improved independently.
Grounding through extraction. The extract_structured_data function is the grounding step. It converts free-text descriptions like "the Q4 bar reaches approximately $2.3 million" into {"quarter": "Q4", "revenue": 2300000}. Once the data is in structured form, the reasoning stage can perform exact arithmetic rather than relying on the vision model's approximate number reading.
Chain-of-thought in the reasoning stage. The reason_about_data function explicitly prompts for step-by-step reasoning, applying the CoT techniques from Module 2. This is critical for multi-step calculations like growth rates, where a single-step answer is prone to errors.
Validation: Closing the Loop
One of the most powerful aspects of cross-modal reasoning is the ability to validate extracted data by crossing back into the visual modality. If the agent extracts a value of $2.3M for Q4 revenue, it can re-examine the chart with a focused prompt: "Look at the Q4 bar specifically. Does it reach the $2.3M gridline?" This cross-modal validation catches extraction errors that would otherwise propagate through the entire pipeline.
This validation step transforms the pipeline from a one-way chain into a feedback loop. When validation catches an error, the agent can re-extract with a corrected prompt, improving the accuracy of the final output. This iterative refinement is a hallmark of robust cross-modal systems.
When Cross-Modal Reasoning Breaks Down
Cross-modal reasoning is powerful but not infallible. Understanding its failure modes helps you build more robust agents:
- Perception errors compound. If the vision model misreads "1.8M" as "1.3M" in the perception stage, every downstream calculation will be wrong. The validation step described above mitigates this, but does not eliminate it entirely.
- Ambiguous visuals resist grounding. Low-resolution charts, overlapping labels, and 3D effects make precise value extraction unreliable. When the agent encounters ambiguous visuals, it should express uncertainty rather than guess.
- Context limits constrain complex documents. A multi-page report with dozens of charts may exceed the model's context window when all descriptions and extracted data are combined. Prioritizing which charts to analyze deeply is itself a reasoning task.
- Hallucinated precision. The agent may report a value as "$2,347,521" when the chart only shows resolution to the nearest $100K. Training the agent to report values at the appropriate precision level is important for trustworthiness.
Practical tip: Always include confidence indicators in your cross-modal pipeline. If the perception stage is uncertain about a value ("the bar appears to be between $1.7M and $1.9M"), that uncertainty should propagate through the extraction and reasoning stages rather than being silently resolved into a false-precision number.
Summary
Cross-modal reasoning is the ability to combine information from multiple modalities within a single reasoning chain, using insights from one modality to guide extraction or reasoning in another. It is built on the concept of grounding -- anchoring visual or auditory elements to their semantic meaning by linking perception to structured data.
The cross-modal pipeline follows four stages: perceive (describe what the agent sees), extract (convert descriptions to structured data), reason (apply chain-of-thought logic to the structured data), and generate (produce a final output that may span multiple modalities). This pipeline directly applies the chain-of-thought reasoning principles from Module 2, with the added dimension of crossing modality boundaries between steps.
The key design principle is separation of perception from reasoning. Vision models excel at describing what they see but struggle with precise arithmetic. By extracting structured data as an intermediate step, the agent can apply exact computation to values that were originally encoded as pixels. Validation steps that cross back into the visual modality create feedback loops that catch extraction errors before they propagate.
In the next lesson, we will explore Multi-Modal Tool Use -- how agents interact with screens, browsers, cameras, and file systems to gather multi-modal inputs and produce multi-modal outputs in real-world environments.