RoboFailRing: Retrieval-Augmented and Language Grounding Failure Detection for VLM-enabled Robotic Manipulation
RoboFailRing is a retrieval-augmented failure detection framework for robotic manipulation. It constructs a Spatio-Temporal Memory Bank from historical failure and utilizes Neuro-Symbolic Grounding to empower Vision-Language Models (VLMs) with precise, grounded reasoning capabilities.
This repository implements the core pipeline:
- Memory Construction: Building a dual-frame (Start+End) vector index using CLIP.
- Retrieval: Task-constrained similarity search to identify analogous historical failures.
- Reasoning: Generating structured failure reports and actionable repair plans using Gemini 2.5 Flash.
robofailring/
├── config.py # Global configuration (paths, models, devices)
├── build_index.py # Script to build FAISS index from failure dataset
├── retriever.py # Core class for retrieval and search logic
├── grounding.py # Neuro-symbolic bridge (Symbol -> Natural Language)
├── run_reasoning_demo.py # VLM reasoning demo
├── evaluate_metrics.py # Evaluation script for Detection Rate (Recall/FPR)
└── utils.py # Helper functions for data handling
We recommend using Conda to manage the environment.
conda create -n robofailring python=3.10
conda activate robofailringpip install -r requirements.txtNote: This project requires
faiss-gpufor efficient indexing. If you are running on a machine without NVIDIA GPUs, please switch tofaiss-cpuinrequirements.txt.
To use the VLM reasoning module (run_reasoning_demo.py), you need a Google Gemini API Key.
export GEMINI_API_KEY="your_api_key_here"The system expects the dataset to be organized in a hierarchical structure. Please configure the DATASET_ROOT in config.py to point to your data directory.
Directory Structure:
data/
└── data_0/ # Source Domain (For Memory Bank Construction)
├── task_name_A/
│ ├── failure_case_1/ # Must contain image sequence (0.png ... N.png)
│ └── ...
└── ...
data_success/
└── data_1/ # Target Domain (For Evaluation/Testing)
├── task_name_A/
│ ├── success_case/ # Folder name matches task name (Exact match)
│ └── failure_case_X/ # Folder name contains failure suffix
└── ...
First, encode the historical failure cases from the source dataset (e.g. data_0) into a FAISS vector index.
python failure_memory/build_index.pyOutput: A .faiss index file and metadata pickle will be saved in failure_memory/memory_bank/.
Detects a specific failure case using the retrieval-augmented VLM pipeline. This script retrieves a similar past failure, generates a structured failure report, and queries Gemini-2.5-flash.
python failure_memory/run_reasoning_demo.pyWe provide script to quantitatively evaluate the system's performance.
Detection Robustness (Recall & FPR) Evaluate the system's ability to distinguish between success and failure episodes across different similarity thresholds.
python failure_memory/evaluate_metrics.pyYou can customize the system behavior in failure_memory/config.py:
CLIP_MODEL_NAME: Visual backbone (Default:ViT-B/32).DEVICE: Execution device (cudaorcpu).
We thank the following projects that parts of our code and data are derived from: