Prompting-MammAlps: Fine-Grained Text-to-Video Retrieval for Camera-Trap Data

Valentin Gabeff, Baptiste Maquignaz, Jennifer Shan, Sepideh Mamooler, Gencer Sumbul, Blair Costelloe, Devis Tuia, Alexander MathisarXiv 2026

TL;DR

This paper introduces Prompting-MammAlps, the first text-to-video retrieval benchmark specifically designed for camera-trap data. To tackle the limitations of standard vision-language models in capturing complex animal behaviors, the authors propose a modular, interpretable neuro-symbolic approach that converts video into structured JSON text and uses an LLM-based coding agent to retrieve matching clips via automatically generated Python functions.

What Problem Does This Paper Address?

Ecologists deploy massive networks of camera traps to monitor wildlife, generating thousands of hours of video footage. Sifting through this data to find specific ecological events—such as a juvenile deer scratching its body or animals interacting—is incredibly time-consuming and typically done manually by experts.

While modern Video-Language Models (VLMs) excel at general text-to-video retrieval, they struggle heavily in specialized domains like ecology. They often lack fine-grained spatiotemporal understanding (e.g., distinguishing "animal reacting to a camera then foraging" from the reverse sequence) and fail to generalize to wild settings. Furthermore, standard end-to-end deep learning models act as black boxes, providing no explanation for why a video was retrieved, and direct long-video description by LLMs is highly prone to hallucination.

Methods

The authors reject the standard "joint embedding similarity" approach in favor of a highly interpretable, two-step modular framework:

  1. Spatiotemporal Action Localization (SALMA): A vision transformer (VideoMAE encoder with a DETR/MOTR-style decoder) processes candidate videos offline. It tracks individual animals across frames and predicts fine-grained attributes (species, age, sex, actions, activities, and weather). This rich visual data is saved into a structured .json format for each video.
  2. LLM-Guided Text Parsing Retrieval: At query time, a user inputs a natural language prompt. Instead of reading the video data directly, a Large Language Model (acting as a code agent) translates the query into an executable Python parsing function. This function utilizes a custom library of 23 predefined primitive operations (e.g., check_tracks_contain_species). The function runs over the JSON files to return a binary match decision.
Fig. 1: Overview of Prompting-MammAlps and our TVR method. (a) We associate a densely annotated pool of camera-trap videos with 135 queries spanning six fine-grained visual attributes and diverse spatiotemporal relationships. (b) We perform spatiotemporal action localization on the candidate videos and store each result in a structured .json format. For each query, we task a LLM to write a parsing function that assesses if the text representation of a candidate video matches the query or not.

By restricting the LLM to writing code based on a strict library rather than reading raw video descriptions, the risk of hallucination is minimized, and the generated code provides a clear, inspectable logic trail for the user.

Datasets

The paper introduces two major contributions to ecological datasets:

  • MammAlps-S2: An extension of the original MammAlps dataset, containing 2,865 camera-trap videos (18 hours total) across 15 camera views. It features dense, frame-level annotations for 3,227 individual animal tracks, spanning 27 distinct actions and 13 high-level activities.
  • Prompting-MammAlps Benchmark: A set of 135 open-vocabulary text queries designed in collaboration with behavioral ecologists. These queries test various reasoning complexities, including single/multiple attributes, multi-individual interactions, complex temporal sequences, and video-to-video comparisons.
Fig. 2: Prompting-MammAlps Benchmark. (a) The 135 queries are categorized in five ecological and five reasoning categories. One query can belong to multiple categories. (b-c) Number of matching videos per query and inversely (excluding zero entries).

Key Insights and Ideas

  • The Perception Bottleneck: When the LLM code agent was evaluated against ground-truth annotations (an "Oracle" setup), it achieved an outstanding F1-score of 87%. However, when paired with SALMA's automated visual predictions, the score dropped to 34%. This reveals that the primary bottleneck in automated ecological video retrieval is visual perception (accurately detecting and segmenting fine-grained actions), not the linguistic reasoning or code generation capabilities of modern LLMs.
  • Code as an Intermediary Eliminates Hallucination: Traditional text-based video retrieval methods that ask an LLM to read a video caption often suffer from the model "imagining" details. Forcing the LLM to act purely as a compiler that maps a query to a logical sequence of API calls completely bypasses this issue.

Key Results

The benchmark evaluations highlight the massive domain gap for standard models:

  • Zero-Shot VLMs: State-of-the-art models like InternVideo2.0 struggled significantly, achieving a top zero-shot F1-score of just 18%.
  • Supervised Baseline: Fine-tuning CLIP4Clip on the training set improved performance but maxed out at a 26% F1-score.
  • Proposed Method (Agent + SALMA): The neuro-symbolic approach achieved a set-based F1-score of 34% across all queries (rising to 37% when excluding complex video-comparison queries), outperforming the best zero-shot model by a wide margin while remaining fully auditable.

Limitations and Future Work

The clear limitation of this work is the visual classifier's performance on subtle, fine-grained animal actions (SALMA achieved a macro-average F1-score of only 0.29 on specific actions). Improving spatiotemporal action localization in cluttered, outdoor environments remains a major open challenge.

Additionally, the current framework operates on a binary set-retrieval mechanism (match vs. no match). The authors note that extending this to a ranking-based system—where videos are sorted by a continuous similarity score derived from the JSON data—would be a valuable direction for future iterations.

Summary updated

BibTeX
@misc{gabeff2026prompting,
  author = {Valentin Gabeff and Baptiste Maquignaz and Jennifer Shan and Sepideh Mamooler and Gencer Sumbul and Blair Costelloe and Devis Tuia and Alexander Mathis},
  title = {{Prompting-MammAlps: Fine-Grained Text-to-Video Retrieval for Camera-Trap Data}},
  year = {2026},
  eprint = {2607.09876},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2607.09876},
}
Figure