Hello! In our last session, you successfully implemented and trained your multimodal fusion model, a crucial step in integrating the different data streams of your project. You've now built separate experts for images and text, and a manager that listens to both.
Today, we address the all-important question: was it worth the effort? This lesson focuses on the final step of this module: to compare the multimodal model's performance against the single-modality baselines to quantify the benefit of fusion. We will move from simply building models to rigorously evaluating them and justifying your architectural choices. This process of quantitative comparison is fundamental to data science and will form a core part of your final project report.
The "Moment of Truth": Why We Compare
Adding complexity to a machine learning system, such as moving from a unimodal to a multimodal architecture, is not a guaranteed path to better performance. It increases computational cost, training time, and engineering effort. Therefore, we must empirically prove that our more complex fusion model provides a tangible benefit, a concept often called "fusion-lift." The goal is to demonstrate synergy, where the combined model is more powerful than the sum of its parts.
This is because different modalities often provide complementary information. A text complaint might be vague, but the associated image might clearly show a violation. Conversely, an image might be ambiguous, but the text provides critical context. A multimodal model learns to leverage these complementary strengths.
Multimodal Deep Multipage Document Classification using both Image and Text
This article's introduction provides an excellent rationale for why multimodal approaches are powerful.
Read the section titled "Why Use Both Text and Image for Document Classification?". The author explains how combining modalities can improve accuracy and robustness, especially when one data source is incomplete or of poor quality—a situation you will likely face with user-submitted meal photos and complaints.
The Evaluation Protocol: A Fair Competition
To ensure a fair and scientific comparison, we must follow a strict evaluation protocol. The principles are simple: a level playing field and consistent scoring.
- Unified Test Set: All three of your models—the image-only CNN, the text-only BERT, and the new fusion model—must be evaluated on the exact same, unseen test dataset. This ensures that any performance difference is due to the models themselves, not variations in the data.
- Consistent Metrics: We will use the same evaluation metrics you've applied before: Precision, Recall, and F1-score. These metrics give a balanced view of a model's performance, which is especially important if your classes (e.g., 'No Violation', 'Minor Violation', 'Major Violation') are imbalanced.
The workflow to generate these comparative results is as follows:
- For each of the three models, load its trained weights.
- Set the model to evaluation mode using
model.eval(). This deactivates layers likeDropoutthat are only used during training. - In a
torch.no_grad()context to save memory and computation, loop through the test data loader. - For each batch, generate predictions.
- Collect all predictions and true labels for the entire test set.
- Use a library like
scikit-learnto compute the final metrics.
You can create a reusable evaluation function in Python that takes a model and a data loader as input and returns a dictionary of metrics.
Quantifying and Visualizing the Fusion-Lift
After running the evaluation, you will have a set of metrics for each model. The most effective way to present this is in a simple table.
| Model | Precision | Recall | F1-Score |
|---|---|---|---|
| Image-only (ResNet Baseline) | 0.72 | 0.70 | 0.71 |
| Text-only (BERT Baseline) | 0.75 | 0.78 | 0.76 |
| Multimodal (Late Fusion) | 0.85 | 0.83 | 0.84 |
From this hypothetical table, you can now quantify the improvement. For instance, the multimodal model shows a 13-point increase in F1-score (0.84 vs 0.71) over the best-performing baseline (text-only). This is a significant "fusion-lift" and strong evidence for your multimodal approach.
Visualizations are also extremely powerful. The plot below shows performance metrics for a fused model versus several single-data-type models. The fused model clearly outperforms all others.

To see how this is done in research, the following paper on fake news detection provides a comprehensive example of comparing unimodal and multimodal models.
Text–image multimodal fusion model for enhanced fake news detection - PMC
This paper perfectly mirrors the evaluation process you are undertaking. It uses ResNet and BERT, establishes single-modality baselines, and then evaluates various fusion methods.
First, quickly look at the tables in the section Experiment #1 to see how they establish baseline performance for text-only (Table 5) and image-only (Table 6) models. Next, skim through the tables in Experiment #4, particularly "Table 11. Ensemble learning performance in four classifiers." This table is a fantastic example of a comprehensive comparison, putting single-feature models (Codes A, B) head-to-head with various fusion models (Codes C-H). Finally, read the Conclusion. Pay attention to the sentences where the authors explicitly state the performance numbers for single-modality versus multimodal approaches, quantifying the improvement. For example, they note that the F1-score improved from a maximum of 88% with a single modality to 90% with fusion.
Beyond the Numbers: "Why" Does Fusion Win?
Metrics tell us that the fusion model is better, but a deep analysis also explores why. This involves looking at individual examples from your test set. You should find cases where:
- Image clarifies vague text: A text complaint is simple, like "The food was disgusting." The text-only model might struggle to classify the severity. However, the accompanying image clearly shows a large insect in the rice. The image model provides a strong signal, allowing the fusion model to correctly classify this as a 'Major Violation'.
- Text provides context for an ambiguous image: An image shows a small portion of what looks like dal (lentils). The image-only model might classify this as 'Adequate Quantity'. But the text complaint says, "It's the third time this week we only got dal, where is the protein and vegetable?" The text provides crucial context about lack of variety, a rule violation that the fusion model, using both inputs, can correctly identify.
This qualitative analysis is incredibly valuable for understanding your model's behavior and for telling a compelling story in your final report.
Multimodal Deep Multipage Document Classification using both Image and Text
This article's "Empirical Analysis" provides a great example of this qualitative approach.
Read the section titled Empirical Analysis. The author discusses specific document types where the text-only model failed (e.g., noisy OCR) but the image-based model succeeded, and vice-versa. This is exactly the kind of analysis you should perform on your own model's predictions.
Conclusion
In this lesson, you've learned how to conduct a rigorous and meaningful comparison between your multimodal model and its unimodal baselines. This is the capstone of our model-building phase, providing the evidence needed to validate your entire approach.
Key takeaways from today's session:
- The Goal of Comparison: To empirically prove that the added complexity of a multimodal architecture delivers a quantifiable performance improvement, or "fusion-lift."
- Evaluation Protocol: A fair comparison requires using a unified test set and consistent metrics (Precision, Recall, F1-score) across all models.
- Quantitative Analysis: Presenting results in a clear table allows you to calculate the exact improvement provided by the fusion model over the baselines.
- Qualitative Analysis: Investigating specific failure cases of unimodal models that are correctly handled by the fusion model provides deep insight into why fusion is effective.
You now have all the components to build, train, and validate the core predictive engine of your project. In the next lesson, we will pivot from model engineering to a different form of analysis. We will begin our journey into Geospatial Analysis of Violation Hotspots, starting with how to load and manipulate geographic data using GeoPandas. This will allow you to plot your model's predictions on a map and uncover regional patterns.