SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2302.05783 · ICML · 2023

ConCerNet: A Contrastive Learning Based Framework for Automated Conservation Law Discovery and Trustworthy Dynamical System Prediction

Subhro Das, Luca Daniel, Lam Nguyen, Tsui-Wei Weng, Wang Zhang, Alexandre Megretski

arXiv · PDF · Open in the Atlas

Code that ran

6 of 7 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; 3 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 3 failures of our instrument; 1 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/2302.05783.json · badge: /api/ran/2302.05783.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
wz16/concernet canonical (classifier label)
classifier basis: classifier_2025
5 ran · 1 no recorded run
copy not recorded community
not in the paper's declared repositories
1 ran · 0 no recorded run
FunctionStatusWhere it lives
MSE Ran
ran, honoured the contract we drafted
wz16/concernet/train_contrastive_conservation.py
code served (permissive licence) · get_code("47e5596498a1fdfc")
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 tuple, 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

torch.manual_seed(0)

# MSE function takes two arguments: x and y
# Both are used in arithmetic operations (subtraction, squaring, mean)
# They should be tensors of the same shape

x = torch.randn(2, 4)
y = torch.randn(2, 4)

ARGS = {
    "x": x,
    "y": y,
}
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 tuple, ndim 1, dtype family float — a tuple 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
count_parameters Ran
ran, honoured the contract we drafted
this paper's copy was not recorded; identical code first harvested from crisbodnar/ndp
pointer only · get_code("f6b944f50d3f15ae")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

evaluate Ran
ran, honoured the contract we drafted
wz16/concernet/simple_projection_layer_demo.py
code served (permissive licence) · get_code("0610fd33a23e90cc")
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 float, ndim 0, dtype family float, shape () 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
import torch.nn as nn

torch.manual_seed(0)

# Create a minimal wrapper model that satisfies the forward() function's usage
class WrapperModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, input_data):
        # Handle both cases: single tensor or tuple of (tensor, shape_value)
        if isinstance(input_data, tuple):
            x, shape_val = input_data
            return self.linear(x)
        else:
            return self.linear(input_data)

wrapper_model = WrapperModel()

# Create test data loader with distinct dimensions
# x has shape (batch=2, features=4)
# fx has shape (batch=2, output=3)
test_loader = [
    (torch.randn(2, 4), torch.randn(2, 3)),
    (torch.randn(2, 4), torch.randn(2, 3)),
]

# Create a loss function
loss_func = nn.MSELoss()

ARGS = {
    "wrapper_model": wrapper_model,
    "test_loader": test_loader,
    "loss_func": loss_func,
}
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 float, ndim 0, dtype family float, shape () — shape () 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
square_ratio_loss Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
wz16/concernet/train_contrastive_conservation.py
code served (permissive licence) · get_code("d88eb049773bf0df")
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 Tensor, ndim 0, dtype family float; no output shape is stated. 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 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)

# The function expects:
# - features: a tensor of shape (num_label, len_traj, num_traj_output)
#   where num_label > 1 and len_traj > 1
# - x: optional parameter (not used in function body)

# Create a small features tensor
# num_label=2, len_traj=3, num_traj_output=4
features = torch.randn(2, 3, 4)

# x is optional and not used in the function
x = None

ARGS = {
    'features': features,
    'x': x,
}
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 Tensor, ndim 0, dtype family float — no output shape is stated: observe_signature.py could not observe it (call:AssertionError)
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
train Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
wz16/concernet/train_dynamics.py
code served (permissive licence) · get_code("27532e4f2baa8924")
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 WrapperModel. 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 argparse

torch.manual_seed(0)

# Create a minimal autoencoder model
class MinimalAE(nn.Module):
    def __init__(self, input_dim, latent_dim):
        super().__init__()
        self.encoder = nn.Linear(input_dim, latent_dim)
        self.decoder = nn.Linear(latent_dim, input_dim)
    
    def encode(self, x):
        return self.encoder(x)
    
    def decode(self, z):
        return self.decoder(z)
    
    def forward(self, x):
        z = self.encode(x)
        return self.decode(z)

# Create a minimal dynamics model
class MinimalDynamicsModel(nn.Module):
    def __init__(self, input_dim, output_dim):
        super().__init__()
        self.linear = nn.Linear(input_dim, output_dim)
    
    def forward(self, x):
        return self.linear(x)

# Create a minimal wrapper model
class WrapperModel(nn.Module):
    def __init__(self, dynamics_model, ae_model=None, ae_mode=False):
        super().__init__()
        self.dynamics_model = dynamics_model
        self.ae_model = ae_model
        self.ae_mode = ae_mode
    
    def forward(self, x):
        if isinstance(x, tuple):
            x_tensor, _ = x
            return self.dynamics_model(x_tensor)
        else:
            return self.dynamics_model(x)
    
    def train(self):
        super().train()

# Set up dimensions
input_dim = 5
output_dim = 3
latent_dim = 4
batch_size = 2

# Create models
dynamics_model = MinimalDynamicsModel(input_dim, output_dim)
ae_model = MinimalAE(input_dim, latent_dim)
wrapper_model = WrapperModel(dynamics_model, ae_model, ae_mode=False)

# Create dummy data
n_train = 4
n_test = 2

x_data = torch.randn(n_train, input_dim)
fx_data = torch.randn(n_train, output_dim)
test_x_data = torch.randn(n_test, input_dim)
test_fx_data = torch.randn(n_test, output_dim)

data = {
    'x': x_data.numpy(),
    'fx': fx_data.numpy(),
    'test_x': test_x_data.numpy(),
    'test_fx': test_fx_data.numpy(),
}

# Create args namespace
args = argparse.Namespace(
    epochs=2,
    batch_size=batch_size,
    learning_rate=0.001,
    wrapper_mode='default',
    dynamics_model_input_dim=latent_dim,
)

ARGS = {
    'wrapper_model': wrapper_model,
    'data': data,
    'args': args,
}
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 WrapperModel — a WrapperModel output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a WrapperModel 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
train_traj_repre Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
wz16/concernet/train_contrastive_conservation.py
code served (permissive licence) · get_code("66fddeb650dafe32")
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 SimpleModel. 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)

class SimpleModel(nn.Module):
    def __init__(self, input_dim, output_dim):
        super().__init__()
        self.linear = nn.Linear(input_dim, output_dim)
    
    def forward(self, x):
        # x shape: (batch_size, input_dim)
        # Need to output shape (batch_size, len_traj, num_traj_output)
        batch_size = x.shape[0]
        output = self.linear(x)  # (batch_size, output_dim)
        # Reshape to (batch_size, len_traj, num_traj_output)
        return output.view(batch_size, 2, 2)

class SimpleAEModel(nn.Module):
    def __init__(self, input_dim, latent_dim):
        super().__init__()
        self.encoder = nn.Linear(input_dim, latent_dim)
    
    def encode(self, x):
        return self.encoder(x)

class SimpleArgs:
    def __init__(self):
        self.epochs = 2
        self.batch_size = 2
        self.learning_rate = 0.001
        self.loss_func = 'square_ratio'

# Create model
model = SimpleModel(input_dim=4, output_dim=4)

# Create data dictionary
# x shape: (num_samples, input_dim) = (4, 4)
# After model forward: (4, 2, 2) where 2 is len_traj and 2 is num_traj_output
# fx shape: (num_samples, len_traj, num_traj_output) = (4, 2, 2)
data = {
    'x': np.random.randn(4, 4).astype(np.float32),
    'fx': np.random.randn(4, 2, 2).astype(np.float32),
    'test_x': np.random.randn(2, 4).astype(np.float32),
    'test_fx': np.random.randn(2, 2, 2).astype(np.float32),
}

# Create dynamics (not used in the function body)
dynamics = None

# Create args
args = SimpleArgs()

# Create ae_model
ae_model = SimpleAEModel(input_dim=4, latent_dim=4)

ARGS = {
    'model': model,
    'data': data,
    'dynamics': dynamics,
    'args': args,
    'ae_model': ae_model,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type SimpleModel — a SimpleModel output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a SimpleModel 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
get_data Not yet run
unverified (harvested, no recorded run)
wz16/concernet/simple_projection_layer_demo.py
code served (permissive licence) · get_code("642d5b6e8bd5880b")
How it ran

no invocation recorded.

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 1 the same month, 1 later) and 6 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
count_parameters 180 other papers
79 dated earlier, 2 the same month, 95 later, 4 same year, order not determinable · 8 only as an assembly brick
1705.08415 (2017-05)
Supervised Community Detection with Line Graph Neural Networks
1707.01926 (2017-07)
Diffusion Convolutional Recurrent Neural Network: Data-Driven Traffic Forecasting
1808.09367 (2018-08)
Deriving Machine Attention from Human Rationales
and 177 more not named here

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

Deep neural networks (DNN) have shown great capacity of modeling a dynamical system; nevertheless, they usually do not obey physics constraints such as conservation laws. This paper proposes a new learning framework named ConCer-Net to improve the trustworthiness of the DNN based dynamics modeling to endow the invariant properties. ConCerNet consists of two steps: (i) a contrastive learning method to automatically capture the system invariants (i.e. conservation properties) along the trajectory observations; (ii) a neural projection layer to guarantee that the learned dynamics models preserve the learned invariants. We theoretically prove the functional relationship between the learned latent representation and the unknown system invariant function. Experiments show that our method consistently outperforms the baseline neural networks in both coordinate error and conservation metrics by a large margin. With neural network based parameterization and no dependence on prior knowledge, our method can be extended to complex and largescale dynamics by leveraging an autoencoder.

For agents

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

get_harvested_code_for_paper("2302.05783")
get_code_for_paper("2302.05783")
have("2302.05783")

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

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

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

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

Connect an agent — have() is free.