SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2409.20012 · NeurIPS · 2024

Towards Robust Multimodal Sentiment Analysis with Incomplete Data

Wenbin Wang, Tianshu Yu, Haoyu Zhang

arXiv · PDF · Open in the Atlas

Code that ran

10 of 14 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 9 have no contract verdict; 1 failure of our instrument; 4 no recorded run), measured 2026-11-22; 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/2409.20012.json · badge: /api/ran/2409.20012.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
Haoyu-ha/LNLN canonical (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
haoyu-ha/lnln marked official in Papers with Code
Papers with Code archive
9 ran · 4 no recorded run
FunctionStatusWhere it lives
Attention Ran
ran on a synthesized input
haoyu-ha/lnln/models/lnln.py
code served (permissive licence) · get_code("8ced8002b277acce")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 3, dtype family float, shape (2, 3, 16) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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
from torch import nn
from einops import rearrange, repeat
from torch import einsum

class Attention(nn.Module):

    def __init__(self, dim, heads=8, dim_head=64, dropout=0.0):
        super().__init__()
        inner_dim = dim_head * heads
        project_out = not (heads == 1 and dim_head == dim)
        self.heads = heads
        self.scale = dim_head ** (-0.5)
        self.attend = nn.Softmax(dim=-1)
        self.to_q = nn.Linear(dim, inner_dim, bias=False)
        self.to_k = nn.Linear(dim, inner_dim, bias=False)
        self.to_v = nn.Linear(dim, inner_dim, bias=False)
        self.to_out = nn.Sequential(nn.Linear(inner_dim, dim), nn.Dropout(dropout)) if project_out else nn.Identity()

    def forward(self, q, k, v):
        b, n, _, h = (*q.shape, self.heads)
        q = self.to_q(q)
        k = self.to_k(k)
        v = self.to_v(v)
        q, k, v = map(lambda t: rearrange(t, 'b n (h d) -> b h n d', h=h), (q, k, v))
        dots = einsum('b h i d, b h j d -> b h i j', q, k) * self.scale
        attn = self.attend(dots)
        out = einsum('b h i j, b h j d -> b h i d', attn, v)
        out = rearrange(out, 'b h n d -> b n (h d)')
        return self.to_out(out)


INIT_ARGS = {
    'dim': 16,
    'heads': 2,
    'dim_head': 8,
    'dropout': 0.1
}

ARGS = {
    'q': torch.randn(2, 3, 16),
    'k': torch.randn(2, 5, 16),
    'v': torch.randn(2, 5, 16)
}

if __name__ == '__main__':
    attention = Attention(**INIT_ARGS)
    output = attention(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Expected shape: (2, 3, 16)")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (2, 3, 16) — shape (2, 3, 16) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
CrossTransformerEncoder Ran
ran on a synthesized input
haoyu-ha/lnln/models/lnln.py
code served (permissive licence) · get_code("9479a95a1709394e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 3, dtype family float, shape (2, 5, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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
from torch import nn
from einops import rearrange, repeat
from torch import nn, einsum

class Attention(nn.Module):

    def __init__(self, dim, heads=8, dim_head=64, dropout=0.0):
        super().__init__()
        inner_dim = dim_head * heads
        project_out = not (heads == 1 and dim_head == dim)
        self.heads = heads
        self.scale = dim_head ** (-0.5)
        self.attend = nn.Softmax(dim=-1)
        self.to_q = nn.Linear(dim, inner_dim, bias=False)
        self.to_k = nn.Linear(dim, inner_dim, bias=False)
        self.to_v = nn.Linear(dim, inner_dim, bias=False)
        self.to_out = nn.Sequential(nn.Linear(inner_dim, dim), nn.Dropout(dropout)) if project_out else nn.Identity()

    def forward(self, q, k, v):
        b, n, _, h = (*q.shape, self.heads)
        q = self.to_q(q)
        k = self.to_k(k)
        v = self.to_v(v)
        q, k, v = map(lambda t: rearrange(t, 'b n (h d) -> b h n d', h=h), (q, k, v))
        dots = einsum('b h i d, b h j d -> b h i j', q, k) * self.scale
        attn = self.attend(dots)
        out = einsum('b h i j, b h j d -> b h i d', attn, v)
        out = rearrange(out, 'b h n d -> b n (h d)')
        return self.to_out(out)

class FeedForward(nn.Module):

    def __init__(self, dim, hidden_dim, dropout=0.0):
        super().__init__()
        self.net = nn.Sequential(nn.Linear(dim, hidden_dim), nn.GELU(), nn.Dropout(dropout), nn.Linear(hidden_dim, dim), nn.Dropout(dropout))

    def forward(self, x):
        return self.net(x)

class PreNorm(nn.Module):

    def __init__(self, dim, fn):
        super().__init__()
        self.norm = nn.LayerNorm(dim)
        self.fn = fn

    def forward(self, x, **kwargs):
        return self.fn(self.norm(x), **kwargs)

class PreNorm_qkv(nn.Module):

    def __init__(self, dim, fn):
        super().__init__()
        self.norm_q = nn.LayerNorm(dim)
        self.norm_k = nn.LayerNorm(dim)
        self.norm_v = nn.LayerNorm(dim)
        self.fn = fn

    def forward(self, q, k, v, **kwargs):
        q = self.norm_q(q)
        k = self.norm_k(k)
        v = self.norm_v(v)
        return self.fn(q, k, v)

class CrossTransformerEncoder(nn.Module):

    def __init__(self, dim, depth, heads, dim_head, mlp_dim, dropout=0.0):
        super().__init__()
        self.layers = nn.ModuleList([])
        for _ in range(depth):
            self.layers.append(nn.ModuleList([PreNorm_qkv(dim, Attention(dim, heads=heads, dim_head=dim_head, dropout=dropout)), PreNorm(dim, FeedForward(dim, mlp_dim, dropout=dropout))]))

    def forward(self, source_x, target_x):
        for attn, ff in self.layers:
            target_x_tmp = attn(target_x, source_x, source_x)
            target_x = target_x_tmp + target_x
            target_x = ff(target_x) + target_x
        return target_x


INIT_ARGS = {
    'dim': 4,
    'depth': 2,
    'heads': 2,
    'dim_head': 2,
    'mlp_dim': 8,
    'dropout': 0.0
}

ARGS = {
    'source_x': torch.randn(2, 3, 4),
    'target_x': torch.randn(2, 5, 4)
}

if __name__ == '__main__':
    model = CrossTransformerEncoder(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Expected shape: (2, 5, 4)")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (2, 5, 4) — shape (2, 5, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
GradientReversalLayer Ran
ran on a synthesized input
haoyu-ha/lnln/models/lnln.py
code served (permissive licence) · get_code("2c0d4b2a4a933000")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 2, dtype family float, shape (2, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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
from torch import nn

class GradientReversalFn(torch.autograd.Function):

    @staticmethod
    def forward(ctx, x, alpha):
        ctx.alpha = alpha
        return x.view_as(x)

    @staticmethod
    def backward(ctx, grad_output):
        output = grad_output.neg() * ctx.alpha
        return (output, None)

class GradientReversalLayer(nn.Module):

    def __init__(self, alpha=1.0):
        super(GradientReversalLayer, self).__init__()
        self.alpha = alpha

    def forward(self, x):
        return GradientReversalFn.apply(x, self.alpha)


INIT_ARGS = {
    'alpha': 0.5
}

ARGS = {
    'x': torch.randn(2, 4)
}

if __name__ == '__main__':
    layer = GradientReversalLayer(**INIT_ARGS)
    output = layer(**ARGS)
    print("Output shape:", output.shape)
    print("Output:", output)
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
HhyperLearningEncoder Ran
ran on a synthesized input
haoyu-ha/lnln/models/lnln.py
code served (permissive licence) · get_code("b7ac1eda234ca7a0")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 3, dtype family float, shape (2, 3, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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
from torch import nn
from einops import rearrange, repeat
from torch import einsum

from torch import nn
from einops import rearrange, repeat
from torch import nn, einsum

class HhyperLearningLayer(nn.Module):

    def __init__(self, dim, heads=8, dim_head=64, dropout=0.0):
        super().__init__()
        inner_dim = dim_head * heads
        project_out = not (heads == 1 and dim_head == dim)
        self.heads = heads
        self.scale = dim_head ** (-0.5)
        self.attend = nn.Softmax(dim=-1)
        self.to_q = nn.Linear(dim, inner_dim, bias=False)
        self.to_k_ta = nn.Linear(dim, inner_dim, bias=False)
        self.to_k_tv = nn.Linear(dim, inner_dim, bias=False)
        self.to_v_ta = nn.Linear(dim, inner_dim, bias=False)
        self.to_v_tv = nn.Linear(dim, inner_dim, bias=False)
        self.to_out = nn.Sequential(nn.Linear(inner_dim, dim, bias=True), nn.Dropout(dropout)) if project_out else nn.Identity()

    def forward(self, h_dominate, h_a, h_v, h_hyper):
        h = self.heads
        q = self.to_q(h_dominate)
        k_a = self.to_k_ta(h_a)
        k_v = self.to_k_tv(h_v)
        v_a = self.to_v_ta(h_a)
        v_v = self.to_v_tv(h_v)
        q, k_a, k_v, v_a, v_v = map(lambda t: rearrange(t, 'b n (h d) -> b h n d', h=h), (q, k_a, k_v, v_a, v_v))
        dots_q_ka = einsum('b h i d, b h j d -> b h i j', q, k_a) * self.scale
        attn_q_ka = self.attend(dots_q_ka)
        out_q_ka = einsum('b h i j, b h j d -> b h i d', attn_q_ka, v_a)
        out_q_ka = rearrange(out_q_ka, 'b h n d -> b n (h d)')
        dots_q_kv = einsum('b h i d, b h j d -> b h i j', q, k_v) * self.scale
        attn_q_kv = self.attend(dots_q_kv)
        out_q_kv = einsum('b h i j, b h j d -> b h i d', attn_q_kv, v_v)
        out_q_kv = rearrange(out_q_kv, 'b h n d -> b n (h d)')
        h_hyper_shift = self.to_out(out_q_ka + out_q_kv)
        h_hyper += h_hyper_shift
        return h_hyper

class PreNorm_hyper(nn.Module):

    def __init__(self, dim, fn):
        super().__init__()
        self.norm1 = nn.LayerNorm(dim)
        self.norm2 = nn.LayerNorm(dim)
        self.norm3 = nn.LayerNorm(dim)
        self.norm4 = nn.LayerNorm(dim)
        self.fn = fn

    def forward(self, h_dominate, h_a, h_v, h_hyper):
        h_dominate = self.norm1(h_dominate)
        h_a = self.norm2(h_a)
        h_v = self.norm3(h_v)
        h_hyper = self.norm4(h_hyper)
        return self.fn(h_dominate, h_a, h_v, h_hyper)

class HhyperLearningEncoder(nn.Module):

    def __init__(self, dim, depth, heads, dim_head, dropout=0.0):
        super().__init__()
        self.layers = nn.ModuleList([])
        for _ in range(depth):
            self.layers.append(nn.ModuleList([PreNorm_hyper(dim, HhyperLearningLayer(dim, heads=heads, dim_head=dim_head, dropout=dropout))]))

    def forward(self, h_domonate_list, h_a, h_v, h_hyper):
        for i, attn in enumerate(self.layers):
            h_hyper = attn[0](h_domonate_list[i], h_a, h_v, h_hyper)
        return h_hyper


INIT_ARGS = {
    'dim': 4,
    'depth': 2,
    'heads': 2,
    'dim_head': 2,
    'dropout': 0.0,
}

ARGS = {
    'h_domonate_list': [torch.randn(2, 3, 4), torch.randn(2, 3, 4)],
    'h_a': torch.randn(2, 3, 4),
    'h_v': torch.randn(2, 3, 4),
    'h_hyper': torch.randn(2, 3, 4),
}

if __name__ == '__main__':
    model = HhyperLearningEncoder(**INIT_ARGS)
    output = model(**ARGS)
    print("Output shape:", output.shape)
    print("Test passed!")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (2, 3, 4) — shape (2, 3, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
HhyperLearningLayer Ran
ran on a synthesized input
haoyu-ha/lnln/models/lnln.py
code served (permissive licence) · get_code("6a3c9761d14b858c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 3, dtype family float, shape (2, 3, 16) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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
from torch import nn
from einops import rearrange, repeat
from einops import einsum

class HhyperLearningLayer(nn.Module):

    def __init__(self, dim, heads=8, dim_head=64, dropout=0.0):
        super().__init__()
        inner_dim = dim_head * heads
        project_out = not (heads == 1 and dim_head == dim)
        self.heads = heads
        self.scale = dim_head ** (-0.5)
        self.attend = nn.Softmax(dim=-1)
        self.to_q = nn.Linear(dim, inner_dim, bias=False)
        self.to_k_ta = nn.Linear(dim, inner_dim, bias=False)
        self.to_k_tv = nn.Linear(dim, inner_dim, bias=False)
        self.to_v_ta = nn.Linear(dim, inner_dim, bias=False)
        self.to_v_tv = nn.Linear(dim, inner_dim, bias=False)
        self.to_out = nn.Sequential(nn.Linear(inner_dim, dim, bias=True), nn.Dropout(dropout)) if project_out else nn.Identity()

    def forward(self, h_dominate, h_a, h_v, h_hyper):
        h = self.heads
        q = self.to_q(h_dominate)
        k_a = self.to_k_ta(h_a)
        k_v = self.to_k_tv(h_v)
        v_a = self.to_v_ta(h_a)
        v_v = self.to_v_tv(h_v)
        q, k_a, k_v, v_a, v_v = map(lambda t: rearrange(t, 'b n (h d) -> b h n d', h=h), (q, k_a, k_v, v_a, v_v))
        dots_q_ka = einsum('b h i d, b h j d -> b h i j', q, k_a) * self.scale
        attn_q_ka = self.attend(dots_q_ka)
        out_q_ka = einsum('b h i j, b h j d -> b h i d', attn_q_ka, v_a)
        out_q_ka = rearrange(out_q_ka, 'b h n d -> b n (h d)')
        dots_q_kv = einsum('b h i d, b h j d -> b h i j', q, k_v) * self.scale
        attn_q_kv = self.attend(dots_q_kv)
        out_q_kv = einsum('b h i j, b h j d -> b h i d', attn_q_kv, v_v)
        out_q_kv = rearrange(out_q_kv, 'b h n d -> b n (h d)')
        h_hyper_shift = self.to_out(out_q_ka + out_q_kv)
        h_hyper += h_hyper_shift
        return h_hyper


INIT_ARGS = {
    'dim': 16,
    'heads': 2,
    'dim_head': 8,
    'dropout': 0.1,
}

ARGS = {
    'h_dominate': torch.randn(2, 3, 16),
    'h_a': torch.randn(2, 3, 16),
    'h_v': torch.randn(2, 3, 16),
    'h_hyper': torch.randn(2, 3, 16),
}

if __name__ == '__main__':
    layer = HhyperLearningLayer(**INIT_ARGS)
    output = layer(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Output dtype: {output.dtype}")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (2, 3, 16) — shape (2, 3, 16) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
PreNorm_hyper Ran
ran on a synthesized input
haoyu-ha/lnln/models/lnln.py
code served (permissive licence) · get_code("670781bc5235810d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned tuple. 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
from torch import nn

class PreNorm_hyper(nn.Module):

    def __init__(self, dim, fn):
        super().__init__()
        self.norm1 = nn.LayerNorm(dim)
        self.norm2 = nn.LayerNorm(dim)
        self.norm3 = nn.LayerNorm(dim)
        self.norm4 = nn.LayerNorm(dim)
        self.fn = fn

    def forward(self, h_dominate, h_a, h_v, h_hyper):
        h_dominate = self.norm1(h_dominate)
        h_a = self.norm2(h_a)
        h_v = self.norm3(h_v)
        h_hyper = self.norm4(h_hyper)
        return self.fn(h_dominate, h_a, h_v, h_hyper)


class DummyFn(nn.Module):
    def forward(self, h_dominate, h_a, h_v, h_hyper):
        return h_dominate, h_a, h_v, h_hyper


INIT_ARGS = {
    'dim': 4,
    'fn': DummyFn()
}

ARGS = {
    'h_dominate': torch.randn(2, 4),
    'h_a': torch.randn(2, 4),
    'h_v': torch.randn(2, 4),
    'h_hyper': torch.randn(2, 4)
}

if __name__ == '__main__':
    model = PreNorm_hyper(**INIT_ARGS)
    output = model(**ARGS)
    print("Output shapes:", [o.shape for o in output])
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
PreNorm_qkv Ran
ran on a synthesized input
haoyu-ha/lnln/models/lnln.py
code served (permissive licence) · get_code("82683b7abf1c3e89")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 3, dtype family float, shape (2, 3, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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
from torch import nn

class PreNorm_qkv(nn.Module):

    def __init__(self, dim, fn):
        super().__init__()
        self.norm_q = nn.LayerNorm(dim)
        self.norm_k = nn.LayerNorm(dim)
        self.norm_v = nn.LayerNorm(dim)
        self.fn = fn

    def forward(self, q, k, v, **kwargs):
        q = self.norm_q(q)
        k = self.norm_k(k)
        v = self.norm_v(v)
        return self.fn(q, k, v)


class DummyAttention(nn.Module):
    def __init__(self, dim):
        super().__init__()
        self.dim = dim
    
    def forward(self, q, k, v):
        batch_size = q.shape[0]
        return torch.zeros(batch_size, q.shape[1], self.dim)


dim = 4
fn = DummyAttention(dim)

INIT_ARGS = {
    'dim': dim,
    'fn': fn
}

ARGS = {
    'q': torch.randn(2, 3, dim),
    'k': torch.randn(2, 3, dim),
    'v': torch.randn(2, 3, dim)
}

model = PreNorm_qkv(**INIT_ARGS)
output = model(**ARGS)
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (2, 3, 4) — shape (2, 3, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
Transformer Ran
ran on a synthesized input
haoyu-ha/lnln/models/lnln.py
code served (permissive licence) · get_code("4e3cc466dd44fcfa")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned list. 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 numpy as np
from torch import nn

INIT_ARGS = {
    'num_frames': 6,
    'token_len': 2,
    'save_hidden': True,
    'dim': 4,
    'depth': 2,
    'heads': 2,
    'mlp_dim': 8,
    'pool': 'cls',
    'channels': 3,
    'dim_head': 4,
    'dropout': 0.0,
    'emb_dropout': 0.0
}

# Construct input tensor: batch=2, sequence_length=num_frames=6, feature_dim=dim=4
input_tensor = torch.randn(2, 6, 4)

ARGS = {
    'x': input_tensor
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
einops, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list — a list output has no array shape of its own; none is 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
TransformerEncoder Ran
ran on a synthesized input
haoyu-ha/lnln/models/lnln.py
code served (permissive licence) · get_code("a5f60555f90d2b05")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 3, dtype family float, shape (2, 3, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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
from torch import nn
from einops import rearrange, repeat
from torch import einsum

from torch import nn
from einops import rearrange, repeat
from torch import nn, einsum

class Attention(nn.Module):

    def __init__(self, dim, heads=8, dim_head=64, dropout=0.0):
        super().__init__()
        inner_dim = dim_head * heads
        project_out = not (heads == 1 and dim_head == dim)
        self.heads = heads
        self.scale = dim_head ** (-0.5)
        self.attend = nn.Softmax(dim=-1)
        self.to_q = nn.Linear(dim, inner_dim, bias=False)
        self.to_k = nn.Linear(dim, inner_dim, bias=False)
        self.to_v = nn.Linear(dim, inner_dim, bias=False)
        self.to_out = nn.Sequential(nn.Linear(inner_dim, dim), nn.Dropout(dropout)) if project_out else nn.Identity()

    def forward(self, q, k, v):
        b, n, _, h = (*q.shape, self.heads)
        q = self.to_q(q)
        k = self.to_k(k)
        v = self.to_v(v)
        q, k, v = map(lambda t: rearrange(t, 'b n (h d) -> b h n d', h=h), (q, k, v))
        dots = einsum('b h i d, b h j d -> b h i j', q, k) * self.scale
        attn = self.attend(dots)
        out = einsum('b h i j, b h j d -> b h i d', attn, v)
        out = rearrange(out, 'b h n d -> b n (h d)')
        return self.to_out(out)

class FeedForward(nn.Module):

    def __init__(self, dim, hidden_dim, dropout=0.0):
        super().__init__()
        self.net = nn.Sequential(nn.Linear(dim, hidden_dim), nn.GELU(), nn.Dropout(dropout), nn.Linear(hidden_dim, dim), nn.Dropout(dropout))

    def forward(self, x):
        return self.net(x)

class PreNorm(nn.Module):

    def __init__(self, dim, fn):
        super().__init__()
        self.norm = nn.LayerNorm(dim)
        self.fn = fn

    def forward(self, x, **kwargs):
        return self.fn(self.norm(x), **kwargs)

class PreNorm_qkv(nn.Module):

    def __init__(self, dim, fn):
        super().__init__()
        self.norm_q = nn.LayerNorm(dim)
        self.norm_k = nn.LayerNorm(dim)
        self.norm_v = nn.LayerNorm(dim)
        self.fn = fn

    def forward(self, q, k, v, **kwargs):
        q = self.norm_q(q)
        k = self.norm_k(k)
        v = self.norm_v(v)
        return self.fn(q, k, v)

class TransformerEncoder(nn.Module):

    def __init__(self, dim, depth, heads, dim_head, mlp_dim, dropout=0.0):
        super().__init__()
        self.layers = nn.ModuleList([])
        for _ in range(depth):
            self.layers.append(nn.ModuleList([PreNorm_qkv(dim, Attention(dim, heads=heads, dim_head=dim_head, dropout=dropout)), PreNorm(dim, FeedForward(dim, mlp_dim, dropout=dropout))]))

    def forward(self, x, save_hidden=False):
        if save_hidden == True:
            hidden_list = []
            hidden_list.append(x)
            for attn, ff in self.layers:
                x = attn(x, x, x) + x
                x = ff(x) + x
                hidden_list.append(x)
            return hidden_list
        else:
            for attn, ff in self.layers:
                x = attn(x, x, x) + x
                x = ff(x) + x
            return x


INIT_ARGS = {
    'dim': 4,
    'depth': 2,
    'heads': 2,
    'dim_head': 2,
    'mlp_dim': 8,
    'dropout': 0.0,
}

ARGS = {
    'x': torch.randn(2, 3, 4),
    'save_hidden': False,
}

if __name__ == '__main__':
    model = TransformerEncoder(**INIT_ARGS)
    output = model(**ARGS)
    print("Output shape:", output.shape)
    print("Output:", output)
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (2, 3, 4) — shape (2, 3, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
evaluate Ran
ran; our contract draft was wrong, not the code
Haoyu-ha/LNLN/robust_evaluation.py
code served (permissive licence) · get_code("980a7a91e8c19f50")
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) and returned dict. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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)

USE_CUDA = torch.cuda.is_available()
device = torch.device('cuda' if USE_CUDA else 'cpu')

# Build a minimal model that satisfies the function's usage
class MinimalMultimodalModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(12, 2)  # 4+4+4 input dims, 2 sentiment classes
    
    def forward(self, complete_input, incomplete_input):
        # incomplete_input is (vision_m, audio_m, text_m)
        vision_m, audio_m, text_m = incomplete_input
        # Concatenate all modalities
        combined = torch.cat([vision_m, audio_m, text_m], dim=1)
        # Output dict with 'sentiment_preds' key
        out = self.linear(combined)
        return {'sentiment_preds': out}

model = MinimalMultimodalModel()
model.to(device)

# Build eval_loader as a list of data dicts
eval_loader = [
    {
        'vision_m': torch.randn(2, 4),
        'audio_m': torch.randn(2, 4),
        'text_m': torch.randn(2, 4),
        'labels': {'M': torch.randint(0, 2, (2,))}
    },
    {
        'vision_m': torch.randn(2, 4),
        'audio_m': torch.randn(2, 4),
        'text_m': torch.randn(2, 4),
        'labels': {'M': torch.randint(0, 2, (2,))}
    }
]

# Build metrics function that takes (pred, true) and returns results dict
def metrics_fn(pred, true):
    # Simple accuracy metric
    accuracy = (pred.argmax(dim=1) == true).float().mean().item()
    return {'accuracy': accuracy}

ARGS = {
    'model': model,
    'eval_loader': eval_loader,
    'metrics': metrics_fn
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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)
haoyu-ha/lnln/models/lnln.py
code served (permissive licence) · get_code("70bc37d0c6b440f1")
How it ran

no invocation recorded.

CrossTransformer Not yet run
unverified (harvested, no recorded run)
haoyu-ha/lnln/models/lnln.py
code served (permissive licence) · get_code("a894a9c195e324dd")
How it ran

no invocation recorded.

GradientReversalFn Not yet run
unverified (harvested, no recorded run)
haoyu-ha/lnln/models/lnln.py
code served (permissive licence) · get_code("c891ae581eab6627")
How it ran

no invocation recorded.

LNLN Not yet run
unverified (harvested, no recorded run)
haoyu-ha/lnln/models/lnln.py
code served (permissive licence) · get_code("68bac151f1ad1031")
How it ran

no invocation recorded.

Also present in other papers' code

Of 14 samples lifted from this paper's linked repositories, 14 carry a function identity and 0 do not. Of the 14 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 0 later) and 13 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 dated earlier · 1 only as an assembly brick
2102.04830 (2021-02)
Learning Modality-Specific Representations with Self-Supervised Multi-Task Learning for Multimodal Sentiment Analysis
2303.13802 (2023-03)
Decoupled Multimodal Distilling for Emotion Recognition

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-22.

Repositories linked to this paper

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

Abstract

The field of Multimodal Sentiment Analysis (MSA) has recently witnessed an emerging direction seeking to tackle the issue of data incompleteness. Recognizing that the language modality typically contains dense sentiment information, we consider it as the dominant modality and present an innovative Languagedominated Noise-resistant Learning Network (LNLN) to achieve robust MSA. The proposed LNLN features a dominant modality correction (DMC) module and dominant modality based multimodal learning (DMML) module, which enhances the model's robustness across various noise scenarios by ensuring the quality of dominant modality representations. Aside from the methodical design, we perform comprehensive experiments under random data missing scenarios, utilizing diverse and meaningful settings on several popular datasets (e.g., MOSI, MOSEI, and SIMS), providing additional uniformity, transparency, and fairness compared to existing evaluations in the literature. Empirically, LNLN consistently outperforms existing baselines, demonstrating superior performance across these challenging and extensive evaluation metrics. 1

For agents

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

get_harvested_code_for_paper("2409.20012")
get_code_for_paper("2409.20012")
have("2409.20012")

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

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

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

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

Connect an agent — have() is free.