OIL-AD: An Anomaly Detection Framework for Sequential Decision Sequences

Chen Wang, Sarah M. Erfani, Tansu Alpcan, Christopher LeckiearXiv 2024 · DOI

Abstract

Anomaly detection in sequential decision-making is critical for applications ranging from autonomous vehicle safety to maritime surveillance. However, existing methods often rely on unrealistic assumptions such as access to reward signals or environment simulators. We present OIL-AD (Offline Imitation Learning based Anomaly Detection), an unsupervised framework that identifies anomalies in offline trajectory logs. By training a Transformer-based model on normal behavior, OIL-AD extracts features of action optimality and sequential association. Our approach demonstrates superior performance on real-world datasets, achieving up to a 34.8% improvement in F1 score over state-of-the-art baselines.

Introduction

Detecting anomalies in sequences—such as a taxi taking a suspicious detour or a ship exhibiting erratic movement—is challenging because "normality" is often defined by long-term goal-directedness rather than single-step outliers. Traditional Reinforcement Learning (RL) approaches to this problem typically require a known reward function or a simulator for online interaction, which are rarely available in real-world "offline" datasets like GPS logs. OIL-AD addresses these challenges by learning a representation of normal behavior purely from historical demonstrations.

The OIL-AD Framework

The core of OIL-AD is a Transformer-based policy network designed to capture long-range dependencies in decision history. Unlike standard Behavioral Cloning, which only predicts actions, OIL-AD is trained to recover both a Q-function (action-value) and a state-value function ($v$) from normal trajectories.

Training Objectives

The model utilizes two primary loss functions to define normality:

  • Action Loss: Ensures the model learns the "optimal" policy of normal agents.
  • Monotonicity Loss: This "secret sauce" objective enforces that the learned state-value $v$ increases over time for normal, goal-oriented sequences. This is implemented using a differentiable Spearman’s rank correlation.

Feature Extraction and Detection

OIL-AD maps sequences into a 2D latent space defined by two features:

  • Action Optimality ($f_{AO}$): Measures the gap between the agent's actual action and the "optimal" action predicted by the learned Q-function.
  • Sequential Association ($f_{SA}$): Measures how well the state values of a new sequence follow the expected monotonic (increasing) trend.
Mapping trajectories to the Action Optimality and Sequential Association feature space.

An Isolation Forest is then applied to this 2D space to establish a boundary for normal behavior.

Experimental Evaluation

The framework was evaluated on three distinct datasets: Chengdu taxi trajectories, AIS maritime traffic data, and the LunarLander simulation environment. OIL-AD consistently outperformed traditional anomaly detection (like OC-SVM) and deep learning baselines (like LSTM-Autoencoders).

Key Results

  • Performance Gains: The model achieved up to a 34.8% improvement in F1 score on the Chengdu dataset and at least an 8.3% improvement on the noisy AIS maritime dataset.
  • Latent Space Clarity: Visualization confirmed that normal trajectories cluster tightly in the "high optimality, high association" corner, while anomalies are clearly scattered elsewhere.

Discussion and Conclusion

A key insight of this work is the use of monotonicity as a proxy for intent. By assuming that a normal agent's "value" should generally increase as they approach a goal, the model can detect deviations without explicit reward signals. While currently optimized for discrete action spaces, future work aims to extend OIL-AD to continuous action spaces and non-stationary environments. OIL-AD provides a powerful, unsupervised tool for real-world sequential anomaly detection where environment models and reward signals are unavailable.

Summary updated

BibTeX
@misc{wang2024oil,
  author = {Chen Wang and Sarah M. Erfani and Tansu Alpcan and Christopher Leckie},
  title = {{OIL-AD: An Anomaly Detection Framework for Sequential Decision Sequences}},
  year = {2024},
  eprint = {2402.04567},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2402.04567},
}
Figure