Attack for Defense: Adversarial Agents for Point Prompt Optimization Empowering Segment Anything Model

Xueyu Liu, Xiaoyi Zhang, Guangze Shi, Meilin Liu, Yexin Lai +2 more
9/23/2025
cs.CV

No confident code implementation found for this paper.

Abstract

Prompt quality plays a critical role in the performance of the Segment Anything Model (SAM), yet existing approaches often rely on heuristic or manually crafted prompts, limiting scalability and generalization. In this paper, we propose Point Prompt Defender, an adversarial reinforcement learning framework that adopts an attack-for-defense paradigm to automatically optimize point prompts. We construct a task-agnostic point prompt environment by representing image patches as nodes in a dual-space graph, where edges encode both physical and semantic distances. Within this environment, an attacker agent learns to activate a subset of prompts that maximally degrade SAM's segmentation performance, while a defender agent learns to suppress these disruptive prompts and restore accuracy. Both agents are trained using Deep Q-Networks with a reward signal based on segmentation quality variation. During inference, only the defender is deployed to refine arbitrary coarse prompt sets, enabling enhanced SAM segmentation performance across diverse tasks without retraining. Extensive experiments show that Point Prompt Defender effectively improves SAM's robustness and generalization, establishing a flexible, interpretable, and plug-and-play framework for prompt-based segmentation.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{liu2025attack,
  title  = {Attack for Defense: Adversarial Agents for Point Prompt Optimization Empowering Segment Anything Model},
  author = {Xueyu Liu and Xiaoyi Zhang and Guangze Shi and Meilin Liu and Yexin Lai and Yongfei Wu and Mingqiang Wei},
  year   = {2025},
  eprint = {2509.18891},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2509.18891v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2509.18891.svg)](https://codeofpaper.com/paper/2509.18891)

Discussion