---
title: 'VectorNet: Hierarchical GNN for Autonomous Driving'
url: https://www.emergentmind.com/topics/vectornet-model
type: topic
---

# VectorNet: Hierarchical GNN for Autonomous Driving

VectorNet is a hierarchical graph neural network (GNN) architecture designed for behavior prediction in dynamic, multi-agent environments, with particular application to autonomous driving systems. It addresses the limitations of raster-based convolutional neural network (ConvNet) approaches by directly operating on vectorized representations of high-definition (HD) maps and agent trajectories. This enables both efficient encoding and precise modeling of spatial relationships and interactions among road elements and moving agents [2005.04259].

## 1. Vectorized Representation of Road Context and Agent Dynamics

VectorNet encodes the static and dynamic context of traffic scenes by representing all road components (lane-centers, lane-boundaries, crosswalk polygons, traffic-light points) and agent trajectories as sequences of short vectors—line segments sampled at fixed spatial (for map entities) or temporal (for trajectories) intervals. Each such vector is assigned to a polyline group, producing an unordered set of polyline segments.

The formal representation of each input vector $v_i$ in polyline $\mathcal P_j$ is:
$$
v_i = [d_i^s,\;d_i^e,\;a_i,\;j]
$$
where $d_i^s, d_i^e \in \mathbb R^2$ (or $\mathbb R^3$) are the start and end coordinates, $a_i$ encodes semantic and context attributes (e.g., lane type, speed limit, traffic-light state, temporal index), and $j$ is the polyline identifier for subgraph assignment.

Agent-centric normalization translates (and optionally rotates) all coordinates so that the last observed position of the target agent is at the origin. This imposes translational invariance on the feature space.

## 2. Hierarchical GNN Model Architecture

VectorNet adopts a two-stage hierarchical GNN structure:

### 2.1 Local Polyline Subgraphs

Each polyline $\mathcal P = \{v_1, \ldots, v_P\}$ is modeled as a fully-connected local subgraph among its constituent vectors. The node update for each vector at layer $l$ is:
$$
v_i^{(l+1)} = \varphi_\text{rel}\bigl(g_\text{enc}(v_i^{(l)}),\; \varphi_\text{agg}(\{g_\text{enc}(v_j^{(l)})\}_{j\neq i})\bigr)
$$
where $g_\text{enc}$ is an MLP followed by LayerNorm and ReLU; $\varphi_\text{agg}$ performs element-wise max-pooling across neighbors; and $\varphi_\text{rel}$ denotes concatenation. After $L_p$ such layers, a single aggregated polyline embedding $p = \varphi_\text{agg}(\{v_i^{(L_p)}\})$ (again, max-pooling) is produced.

### 2.2 Global Polyline Interaction Graph

Polyline embeddings from the local stage act as nodes in a fully-connected global interaction graph. The global update uses self-attention:
$$
P^{(l+1)} = \mathrm{softmax}(P_Q^{(l)}(P_K^{(l)})^T) \, P_V^{(l)}
$$
where $P^{(l)}$ collects all node features, and $P_Q$, $P_K$, $P_V$ are linear projections to query, key, and value spaces, respectively. The model uses a single global attention layer ($L_t = 1$).

Decoding of agent future trajectories is performed via a shallow MLP $\varphi_\text{traj}$ applied to the polyline’s final global feature, outputting per-step offset coordinates.

## 3. Auxiliary Node Recovery and Training Objective

To enhance context modeling beyond supervised trajectory prediction, VectorNet employs an auxiliary self-supervised node recovery task inspired by masked modeling paradigms.

A random subset of polyline nodes (from both maps and agents) has its input embedding zeroed during training. Each masked node receives an auxiliary “ID” embedding (such as the minimum of its vectors’ start coordinates) to identify it within the graph. The goal is to reconstruct the masked node’s embedding after the global interaction stage:
$$
\hat p_i = \varphi_\text{node}(p_i^{(L_t)})
$$
The corresponding loss is a Huber penalty:
$$
\mathcal L_\text{node} = \sum_{i \in \mathcal M} \mathrm{Huber}(\hat p_i, p_i^\text{gt})
$$
where $\mathcal M$ is the set of masked polylines. All polyline embeddings are $\ell_2$-normalized before the global GNN layer to prevent trivial solutions.

The primary supervised loss is negative log-likelihood under a per-step Gaussian distribution for future positions:
$$
\mathcal L_\text{traj} = - \sum_{t=1}^T \log \mathcal N(\Delta x_t^\text{pred};\, \Delta x_t^\text{gt},\, \sigma^2 I)
$$
The total objective is:
$$
\mathcal L = \mathcal L_\text{traj} + \alpha\,\mathcal L_\text{node}
$$
with $\alpha = 1.0$.

## 4. Experimental Protocols and Datasets

The model was evaluated on two benchmarks:

- **In-house benchmark:** 2.2 million training and 0.55 million test trajectories, with a 1 s observation and 3 s prediction window. Map features included lane-centers, stop signs, crosswalks, and speed bumps.
- **Argoverse Forecasting Dataset:** 211,000 train, 41,000 validation, and 80,000 test sequences. Observation window of 2 s, prediction window of 3 s, sampled at 10 Hz. The map contains a rich lane graph and driveable area information.

All entities are vectorized per the described protocol, and coordinates are normalized with respect to the target agent.

Training used $L_p = 3$ layers in local subgraphs, $L_t = 1$ attention layer globally, with hidden dimension 64 throughout. Models were trained for 25 epochs using Adam (initial learning rate 0.001, decaying by 0.3 every 5 epochs) with synchronised batches across 8 GPUs.

## 5. Quantitative Results and Computational Characteristics

Evaluation metrics include:

- **ADE**: Average per-step displacement error over the forecast horizon.
- **DE@t**: Displacement error at time $t$ seconds ($t \in \{1,2,3\}$), both reported in meters.

VectorNet was compared against a ResNet-18 ConvNet baseline operating on rasterized bird’s-eye representations (400 × 400 pixels, 3N channels: N=10 for in-house, N=20 for Argoverse). A summary of the results:

| Dataset       | Model           | DE@3s (m) | ADE (m)  | Parameters | FLOPs per agent |
|:------------- |:---------------|:----------|:---------|:-----------|:----------------|
| In-house      | ConvNet (best) | ≈1.00     | ≈0.63    | 246K       | 10.6 GFLOPs     |
| In-house      | VectorNet      |  1.00     | 0.66     | 72K        | 0.041G × n_agents|
| Argoverse     | ConvNet (best) | ≈4.49     | ≈1.96    | 246K       | 10.6 GFLOPs     |
| Argoverse     | VectorNet      |  3.67     | 1.66     | 72K        | 0.041G × n_agents|

On the Argoverse public leaderboard with $K=1$ (single trajectory), VectorNet achieved DE@3s = 4.01 m and ADE = 1.81 m, outperforming the previous state of the art (DE@3s ≈ 4.17 m).

VectorNet reduces parameter count by over 70% and the number of floating-point operations (FLOPs) per agent by one to two orders of magnitude compared to the ConvNet baseline.

## 6. Ablation Studies and Architectural Insights

Ablation analyses revealed several findings:

- Including map and agent context consistently improved performance (in-house DE@3s: no context ≈1.29 m; map alone 1.11 m; map + agents 1.05 m; map + agents + node auxiliary 1.00 m).
- The optimal configuration was $L_p=3$ local GNN layers and $L_t=1$ global layer. Increasing width (more MLP units) degraded generalization on Argoverse.
- The auxiliary node recovery loss especially improved long-horizon trajectory errors, consistent with bidirectional context modeling seen in language models.
- The agent-centric normalization is single-target; multi-target parallel prediction was not explored. Output trajectories are unimodal; variants could introduce anchor-based or variational decoders (e.g., MultiPath, VRNNs). The current fully-connected global graph could become computationally demanding if the number of polylines increases; sparse connectivity heuristics are a potential extension.

## 7. Significance and Limitations

VectorNet establishes an end-to-end vectorized modeling pipeline that alleviates the computational and representational inefficiencies of raster-based ConvNet approaches. By hierarchically exploiting spatial structure at the subgraph (polyline) and global (roadscape + agent) levels and supporting auxiliary self-supervised learning, it achieves state-of-the-art or competitive predictive accuracy with substantially fewer computational resources.

Current design choices—single target normalization, unimodal output, fully-connected graphs—suggest further research directions in multi-target prediction, multi-modality, and sparse interaction modeling for large-scale traffic scenes [2005.04259].

Source: https://www.emergentmind.com/topics/vectornet-model