InstructSAM: Segment Any Instance with Any Instructions

Yuqian Yuan, Wentong Li, Zhaocheng Li, Yutong Lin, Juncheng Li, Siliang Tang, Jun Xiao, Yueting Zhuang, Wenqiao ZhangarXiv 2026

TL;DR

InstructSAM bridges the gap between high-level language reasoning and pixel-level instance segmentation by connecting Vision-Language Models (VLMs) with SAM3. By introducing a parallel bank of learnable queries and a hybrid-attention mechanism, it can segment multiple distinct objects from complex, compositional instructions in a single forward pass. This approach achieves a ~27x speedup over traditional agentic pipelines while setting new state-of-the-art results on instruction-based segmentation tasks.

What Problem Does This Paper Address?

While models like the Segment Anything Model (SAM3) excel at segmenting objects using simple noun phrases (e.g., "traffic cone"), they struggle with real-world human instructions. Humans rarely point to objects using isolated category labels; instead, we use complex, compositional language involving attributes ("the small mugs"), spatial relations ("on the left"), exclusions ("except the one in front"), or counting ("the two largest").

To handle these complex prompts, current systems typically rely on one of two paradigms:

  1. Agentic Pipelines: A large VLM rewrites the complex instruction into simple phrases, repeatedly calls SAM3, and filters the results. This multi-step process is incredibly slow and prone to error accumulation.
  2. Token-as-Mask MLLMs: Multi-modal LLMs are trained to output a special token (like [SEG]) that decodes into a mask. However, because these tokens are generated autoregressively and lack an explicit instance-binding mechanism, they frequently produce duplicate or unstable masks when dealing with multiple instances.

InstructSAM addresses this by introducing an explicit, parallel reasoning-to-instance query interface that allows a VLM to communicate complex intent directly to SAM3 in a single pass.

Comparison of instruction-driven segmentation paradigms

Methods

InstructSAM formulates instruction-driven instance segmentation as a set-structured query prediction problem. Its architecture consists of three main components:

  • Parallel Instance Query Bank: Instead of forcing the LLM to generate mask tokens one by one, the authors inject a fixed bank of learnable queries ($K=10$ by default) into the LLM sequence right after a trigger token (<mask_start>). These act as parallel slots waiting to be filled with instance data.
  • Hybrid-Attention Design: To make these parallel slots work within an autoregressive LLM, the authors customized the attention mechanism. While standard text tokens follow strict causal (forward-only) attention, the injected mask queries are allowed full bidirectional attention with each other and global attention across all image and text tokens. This allows the slots to communicate, coordinate, and naturally suppress duplicate predictions.
  • Query Projection Layer: The final LLM-conditioned query embeddings are mapped via a lightweight MLP directly into SAM3's detector query space. SAM3's mask decoder then processes these queries to localize and output distinct binary masks and confidence scores simultaneously.

Datasets

To train and evaluate this capability, the authors introduced Inst2Seg, a large-scale instruction-based instance segmentation dataset. It features:

  • Training Set: 500K QA pairs across 100K images, generated via an automated pipeline using Gemini 3 Flash and SAM2.
  • Benchmark Set: 3,328 unique, manually verified instructions across 986 images, explicitly stratifying single-target, multi-target, and no-target scenarios.

The model was also evaluated on several established benchmarks: ReasonSeg (reasoning semantic segmentation), gRefCOCO (multi-object referring expressions), GSEval, and RoboRefIt (robotic manipulation grounding).

Key Insights and Ideas

  • Parallel Slots Beat Autoregressive Tokens: Forcing an LLM to "speak" masks sequentially is fundamentally mismatched with the task of instance enumeration. Allowing parallel queries to interact bidirectionally lets the model perform joint set prediction, ensuring cleaner instance separation.
  • Modular Synergy: You don't need to modify or retrain the core architecture of a powerful segmenter like SAM3 to give it deep reasoning capabilities. A simple query-space projection layer is enough to inherit SAM3's open-world mask quality while steering it with a VLM.
  • The Necessity of Data Filtering: When building the Inst2Seg dataset, the authors discovered that naive VLM-to-SAM generation introduces massive label noise. Implementing a rigorous filtering stage was vital; removing it caused the model's performance on the Inst2Seg benchmark to plummet from 31.5 mAP to 11.9 mAP.

Key Results

  • State-of-the-Art Accuracy: On the new Inst2Seg benchmark, the 2B-scale InstructSAM achieved 31.5 mAP, drastically outperforming existing end-to-end MLLM methods like LISA-7B (1.9 mAP) and SA2VA-8B (9.4 mAP).
  • Massive Speedups: InstructSAM completely bypasses the slow, iterative nature of agentic loops. On the Inst2Seg benchmark, it achieved an average inference time of 1.1 seconds, compared to 29.6 seconds for a SAM3-Agent pipeline powered by Qwen3-VL-2B—representing a ~27x execution speedup.
  • Strong Generalization: On the robotic grounding dataset RoboRefIt, InstructSAM-2B scored 74.4 on the distribution-shifted testB split, outperforming SA2VA-4B (34.0) and even beating the task-specific RefTR-r101 model (60.7).

Limitations and Future Work

  • Static Image Constraint: The current model is strictly limited to static images. Extending this parallel query architecture to video data introduces significant hurdles in maintaining temporal correspondence and frame-to-frame mask consistency.
  • Co-Training Interference: The authors noted that effectively blending dense segmentation datasets with general conversational instruction datasets remains an open challenge. Naive joint training often degrades performance on specific segmentation benchmarks, meaning more sophisticated data-balancing and co-training strategies are required.

Summary updated

BibTeX
@misc{yuan2026instructsam,
  author = {Yuqian Yuan and Wentong Li and Zhaocheng Li and Yutong Lin and Juncheng Li and Siliang Tang and Jun Xiao and Yueting Zhuang and Wenqiao Zhang},
  title = {{InstructSAM: Segment Any Instance with Any Instructions}},
  year = {2026},
  eprint = {2605.26102},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2605.26102},
}
Figure