SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2102.04830 · AAAI · 2021

Learning Modality-Specific Representations with Self-Supervised Multi-Task Learning for Multimodal Sentiment Analysis

Hua Xu, Wenmeng Yu, Ziqi Yuan, Jiele Wu

arXiv · PDF · Open in the Atlas

Code that ran

4 of 6 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (4 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 4 have no contract verdict; 0 failures of our instrument; 2 no recorded run), measured 2026-11-21; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2102.04830.json · badge: /api/ran/2102.04830.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
thuiar/Self-MM marked official in Papers with Code
Papers with Code archive
3 ran · 0 no recorded run
thuiar/MMSA community
Papers with Code archive
1 ran · 2 no recorded run
FunctionStatusWhere it lives
AuViSubNet Ran
ran on a synthesized input · constructed an object; no result was computed
thuiar/MMSA/src/MMSA/models/multiTask/SELF_MM.py
code served (permissive licence) · get_code("cd303ade8d7c28b9")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, AuViSubNet: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from torch.nn.utils.rnn import pack_padded_sequence

torch.manual_seed(0)

class AuViSubNet(nn.Module):

    def __init__(self, in_size, hidden_size, out_size, num_layers=1, dropout=0.2, bidirectional=False):
        """
        Args:
            in_size: input dimension
            hidden_size: hidden layer dimension
            num_layers: specify the number of layers of LSTMs.
            dropout: dropout probability
            bidirectional: specify usage of bidirectional LSTM
        Output:
            (return value in forward) a tensor of shape (batch_size, out_size)
        """
        super(AuViSubNet, self).__init__()
        self.rnn = nn.LSTM(in_size, hidden_size, num_layers=num_layers, dropout=dropout, bidirectional=bidirectional, batch_first=True)
        self.dropout = nn.Dropout(dropout)
        self.linear_1 = nn.Linear(hidden_size, out_size)

    def forward(self, x, lengths):
        """
        x: (batch_size, sequence_len, in_size)
        """
        packed_sequence = pack_padded_sequence(x, lengths, batch_first=True, enforce_sorted=False)
        _, final_states = self.rnn(packed_sequence)
        h = self.dropout(final_states[0].squeeze(0))
        y_1 = self.linear_1(h)
        return y_1


# Create test data
batch_size = 2
sequence_len = 3
in_size = 4
hidden_size = 5
out_size = 6

# Create input tensor: (batch_size, sequence_len, in_size)
x = torch.randn(batch_size, sequence_len, in_size)

# Create lengths tensor for pack_padded_sequence
lengths = torch.tensor([3, 2], dtype=torch.long)

ARGS = {
    "in_size": in_size,
    "hidden_size": hidden_size,
    "out_size": out_size,
    "num_layers": 1,
    "dropout": 0.2,
    "bidirectional": False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type AuViSubNet — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a AuViSubNet output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
AuViSubNet Ran
ran on a synthesized input · constructed an object; no result was computed
thuiar/Self-MM/models/multiTask/SELF_MM.py
code served (permissive licence) · get_code("dc62cb6da8c1316a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, AuViSubNet: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from torch.nn.utils.rnn import pad_sequence, pack_padded_sequence, pad_packed_sequence

torch.manual_seed(0)

class AuViSubNet(nn.Module):

    def __init__(self, in_size, hidden_size, out_size, num_layers=1, dropout=0.2, bidirectional=False):
        """
        Args:
            in_size: input dimension
            hidden_size: hidden layer dimension
            num_layers: specify the number of layers of LSTMs.
            dropout: dropout probability
            bidirectional: specify usage of bidirectional LSTM
        Output:
            (return value in forward) a tensor of shape (batch_size, out_size)
        """
        super(AuViSubNet, self).__init__()
        self.rnn = nn.LSTM(in_size, hidden_size, num_layers=num_layers, dropout=dropout, bidirectional=bidirectional, batch_first=True)
        self.dropout = nn.Dropout(dropout)
        self.linear_1 = nn.Linear(hidden_size, out_size)

    def forward(self, x, lengths):
        """
        x: (batch_size, sequence_len, in_size)
        """
        packed_sequence = pack_padded_sequence(x, lengths, batch_first=True, enforce_sorted=False)
        _, final_states = self.rnn(packed_sequence)
        h = self.dropout(final_states[0].squeeze())
        y_1 = self.linear_1(h)
        return y_1


in_size = 4
hidden_size = 3
out_size = 2
num_layers = 1
dropout = 0.2
bidirectional = False

model = AuViSubNet(
    in_size=in_size,
    hidden_size=hidden_size,
    out_size=out_size,
    num_layers=num_layers,
    dropout=dropout,
    bidirectional=bidirectional
)

x = torch.randn(2, 5, in_size)
lengths = torch.tensor([5, 3])

ARGS = {
    "in_size": in_size,
    "hidden_size": hidden_size,
    "out_size": out_size,
    "num_layers": num_layers,
    "dropout": dropout,
    "bidirectional": bidirectional
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type AuViSubNet — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a AuViSubNet output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
BertTextEncoder Ran
ran on a synthesized input · constructed an object; no result was computed
thuiar/Self-MM/models/multiTask/SELF_MM.py
code served (permissive licence) · get_code("a75584e616de343d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, BertTextEncoder: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from unittest.mock import Mock, MagicMock

torch.manual_seed(0)

# Create mock tokenizer
mock_tokenizer = Mock()
mock_tokenizer.tokenize = Mock(return_value=['[CLS]', 'hello', '[SEP]'])
mock_tokenizer.convert_tokens_to_ids = Mock(return_value=[101, 7592, 102])

# Create minimal mock BERT model
class MinimalBertModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.embedding = nn.Embedding(30522, 768)
    
    def forward(self, input_ids, attention_mask=None, token_type_ids=None):
        # Return tuple with last_hidden_states as first element
        batch_size, seq_len = input_ids.shape
        last_hidden_states = torch.randn(batch_size, seq_len, 768)
        return (last_hidden_states,)

mock_model = MinimalBertModel()

# Patch the from_pretrained methods to return our mocks
original_tokenizer_from_pretrained = nn.Module.from_pretrained if hasattr(nn.Module, 'from_pretrained') else None

def mock_bert_tokenizer_from_pretrained(pretrained_model_name_or_path, **kwargs):
    return mock_tokenizer

def mock_bert_model_from_pretrained(pretrained_model_name_or_path, **kwargs):
    return mock_model

# Monkey patch for this test
import transformers
original_tokenizer_method = transformers.BertTokenizer.from_pretrained
original_model_method = transformers.BertModel.from_pretrained

transformers.BertTokenizer.from_pretrained = classmethod(lambda cls, *args, **kwargs: mock_tokenizer)
transformers.BertModel.from_pretrained = classmethod(lambda cls, *args, **kwargs: mock_model)

ARGS = {
    'language': 'en',
    'use_finetune': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type BertTextEncoder — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a BertTextEncoder output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
SELF_MM Ran
ran on a synthesized input · constructed an object; no result was computed
thuiar/Self-MM/models/multiTask/SELF_MM.py
code served (permissive licence) · get_code("df89e466d6eae391")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, SELF_MM: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

class MockArgs:
    def __init__(self):
        # Data alignment
        self.need_data_aligned = True
        
        # Language and finetuning
        self.language = 'en'
        self.use_finetune = False
        
        # Feature dimensions: (text_dim, audio_dim, video_dim)
        self.feature_dims = [768, 32, 64]
        
        # Audio subnet parameters
        self.a_lstm_hidden_size = 16
        self.a_lstm_layers = 1
        self.a_lstm_dropout = 0.2
        self.audio_out = 8
        
        # Video subnet parameters
        self.v_lstm_hidden_size = 20
        self.v_lstm_layers = 1
        self.v_lstm_dropout = 0.2
        self.video_out = 12
        
        # Text output
        self.text_out = 24
        
        # Post-fusion parameters
        self.post_fusion_dropout = 0.2
        self.post_fusion_dim = 32
        
        # Post-text parameters
        self.post_text_dropout = 0.2
        self.post_text_dim = 16
        
        # Post-audio parameters
        self.post_audio_dropout = 0.2
        self.post_audio_dim = 16
        
        # Post-video parameters
        self.post_video_dropout = 0.2
        self.post_video_dim = 16

class MockBertModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.embedding = nn.Embedding(1000, 768)
    
    def forward(self, input_ids, attention_mask=None, token_type_ids=None):
        hidden_states = self.embedding(input_ids)
        return (hidden_states,)

class MockBertTokenizer:
    def __init__(self):
        pass
    
    @staticmethod
    def from_pretrained(path, do_lower_case=True):
        return MockBertTokenizer()

class MockBertTextEncoder(nn.Module):
    def __init__(self, language='en', use_finetune=False):
        super().__init__()
        self.use_finetune = use_finetune
        self.model = MockBertModel()
        self.tokenizer = MockBertTokenizer()
    
    def forward(self, text):
        batch_size = text.shape[0]
        return torch.randn(batch_size, 768, 768)

# Create mock implementations to avoid loading pretrained models
import sys
from unittest.mock import MagicMock

original_bert_tokenizer = None
original_bert_model = None

def mock_bert_tokenizer_from_pretrained(*args, **kwargs):
    return MockBertTokenizer()

def mock_bert_model_from_pretrained(*args, **kwargs):
    return MockBertModel()

# Patch the from_pretrained methods
from transformers import BertTokenizer, BertModel
BertTokenizer.from_pretrained = staticmethod(mock_bert_tokenizer_from_pretrained)
BertModel.from_pretrained = staticmethod(mock_bert_model_from_pretrained)

# Create args instance
args = MockArgs()

ARGS = {
    'args': args
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type SELF_MM — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a SELF_MM output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
BertTextEncoder Not yet run
unverified (harvested, no recorded run)
thuiar/MMSA/src/MMSA/models/multiTask/SELF_MM.py
code served (permissive licence) · get_code("3995af40703d5764")
How it ran

no invocation recorded.

SELF_MM Not yet run
unverified (harvested, no recorded run)
thuiar/MMSA/src/MMSA/models/multiTask/SELF_MM.py
code served (permissive licence) · get_code("ac60192ce69243a4")
How it ran

no invocation recorded.

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 6 distinct functions with an identity, 1 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 1 later) and 5 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
BertTextEncoder
brick of this paper's assembly: model
2 other papers
2 later · 1 only as an assembly brick
2303.13802 (2023-03)
Decoupled Multimodal Distilling for Emotion Recognition
2409.20012 (2024-09)
Towards Robust Multimodal Sentiment Analysis with Incomplete Data

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-21.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Representation Learning is a significant and challenging task in multimodal learning. Effective modality representations should contain two parts of characteristics: the consistency and the difference. Due to the unified multimodal annotation, existing methods are restricted in capturing differentiated information. However, additional unimodal annotations are high time-and labor-cost. In this paper, we design a label generation module based on the self-supervised learning strategy to acquire independent unimodal supervisions. Then, joint training the multimodal and uni-modal tasks to learn the consistency and difference, respectively. Moreover, during the training stage, we design a weight-adjustment strategy to balance the learning progress among different subtasks. That is to guide the subtasks to focus on samples with the larger difference between modality supervisions. Last, we conduct extensive experiments on three public multimodal baseline datasets. The experimental results validate the reliability and stability of auto-generated unimodal supervisions. On MOSI and MOSEI datasets, our method surpasses the current state-of-the-art methods. On the SIMS dataset, our method achieves comparable performance than humanannotated unimodal labels. The full codes are available at https://github.com/thuiar/Self-MM.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2102.04830")
get_code_for_paper("2102.04830")
have("2102.04830")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2102.04830.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2102.04830.svg)](https://syntology.ai/paper/2102.04830)

Connect an agent — have() is free.