# Real-Time Anomaly Detection and Reactive Planning with Large Language Models

**Authors:** Rohan Sinha, Amine Elhafsi, Christopher Agia, Matthew Foutter, Edward Schmerling, Marco Pavone  
**arXiv:** [2407.08735](https://arxiv.org/abs/2407.08735)  
**Date:** 2024-07-11  
**Summary page:** https://www.summarizepaper.com/en/arxiv-id/2407.08735v1/

## Key points

- Authors introduce a two-stage reasoning framework for enhancing trustworthiness of dynamic robotic systems
- Large language models (LLMs) trained on vast internet-scale data are used for zero-shot generalization capabilities crucial for detecting and mitigating out-of-distribution failure modes in robotics
- Primary challenges addressed include significant computational expense associated with LLMs and integration of anomaly detection judgments into safe control framework
- Proposed framework includes fast binary anomaly classifier operating in LLM embedding space and slower fallback selection process leveraging generative LLMs' reasoning abilities
- Model predictive control strategy ensures safety by maintaining feasibility across various fallback plans once an anomaly is detected
- Fast anomaly classifier surpasses autoregressive reasoning using state-of-the-art GPT models, even with relatively small language models, enhancing reliability of dynamic robotic systems like quadrotors or autonomous vehicles under resource and time constraints
- Videos showcasing implementation available on project page; research accepted for presentation at Robotics: Science and Systems (RSS) 2024

## Summary

In their paper titled "Real-Time Anomaly Detection and Reactive Planning with Large Language Models," authors Rohan Sinha, Amine Elhafsi, Christopher Agia, Matthew Foutter, Edward Schmerling, and Marco Pavone introduce a novel two-stage reasoning framework aimed at enhancing the trustworthiness of dynamic robotic systems. The foundation models utilized in this work are large language models (LLMs) trained on vast amounts of internet-scale data, which endow them with zero-shot generalization capabilities crucial for detecting and mitigating out-of-distribution failure modes in robotics. The primary challenges addressed by the authors include the significant computational expense associated with these LLMs and the integration of their anomaly detection judgments into a safe control framework. To tackle these issues, the proposed framework consists of a fast binary anomaly classifier that operates in an LLM embedding space to quickly analyze observations. This initial stage can then trigger a slower fallback selection process that leverages the reasoning abilities of generative LLMs. These stages serve as branch points within a model predictive control strategy designed to ensure safety by maintaining feasibility across various fallback plans once an anomaly is detected. Notably, the authors demonstrate that their fast anomaly classifier surpasses autoregressive reasoning using state-of-the-art GPT models, even when employing relatively small language models. This advancement enables their runtime monitor to enhance the reliability of dynamic robotic systems such as quadrotors or autonomous vehicles under constraints related to resources and time. Additionally, videos showcasing the implementation of this approach in both simulation environments and real-world experiments are available on the project page provided. This research has been accepted for presentation at Robotics: Science and Systems (RSS) 2024, highlighting its significance in advancing real-time anomaly detection and reactive planning methodologies utilizing large language models for ensuring safety in robotic applications.
