SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2210.06609 · 2022

TrafficGen: Learning to Generate Diverse and Realistic Traffic Scenarios

arXiv · PDF · Open in the Atlas

Code that ran

7 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; 0 honoured the contract we drafted, 0 violated it and 7 have no contract verdict; 0 failures of our instrument; 0 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/2210.06609.json · badge: /api/ran/2210.06609.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
metadriverse/trafficgen community (classifier label)
classifier basis not recorded on the link
7 ran · 0 no recorded run
FunctionStatusWhere it lives
act_loss Ran
ran on a synthesized input
metadriverse/trafficgen/trafficgen/act/model/tg_act.py
code served (permissive licence) · get_code("467cfdf8ba25d0dc")
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, 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)

# Construct pred dict with required keys: 'prob', 'velo', 'pos', 'heading'
batch_size = 2
num_modes = 6
num_timesteps = 5
pos_dim = 2
velo_dim = 2
heading_dim = 1

pred = {
    'prob': torch.randn(batch_size, num_modes),  # (2, 6)
    'velo': torch.randn(batch_size, num_modes, num_timesteps, velo_dim),  # (2, 6, 5, 2)
    'pos': torch.randn(batch_size, num_modes, num_timesteps, pos_dim),  # (2, 6, 5, 2)
    'heading': torch.randn(batch_size, num_modes, num_timesteps)  # (2, 6, 5)
}

# Construct gt dict with required keys: 'gt_pos', 'gt_vel', 'gt_heading'
gt = {
    'gt_pos': torch.randn(batch_size, num_timesteps, pos_dim),  # (2, 5, 2)
    'gt_vel': torch.randn(batch_size, num_timesteps, velo_dim),  # (2, 5, 2)
    'gt_heading': torch.randn(batch_size, num_timesteps)  # (2, 5)
}

ARGS = {
    'pred': pred,
    'gt': gt
}
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 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
attention Ran
ran on a synthesized input
metadriverse/trafficgen/trafficgen/act/utils/model_utils.py
code served (permissive licence) · get_code("b221aff3b6d88bb6")
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. 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 math
import torch
import torch.nn as nn

torch.manual_seed(0)

# Define tiny tensors for attention computation
# batch_size=2, seq_len=3, d_k=4
batch_size = 2
seq_len = 3
d_k = 4

query = torch.randn(batch_size, seq_len, d_k)
key = torch.randn(batch_size, seq_len, d_k)
value = torch.randn(batch_size, seq_len, d_k)

# Optional mask: shape (batch_size, seq_len, seq_len)
# 1s where we want attention, 0s where we want to mask
mask = torch.ones(batch_size, seq_len, seq_len)

# Optional dropout layer
dropout = nn.Dropout(p=0.1)

ARGS = {
    "query": query,
    "key": key,
    "value": value,
    "mask": mask,
    "dropout": dropout,
}
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 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
cal_rel_dir Ran
ran on a synthesized input
metadriverse/trafficgen/trafficgen/act_dataset.py
code served (permissive licence) · get_code("5b3a9f0588c19582")
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 1, dtype family float, shape (6,) 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 numpy as np

# The function cal_rel_dir takes two direction arrays and calculates relative directions
# by normalizing angles to [0, 2π) range and then adjusting to [-π, π) range

# Create small numpy arrays representing angles (in radians)
# These should be 1D or multidimensional arrays of angles
dir1 = np.array([0.5, 1.0, 2.0, 3.5, 5.0, 6.0])
dir2 = np.array([0.2, 0.8, 1.5, 3.0, 4.5, 5.5])

ARGS = {
    "dir1": dir1,
    "dir2": dir2
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (6,) — shape (6,) 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
clones Ran
ran on a synthesized input
metadriverse/trafficgen/trafficgen/act/utils/model_utils.py
code served (permissive licence) · get_code("3a8e240203d9f9a3")
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 ModuleList. 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
from copy import deepcopy

torch.manual_seed(0)

# Create a simple nn.Module instance to clone
class SimpleModule(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

module = SimpleModule()
n = 5

ARGS = {
    "module": module,
    "n": n
}
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 ModuleList — a ModuleList output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ModuleList output the recorded ndim 1 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
process_lane Ran
ran on a synthesized input
metadriverse/trafficgen/trafficgen/act_dataset.py
code served (permissive licence) · get_code("3d3484398ecd137e")
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. 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 numpy as np

# Construct lane data with shape (batch_size, num_points, lane_dim)
# lane_dim should be at least 5 (indices 0, 1, 2, 4, -2)
batch_size = 2
num_points = 8
lane_dim = 5

# Create lane data
# Columns: [x, y, z, unused, lane_id]
lane = np.zeros((batch_size, num_points, lane_dim))

# Set x coordinates (column 0)
lane[:, :, 0] = np.linspace(-50, -30, num_points)

# Set y coordinates (column 1)
lane[:, :, 1] = np.linspace(-10, 10, num_points)

# Set z coordinates (column 2)
lane[:, :, 2] = np.linspace(0, 5, num_points)

# Set column 4 (used in vector construction)
lane[:, :, 4] = np.linspace(1, 2, num_points)

# Set lane_id (column -2, which is column 3 when lane_dim=5)
lane[:, 0:4, 3] = 1  # First lane
lane[:, 4:, 3] = 2   # Second lane

max_vec = 10
lane_range = 20
offset = -40

ARGS = {
    'lane': lane,
    'max_vec': max_vec,
    'lane_range': lane_range,
    'offset': offset
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — 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
rotate Ran
ran on a synthesized input
metadriverse/trafficgen/trafficgen/act_dataset.py
code served (permissive licence) · get_code("a948ec19de381eb1")
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, 4, 2) 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 numpy as np

torch.manual_seed(0)

# Test with torch tensors
x_torch = torch.randn(2, 4)
y_torch = torch.randn(2, 4)
angle_torch = torch.tensor(0.5)

# Also test with numpy arrays
x_numpy = np.random.randn(2, 4)
y_numpy = np.random.randn(2, 4)
angle_numpy = np.float32(0.5)

# Create ARGS dict with torch tensor version
ARGS = {
    "x": x_torch,
    "y": y_torch,
    "angle": angle_torch
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, 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, 4, 2) — shape (2, 4, 2) 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
split_dim Ran
ran on a synthesized input
metadriverse/trafficgen/trafficgen/act/utils/model_utils.py
code served (permissive licence) · get_code("7a726e7769eb7195")
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 4, dtype family float, shape (2, 2, 2, 3) 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)

# Create a small tensor with distinct dimensions
x = torch.randn(2, 4, 3)  # batch=2, dim1=4, dim2=3

# split_shape is a tuple that specifies how to reshape a particular dimension
# Looking at the function, it reshapes dimension `dim` into multiple dimensions
# specified by split_shape. For example, if dim=1 (size 4), split_shape could be (2, 2)
split_shape = (2, 2)

# dim specifies which dimension to split
dim = 1

ARGS = {
    "x": x,
    "split_shape": split_shape,
    "dim": dim
}
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 4, dtype family float, shape (2, 2, 2, 3) — shape (2, 2, 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

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

FunctionAlso present inEarliest-datedOthers named
clones 1 other paper
1 dated earlier
2003.08111 (2020-03)
Transformer Networks for Trajectory Forecasting

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

Diverse and realistic traffic scenarios are crucial for evaluating the AI safety of autonomous driving systems in simulation. This work introduces a data-driven method called TrafficGen for traffic scenario generation. It learns from the fragmented human driving data collected in the real world and then can generate realistic traffic scenarios. TrafficGen is an autoregressive generative model with an encoder-decoder architecture. In each autoregressive iteration, it first encodes the current traffic context with the attention mechanism and then decodes a vehicle's initial state followed by generating its long trajectory. We evaluate the trained model in terms of vehicle placement and trajectories and show substantial improvements over baselines. TrafficGen can be also used to augment existing traffic scenarios, by adding new vehicles and extending the fragmented trajectories. We further demonstrate that importing the generated scenarios into a simulator as interactive training environments improves the performance and the safety of driving policy learned from reinforcement learning. More project resource is available at https://metadriverse.github.io/trafficgen

For agents

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

get_harvested_code_for_paper("2210.06609")
get_code_for_paper("2210.06609")
have("2210.06609")

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

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

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

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

Connect an agent — have() is free.