TrajEvo: Trajectory Prediction Heuristics Design via LLM-driven Evolution

Zhikai Zhao, Chuanbo Hua, Federico Berto, Kanghoon Lee, Zihan Ma, Jiachen Li, Jinkyoo Park

TL;DR

This paper introduces TRAJEVO, a novel framework that uses Large Language Models (LLMs) and evolutionary algorithms to automatically design trajectory prediction heuristics. TRAJEVO generates fast, explainable, and highly generalizable heuristics that outperform traditional methods and even deep learning models on out-of-distribution datasets.

What Problem Does This Paper Address?

Accurately predicting the movement of people and vehicles is crucial for autonomous systems, from self-driving cars to social robots. Traditional methods, like the Social Force model, are interpretable but often lack accuracy and struggle with complex, dynamic scenarios. Deep learning approaches offer higher accuracy but come with significant drawbacks: they are computationally expensive, slow to run (making them unsuitable for real-time applications), lack transparency (making them "black boxes"), and, critically, often fail to generalize to new, unseen situations (out-of-distribution or OOD scenarios). This gap highlights the need for methods that are accurate, fast, interpretable, and robust across diverse environments.

Methods

TRAJEVO tackles this challenge by automating the design of trajectory prediction heuristics. It employs an evolutionary algorithm, where LLMs act as the core "genetic operators." The process begins with an initial population of simple heuristics. Through an iterative process of selection, crossover (combining successful heuristics), and mutation (making small changes to the best ones), the framework evolves increasingly sophisticated heuristics.

Two key innovations enhance this evolutionary process:

  • Cross-Generation Elite Sampling (CGES): Instead of only considering the best heuristics from the current generation, CGES maintains a history of high-performing heuristics from all past generations. This allows the algorithm to revisit and potentially improve upon successful strategies from earlier stages, helping it escape local optima and explore a wider range of solutions.
  • Statistics Feedback Loop (SFL): This mechanism analyzes why a heuristic performs well. It examines the individual prediction strategies within a heuristic (e.g., different ways of extrapolating motion) and identifies which ones are most effective for reducing prediction error. This feedback guides the LLM in refining the heuristics, leading to more targeted improvements.

The final output is a standalone, efficient Python heuristic that can be used for inference without requiring the LLM.

Datasets

The paper evaluates TRAJEVO on the following datasets:

  • ETH-UCY: A standard benchmark for pedestrian trajectory prediction, used for training and in-distribution evaluation.
  • SDD (Stanford Drone Dataset): Used as an unseen, out-of-distribution (OOD) test set to specifically evaluate generalization capabilities.

Key Insights and Ideas

  • LLMs as Evolutionary Engines: The paper demonstrates that LLMs can effectively act as sophisticated "programmers" within an evolutionary framework, capable of generating and refining complex code (heuristics) for a specific task.
  • The Power of "Reflective Evolution": By incorporating both short-term (immediate feedback) and long-term (historical insights) reflections, TRAJEVO guides the LLM more effectively, leading to better heuristic designs.
  • CGES for Robustness: The ability to sample from past elite solutions is crucial for escaping local optima and discovering heuristics that are not just good on average, but robust across a wider range of scenarios.
  • SFL for Targeted Improvement: Understanding why a heuristic works (which specific strategies are effective) is more valuable than just knowing that it works. SFL provides this insight, enabling more intelligent refinement.
  • Heuristics Can Still Compete: Contrary to the trend of solely relying on deep learning, TRAJEVO shows that well-designed, automatically generated heuristics can achieve competitive or even superior performance, especially in terms of generalization and efficiency.

Key Results

  • In-Distribution Performance: TRAJEVO-generated heuristics consistently outperform traditional heuristic methods on the ETH-UCY benchmark, establishing a new state-of-the-art for heuristic approaches. They also achieve competitive results against deep learning models.
  • Out-of-Distribution (OOD) Generalization: This is TRAJEVO's standout achievement. On the unseen SDD dataset, TRAJEVO significantly outperforms both traditional heuristics and state-of-the-art deep learning models, achieving over a 20% improvement.
  • Computational Efficiency: The generated heuristics are extremely fast, running in milliseconds (Python) or microseconds (C++), making them suitable for real-time applications. This is a stark contrast to the much slower inference times of deep learning models.
  • Cost-Effectiveness: The evolutionary process is also cost-effective, with a single run costing around $0.05, significantly less than training deep learning models.
  • Explainability: The output heuristics are human-readable Python code, offering transparency and interpretability, a key advantage over black-box deep learning models.

Limitations and Future Work

  • In-Distribution Gap: While TRAJEVO excels in OOD generalization and efficiency, it doesn't quite surpass the absolute best deep learning models on in-distribution accuracy for standard benchmarks.
  • Objective Function: The current evolutionary objective focuses solely on prediction error (e.g., MSE, ADE, FDE). Future work could incorporate objectives related to downstream tasks like navigation, safety (e.g., collision avoidance), or comfort.
  • Input Modality: The current framework primarily uses 2D bird's-eye-view positions. Extending it to handle multi-modal inputs (e.g., sensor data, semantic information) and bridging the performance gap with specialized deep models are promising future directions.

Summary updated

Abstract

Trajectory prediction is a crucial task in modeling human behavior, especially in safety-critical fields such as social robotics and autonomous vehicle navigation. Traditional heuristics based on handcrafted rules often lack accuracy, while recently proposed deep learning approaches suffer from computational cost, slow inference speed, lack of explainability, and generalization issues that limit their practical adoption in such environments. In this paper, we introduce TrajEvo, a framework that leverages Large Language Models (LLMs) to automatically design trajectory prediction heuristics. TrajEvo employs an evolutionary algorithm to generate and refine prediction heuristics from past trajectory data. We introduce a Cross-Generation Elite Sampling to promote population diversity and a Statistics Feedback Loop allowing the LLM to analyze alternative predictions. Our evaluations show TrajEvo outperforms previous heuristic methods on various real-world datasets, and remarkably outperforms both heuristics and deep learning methods when generalizing to an unseen real-world dataset. TrajEvo represents a first step toward automated design of fast, explainable, and generalizable trajectory prediction heuristics. We make our source code publicly available to foster future research.
BibTeX
@inproceedings{zhao2026trajevo,
  author = {Zhikai Zhao and Chuanbo Hua and Federico Berto and Kanghoon Lee and Zihan Ma and Jiachen Li and Jinkyoo Park},
  title = {{TrajEvo: Trajectory Prediction Heuristics Design via LLM-driven Evolution}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2026},
  doi = {10.1609/aaai.v40i21.38868},
}
Figure