RSAgent: Learning to Reason and Act via Multi-Turn Tool Invocations for Text-Guided Segmentation

Xingqi He, Yujie Zhang, Shuyong Gao, Wenjie Li, Lingyi Hong, Mingxi Chen, Kaixun Jiang, Jiyuan Fu, Wenqiang ZhangICML 2026

Overview

Text-guided image segmentation has traditionally operated as a "one-shot" guessing game. A model processes an image and a descriptive prompt, then attempts to output a flawless pixel mask in a single forward pass. RSAgent fundamentally transforms this paradigm by treating segmentation as an iterative, agentic process. By interleaving reasoning with multi-turn tool invocations—such as zooming into regions of interest or calling specialized segmentation models like SAM2—RSAgent can self-correct, refine its masks, and handle complex reasoning queries. This approach achieves state-of-the-art results on challenging benchmarks like ReasonSeg and RefCOCOg.

The Problem: The "Single-Pass" Bottleneck

Text-guided segmentation requires a model to perform both cross-modal reasoning (understanding a prompt like "the object the man is using to stay safe") and precise pixel grounding.

Historically, models have treated this as a single forward pass. The authors identify a major bottleneck in this approach: a lack of recourse. If a single-pass model's initial localization is slightly off, or if the target object is small and heavily occluded, the model has no mechanism to "take a closer look" or refine its hypothesis. It cannot verify its own work or refocus its attention based on intermediate visual feedback.

The RSAgent Solution: An Agentic Loop

To overcome the limitations of single-pass prediction, the authors introduce RSAgent, an agentic Multimodal Large Language Model (MLLM) that approaches segmentation as a multi-turn dialogue between the model and a visual toolbox.

Instead of outputting a mask directly, RSAgent follows a Reason-and-Act (ReAct) paradigm:

  1. Reason: The model generates a textual rationale (Chain-of-Thought) detailing what it currently sees and what visual features it needs to find.
  2. Act: It invokes a tool from its visual toolbox. Tools include SAM2 (for generating candidate masks from points or bounding boxes) and Zoom-in/Rotate (to adjust the field of view for better grounding).
  3. Observe: The environment provides feedback, such as a zoomed-in image patch or a mask overlay.
  4. Refine: The model incorporates this new observation into its history, deciding whether to further refine the mask or terminate the loop with a final answer.

Two-Stage Training Framework

Training an agent to effectively use tools and reason over multiple turns requires a specialized pipeline. The authors utilized a two-stage framework:

  • Cold-Start Supervised Fine-Tuning (SFT): To teach the model the basics of tool usage, the authors built a data pipeline to synthesize 5,000 high-quality, multi-turn reasoning trajectories derived from SA-1B.
  • Agentic Reinforcement Learning (RL): The model is further optimized using Group Relative Policy Optimization (GRPO). Crucially, the reward function is not solely based on the final mask accuracy. It incorporates process rewards that encourage step-by-step Intersection over Union (IoU) improvements across turns while penalizing redundant or unhelpful tool calls.

Key Insights and Emergent Behaviors

The agentic framework unlocks several powerful behaviors that are impossible for traditional models:

  • The Power of the "Zoom": RSAgent learned the ability to zoom into ambiguous or small regions before committing to a segmentation mask, mimicking human-like "active perception."
  • Self-Correction: Qualitative results demonstrate the model identifying its own failures (e.g., realizing it initially segmented the wrong person) and using subsequent turns to re-localize the correct target.
  • Process vs. Outcome Rewards: Rewarding the improvement in mask quality between turns successfully taught the model how to recover from early mistakes.
  • Decoupling Reasoning from Grounding: By utilizing a frozen, high-quality segmentor (SAM2) as a tool, the MLLM is freed to focus on high-level linguistic and relational reasoning, delegating the heavy "pixel-crunching" to a specialized module.

State-of-the-Art Results

RSAgent was evaluated on standard Referring Expression Segmentation (RES) benchmarks (RefCOCO, RefCOCO+, RefCOCOg), the challenging ReasonSeg dataset (which requires complex implicit reasoning), and MESS (a multi-domain benchmark for zero-shot semantic segmentation).

The model established new state-of-the-art performance across multiple metrics:

  • ReasonSeg: Achieved 66.5% gIoU (generalized IoU) on the test set, representing a massive 9% improvement over the previous best model, Seg-Zero-7B.
  • RefCOCOg: Reached 81.5% cIoU (cumulative IoU), demonstrating superior performance on traditional referring expression tasks.
  • Zero-Shot Generalization: Despite being trained on a relatively small dataset (including an 8K RefCOCOg subset), RSAgent outperformed models trained on much larger datasets, proving the agentic framework's robust out-of-domain generalization.

Limitations and Future Work

While RSAgent represents a significant leap forward, the authors note a few limitations:

  • Efficiency: Multi-turn interactions inherently increase latency and computational costs compared to single-pass models.
  • Grounding Ceiling: The model's ultimate pixel accuracy is still bounded by the capabilities of its underlying tools. If SAM2 fails on extremely tiny or heavily occluded objects, RSAgent will struggle to recover.
  • Scope: The current framework is limited to still images.

Future directions include extending the visual toolbox to handle video (via temporal tools) and 3D/embodied settings for robotics. Additionally, integrating uncertainty-aware stopping rules could significantly improve the efficiency of the multi-turn loop.

Summary updated

BibTeX
@inproceedings{he2026rsagent,
  author = {Xingqi He and Yujie Zhang and Shuyong Gao and Wenjie Li and Lingyi Hong and Mingxi Chen and Kaixun Jiang and Jiyuan Fu and Wenqiang Zhang},
  title = {{RSAgent: Learning to Reason and Act via Multi-Turn Tool Invocations for Text-Guided Segmentation}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=YYm8Cwn1J3},
}
Figure