SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2403.06659 · 2024

Zero-Shot ECG Classification with Multimodal Learning and Test-time Clinical Knowledge Enhancement

arXiv · PDF · Open in the Atlas

Code that ran

8 of 12 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; 1 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 6 failures of our instrument; 4 no recorded run), measured 2026-11-23; 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/2403.06659.json · badge: /api/ran/2403.06659.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
cheliu-computation/merl canonical (classifier label)
classifier basis: census
8 ran · 4 no recorded run
FunctionStatusWhere it lives
ResNet18 Ran
ran; our contract draft was wrong, not the code
cheliu-computation/merl/finetune/models/resnet1d.py
code served (permissive licence) · get_code("6d247f814f9a7559")
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 ResNet. 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)

ARGS = {
    "num_classes": 10
}
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 ResNet — a ResNet output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ResNet 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
ResNet34 Ran
ran; our contract draft was wrong, not the code
cheliu-computation/merl/finetune/models/resnet1d.py
code served (permissive licence) · get_code("4d972ff40178697e")
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 ResNet. 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)

ARGS = {
    "num_classes": 10
}
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 ResNet — a ResNet output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ResNet 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
ResNet50 Ran
ran; our contract draft was wrong, not the code
cheliu-computation/merl/finetune/models/resnet1d.py
code served (permissive licence) · get_code("73b458636b1bb0bd")
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 ResNet. 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)

ARGS = {
    'num_classes': 10
}
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 ResNet — a ResNet output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ResNet 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
compute_AUCs Ran
ran on a synthesized input
cheliu-computation/merl/utils/zeroshot_val.py
code served (permissive licence) · get_code("be1231d1e98a796f")
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 list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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

torch.manual_seed(0)

# Create small tensors for ground truth and predictions
# Shape: [n_samples=2, n_classes=4]
n_samples = 2
n_class = 4

# Ground truth: binary labels (0 or 1)
gt = torch.randint(0, 2, (n_samples, n_class), dtype=torch.float32)

# Predictions: probability estimates between 0 and 1
pred = torch.rand(n_samples, n_class, dtype=torch.float32)

ARGS = {
    "gt": gt,
    "pred": pred,
    "n_class": n_class
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
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: none by the harness; any seed is in the setup block
get_class_emd Ran
ran, honoured the contract we drafted
cheliu-computation/merl/utils/zeroshot_val.py
code served (permissive licence) · get_code("5f4556f64c743109")
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 Tensor, ndim 2, dtype family float, shape (4, 3) as a later run recorded it. 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, 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
import torch.nn as nn

torch.manual_seed(0)

class MockTokenizer:
    def __call__(self, texts):
        # Return a mock tokenized output with input_ids and attention_mask
        batch_size = len(texts)
        seq_len = 5
        input_ids = torch.randint(0, 1000, (batch_size, seq_len))
        attention_mask = torch.ones(batch_size, seq_len)
        
        class TokenizedOutput:
            pass
        
        output = TokenizedOutput()
        output.input_ids = input_ids
        output.attention_mask = attention_mask
        return output

class MockModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.text_encoder = nn.Linear(5, 8)
        self.proj_t = nn.Linear(8, 4)
    
    def _tokenize(self, texts):
        tokenizer = MockTokenizer()
        return tokenizer(texts)
    
    def get_text_emb(self, input_ids, attention_mask):
        # Simple mock: just average pool the input_ids as embeddings
        batch_size = input_ids.shape[0]
        embeddings = torch.randn(batch_size, 8)
        return embeddings

model = MockModel()
class_names = ['dog', 'cat', 'bird']
device = 'cpu'

ARGS = {
    'model': model,
    'class_name': class_names,
    'device': device
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, tqdm — 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 (4, 3) — shape (4, 3) 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: none by the harness; any seed is in the setup block
get_ecg_emd Ran
ran; our contract draft was wrong, not the code
cheliu-computation/merl/utils/zeroshot_val.py
code served (permissive licence) · get_code("7f500d29d602d34e")
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 ndarray, ndim 2, dtype family float, shape (2, 3) as a later run recorded it. 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, 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
import torch.nn as nn
import numpy as np
from torch.utils.data import DataLoader

torch.manual_seed(0)

# Define a minimal model with ext_ecg_emb method
class MinimalECGModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.embedding_layer = nn.Linear(5, 8)
    
    def ext_ecg_emb(self, x):
        return self.embedding_layer(x)

# Create model instance
model = MinimalECGModel()

# Create tiny ECG data and targets
ecg_data = torch.randn(2, 5)  # batch_size=2, ecg_features=5
target_data = torch.tensor([0, 1])

# Create a simple data loader from list of tuples
loader = [(ecg_data, target_data)]

# Create zeroshot_weights: shape (embedding_dim, num_classes)
# Model outputs embeddings of dim 8, so zeroshot_weights should be (8, 3)
zeroshot_weights = torch.randn(8, 3)

# Set device to CPU
device = 'cpu'

# Set softmax_eval flag
softmax_eval = True

ARGS = {
    'model': model,
    'loader': loader,
    'zeroshot_weights': zeroshot_weights,
    'device': device,
    'softmax_eval': softmax_eval
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch, tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (2, 3) — shape (2, 3) 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: none by the harness; any seed is in the setup block
infer Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
cheliu-computation/merl/finetune/main_single.py
code served (permissive licence) · get_code("9eaf55ea5bb1d3ba")
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 tuple. 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
import numpy as np

torch.manual_seed(0)

# Define a minimal model that satisfies the function's usage
class MinimalECGModel(nn.Module):
    def __init__(self, num_classes=5):
        super().__init__()
        self.linear = nn.Linear(4, num_classes)
    
    def forward(self, x):
        return self.linear(x)

# Create model instance
model = MinimalECGModel(num_classes=5)
model.eval()

# Create a minimal data loader with 2 batches
# Each batch contains (ecg_tensor, target_tensor)
# ECG: shape (batch_size, 4) - small ECG signal
# Target: shape (batch_size, 5) - 5 class labels (multilabel)
loader = [
    (torch.randn(2, 4), torch.randint(0, 2, (2, 5)).float()),
    (torch.randn(2, 4), torch.randint(0, 2, (2, 5)).float()),
]

# Create args with labels_name attribute
class Args:
    def __init__(self):
        self.labels_name = ['class_0', 'class_1', 'class_2', 'class_3', 'class_4']

args = Args()

ARGS = {
    'model': model,
    'loader': loader,
    'args': args,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, pandas, sklearn, torch, tqdm — 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: none by the harness; any seed is in the setup block
precision_at_k Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
cheliu-computation/merl/utils/utils_loss.py
code served (permissive licence) · get_code("e5487ec054cd281e")
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 list, ndim 2, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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

torch.manual_seed(0)

# Create small tensors
# output: batch_size=2, num_classes=4 (logits for classification)
output = torch.randn(2, 4)

# target: batch_size=2 (class indices)
target = torch.tensor([1, 3])

# top_k: tuple of k values to compute precision at
top_k = (1, 2)

ARGS = {
    "output": output,
    "target": target,
    "top_k": top_k,
}
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 list, ndim 2, dtype family float — a list output has no array shape of its own; none is stated
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: none by the harness; any seed is in the setup block
clip_loss Not yet run
unverified (harvested, no recorded run)
cheliu-computation/merl/utils/utils_loss.py
code served (permissive licence) · get_code("19c632192cb40d5c")
How it ran

no invocation recorded.

vit_middle Not yet run
unverified (harvested, no recorded run)
cheliu-computation/merl/finetune/models/vit1d.py
code served (permissive licence) · get_code("42fddfcd0b5f7db0")
How it ran

no invocation recorded.

vit_small Not yet run
unverified (harvested, no recorded run)
cheliu-computation/merl/finetune/models/vit1d.py
code served (permissive licence) · get_code("b86b9766958f2e32")
How it ran

no invocation recorded.

vit_tiny Not yet run
unverified (harvested, no recorded run)
cheliu-computation/merl/finetune/models/vit1d.py
code served (permissive licence) · get_code("5bc84c9b81db6507")
How it ran

no invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 5 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 1 the same month, 1 later) and 7 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
ResNet18 11 other papers
6 dated earlier, 2 the same month, 1 later, 2 same year, order not determinable
1911.00068 (2019-11)
Confident Learning: Estimating Uncertainty in Dataset Labels
2008.00627 (2020-08)
Learning to Purify Noisy Labels via Meta Soft Label Corrector
136850512 (2022 (year only))
Rethinking Confidence Calibration for Failure Prediction
and 8 more not named here
ResNet34 3 other papers
3 dated earlier
1911.00068 (2019-11)
Confident Learning: Estimating Uncertainty in Dataset Labels
2008.00627 (2020-08)
Learning to Purify Noisy Labels via Meta Soft Label Corrector
2310.18910 (2023-10)
InstanT: Semi-supervised Learning with Instance-dependent Thresholds
ResNet50 1 other paper
1 dated earlier
1911.00068 (2019-11)
Confident Learning: Estimating Uncertainty in Dataset Labels
clip_loss 1 other paper
1 dated earlier
2312.01522 (2023-12)
G2D: From Global to Dense Radiography Representation Learning via Vision-Language Pre-training
precision_at_k 1 other paper
1 dated earlier
2312.01522 (2023-12)
G2D: From Global to Dense Radiography Representation Learning via Vision-Language Pre-training

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

Repositories linked to this paper

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

Abstract

Electrocardiograms (ECGs) are non-invasive diagnostic tools crucial for detecting cardiac arrhythmic diseases in clinical practice. While ECG Self-supervised Learning (eSSL) methods show promise in representation learning from unannotated ECG data, they often overlook the clinical knowledge that can be found in reports. This oversight and the requirement for annotated samples for downstream tasks limit eSSL's versatility. In this work, we address these issues with the Multimodal ECG Representation Learning (MERL}) framework. Through multimodal learning on ECG records and associated reports, MERL is capable of performing zero-shot ECG classification with text prompts, eliminating the need for training data in downstream tasks. At test time, we propose the Clinical Knowledge Enhanced Prompt Engineering (CKEPE) approach, which uses Large Language Models (LLMs) to exploit external expert-verified clinical knowledge databases, generating more descriptive prompts and reducing hallucinations in LLM-generated content to boost zero-shot classification. Based on MERL, we perform the first benchmark across six public ECG datasets, showing the superior performance of MERL compared against eSSL methods. Notably, MERL achieves an average AUC score of 75.2% in zero-shot classification (without training data), 3.2% higher than linear probed eSSL methods with 10\% annotated training data, averaged across all six datasets. Code and models are available at https://github.com/cheliu-computation/MERL

For agents

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

get_harvested_code_for_paper("2403.06659")
get_code_for_paper("2403.06659")
have("2403.06659")

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

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

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

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

Connect an agent — have() is free.