SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2603.10821 · 2026

Evaluating randomized smoothing as a defense against adversarial attacks in trajectory prediction

Jens Kober, Luca Laurenti, Julian Schumann, Arkady Zgonnikov, Eduardo Figueiredo, Frederik Baymler Mathiesen

arXiv · PDF · Open in the Atlas

Code that ran

1 of 3 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 1 has no contract verdict; 0 failures of our instrument; 2 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/2603.10821.json · badge: /api/ran/2603.10821.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
julianschumann/General-Framework-Smoothing community
Papers with Code archive
1 ran · 2 no recorded run
FunctionStatusWhere it lives
Control_action Ran
ran on a synthesized input
julianschumann/General-Framework-Smoothing/Framework/Perturbation_methods/Adversarial_classes/smoothing.py
code served (permissive licence) · get_code("c599a787484311ad")
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. 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

class Control_action:

    @staticmethod
    def Inverse_Dynamical_Model(positions_perturb, mask_data, dt, device):
        """
        Computes the control actions, heading, and velocity of agents in a perturbed positions dataset.

        Args:
            positions_perturb (torch.Tensor): A 4-dimensional tensor of shape (batch size, number agents, number time_steps, coordinates (x,y)).
            mask_data (torch.Tensor): A 4-dimensional tensor of shape (batch size, number agents, number time_steps X and Y, coordinates (x,y)).
            dt (float): The time difference between consecutive time steps.
            device (torch.device): The device on which to perform the computations (e.g., 'cpu' or 'cuda').

        Returns:
            tuple: A tuple containing:
                   - control_action (torch.Tensor): A tensor of shape (batch size, number agents, number time_steps - 1, 2)
                     containing the control actions.
                   - heading (torch.Tensor): A tensor of shape (batch size, number agents, number time_steps) containing the headings.
                   - velocity (torch.Tensor): A tensor of shape (batch size, number agents, number time_steps) containing the velocities.
        """
        control_action = torch.zeros((positions_perturb.shape[0], positions_perturb.shape[1], positions_perturb.shape[2] - 1, positions_perturb.shape[3])).to(device)
        heading = torch.zeros(positions_perturb.shape[:3]).to(device)
        velocity = torch.zeros(positions_perturb.shape[:3]).to(device)
        diff = positions_perturb[:, :, 1:, :] - positions_perturb[:, :, :-1, :]
        dist = torch.norm(diff, p=2, dim=-1)
        dist = torch.nan_to_num(dist, nan=2.0)
        dist_cum = torch.cumsum(dist, dim=-1)
        dist_cum = torch.cat([torch.zeros(*dist_cum.shape[:-1], 1).to(device), dist_cum], dim=-1)
        dist_cum_ind = torch.floor(dist_cum / 0.1)
        replace = dist_cum_ind[..., 1:] == dist_cum_ind[..., :-1]
        replace = torch.cat([torch.zeros(*replace.shape[:-1], 1).to(device).bool(), replace], dim=-1)
        replace[..., -1] = False
        replaceable = positions_perturb.isfinite().all(-1)
        replaceable = torch.flip(replaceable, dims=[-1])
        replaceable = torch.cumsum(replaceable.int(), dim=-1) > 0
        replaceable = torch.flip(replaceable, dims=[-1])
        replace[..., :-1] &= replaceable[..., 1:]
        positions_perturb_init = positions_perturb.clone()
        if replace.any():
            replace_sample, replace_agent, replace_time = torch.where(replace)
            prev_ind = replace_time - 1
            while replace[replace_sample, replace_agent, prev_ind].any():
                redo = replace[replace_sample, replace_agent, prev_ind]
                prev_ind[redo] = prev_ind[redo] - 1
            assert prev_ind.min() >= 0, 'Previous index is negative, which should not happen'
            next_ind = replace_time + 1
            while replace[replace_sample, replace_agent, next_ind].any():
                redo = replace[replace_sample, replace_agent, next_ind]
                next_ind[redo] = next_ind[redo] + 1
            assert next_ind.max() < positions_perturb.shape[2], 'Next index is out of bounds, which should not happen'
            Dist_cum_prev = dist_cum[replace_sample, replace_agent, prev_ind]
            Dist_cum_next = dist_cum[replace_sample, replace_agent, next_ind]
            Dist_cum_inter = dist_cum[replace_sample, replace_agent, replace_time]
            fac = (Dist_cum_inter - Dist_cum_prev) / (Dist_cum_next - Dist_cum_prev)
            fac = fac.nan_to_num()
            fac = fac.unsqueeze(-1)
            pos_prev = positions_perturb[replace_sample, replace_agent, prev_ind]
            pos_next = positions_perturb[replace_sample, replace_agent, next_ind]
            positions_perturb[replace_sample, replace_agent, replace_time] = fac * pos_next + (1 - fac) * pos_prev
        
        return control_action, heading, velocity


INIT_ARGS = {}

ARGS = {
    'positions_perturb': torch.randn(2, 3, 8, 2),
    'mask_data': torch.ones(2, 3, 8, 2),
    'dt': 0.1,
    'device': torch.device('cpu')
}

METHOD = 'Inverse_Dynamical_Model'

if __name__ == '__main__':
    control_obj = Control_action(**INIT_ARGS)
    result = getattr(control_obj, METHOD)(**ARGS)
    print("Control action shape:", result[0].shape)
    print("Heading shape:", result[1].shape)
    print("Velocity shape:", result[2].shape)
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
matplotlib, 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)
Helper Not yet run
unverified (harvested, no recorded run)
julianschumann/General-Framework-Smoothing/Framework/Perturbation_methods/Adversarial_classes/smoothing.py
code served (permissive licence) · get_code("1c01b1d50f10708d")
How it ran

no invocation recorded.

Smoothing Not yet run
unverified (harvested, no recorded run)
julianschumann/General-Framework-Smoothing/Framework/Perturbation_methods/Adversarial_classes/smoothing.py
code served (permissive licence) · get_code("b3e90f4dc47fc6ca")
How it ran

no invocation recorded.

Also present in other papers' code

Of 3 samples lifted from this paper's linked repositories, 3 carry a function identity and 0 do not. Of the 3 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 3 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

Accurate and robust trajectory prediction is essential for safe and efficient autonomous driving, yet recent work has shown that even state-of-the-art prediction models are highly vulnerable to inputs being mildly perturbed by adversarial attacks. Although model vulnerabilities to such attacks have been studied, work on effective countermeasures remains limited. In this work, we develop and evaluate a new defense mechanism for trajectory prediction models based on randomized smoothing -an approach previously applied successfully in other domains. We evaluate its ability to improve model robustness through a series of experiments that test different strategies of randomized smoothing. We show that our approach can consistently improve prediction robustness of multiple base trajectory prediction models in various datasets without compromising accuracy in non-adversarial settings. Our results demonstrate that randomized smoothing offers a simple and computationally inexpensive technique for mitigating adversarial attacks in trajectory prediction.

For agents

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

get_harvested_code_for_paper("2603.10821")
get_code_for_paper("2603.10821")
have("2603.10821")

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

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

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

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

Connect an agent — have() is free.