---
title: 'AdaSports-Traj: Adaptive Sports Trajectory Model'
url: https://www.emergentmind.com/topics/adasports-traj
type: topic
---

# AdaSports-Traj: Adaptive Sports Trajectory Model

AdaSports-Traj is an adaptive framework for multi-agent trajectory modeling in sports, explicitly designed to address both intra-domain and inter-domain distributional discrepancies that arise from heterogeneous agent roles (such as players versus balls) and varying sports domains (e.g., basketball, football, soccer). By introducing a Role- and Domain-Aware Adapter in conjunction with a hierarchical contrastive learning paradigm, AdaSports-Traj achieves robust performance in both unified and cross-domain trajectory prediction scenarios, as demonstrated empirically on Basketball-U, Football-U, and Soccer-U datasets [2509.16095].

## 1. Model Architecture and Adapter Design

At its core, AdaSports-Traj employs a Conditional Variational Autoencoder (CVAE) backbone, following the unified trajectory modeling conventions of UniTraj (Xu & Fu ’25). The model processes masked multi-agent trajectories $X \in \mathbb{R}^{N \times T \times D}$ (with mask $M \in \{0, 1\}^{N \times T}$). Its encoder $q_\phi(z^{\leq T} | x^{\leq T})$ and prior $p_\theta(z^t | x^{<t}, z^{<t})$ model the latent states as Gaussian distributions, while the decoder reconstructs both visible and missing portions of input trajectories. The training maximizes the evidence lower bound (ELBO), as formalized by:

$$
\mathrm{ELBO}(\theta, \phi) = \mathbb{E}_{q_\phi(z|x)} \left[ \sum_{t=1}^T \log p_\theta(x^t | z^{\leq t}, x^{<t}) - \mathrm{KL}(q_\phi(z^t | x^{\leq t}, z^{<t}) \| p_\theta(z^t | x^{<t}, z^{<t})) \right]
$$

A key innovation is the Role- and Domain-Aware Adapter (RDA), which modulates the encoder’s latent features $z$ based on agent role ($r \in \{\text{Player}, \text{Ball}\}$) and sports domain ($d \in \{\text{Basketball}, \text{Football}, \text{Soccer}\}$):

- **Embeddings**: $e_\mathrm{role} = \mathrm{Emb}_\mathrm{role}(r),\ e_\mathrm{domain} = \mathrm{Emb}_\mathrm{domain}(d)$, both of dimension $\mathbb{R}^h$.
- **Cross-Attention**: Using $e_\mathrm{role} + e_\mathrm{domain}$ as query and $z$ as key/value:
  
  $$
  z_\mathrm{cond} = \mathrm{CrossAttention}(e_\mathrm{role} + e_\mathrm{domain},\ z, z)
  $$

- **Token-wise Gating**: Per-token gating weight $\alpha_\mathrm{gate} = \sigma(\mathrm{MLP}([z, z_\mathrm{cond}]))$ determines the interpolation:

  $$
  z_\mathrm{adapted} = \alpha_\mathrm{gate} \odot z_\mathrm{cond} + (1 - \alpha_\mathrm{gate}) \odot z
  $$

This lightweight, plug-and-play adapter setup requires minimal additional computational overhead and is fully differentiable, supporting end-to-end learning through the primary modeling and contrastive losses.

## 2. Hierarchical Contrastive Learning

AdaSports-Traj introduces a hierarchical contrastive objective to separately supervise role-sensitive and domain-aware latent representations, thereby encouraging their disentanglement.

- **Projection Heads**: Starting from $z_\mathrm{adapted}$, the model produces two L²-normalized projections:
  
  $$
  z_\mathrm{role} = \mathrm{MLP}_\mathrm{role}(z_\mathrm{adapted}),\qquad
  z_\mathrm{domain} = \mathrm{MLP}_\mathrm{domain}(z_\mathrm{adapted})
  $$

- **InfoNCE Contrastive Losses**: For a given batch, role-positive pairs share the same agent type, domain-positive pairs share the same sport, and all other batch members serve as negatives:
  
  $$
  \begin{align*}
  \mathcal{L}_\mathrm{role} &= -\frac{1}{|P_\mathrm{role}|} \sum_{(i, j) \in P_\mathrm{role}}
    \log \frac{\exp(\mathrm{sim}(z^i_\mathrm{role}, z^j_\mathrm{role})/\tau_c)}
              {\sum_{k\neq i} \exp(\mathrm{sim}(z^i_\mathrm{role}, z^k_\mathrm{role})/\tau_c)} \\
  \mathcal{L}_\mathrm{domain} &= -\frac{1}{|P_\mathrm{domain}|} \sum_{(i, j) \in P_\mathrm{domain}}
    \log \frac{\exp(\mathrm{sim}(z^i_\mathrm{domain}, z^j_\mathrm{domain})/\tau_c)}
              {\sum_{k\neq i} \exp(\mathrm{sim}(z^i_\mathrm{domain}, z^k_\mathrm{domain})/\tau_c)}
  \end{align*}
  $$

- **Combined Hierarchical Loss**:
  
  $$
  \mathcal{L}_\mathrm{hier} = \mathcal{L}_\mathrm{role} + \lambda_c\,\mathcal{L}_\mathrm{domain}
  $$

Projecting into orthogonal subspaces eliminates optimization conflict between agent role and domain supervision. Empirical ablations confirm that variants lacking this separation (e.g., shared-feature projection) yield significantly inferior results.

## 3. Training Objectives and Implementation

The complete loss function of AdaSports-Traj augments the CVAE objectives with the hierarchical contrastive term and a Winner-Take-All (WTA) sampling loss to promote diversity:

- **Reconstruction and Regularization**:
  $$
  \mathcal{L}_\mathrm{elbo} = \|\hat X_m - X_m\|^2 + \lambda_1\,\mathrm{KL}(\mathcal{N}(\mu_q, \mathrm{diag}(\sigma_q^2))\| \mathcal{N}(0, I))
  $$
  $$
  \mathcal{L}_\mathrm{rec} = \|\hat X_v - X_v\|^2
  $$
  $$
  \mathcal{L}_\mathrm{wta} = \min_{k\in\{1..K\}}\|\hat Y^{(k)} - Y\|^2
  $$

- **Final Training Loss**:
  $$
  \mathcal{L} = \mathcal{L}_\mathrm{elbo} + \lambda_2\,\mathcal{L}_\mathrm{rec} + \lambda_3\,\mathcal{L}_\mathrm{wta} + \lambda_4\,\mathcal{L}_\mathrm{hier}
  $$

Training employs Adam (β₁=0.9, β₂=0.999), an initial learning rate of 0.001 decayed by 0.9 every 20 epochs, and batch size 128. Mixed-domain batches in unified-to-single (U2S) settings permit simultaneous domain and role contrastive supervision, while single-to-single (S2S) batches enable only role-based losses. The hardware consists of an NVIDIA A6000 GPU and PyTorch implementation.

## 4. Experimental Evaluation

### Datasets

Experiments use three unified multi-agent trajectory datasets:

| Dataset        | Agents (N)           | Train/Test Size        |
|----------------|---------------------|-----------------------|
| Basketball-U   | 11 (5+5+1)          | 93,490 / 11,543       |
| Football-U     | 23 (22+1)           | 10,762 / 2,624        |
| Soccer-U       | 23 (22+1)           | 9,882 / 2,448         |

### Metrics

- minADE₍₂₀₎: Minimum Averaged Displacement Error over 20 samples (lower is better)
- OOB: Fraction of predicted points outside field boundaries
- Step: Mean stepwise trajectory displacement (closeness to ground truth)
- Path-L: Total agent path length
- Path-D: Net start-to-end agent displacement

### Results

AdaSports-Traj consistently outperforms UniTraj across all settings. Example: In S2S, Basketball-U minADE₍₂₀₎ drops from 4.77 (UniTraj) to 4.21; similarly, unified-to-single (U2S) settings show clear improvement (Basketball-U minADE₍₂₀₎: 11.12 → 8.74). Detailed ablations reveal:

- Combining RDA and HC yields the best outcome (S2S: 4.21/3.04/91.52 versus RDA or HC alone).
- Token-wise gating in the adapter surpasses feature-wise or no gating configurations.
- Role-only and domain-only contrastive variants underperform relative to hierarchical contrastive learning.

## 5. Analysis, Visualization, and Limitations

t-SNE analysis of learned projections shows distinct clustering for the three sports domains in $z_\mathrm{domain}$ and clear separation between Ball and Player roles in $z_\mathrm{role}$. Qualitative rollout visualizations indicate improved plausible completion and forecast trajectories, especially under heavy observation masking, with fewer out-of-bounds outputs compared to UniTraj.

A principal limitation is that AdaSports-Traj relies on pre-defined role and domain annotations during training, which precludes unsupervised deployment across novel agent types or sports. Future research directions include unsupervised or weakly-supervised discovery of role/domain labels and extending the adapter mechanism to generative backbones beyond CVAEs, such as diffusion models, and to real-time online adaptation contexts.

## 6. Context and Significance

AdaSports-Traj directly addresses the structured heterogeneity and distributional shift challenges characteristic of multi-agent sports trajectory prediction. By introducing a modular and lightweight plug-in for latent space adaptation and validating the necessity of disentangled, orthogonal subspace supervision, it establishes a new methodological baseline for cross-domain, multirole trajectory forecasting. Empirical results on Basketball-U, Football-U, and Soccer-U demonstrate domain-agnostic improvements. This framework represents a substantial step toward unified, adaptable models for structured multi-agent systems in sports and potentially other domains requiring explicit role and context awareness [2509.16095].

Source: https://www.emergentmind.com/topics/adasports-traj