Source-linked AI summary

CLMLF:A Contrastive Learning and Multi-Layer Fusion Method for Multimodal Sentiment Detection

Zhen Li, Bing Xu, Conghui Zhu, Tiejun Zhao

arXiv:2204.05515v4cs.CL

TL;DR

Prior work rarely considers token-level text-image fusion or contrastive learning for multimodal sentiment. CLMLF combines multi-layer fusion with label- and data-based contrastive tasks, and achieves better performance than several baselines on all three evaluated datasets.

  • Problem

    Multimodal sentiment research rarely studies contrastive learning, while fine-grained token-level fusion is also a focus of the proposed approach.

    Source: §1 · pp. 1–2, §6 · p. 8
  • Method

    CLMLF aligns and fuses text-image token features through multi-layer fusion, alongside label- and data-based contrastive tasks for learning sentiment-related common features.

    Source: §1 · p. 2
  • Results

    CLMLF achieves better performance than several baseline models on all three evaluated datasets.

    Source: §1 · p. 2
  • Takeaways & Limitations

    Case studies illustrate that image context can change sentiment interpretations that are difficult to infer from text alone.

    Source: §4.4 · p. 7

Abstract

from arXiv · show

Compared with unimodal data, multimodal data can provide more features to help the model analyze the sentiment of data. Previous research works rarely consider token-level feature fusion, and few works explore learning the common features related to sentiment in multimodal data to help the model fuse multimodal features. In this paper, we propose a Contrastive Learning and Multi-Layer Fusion (CLMLF) method for multimodal sentiment detection. Specifically, we first encode text and image to obtain hidden representations, and then use a multi-layer fusion module to align and fuse the token-level features of text and image. In addition to the sentiment analysis task, we also designed two contrastive learning tasks, label based contrastive learning and data based contrastive learning tasks, which will help the model learn common features related to sentiment in multimodal data. Extensive experiments conducted on three publicly available multimodal datasets demonstrate the effectiveness of our approach for multimodal sentiment detection compared with existing methods. The codes are available for use at https://github.com/Link-Li/CLMLF

1 Introduction

CLMLF combines token-level text-image fusion with label- and data-based contrastive learning for multimodal sentiment analysis. The paper reports better performance than several baselines on three multimodal datasets.

  • Complementary text-image signals can clarify sentiment: an image reveals positive intent absent from declarative text, while ruins in another image deepen negative sentiment.Source: §1 · p. 1
  • The Transformer-Encoder MLF uses multi-head self-attention across text tokens and image patches to align and fuse token-level features, while multiple layers deepen abstraction.Source: §1 · p. 2
  • The authors argue that concatenation, gating, attention, and memory-based methods offer limited fusion because different modality vector spaces make text-image alignment difficult.Source: §1 · pp. 1–2
  • CLMLF achieves better performance than several baseline models on MVSA-Single, MVSA-Multiple, and HFM.Source: §1 · p. 2
  • LBCL and DBCL use sentiment labels and data augmentation to learn common sentiment-related multimodal features and improve model performance.Source: §1 · p. 2

2 Approach

CLMLF combines token-level text-image fusion with sentiment classification and two contrastive learning tasks. Its training objective incorporates label-based and data-based contrastive losses.

2.1 Overview

  • The overall architecture comprises a multi-layer fusion module and a multi-task learning module with sentiment classification and both contrastive-learning tasks.Source: §2.1 · p. 2

2.2 Multi-Layer Fusion Module

  • The multi-layer fusion module projects ResNet image features into the text dimension, encodes the image sequence, fuses it with text using a Transformer, and applies attention to obtain a multimodal representation.The fusion Transformer aligns and combines token-level text and image features.Source: §2.2 · p. 3

2.3 Sentiment Classification

  • The sentiment-classification task feeds the multimodal representation to a fully connected layer and softmax, using cross-entropy loss.Source: §2.3 · p. 3

2.4 Label Based Contrastive Learning

  • Label-based contrastive learning treats same-sentiment examples in a batch as positives and examples with different sentiment labels as negatives.The task calculates a contrastive loss from the batch labels and loss matrix.Source: §2.4 · p. 4

2.5 Data Based Contrastive Learning

  • The data-based contrastive task uses augmented text-image examples to encourage invariant, sentiment-relevant features despite changes in surface form.Text is augmented with back-translation, while images use RandAugment.Source: §2.5 · p. 4

2.6 Model Training

  • The label-based and data-based contrastive losses are added to the total loss as regularization, with coefficients balancing the training losses.Source: §2.6 · p. 5

3 Experimental Setup

The experiments evaluate CLMLF on three public datasets, using specified dataset processing and implementation settings. Comparisons include unimodal text and image models and multimodal sentiment models.

3.1 Dataset

  • Experiments use MVSA-Single, MVSA-Multiple, and HFM; MVSA splits are 8:1:1, with preprocessing following Xu and Mao (2017) and Cai et al. (2019), respectively.The MVSA datasets contain Twitter text-image pairs labeled with a single sentiment; HFM preprocessing follows Cai et al. (2019).Source: §3.1 · p. 5

3.2 Implementation Details

  • CLMLF uses BERT-base and ResNet-50 encoders, AdamW with a 2e-5 learning rate, and batch sizes of 32, 64, and 128 for MVSA-Single, MVSA-Multiple, and HFM.Both contrastive-loss weights are 1.0; experiments use four NVIDIA 3090 GPUs. PyTorch and HuggingFace Transformers are used for implementation.Source: §3.2 · p. 5

3.3 Compared Methods

4 Results and Analysis

Across three datasets, CLMLF is competitive with strong baselines; ablations and visualizations support the roles of multimodal fusion, contrastive learning, and token-level text-image alignment.

4.1 Overall Result

  • CLMLF is competitive with strong baselines across three datasets; multimodal models outperform unimodal ones, while image-only sentiment is weakest and gains are smaller on binary HFM.The authors suggest image sentiment features are sparse and noisy, and attribute HFM’s smaller improvement over BERT to its binary classification setting versus three-class MVSA-Single.Source: §4.1 · p. 6

4.2 Ablation

  • The complete CLMLF model performs best in the ablation comparison; multi-layer fusion improves performance, and adding both contrastive tasks improves it further.The authors interpret the contrastive tasks as helping the model learn common sentiment features and separate data with different sentiments.Source: §4.2 · p. 6, Table 3

4.3 Influence of MLF Layer

  • The selected fusion/image layer combinations were 3-2, 4-2, and 5-1 across the datasets, and HFM benefits more from text than images.The layer analysis indicates that text and image contributions differ by dataset; the authors therefore use more text-related than image-related transformer layers in the MLF module.Source: §4.3 · pp. 6–7, Figure 3 · p. 7

4.4 Case Study

  • In two case-study examples, image context helps CLMLF correctly identify sentiment that text-only BERT misclassifies.One text refers to a positive image, while another appears negative from text alone but is a joke expressing positive sentiment when the image is considered.Source: §4.4 · p. 7, Figure 4 · p. 7

4.5 Visualization

  • Attention visualization shows that the model aligns text keywords with corresponding image regions at token level, including when “lady” refers to only half a face.The visualization uses the first attention head of the final Transformer-Encoder layer in the Multi-Layer Fusion module.Source: §4.5 · p. 7, Image Text CLMLF BERT · p. 7, Figure 5 · p. 7

Image Text CLMLF BERT

  • On MVSA-Single, CLMLF’s representations separate positive from negative sentiment more clearly and cluster neutral examples better than BERT’s.The authors use t-SNE visualizations of the models’ final-layer features and interpret the clustering as evidence that contrastive learning captures common sentiment features.Source: Image Text CLMLF BERT · pp. 7–8, Figure 6 · p. 8

5 Related Work

Prior multimodal sentiment methods encode and fuse text-image features, while contrastive learning has been applied across language, vision, and multimodal tasks. CLMLF focuses on token-level alignment and fusion and learning sentiment-related common features.

5.1 Multimodal Sentiment Analysis

  • Prior multimodal sentiment methods range from concatenating text and image representations to modeling their interactions with co-memory, attention, fusion, and graph networks.MultiSentiNet and HSAN (Xu, 2017) concatenate encoded representations; CoMN, Yu et al. (2019), MVAN, and Yang et al. (2021) use interaction- or fusion-focused approaches.Source: §5.1 · p. 8

5.2 Contrastive Learning

  • CLMLF distinguishes its focus on aligning and fusing token-level features and learning sentiment-related common features from prior contrastive-learning work.Earlier multimodal applications use intramodal, inter-modal, and cross-lingual contrastive learning for video search, or combine within-modality data properties with cross-modal semantics to improve visual representations.Source: §5.2 · p. 8

6 Conclusion and Future Work

CLMLF combines token-level multimodal fusion with contrastive learning to support sentiment-feature extraction and fusion, and is competitive with strong baselines. Future work will add modalities such as audio.

6 Conclusion and Future Work

  • The multi-layer fusion module fuses text and image features at fine-grained token level, supporting local feature fusion.The conclusion contrasts this with previous works’ fusion approaches.Source: §6 · p. 8
  • Contrastive learning tasks help CLMLF learn sentiment-related multimodal features and improve its ability to extract and fuse them.Source: §6 · p. 9
  • Experiments on public datasets show CLMLF is competitive with strong baselines, while visualizations offer intuitive interpretations of its contrastive tasks and fusion module.Source: §6 · p. 9
  • Future work will incorporate other modalities, such as audio, into sentiment detection.Source: §6 · p. 9

A Dataset Statistics

The section reports sentiment-category statistics for MVSA-Single, MVSA-Multiple, and HFM, noting that HFM is binary while both MVSA datasets are three-class.

B Aspect Based Multimodal Sentiment · B.1 Experimental Setup

CLMLF was adapted for aspect-based multimodal sentiment analysis by adding the aspect to the text input while leaving image input unchanged. Experiments used three datasets, with one randomly selected image per Multi-ZOL example; the reported results improved over text-only input.

B.1 Experimental Setup

  • CLMLF’s text input changes to “[CLS] sentence [SEP] aspect [SEP]” for aspect-based sentiment analysis, while image input remains unchanged.The paper reports that this simple modification lets CLMLF work on aspect-based multimodal sentiment tasks.Source: §B.1 · p. 12
  • Experiments use Multi-ZOL8, Twitter-15, and Twitter-179, where each sentence has a corresponding aspect attribute.The dataset statistics are reported in Table 5.Source: §B.1 · p. 12
  • For Multi-ZOL, which contains multiple images per example, the experiments randomly select one image for fusion and report improvement over text-only input.The passage notes that this selection loses some features but provides no quantitative comparison.Source: §B.1 · p. 12

B.2 Results

The results report good performance for CLMLF using Macro-F1 and ACC, while ablations support the effectiveness of its fusion and contrastive-learning components.

B.2 Results

  • The comparison includes LSTM, AE-LSTM, RAM, MIMN, TomBERT (Yu and Jiang, 2019), and ESAFN (Yu et al., 2019).The listed baselines span sentence-level and attention-based LSTM models, memory-based approaches, and multimodal models.Source: §B.2 · p. 12
  • CLMLF achieves good results in the reported comparison, evaluated with Macro-F1 and ACC.The supplied passages do not provide the table's numerical values or identify a winning baseline.Source: §B.2 · pp. 12–13, Table 6 · p. 13
  • Ablations support the effectiveness of multi-layer fusion, label-based contrastive learning, and data-based contrastive learning.The ablation results are presented in Table 7.Source: Table 7 · p. 13, §B.2 · p. 13
Loading 2204.05515v4…