SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2410.03936 · NeurIPS · 2024

Learning Truncated Causal History Model for Video Restoration

Di Niu, Mohammad Salameh

arXiv · PDF · Open in the Atlas

Code that ran

7 of 12 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (5 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 6 have no contract verdict; 1 failure of our instrument; 5 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/2410.03936.json · badge: /api/ran/2410.03936.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
Ascend-Research/Turtle marked official in Papers with Code
Papers with Code archive
7 ran · 5 no recorded run
FunctionStatusWhere it lives
ChannelAttention Ran
ran on a synthesized input · constructed an object; no result was computed
Ascend-Research/Turtle/basicsr/models/archs/turtle_arch.py
code served (permissive licence) · get_code("b07cc66e024e5802")
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, ChannelAttention: 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)

# ChannelAttention expects:
# - dim: int (channel dimension)
# - num_heads: int (number of attention heads)
# - bias: bool (whether to use bias in convolutions)
# - forward() receives x tensor of shape (b, c, h, w)

ARGS = {
    "dim": 4,
    "num_heads": 2,
    "bias": True,
}

# Instantiate the model to verify it works
model = nn.Module.__new__(type(
    'ChannelAttention', (nn.Module,), {
        '__init__': lambda self, dim, num_heads, bias: (
            super(type(self), self).__init__(),
            setattr(self, 'dim', dim),
            setattr(self, 'bias', bias),
            setattr(self, 'num_heads', num_heads),
            setattr(self, 'temperature', nn.Parameter(torch.ones(num_heads, 1, 1))),
            setattr(self, 'qkv', nn.Conv2d(dim, dim * 3, kernel_size=1, bias=bias)),
            setattr(self, 'qkv_dwconv', nn.Conv2d(dim * 3, dim * 3, kernel_size=3, stride=1, padding=1, groups=dim * 3, bias=bias)),
            setattr(self, 'project_out', nn.Conv2d(dim, dim, kernel_size=1, bias=bias)),
        )[-1]
    }
))

# Test input: batch_size=2, channels=4, height=3, width=5
test_input = torch.randn(2, 4, 3, 5)
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ChannelAttention — 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 ChannelAttention 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
FeedForward Ran
ran on a synthesized input · constructed an object; no result was computed
Ascend-Research/Turtle/basicsr/models/archs/turtle_arch.py
code served (permissive licence) · get_code("e9335a8b80d8981e")
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, FeedForward: 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)

# FeedForward is a standalone module, so we need to construct arguments for __init__
# Parameters: c (channels), FFN_Expand (expansion factor), drop_out_rate (dropout rate)

ARGS = {
    'c': 4,
    'FFN_Expand': 2,
    'drop_out_rate': 0.1
}
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 FeedForward — 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 FeedForward 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
FrameHistoryRouter Ran
ran on a synthesized input · constructed an object; no result was computed
Ascend-Research/Turtle/basicsr/models/archs/turtle_arch.py
code served (permissive licence) · get_code("2d6705f2ef6c4ea6")
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, FrameHistoryRouter: 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 ARGS dict with all parameters for FrameHistoryRouter.__init__
ARGS = {
    'dim': 4,
    'num_heads': 2,
    'bias': True,
    'num_frames_tocache': 1,
}

# Create an instance to verify it works
model = nn.Module()
model.frame_router = None  # Placeholder

# Verify the setup by instantiating the module
from einops import rearrange

class FrameHistoryRouter(nn.Module):

    def __init__(self, dim, num_heads, bias, num_frames_tocache=1):
        super(FrameHistoryRouter, self).__init__()
        self.dim = dim
        self.bias = bias
        self.num_heads = num_heads
        self.temperature = nn.Parameter(torch.ones(num_heads, 1, 1))
        self.qkv = nn.Conv2d(dim, dim * 3, kernel_size=1, bias=bias)
        self.qkv_dwconv = nn.Conv2d(dim * 3, dim * 3, kernel_size=3, stride=1, padding=1, groups=dim * 3, bias=bias)
        self.project_out = nn.Conv2d(dim, dim, kernel_size=1, bias=bias)
        self.num_frames_tocache = num_frames_tocache

    def forward(self, x, k_cached=None, v_cached=None):
        b, c, h, w = x.shape
        qkv = self.qkv_dwconv(self.qkv(x))
        q, k, v = qkv.chunk(3, dim=1)
        q = rearrange(q, 'b (head c) h w -> b head c (h w)', head=self.num_heads)
        k = rearrange(k, 'b (head c) h w -> b head c (h w)', head=self.num_heads)
        v = rearrange(v, 'b (head c) h w -> b head c (h w)', head=self.num_heads)
        q = torch.nn.functional.normalize(q, dim=-1)
        k = torch.nn.functional.normalize(k, dim=-1)
        if k_cached is not None and v_cached is not None:
            k = torch.cat([k_cached, k], dim=2)
            v = torch.cat([v_cached, v], dim=2)
        attn = q @ k.transpose(-2, -1) * self.temperature
        attn = attn.softmax(dim=-1)
        out = attn @ v
        out = rearrange(out, 'b head c (h w) -> b (head c) h w', head=self.num_heads, h=h, w=w)
        out = self.project_out(out)
        num_cache_to_keep = int(self.num_frames_tocache * c / self.num_heads)
        return (out, k[:, :, -num_cache_to_keep:, :], v[:, :, -num_cache_to_keep:, :])


# Test instantiation
router = FrameHistoryRouter(**ARGS)

# Create sample input for forward pass testing
x = torch.randn(2, ARGS['dim'], 3, 5)  # batch=2, channels=4, height=3, width=5
output = router(x)

ARGS
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type FrameHistoryRouter — 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 FrameHistoryRouter 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
GatedFeedForward Ran
ran on a synthesized input · constructed an object; no result was computed
Ascend-Research/Turtle/basicsr/models/archs/turtle_arch.py
code served (permissive licence) · get_code("050d409ebfd41fdc")
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, GatedFeedForward: 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)

# GatedFeedForward.__init__ takes: self, dim, ffn_expansion_factor, bias
# GatedFeedForward.forward takes: self, x (a tensor)
# The forward method expects x to be a 4D tensor (batch, channels, height, width)
# based on Conv2d usage

ARGS = {
    'dim': 4,
    'ffn_expansion_factor': 2,
    'bias': True,
}
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 GatedFeedForward — 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 GatedFeedForward 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
ReducedAttn Ran
ran on a synthesized input
Ascend-Research/Turtle/basicsr/models/archs/turtle_arch.py
code served (permissive licence) · get_code("c2ca119c6231cc68")
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
import torch.nn as nn
import torch.nn.functional as F

class ReducedAttn(nn.Module):

    def __init__(self, c, DW_Expand=2.0, drop_out_rate=0.0):
        super().__init__()
        dw_channel = int(c * DW_Expand)
        self.conv1 = nn.Conv2d(in_channels=c, out_channels=dw_channel, kernel_size=1, padding=0, stride=1, groups=1, bias=True)
        self.conv2 = nn.Conv2d(in_channels=dw_channel, out_channels=dw_channel, kernel_size=3, padding=1, stride=1, groups=dw_channel, bias=True)
        self.conv3 = nn.Conv2d(in_channels=dw_channel, out_channels=c, kernel_size=1, padding=0, stride=1, groups=1, bias=True)
        self.dropout1 = nn.Dropout(drop_out_rate) if drop_out_rate > 0.0 else nn.Identity()
        self.beta = nn.Parameter(torch.zeros((1, c, 1, 1)), requires_grad=True)

    def forward(self, inp, k_cached=None, v_cached=None):
        x = self.conv1(inp)
        x = self.conv2(x)
        x = F.gelu(x)
        x = self.conv3(x)
        x = self.dropout1(x)
        return (x * self.beta, None, None)


INIT_ARGS = {
    'c': 4,
    'DW_Expand': 2.0,
    'drop_out_rate': 0.0,
}

ARGS = {
    'inp': torch.randn(2, 4, 3, 5),
    'k_cached': None,
    'v_cached': None,
}

if __name__ == '__main__':
    model = ReducedAttn(**INIT_ARGS)
    output = model(**ARGS)
    print("Output shapes:", [o.shape if isinstance(o, torch.Tensor) else o 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)
StateAlignBlock Ran
ran on a synthesized input · constructed an object; no result was computed
Ascend-Research/Turtle/basicsr/models/archs/turtle_arch.py
code served (permissive licence) · get_code("ddecee6c9e2c9a1b")
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, StateAlignBlock: 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
import math

torch.manual_seed(0)

ARGS = {
    "dim": 4,
    "num_heads": 2,
    "bias": True,
    "num_frames_tocache": 3,
    "Scale_patchsize": 1,
    "plot_attn": False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type StateAlignBlock — 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 StateAlignBlock 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
clipped_softmax Ran
ran; our contract draft was wrong, not the code
Ascend-Research/Turtle/basicsr/models/archs/turtle_arch.py
code served (permissive licence) · get_code("b590a818f9cac7b0")
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
import torch.nn.functional as F

torch.manual_seed(0)

# Create a small tensor with some zero and non-zero elements
# Shape: (2, 4) - batch size 2, dimension 4
tensor = torch.tensor([
    [1.0, 0.0, 2.0, 0.0],
    [0.0, 3.0, 1.0, 2.0]
])

ARGS = {
    "tensor": tensor,
    "dim": -1
}
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
CausalHistoryModel Not yet run
unverified (harvested, no recorded run)
Ascend-Research/Turtle/basicsr/models/archs/turtle_arch.py
code served (permissive licence) · get_code("5cdfb9da933b6657")
How it ran

no invocation recorded.

LatentCacheBlock Not yet run
unverified (harvested, no recorded run)
Ascend-Research/Turtle/basicsr/models/archs/turtle_arch.py
code served (permissive licence) · get_code("e5f9638afc133d36")
How it ran

no invocation recorded.

LevelBlock Not yet run
unverified (harvested, no recorded run)
Ascend-Research/Turtle/basicsr/models/archs/turtle_arch.py
code served (permissive licence) · get_code("0e0dc3c7bedb50e1")
How it ran

no invocation recorded.

Turtle Not yet run
unverified (harvested, no recorded run)
Ascend-Research/Turtle/basicsr/models/archs/turtle_arch.py
code served (permissive licence) · get_code("fd6c108754209f62")
How it ran

no invocation recorded.

TurtleAttnBlock Not yet run
unverified (harvested, no recorded run)
Ascend-Research/Turtle/basicsr/models/archs/turtle_arch.py
code served (permissive licence) · get_code("d3be814b170e0f4b")
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, 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 12 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-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

One key challenge to video restoration is to model the transition dynamics of video frames governed by motion. In this work, we propose TURTLE to learn the TRUncaTed causaL history modEl for efficient and high-performing video restoration. Unlike traditional methods that process a range of contextual frames in parallel, Turtle enhances efficiency by storing and summarizing a truncated history of the input frame latent representation into an evolving historical state. This is achieved through a sophisticated similarity-based retrieval mechanism that implicitly accounts for inter-frame motion and alignment. The causal design in TURTLE enables recurrence in inference through state-memorized historical features while allowing parallel training by sampling truncated video clips. We report new state-of-the-art results on a multitude of video restoration benchmark tasks, including video desnowing, nighttime video deraining, video raindrops and rain streak removal, video super-resolution, real-world and synthetic video deblurring, and blind video denoising while reducing the computational cost compared to existing best contextual methods on all these tasks. https://kjanjua26.github.io/turtle/ Recently, methods based on state space models (SSMs) have seen applications across several machine vision tasks, including image restoration [19,56], and video understanding [30]. While Video-Mamba [30] proposes a state space model for video understanding, the learned state space does not reason at the pixel level and, hence, can suffer from information collapse in restoration tasks [77].

For agents

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

get_harvested_code_for_paper("2410.03936")
get_code_for_paper("2410.03936")
have("2410.03936")

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

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

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

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

Connect an agent — have() is free.