SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · Xia_GSVA_Generalized_Segmentation_via_Multimodal_Large_Language_Models_CVPR_2024_paper · CVPR · 2024

GSVA: Generalized Segmentation via Multimodal Large Language Models

Gao Huang, Shiji Song, Xuran Pan, Yizeng Han, Dongchen Han, Zhuofan Xia

Open in the Atlas

Code that ran

6 of 10 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 5 failures of our instrument; 4 no recorded run), measured 2026-11-23; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/Xia_GSVA_Generalized_Segmentation_via_Multimodal_Large_Language_Models_CVPR_2024_paper.json · badge: /api/ran/Xia_GSVA_Generalized_Segmentation_via_Multimodal_Large_Language_Models_CVPR_2024_paper.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
LeapLabTHU/GSVA canonical (classifier label)
classifier basis: census
6 ran · 4 no recorded run
FunctionStatusWhere it lives
dice_loss Ran
ran; our contract draft was wrong, not the code
LeapLabTHU/GSVA/model/losses.py
code served (permissive licence) · get_code("6ec47ecac3fe27fc")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Create small test tensors
# inputs: shape (batch=2, height=4, width=3) - will be flattened to (2, 12)
inputs = torch.randn(2, 4, 3, requires_grad=True)

# targets: shape (batch=2, height=4, width=3) - will be flattened to (2, 12)
targets = torch.randint(0, 2, (2, 4, 3), dtype=torch.float32)

# num_masks: number of masks in the batch
num_masks = 2.0

ARGS = {
    "inputs": inputs,
    "targets": targets,
    "num_masks": num_masks,
    "scale": 1000,
    "eps": 1e-06,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_logger Ran
ran; our contract draft was wrong, not the code
LeapLabTHU/GSVA/utils/logger.py
code served (permissive licence) · get_code("7e11d9ec27335f5b")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Logger. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import functools
import logging
import os
import sys
import tempfile
from termcolor import colored

@functools.lru_cache()
def get_logger(output_dir, dist_rank=0, name=''):
    logger = logging.getLogger(name)
    logger.setLevel(logging.DEBUG)
    logger.propagate = False
    fmt = '[%(asctime)s %(name)s] (%(filename)s %(lineno)d): %(levelname)s %(message)s'
    color_fmt = colored('[%(asctime)s %(name)s]', 'green') + colored('(%(filename)s %(lineno)d)', 'yellow') + ': %(levelname)s %(message)s'
    if dist_rank == 0:
        console_handler = logging.StreamHandler(sys.stdout)
        console_handler.setLevel(logging.DEBUG)
        console_handler.setFormatter(logging.Formatter(fmt=color_fmt, datefmt='%Y-%m-%d %H:%M:%S'))
        logger.addHandler(console_handler)
        file_handler = logging.FileHandler(os.path.join(output_dir, f'{name}_log.txt'), mode='a')
        file_handler.setLevel(logging.DEBUG)
        file_handler.setFormatter(logging.Formatter(fmt=fmt, datefmt='%Y-%m-%d %H:%M:%S'))
        logger.addHandler(file_handler)
    return logger

temp_dir = tempfile.mkdtemp()

ARGS = {
    'output_dir': temp_dir,
    'dist_rank': 0,
    'name': 'test_logger'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
termcolor — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Logger — a Logger output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Logger output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
iou_loss Ran
ran; our contract draft was wrong, not the code
LeapLabTHU/GSVA/model/losses.py
code served (permissive licence) · get_code("af6fc3d42a9de09a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Create small tensors for the function parameters
# pred_iou: should be a tensor of predicted IoU scores (batch of predictions)
pred_iou = torch.randn(2, 1, dtype=torch.float32)

# pred_mask: predicted mask tensor
pred_mask = torch.randn(2, 4, dtype=torch.float32)

# target_mask: ground truth mask tensor
target_mask = torch.randn(2, 4, dtype=torch.float32)

# num_masks: number of masks (scalar)
num_masks = 2.0

ARGS = {
    "pred_iou": pred_iou,
    "pred_mask": pred_mask,
    "target_mask": target_mask,
    "num_masks": num_masks,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
load_image_from_base64 Ran
ran, honoured the contract we drafted
LeapLabTHU/GSVA/model/llava/mm_utils.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from tencent/hunyuan3d-2, is pointer only (licence: NOASSERTION) · get_code("0dde2e782959c0bd")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from tencent/hunyuan3d-2, and GitHub could not classify the licence of that repository (NOASSERTION). The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

process_images Ran
ran; our contract draft was wrong, not the code
LeapLabTHU/GSVA/model/llava/mm_utils.py
code served (permissive licence) · get_code("1df990c375318896")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 4, dtype family float, shape (2, 3, 4, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Create a minimal image processor stand-in
class MockImageProcessor:
    def __call__(self, images, return_tensors=None):
        # The function calls this with images and return_tensors='pt'
        # It expects a dict with 'pixel_values' key containing a tensor
        if isinstance(images, list):
            # Stack list of images into batch
            stacked = torch.stack(images)
        else:
            stacked = images
        
        return {
            'pixel_values': stacked
        }

# Create minimal model config (unused in function body, but required parameter)
model_cfg = {}

# Create sample images - batch of 2, with shape (3, 4, 4) for RGB images of size 4x4
images = [
    torch.randn(3, 4, 4),
    torch.randn(3, 4, 4)
]

# Create image processor
image_processor = MockImageProcessor()

ARGS = {
    'images': images,
    'image_processor': image_processor,
    'model_cfg': model_cfg
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float, shape (2, 3, 4, 4) — shape (2, 3, 4, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
sigmoid_ce_loss Ran
ran; our contract draft was wrong, not the code
LeapLabTHU/GSVA/model/losses.py
code served (permissive licence) · get_code("13c0bb91f8009d9c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn.functional as F

torch.manual_seed(0)

# Construct tiny tensors for inputs and targets
# inputs: logits tensor, shape (batch=2, height=4, width=3)
inputs = torch.randn(2, 4, 3)

# targets: binary targets, shape (batch=2, height=4, width=3)
targets = torch.randint(0, 2, (2, 4, 3)).float()

# num_masks: a float representing the number of masks
num_masks = 2.0

ARGS = {
    "inputs": inputs,
    "targets": targets,
    "num_masks": num_masks,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
build_sam_vit_b Not yet run
unverified (harvested, no recorded run)
LeapLabTHU/GSVA/model/segment_anything/build_sam.py
code served (permissive licence) · get_code("e11c7f60d91192ce")
How it ran

no invocation recorded.

build_sam_vit_h Not yet run
unverified (harvested, no recorded run)
LeapLabTHU/GSVA/model/segment_anything/build_sam.py
code served (permissive licence) · get_code("06cfc37f79036a2c")
How it ran

no invocation recorded.

build_sam_vit_l Not yet run
unverified (harvested, no recorded run)
LeapLabTHU/GSVA/model/segment_anything/build_sam.py
code served (permissive licence) · get_code("7cea226e4ef7b90d")
How it ran

no invocation recorded.

init_vision_seg_for_model Not yet run
unverified (harvested, no recorded run)
LeapLabTHU/GSVA/model/prepare_model_tokenizer.py
code served (permissive licence) · get_code("0a8545604f9b15d8")
How it ran

no invocation recorded.

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 10 are also present in other papers whose code we hold (10 with at least one paper dated earlier, 0 the same month, 8 later) and 0 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
load_image_from_base64 85 other papers
16 dated earlier, 15 later, 54 same year, order not determinable
2112.05682 (2021-12)
Self-attention Does Not Need $O(n^2)$ Memory
2308.10253 (2023-08)
StableLLaVA: Enhanced Visual Instruction Tuning with Synthesized Image-Dialogue Data
2309.07120 (2023-09)
Sight Beyond Text: Multi-Modal Training Enhances LLMs in Truthfulness and Ethics
and 82 more not named here
build_sam_vit_h 37 other papers
17 dated earlier, 5 later, 15 same year, order not determinable · 2 only as an assembly brick
2304.06790 (2023-04)
Inpaint Anything: Segment Anything Meets Image Inpainting
2304.12306 (2023-04)
Segment Anything in Medical Images
2305.01586 (2023-05)
An Alternative to WSSS? An Empirical Study of the Segment Anything Model (SAM) on Weakly-Supervised Semantic Segmentation Problems
and 34 more not named here
build_sam_vit_b 34 other papers
17 dated earlier, 3 later, 14 same year, order not determinable
2304.06790 (2023-04)
Inpaint Anything: Segment Anything Meets Image Inpainting
2304.12306 (2023-04)
Segment Anything in Medical Images
2305.01586 (2023-05)
An Alternative to WSSS? An Empirical Study of the Segment Anything Model (SAM) on Weakly-Supervised Semantic Segmentation Problems
and 31 more not named here
build_sam_vit_l 34 other papers
17 dated earlier, 3 later, 14 same year, order not determinable
2304.06790 (2023-04)
Inpaint Anything: Segment Anything Meets Image Inpainting
2304.12306 (2023-04)
Segment Anything in Medical Images
2305.01586 (2023-05)
An Alternative to WSSS? An Empirical Study of the Segment Anything Model (SAM) on Weakly-Supervised Semantic Segmentation Problems
and 31 more not named here
sigmoid_ce_loss 17 other papers
4 dated earlier, 5 later, 8 same year, order not determinable · 1 only as an assembly brick
2312.02228 (2023-12)
PixelLM: Pixel Reasoning with Large Multimodal Model
2312.10103 (2023-12)
GSVA: Generalized Segmentation via Multimodal Large Language Models
2312.15715 (2023-12)
Segment Every Reference Object in Spatial and Temporal Spaces
and 14 more not named here
dice_loss 16 other papers
5 dated earlier, 5 later, 6 same year, order not determinable · 1 only as an assembly brick
2311.05348 (2023-11)
u-LLaVA: Unifying Multi-Modal Tasks via Large Language Model
2312.02228 (2023-12)
PixelLM: Pixel Reasoning with Large Multimodal Model
2312.10103 (2023-12)
GSVA: Generalized Segmentation via Multimodal Large Language Models
and 13 more not named here
process_images 15 other papers
6 dated earlier, 2 later, 7 same year, order not determinable
2309.07120 (2023-09)
Sight Beyond Text: Multi-Modal Training Enhances LLMs in Truthfulness and Ethics
2311.16208 (2023-11)
InstructMol: Multi-Modal Integration for Building a Versatile and Reliable Molecular Assistant in Drug Discovery
2311.18445 (2023-11)
VTimeLLM: Empower LLM to Grasp Video Moments
and 12 more not named here
iou_loss 2 other papers
1 dated earlier, 1 later
2312.10103 (2023-12)
GSVA: Generalized Segmentation via Multimodal Large Language Models
2510.03853 (2025-10)
UGround: Towards Unified Visual Grounding with Unrolled Transformers
get_logger 1 other paper
1 dated earlier
2312.10103 (2023-12)
GSVA: Generalized Segmentation via Multimodal Large Language Models
init_vision_seg_for_model 1 other paper
1 dated earlier
2312.10103 (2023-12)
GSVA: Generalized Segmentation via Multimodal Large Language Models

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Generalized Referring Expression Segmentation (GRES) extends the scope of classic RES to refer to multiple objects in one expression or identify the empty targets absent in the image. GRES poses challenges in modeling the complex spatial relationships of the instances in the image and identifying non-existing referents. Multimodal Large Language Models (MLLMs) have recently shown tremendous progress in these complicated vision-language tasks. Connecting Large Language Models (LLMs) and vision models, MLLMs are proficient in understanding contexts with visual inputs. Among them, LISA, as a representative, adopts a special [SEG] token to prompt a segmentation mask decoder, e.g., SAM, to enable MLLMs in the RES task. However, existing solutions to GRES remain unsatisfactory since current segmentation MLLMs cannot correctly handle the cases where users might reference multiple subjects in a singular prompt or provide descriptions incongruent with any image target. In this paper, we propose Generalized Segmentation Vision Assistant (GSVA) to address this gap. Specifically, GSVA reuses the [SEG] token to prompt the segmentation model towards supporting multiple mask references simultaneously and innovatively learns to generate a [REJ] token to reject the null targets explicitly. Experiments validate GSVA's efficacy in resolving the GRES issue, marking a notable enhancement and setting a new record on the GRES benchmark gRefCOCO dataset. GSVA also proves effective across various classic referring segmentation and comprehension tasks. Code is available at https://github.com/LeapLabTHU/GSVA.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("Xia_GSVA_Generalized_Segmentation_via_Multimodal_Large_Language_Models_CVPR_2024_paper")
get_code_for_paper("Xia_GSVA_Generalized_Segmentation_via_Multimodal_Large_Language_Models_CVPR_2024_paper")
have("Xia_GSVA_Generalized_Segmentation_via_Multimodal_Large_Language_Models_CVPR_2024_paper")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/Xia_GSVA_Generalized_Segmentation_via_Multimodal_Large_Language_Models_CVPR_2024_paper.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/Xia_GSVA_Generalized_Segmentation_via_Multimodal_Large_Language_Models_CVPR_2024_paper.svg)](https://syntology.ai/paper/Xia_GSVA_Generalized_Segmentation_via_Multimodal_Large_Language_Models_CVPR_2024_paper)

Connect an agent — have() is free.