Papers › AgentFormer: Agent-Aware Transformers for Socio-Temporal Multi-Agent Forecasting

AgentFormer: Agent-Aware Transformers for Socio-Temporal Multi-Agent Forecasting

25 Mar 2021ICCV 2021 10arXiv:2103.14023archive 2025-07-28

Ye Yuan, Xinshuo Weng, Yanglan Ou, Kris Kitani

Predicting accurate future trajectories of multiple agents is essential for autonomous systems, but is challenging due to the complex agent interaction and the uncertainty in each agent's future behavior. Forecasting multi-agent trajectories requires modeling two key dimensions: (1) time dimension, where we model the influence of past agent states over future states; (2) social dimension, where we model how the state of each agent affects others. Most prior methods model these two dimensions separately, e.g., first using a temporal model to summarize features over time for each agent independently and then modeling the interaction of the summarized features with a social model. This approach is suboptimal since independent feature encoding over either the time or social dimension can result in a loss of information. Instead, we would prefer a method that allows an agent's state at one time to directly affect another agent's state at a future time. To this end, we propose a new Transformer, AgentFormer, that jointly models the time and social dimensions. The model leverages a sequence representation of multi-agent trajectories by flattening trajectory features across time and agents. Since standard attention operations disregard the agent identity of each element in the sequence, AgentFormer uses a novel agent-aware attention mechanism that preserves agent identities by attending to elements of the same agent differently than elements of other agents. Based on AgentFormer, we propose a stochastic multi-agent trajectory prediction model that can attend to features of any agent at any previous timestep when inferring an agent's future position. The latent intent of all agents is also jointly modeled, allowing the stochasticity in one agent's behavior to affect other agents. Our method substantially improves the state of the art on well-established pedestrian and autonomous driving datasets.

PaperPDFConference PDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2103.14023")

Code

Syntology Ran 4 of 17 code samples harvested from 1 repository linked to this paper; 13 have no recorded run. Of those that ran: 2 ran · our draft was wrong; 2 ran with no contract checked.

By repository: official repository: 17 samples from 1 repository, 4 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

Khrylx/AgentFormer officialmentioned in papermentioned on GitHubpytorchMIT report
zhanwei-z/g2ltraj mentioned on GitHubpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

17 samples harvested; 4 ran; 0 honoured the contract we drafted; 13 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

2ran · our draft was wrong
2ran
13unverified

Licence: 0 of the 17 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from Khrylx/AgentFormer. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

conv1x1 Khrylx/AgentFormer/model/common/resnet.py official repository ran · our draft was wrong MIT (permissive) · d9def42110729a85 · report
conv3x3 Khrylx/AgentFormer/model/common/resnet.py official repository ran · our draft was wrong MIT (permissive) · 160bb14bd76201b4 · report
generate_ar_mask Khrylx/AgentFormer/model/agentformer.py official repository ran MIT (permissive) · 1b373d997a81df48 · report
generate_mask Khrylx/AgentFormer/model/agentformer.py official repository ran MIT (permissive) · 66d9c97d20cb3bfd · report
batch_to Khrylx/AgentFormer/utils/torch.py official repository unverified MIT (permissive) · f6e42d1a52522ffb · report
compute_motion_mse Khrylx/AgentFormer/model/agentformer_loss.py official repository unverified MIT (permissive) · d328d7d027ef837d · report
compute_sample_loss Khrylx/AgentFormer/model/agentformer_loss.py official repository unverified MIT (permissive) · 27e6bed86bfe75d0 · report
compute_z_kld Khrylx/AgentFormer/model/agentformer_loss.py official repository unverified MIT (permissive) · f19fb436bd1c1362 · report
compute_z_kld Khrylx/AgentFormer/model/dlow.py official repository unverified MIT (permissive) · 7dd2a5c1f5974656 · report
diversity_loss Khrylx/AgentFormer/model/dlow.py official repository unverified MIT (permissive) · 82eee2c876ef54f2 · report
get_flat_params_from Khrylx/AgentFormer/utils/torch.py official repository unverified MIT (permissive) · 748ebf6d58779d56 · report
isfloat Khrylx/AgentFormer/utils/utils.py official repository unverified MIT (permissive) · 664e282ebf0d3ef6 · report
isinteger Khrylx/AgentFormer/utils/utils.py official repository unverified MIT (permissive) · 7795043c27738a7a · report
isnparray Khrylx/AgentFormer/utils/utils.py official repository unverified MIT (permissive) · e58bf86f2419f13f · report
recon_loss Khrylx/AgentFormer/model/dlow.py official repository unverified MIT (permissive) · 7a165e35db87d53d · report
resnet18 Khrylx/AgentFormer/model/common/resnet.py official repository unverified MIT (permissive) · 17abbd201c85e08b · report
rotation_2d_torch Khrylx/AgentFormer/utils/torch.py official repository unverified MIT (permissive) · bf9596e8a6a6b696 · report

Tasks

Autonomous DrivingPedestrian Trajectory PredictionTrajectory ForecastingTrajectory Prediction

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Trajectory Prediction ETH/UCY AgentFomer ADE-8/12 0.23 #10 of 20 Archive leaderboard report
Trajectory Prediction ETH/UCY AgentFomer FDE-8/12 0.39 #10 of 20 Archive leaderboard report
Trajectory Prediction nuScenes AgentFormer MinADE_10 1.45 #21 of 34 Archive leaderboard report
Trajectory Prediction nuScenes AgentFormer MinADE_5 1.86 #21 of 34 Archive leaderboard report

Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.

Methods

Absolute Position EncodingsAdamAttentionBPEDense ConnectionsDropoutLabel SmoothingLayer NormalizationLinear LayerMulti-Head AttentionPosition-Wise Feed-Forward LayerResidual ConnectionSoftmaxTransformer

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections