Skip to content

L-AILab/PromptPilot

Repository files navigation

PromptPilot: Game-Theoretic Multi-Agent Prompt Optimization for Segment Anything

OpenReview ICML 2026 Python License: MIT

News | Description | Highlights | Framework | Repository Structure | Installation | Data Preparation | Running | Results | Citation | Acknowledgement

PromptPilot is a hierarchical multi-agent reinforcement learning framework for point prompt optimization with frozen DINOv2 and Segment Anything Model (SAM). It formulates automated prompt construction as a cooperative game, where specialized agents balance semantic consistency, spatial coverage, and prompt-level credit assignment without updating the foundation models during inference.

News

Description

Few-shot segmentation with vision foundation models relies on high-quality prompts to segment unseen categories from limited support annotations. Existing prompt construction strategies often depend on test-time adaptation, fixed heuristic sampling, or monolithic reinforcement learning. These designs make it difficult to jointly optimize semantic consistency, spatial coverage, and prompt-level credit assignment.

PromptPilot addresses this limitation by decomposing prompt optimization into complementary decision spaces. A Feature Agent improves semantic discriminability in the DINOv2 feature space, a Physical Agent improves spatial coverage in the image plane, and a centralized Manager Agent selects actions according to SAM feedback and local marginal contribution. The framework operates as an inference-time prompt optimizer and keeps DINOv2 and SAM frozen.

Highlights

  • Game-theoretic prompt optimization: Prompt construction is formulated as sequential decision making over a cooperative prompt game.
  • Hierarchical multi-agent policy: Feature and Physical agents propose complementary prompt modifications, while a Manager agent arbitrates the executed action.
  • SAM-aligned feedback: Global DSC feedback from SAM aligns prompt optimization with the final segmentation objective.
  • Prompt credit assignment: Leave-one-out marginal contribution with EMA smoothing estimates the utility of individual prompts in the current prompt coalition.

Framework

PromptPilot workflow

Repository Structure

The public repository contains the main training, optimization, and evaluation entry points:

PromptPilot/
+-- agents/                 # Feature, Physical, and Manager agents
+-- feature_matching/       # DINOv2-based matching and prompt initialization
+-- segmenter/              # SAM interface and mask prediction utilities
+-- arg_game_multi.py       # Multi-agent prompt optimization
+-- train_game.py           # Agent training
+-- evaluate_all.py         # Benchmark evaluation
+-- arg_run.sh              # Training/optimization launch script
+-- evaluate_run.sh         # Evaluation launch script
+-- requirements.txt        # Python dependencies
+-- utils.py                # Shared utilities

Installation

Clone the repository and install dependencies:

git clone https://github.com/L-AILab/PromptPilot.git
cd PromptPilot
pip install -r requirements.txt

Prepare the required frozen backbones:

  • DINOv2 for patch-level feature extraction.
  • SAM for promptable mask decoding.

Place downloaded checkpoints in the paths expected by your local configuration or scripts.

Data Preparation

PromptPilot is evaluated on natural image, medical image, and video object segmentation datasets:

  • PASCAL VOC
  • COCO
  • ISIC
  • Kvasir
  • GBM
  • JSRT
  • DAVIS 2016
  • DAVIS 2017

Organize datasets according to the paths used in arg_run.sh, evaluate_run.sh, or your local configuration. A common layout is:

Dataset/
+-- ClassName/
    +-- reference_images/
    +-- reference_masks/
    +-- target_images/
    +-- target_masks/

Running

Train the PromptPilot agents:

bash arg_run.sh

Run multi-agent prompt optimization directly:

python arg_game_multi.py

Evaluate trained policies:

bash evaluate_run.sh

or run the evaluation entry point:

python evaluate_all.py

For custom paths, checkpoints, or benchmark splits, edit the corresponding shell scripts and configuration arguments in the repository.

Results

Natural and Medical Image Segmentation

PromptPilot achieves state-of-the-art automated prompt optimization performance across natural and medical segmentation benchmarks. Gray rows in the paper correspond to manual-prompt or adaptation-based reference settings.

Method VOC COCO ISIC Kvasir GBM JSRT
DSCmIoU DSCmIoU DSCmIoU DSCmIoU DSCmIoU DSCmIoU
SAM (Point)50.441.252.242.869.360.172.463.665.452.559.643.1
SAM (Box)80.172.872.364.584.675.978.672.055.841.760.845.9
SAM-Adapter--------74.765.486.379.151.941.690.082.2
SAM-LoRA--------91.084.483.475.867.555.587.381.6
PerSAM55.349.326.522.763.954.529.319.943.633.258.241.5
PerSAM-f54.548.023.820.260.651.433.325.045.235.257.340.8
VRP-SAM48.840.825.219.264.555.528.017.919.712.349.833.4
Matcher68.959.945.038.474.766.339.429.558.845.389.581.3
GBMSeg55.347.732.926.959.248.340.228.959.145.079.666.9
FM-PPO61.352.836.730.472.462.744.933.966.053.187.778.4
PromptPilot (Ours)69.361.354.447.178.669.049.340.172.560.689.881.7

Video Object Segmentation

Method DAVIS 2016 DAVIS 2017
JF JF
PerSAM68.269.761.767.7
PerSAM-f69.370.664.970.3
VRP-SAM47.447.435.139.0
Matcher78.581.765.173.0
GBMSeg76.574.656.154.9
FM-PPO75.976.061.562.4
PromptPilot (Ours)80.181.869.371.1

Ablation Study

On four medical benchmarks, the full PromptPilot design reaches 72.6 DSC and 62.9 mIoU on average. Using both actor agents with Manager supervision improves the average mIoU to 61.3, and adding leave-one-out marginal contribution further improves it by 1.6 points.

Actor Agents Manager Agent ISIC Kvasir GBM JSRT Average
FeaturePhysical DSCLOO DSCmIoU DSCmIoU DSCmIoU DSCmIoU DSCmIoU
yesnonono51.441.122.415.840.931.463.947.544.734.0
noyesnono52.342.222.615.939.930.565.549.245.134.5
yesyesnono50.339.923.216.241.431.665.649.245.134.2
yesnoyesno74.465.336.327.461.148.579.367.762.852.2
noyesyesno74.865.736.827.864.051.479.267.063.753.0
yesyesyesno77.968.347.738.471.158.988.379.671.361.3
yesyesyesyes78.669.049.340.172.560.689.881.772.662.9

Plug-and-Play Prompt Optimization

Setting Method ISIC Kvasir GBM JSRT Average
DSC mIoU DSC mIoU DSC mIoU DSC mIoU DSC mIoU
Feature Matching Baseline 71.661.5 36.928.8 49.938.9 73.260.5 57.947.4
Feature Matching FM-PPO 72.462.7 44.933.9 66.053.1 87.778.4 67.857.0
Feature Matching FM-PromptPilot 78.669.0 49.340.1 72.560.6 89.881.7 72.662.9
Coarse Segmentation Baseline 46.036.0 20.414.5 25.418.3 44.931.2 34.225.0
Coarse Segmentation CS-PPO 51.241.1 22.416.2 21.214.7 58.542.3 38.328.6
Coarse Segmentation CS-PromptPilot 78.569.0 45.936.4 71.258.4 89.381.1 71.261.2

Citation

If you find this project useful, please cite:

@inproceedings{
shi2026promptpilot,
title={PromptPilot: Game-Theoretic Multi-Agent Prompt Optimization for Segment Anything},
author={Guangze Shi and Yingjie Mi and Jia Shen and Feixue Shao and Jiarui Cao and Yexin Lai and Xueyu Liu and Rui Wang and Yongfei Wu and Mingqiang Wei},
booktitle={Forty-third International Conference on Machine Learning},
year={2026},
url={https://openreview.net/forum?id=H6T8ECJafn}
}

Acknowledgement

This work builds on DINOv2, SAM, and Plug-and-Play PPO. We thank the authors of these projects for their open research contributions.

This work was supported by the National Natural Science Foundation of China, the Fundamental Research Program of Shanxi Province, and the Key Research and Development Program of Shanxi Province.

About

Official code for ICML 2026 paper "PromptPilot: Game-Theoretic Multi-Agent Prompt Optimization for Segment Anything"

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors