SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2608.13215 · 2026

History-informed Lagrangian Neural Networks

He Cao, Tianshuo Zhang, Wenzhe Zhai, Jia Gao

arXiv · PDF · Open in the Atlas

Code that ran

6 of 6 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (3 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 3 failures of our instrument; 0 no recorded run), measured 2026-11-24; 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/2608.13215.json · badge: /api/ran/2608.13215.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
yingtian22/History-informed-LNN community
Papers with Code archive
6 ran · 0 no recorded run
FunctionStatusWhere it lives
ContextLagrangianCore Ran
ran on a synthesized input · constructed an object; no result was computed
yingtian22/History-informed-LNN/src/models/hilnn.py
code served (permissive licence) · get_code("c471c61092045335")
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, ContextLagrangianCore: 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)

q_dim = 4
context_dim = 3
hidden_dim = 128
eps = 0.001

ARGS = {
    "q_dim": q_dim,
    "context_dim": context_dim,
    "hidden_dim": hidden_dim,
    "eps": eps,
}
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 ContextLagrangianCore — 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 ContextLagrangianCore 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
GRUHistoryEncoder Ran
ran on a synthesized input · constructed an object; no result was computed
yingtian22/History-informed-LNN/src/models/hilnn.py
code served (permissive licence) · get_code("f776a16074807b95")
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, GRUHistoryEncoder: 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)

# Define the GRUHistoryEncoder class
class GRUHistoryEncoder(nn.Module):
    """Encode position history into latent mechanical context z_t."""

    def __init__(self, q_dim: int, hidden_dim: int=64, context_dim: int=32, num_layers: int=1):
        super().__init__()
        self.q_dim = q_dim
        self.context_dim = context_dim
        self.gru = nn.GRU(input_size=q_dim, hidden_size=hidden_dim, num_layers=num_layers, batch_first=True)
        self.proj = nn.Sequential(nn.Linear(hidden_dim, hidden_dim), nn.Tanh(), nn.Linear(hidden_dim, context_dim))

    def forward(self, hist_q: torch.Tensor) -> torch.Tensor:
        """hist_q: [B, L, q_dim] -> z: [B, context_dim]"""
        _, h = self.gru(hist_q)
        return self.proj(h[-1])


# Construct arguments for the __init__ method
q_dim = 4
hidden_dim = 8
context_dim = 3
num_layers = 1

ARGS = {
    "q_dim": q_dim,
    "hidden_dim": hidden_dim,
    "context_dim": context_dim,
    "num_layers": num_layers
}
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 GRUHistoryEncoder — 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 GRUHistoryEncoder 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
HiLNN Ran
ran on a synthesized input · constructed an object; no result was computed
yingtian22/History-informed-LNN/src/models/hilnn.py
code served (permissive licence) · get_code("0c095344f70cda8e")
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, HiLNN: 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)

ARGS = {
    "q_dim": 2,
    "history_len": 8,
    "context_dim": 4,
    "encoder_hidden_dim": 16,
    "encoder_num_layers": 1,
    "core_hidden_dim": 32,
    "eps": 0.001,
}
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 HiLNN — 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 HiLNN 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
euler_step Ran
ran; our contract draft was wrong, not the code
yingtian22/History-informed-LNN/src/models/hilnn.py
code served (permissive licence) · get_code("c4472cd0e3b92770")
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 (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

torch.manual_seed(0)

# Define a simple dynamics function that takes a tensor and returns a tensor of the same shape
def simple_dynamics(x: torch.Tensor) -> torch.Tensor:
    return torch.sin(x)

# Create a small input tensor (batch_size=2, dim=4)
x = torch.randn(2, 4)

# Define the time step
dt = 0.01

# Construct the ARGS dictionary
ARGS = {
    "dynamics": simple_dynamics,
    "x": x,
    "dt": dt
}
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 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: none by the harness; any seed is in the setup block
rk4_step Ran
ran; our contract draft was wrong, not the code
yingtian22/History-informed-LNN/src/models/hilnn.py
code served (permissive licence) · get_code("f256aa8992c367f5")
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 (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

torch.manual_seed(0)

# Define a simple dynamics function that takes a tensor and returns a tensor of the same shape
def simple_dynamics(x: torch.Tensor) -> torch.Tensor:
    return -x  # Simple linear dynamics: dx/dt = -x

# Create a small state tensor (batch_size=2, state_dim=4)
x = torch.randn(2, 4)

# Time step
dt = 0.01

ARGS = {
    "dynamics": simple_dynamics,
    "x": x,
    "dt": dt,
}
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 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: none by the harness; any seed is in the setup block
rollout Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
yingtian22/History-informed-LNN/src/models/hilnn.py
code served (permissive licence) · get_code("49cea354592c9d0a")
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 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
import torch.nn as nn

torch.manual_seed(0)

# Define a simple dynamics function as an nn.Module
class SimpleDynamics(nn.Module):
    def __init__(self, state_dim):
        super().__init__()
        self.linear = nn.Linear(state_dim, state_dim)
    
    def forward(self, x):
        return self.linear(x)

# Create instances
state_dim = 4
batch_size = 2
dynamics_model = SimpleDynamics(state_dim)

# Create initial state [B, state_dim]
x0 = torch.randn(batch_size, state_dim)

# Create a dynamics function (callable that takes tensor and returns tensor)
def dynamics_fn(x):
    return dynamics_model(x)

# Set parameters
dt = 0.01
horizon = 3
method = 'rk4'
detach_between_steps = False

ARGS = {
    'dynamics': dynamics_fn,
    'x0': x0,
    'dt': dt,
    'horizon': horizon,
    'method': method,
    'detach_between_steps': detach_between_steps
}
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 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: none by the harness; any seed is in the setup block

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, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 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.

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

Repositories linked to this paper

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

Abstract

Forecasting the long-horizon evolution of mechanical systems from position-only observations is a pivotal yet difficult task, as hidden velocities and trajectory-specific physical properties must be inferred simultaneously. Although physics-guided neural networks like Lagrangian Neural Networks (LNNs) guarantee physical plausibility, they generally require complete state inputs and lack adaptability to changing system parameters. To break these limitations, we introduce Historyinformed Lagrangian Neural Networks (HiLNN). Grounded in the insight that temporal position sequences implicitly encode underlying dynamics, HiLNN employs a recurrent encoder to extract a latent context from history. This context not only reconstructs the unobserved initial velocity but also adaptively modulates the mass matrix, potential energy, and damping coefficients of a structured Lagrangian system. By leveraging a differentiable RK4 rollout scheme, the entire pipeline is optimized end-toend under multi-step trajectory supervision and energy-consistency regularization. Empirical evaluations across conservative, dissipative, and heterogeneous variable-parameter systems show that HiLNN delivers superior long-term prediction accuracy and maintains precise energy profiles compared to state-of-the-art baselines. The source code is publicly available at https://github.com/yingtian22/History-informed-LNN.

For agents

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

get_harvested_code_for_paper("2608.13215")
get_code_for_paper("2608.13215")
have("2608.13215")

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

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

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

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

Connect an agent — have() is free.