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.
| Component | Typical implementation | Role in the task |
|---|---|---|
| Vision encoder | ResNet, Swin Transformer, ViT | Extracts multi-scale spatial features |
| Text encoder | BERT, CLIP text tower, LLM | Encodes attributes, relations and positions |
| Fusion module | Cross-attention, gated fusion | Aligns words with image regions |
| Mask decoder | FPN-style or transformer decoder | Upsamples fused features into a mask |
| Loss function | Binary cross-entropy plus Dice loss | Rewards accurate object boundaries |
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.
| Dataset | Expression style | Main difficulty |
|---|---|---|
| RefCOCO | Short phrases, spatial words allowed | Many same-category distractors |
| RefCOCO+ | Spatial words such as left or right banned | Requires appearance-based reasoning |
| RefCOCOg | Longer, descriptive sentences | Complex relations and syntax |
| gRefCOCO | Expressions with zero, one or many targets | Handling empty or multi-object queries |
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.
How it differs from related multimodal tasks
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.
| Task | Input | Output |
|---|---|---|
| Referring expression segmentation | Image and one phrase | Pixel mask of the referred object |
| Referring expression comprehension | Image and one phrase | Bounding box of the referred object |
| Open-vocabulary segmentation | Image and category names | Masks for every instance of each class |
| Visual question answering | Image and question | Text answer |
| Reasoning segmentation | Image and implicit instruction | Mask inferred through world knowledge |
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.
| Symptom | Likely cause | Mitigation |
|---|---|---|
| Wrong instance selected | Weak relational or spatial reasoning | Relation-aware fusion, harder training negatives |
| Mask covers several objects | Phrase matched by category only | Instance-level supervision, contrastive losses |
| Hallucinated mask for absent object | Model always predicts a target | Train on no-target expressions |
| Ragged boundaries | Low-resolution decoder features | Multi-scale decoding, boundary-aware loss |
| Fails on negation | Words like not or without ignored | Targeted data augmentation and evaluation |
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.