Referring expression segmentation

On this page 7

Referring expression segmentation is the task of producing a pixel-accurate mask for the specific object or region in an image that a natural-language phrase describes, such as “the man in the red jacket holding an umbrella”. It is a core problem in multimodal AI because the model must jointly interpret language and vision: the phrase selects one target among many similar candidates, and the output must trace that target’s exact outline rather than a rough box.

Within artificial intelligence, the task sits between visual grounding, which usually returns a bounding box, and classic semantic segmentation, which labels pixels by fixed categories without any notion of a sentence. Its abbreviation in research literature is usually RES, and the closely related video variant is called referring video object segmentation.

How referring expression segmentation works

A referring expression segmentation model takes an image and a text query and returns a binary mask in which each pixel is marked as belonging or not belonging to the referred object. The pipeline has three stages: encoding each modality, fusing the two representations, and decoding a mask at the original image resolution.

The vision encoder extracts multi-scale feature maps, typically from a convolutional backbone or a vision transformer. The text encoder, often a BERT-style model or the text tower of CLIP, turns the expression into word-level and sentence-level embeddings. The fusion stage then injects language into visual features through cross-modal attention, so that each spatial location is weighted by how well it matches words such as “left”, “smaller” or “behind the car”.

The following table lists the main components and the role each plays in the pipeline.

ComponentTypical implementationRole in the task
Vision encoderResNet, Swin Transformer, ViTExtracts multi-scale spatial features
Text encoderBERT, CLIP text tower, LLMEncodes attributes, relations and positions
Fusion moduleCross-attention, gated fusionAligns words with image regions
Mask decoderFPN-style or transformer decoderUpsamples fused features into a mask
Loss functionBinary cross-entropy plus Dice lossRewards accurate object boundaries
Core components of a referring segmentation model

Benchmarks and evaluation metrics

Progress in referring expression segmentation is measured on a small family of standard benchmarks built on MS COCO images. RefCOCO, RefCOCO+ and RefCOCOg differ in how the expressions were collected and which cues they allow, so results on one do not transfer automatically to another.

DatasetExpression styleMain difficulty
RefCOCOShort phrases, spatial words allowedMany same-category distractors
RefCOCO+Spatial words such as left or right bannedRequires appearance-based reasoning
RefCOCOgLonger, descriptive sentencesComplex relations and syntax
gRefCOCOExpressions with zero, one or many targetsHandling empty or multi-object queries
Widely used benchmark datasets

The usual metrics are overall IoU (cumulative intersection divided by cumulative union across the test set), mean IoU averaged per expression, and precision at thresholds such as Prec@0.5 and Prec@0.9. Overall IoU favors large objects, so careful papers report both overall and mean values, and a high Prec@0.9 score indicates genuinely sharp boundaries rather than roughly correct localization.

Referring expression segmentation is the most spatially precise grounding task in the multimodal family, but it is not the only way to connect language with image regions. The comparison below clarifies where it fits.

TaskInputOutput
Referring expression segmentationImage and one phrasePixel mask of the referred object
Referring expression comprehensionImage and one phraseBounding box of the referred object
Open-vocabulary segmentationImage and category namesMasks for every instance of each class
Visual question answeringImage and questionText answer
Reasoning segmentationImage and implicit instructionMask inferred through world knowledge
Comparison with neighboring tasks

The key distinction from open-vocabulary segmentation is instance selection: “dog” asks for all dogs, while “the dog lying on the sofa” asks for exactly one. Reasoning segmentation extends the idea further with queries such as “the object that keeps food cold”, which requires the model to infer the target from world knowledge rather than from explicit attributes.

Model families and design choices

Architectures for referring expression segmentation have moved from CNN and LSTM pipelines to transformer-based fusion and, most recently, to multimodal large language models that emit segmentation tokens. Each generation improved how relational language is handled.

  • Early fusion designs concatenate sentence embeddings with every pixel feature and then decode a mask; they are simple but struggle with relational phrases.
  • Transformer fusion models such as LAVT and CRIS inject language at several encoder stages or align pixels with text using contrastive pixel-text objectives.
  • Query-based decoders treat the expression as a set of learned queries, which also supports multi-target and no-target cases in generalized benchmarks.
  • LLM-driven segmenters such as LISA add a special segmentation token to a multimodal language model and pass its hidden state to a promptable mask decoder like SAM.

A frequent practical pattern is a two-stage combination: a grounding model predicts a box or point from the phrase, and a promptable segmenter converts it into a mask. This trades some accuracy for modularity and easier maintenance, because each component can be upgraded independently.

Limitations and common failure modes

Despite strong benchmark numbers, referring expression segmentation remains brittle under linguistic and visual ambiguity. Most errors come from misreading the phrase rather than from poor mask quality, which is why diagnosing failures requires looking at both modalities.

SymptomLikely causeMitigation
Wrong instance selectedWeak relational or spatial reasoningRelation-aware fusion, harder training negatives
Mask covers several objectsPhrase matched by category onlyInstance-level supervision, contrastive losses
Hallucinated mask for absent objectModel always predicts a targetTrain on no-target expressions
Ragged boundariesLow-resolution decoder featuresMulti-scale decoding, boundary-aware loss
Fails on negationWords like not or without ignoredTargeted data augmentation and evaluation
Typical errors, causes and mitigations

Benchmark bias is another concern: models can exploit dataset shortcuts, such as the most salient object usually being the answer. Real deployments should therefore be validated on in-domain expressions written by actual users, including ambiguous and empty queries.

The simple explanation

Imagine showing a friend a crowded photo and saying, “Color in the girl with the blue backpack.” Your friend must find the right girl. Then they must trace her outline exactly. Referring expression segmentation teaches a computer to do this.

The computer reads your words and looks at the picture. It decides which pixels belong to the thing you described. The result is a precise cutout of one object, not just a box around it. The hard part is choosing the right object among look-alikes.

How it is used in practice

A photo-editing application offers a feature where a user types a description instead of drawing a selection by hand. A user uploads a street scene and writes “remove the parked white van on the right”. A referring segmentation model produces a mask of that van only, ignoring two other white vehicles further down the street, and an inpainting model then fills the masked area.

During development, the team discovers that the model selects the wrong vehicle in about one case out of ten when phrases rely on relative position. They add training examples with spatial relations and introduce a confidence check that asks the user to confirm when two candidates score similarly. The result is faster, more reliable object removal that requires no manual masking for most edits.