Text4Seg++: Advancing Image Segmentation via Generative Language Modeling

Mengcheng Lan, Chaofeng Chen, Jiaxing Xu, Zongrui Li, Yiping Ke, Xudong Jiang, Yingchen Yu, Yunqing Zhao, Song Bai · DOI

Introduction

Multimodal Large Language Models (MLLMs) like LLaVA and Qwen-VL have revolutionized visual understanding, yet they often struggle with dense prediction tasks such as image segmentation. Traditionally, researchers have addressed this by appending external visual decoders (like the Segment Anything Model) to the MLLM. While effective, this approach complicates training pipelines and deviates from the elegant "next-token prediction" paradigm that drives LLM scalability. Other methods, such as predicting polygon coordinates, often fail because LLMs struggle to associate raw numbers with precise spatial shapes.

The "Text-as-Mask" Paradigm

Text4Seg++ introduces a novel "text-as-mask" framework that treats image segmentation purely as a text generation problem. By representing segmentation masks as highly compressed text sequences, the model allows standard MLLMs to perform fine-grained segmentation out-of-the-box without architectural modifications.

Comparison of segmentation paradigms: (a) embeddings-as-mask using external decoders, (b) polygon coordinates, and (c) the proposed text-as-mask approach which treats masks as text sequences.

Methodology: From Grids to Semantic Bricks

The authors propose two primary frameworks to achieve high-quality segmentation through text:

  1. Text4Seg (Image-wise Semantic Descriptors): The image is divided into a grid (e.g., 16x16), where each patch is mapped to a text label. To manage sequence length, the authors introduced Row-wise Run-Length Encoding (R-RLE). Instead of repeating labels (e.g., "sky, sky, sky..."), the model outputs a compressed format (e.g., "sky*3"). Crucially, this is done row-by-row to preserve the 2D spatial structure necessary for LLM reasoning.
  2. Text4Seg++ (Box-wise Semantic Descriptors & Semantic Bricks): To reach finer resolutions (up to 64x64) without token explosion, the model first outputs a bounding box to localize the object. It then generates the mask only within that box using Semantic Bricks—specialized vocabulary tokens representing binary mask segments (e.g., fg5 for 5 foreground pixels). This allows the model to effectively "paint" the mask via next-brick prediction.

Key Insights and Performance

A central finding of this work is that segmentation can be viewed as a translation task: translating a 2D visual mask into a 1D text string. The authors found that global compression methods often destroy spatial reasoning; however, Row-wise RLE preserved spatial patterns while reducing token counts by 74%.

State-of-the-Art Results

  • RefCOCO Benchmarks: The 7B parameter Text4Seg++ achieved an average of 79.3 cIoU, outperforming previous best models (76.4 cIoU) without requiring an external mask refiner.
  • Reasoning and Generalization: On the MUSE multi-object reasoning benchmark, the model scored 63.8 cIoU, significantly higher than the 52.5 cIoU baseline. It also demonstrated strong zero-shot performance on geospatial data (EarthReason), achieving 70.1 cIoU.
  • Efficiency: The R-RLE compression technique provided a 3x speedup in inference compared to uncompressed text masks.

Limitations and Future Work

While Text4Seg++ eliminates the need for external decoders, its quality is currently bottlenecked by the input resolution of the MLLM's visual encoder. Future work may involve integrating higher-resolution encoders or exploring more sophisticated compression techniques to further refine mask boundaries. Ultimately, treating dense prediction as a generative language task provides a unified path toward more integrated vision-language understanding.

Summary updated

BibTeX
@article{lan2026text,
  author = {Mengcheng Lan and Chaofeng Chen and Jiaxing Xu and Zongrui Li and Yiping Ke and Xudong Jiang and Yingchen Yu and Yunqing Zhao and Song Bai},
  title = {{Text4Seg++: Advancing Image Segmentation via Generative Language Modeling}},
  journal = {IEEE Trans. Pattern Anal. Mach. Intell.},
  year = {2026},
  doi = {10.1109/tpami.2026.3683307},
}
Figure