SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2405.03144 · CVPR · 2024

PTQ4SAM: Post-Training Quantization for Segment Anything

Xianglong Liu, Hong Chen, Jinyang Guo, Yifu Ding, Chengtao Lv

arXiv · PDF · Open in the Atlas

Code that ran

8 of 9 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; 0 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 8 failures of our instrument; 1 no recorded run); 1 of them was also run on the host, not in the jail, by the peer-agreement lane that set its level, measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; 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/2405.03144.json · badge: /api/ran/2405.03144.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
chengtao-lv/PTQ4SAM canonical (classifier label)
classifier basis: census
8 ran · 1 no recorded run
FunctionStatusWhere it lives
round_ste Ran
ran; our contract draft was wrong, not the code
chengtao-lv/PTQ4SAM/ptq4sam/quantization/util_quant.py
pointer only (licence: NONE) · get_code("675da8641c602b03")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, chengtao-lv/PTQ4SAM when it was checked. 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.

fake_logquantize_per_tensor_affine Ran
ran; our contract draft was wrong, not the code
chengtao-lv/PTQ4SAM/ptq4sam/quantization/util_quant.py
pointer only (licence: NONE) · get_code("235ca98c280dc43c")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, chengtao-lv/PTQ4SAM when it was checked. 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.

fake_quantize_per_tensor_affine Ran
ran; our contract draft was wrong, not the code
chengtao-lv/PTQ4SAM/ptq4sam/quantization/util_quant.py
pointer only (licence: NONE) · get_code("f5f3045a5c318d7c")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, chengtao-lv/PTQ4SAM when it was checked. 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.

get_module_args Ran
ran; our contract draft was wrong, not the code
chengtao-lv/PTQ4SAM/ptq4sam/quantization/quantized_module_matmul.py
pointer only (licence: NONE) · get_code("2f381ebd3e023bfa")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, chengtao-lv/PTQ4SAM when it was checked. 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.

lp_loss Ran
ran; our contract draft was wrong, not the code
chengtao-lv/PTQ4SAM/ptq4sam/solver/recon.py
pointer only (licence: NONE) · get_code("8003cb7a5176e497")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, chengtao-lv/PTQ4SAM when it was checked. 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.

parse_config Ran
ran; our contract draft was wrong, not the code
chengtao-lv/PTQ4SAM/ptq4sam/solver/utils.py
pointer only (licence: NONE) · get_code("afb8f93395a730c8")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, chengtao-lv/PTQ4SAM when it was checked. 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_checkpoint Ran
ran; our contract draft was wrong, not the code
chengtao-lv/PTQ4SAM/mmdetection/.dev_scripts/gather_models.py
pointer only (licence: NONE) · get_code("138e112e22b0314e")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, chengtao-lv/PTQ4SAM when it was checked. 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.

update_specialized_quantizer_config Ran
ran; our contract draft was wrong, not the code
chengtao-lv/PTQ4SAM/ptq4sam/model/quant_model.py
pointer only (licence: NONE) · get_code("7a2978318593f764")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, chengtao-lv/PTQ4SAM when it was checked. 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.

ordered_yaml_dump Not yet run
unverified (harvested, no recorded run)
chengtao-lv/PTQ4SAM/mmdetection/.dev_scripts/gather_models.py
pointer only (licence: NONE) · get_code("8ff99a6bd2ebf598")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, chengtao-lv/PTQ4SAM when it was checked. 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. No invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 distinct functions with an identity, 9 are also present in other papers whose code we hold (6 with at least one paper dated earlier, 2 the same month, 9 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
ordered_yaml_dump 31 other papers
26 dated earlier, 1 the same month, 4 later
1611.02644 (2016-11)
Multispectral Deep Neural Networks for Pedestrian Detection
1906.07155 (2019-06)
MMDetection: Open MMLab Detection Toolbox and Benchmark
2105.01928 (2021-05)
Instances as Queries
and 28 more not named here
round_ste 27 other papers
14 dated earlier, 1 the same month, 12 later · 13 only as an assembly brick
2203.05740 (2022-03)
QDrop: Randomly Dropping Quantization for Extremely Low-bit Post-Training Quantization
2204.12322 (2022-04)
RAPQ: Rescuing Accuracy for Power-of-Two Low-bit Post-training Quantization
and 24 more not named here
process_checkpoint 22 other papers
20 dated earlier, 2 later
1611.02644 (2016-11)
Multispectral Deep Neural Networks for Pedestrian Detection
1906.07155 (2019-06)
MMDetection: Open MMLab Detection Toolbox and Benchmark
2105.01928 (2021-05)
Instances as Queries
and 19 more not named here
parse_config 3 other papers
1 dated earlier, 2 later
2303.11906 (2023-03)
Solving Oscillation Problem in Post-Training Quantization Through a Theoretical Perspective
Zhang_AHCPTQ_Accurate_and_Hardware-Compatible_Post-Training_Quantization_for_Segment_Anything_Model_ICCV_2025_paper (2025 (year only))
AHCPTQ: Accurate and Hardware-Compatible Post-Training Quantization for Segment Anything Model
2505.23651 (2025-05)
Merge-Friendly Post-Training Quantization for Multi-Target Domain Adaptation
fake_quantize_per_tensor_affine 2 other papers
1 dated earlier, 1 later
2304.09145 (2023-04)
Outlier Suppression+: Accurate quantization of large language models by equivalent and effective shifting and scaling
Zhang_AHCPTQ_Accurate_and_Hardware-Compatible_Post-Training_Quantization_for_Segment_Anything_Model_ICCV_2025_paper (2025 (year only))
AHCPTQ: Accurate and Hardware-Compatible Post-Training Quantization for Segment Anything Model
lp_loss 2 other papers
1 dated earlier, 1 later
2203.05740 (2022-03)
QDrop: Randomly Dropping Quantization for Extremely Low-bit Post-Training Quantization
Zhang_AHCPTQ_Accurate_and_Hardware-Compatible_Post-Training_Quantization_for_Segment_Anything_Model_ICCV_2025_paper (2025 (year only))
AHCPTQ: Accurate and Hardware-Compatible Post-Training Quantization for Segment Anything Model
fake_logquantize_per_tensor_affine 1 other paper
1 later
Zhang_AHCPTQ_Accurate_and_Hardware-Compatible_Post-Training_Quantization_for_Segment_Anything_Model_ICCV_2025_paper (2025 (year only))
AHCPTQ: Accurate and Hardware-Compatible Post-Training Quantization for Segment Anything Model
get_module_args 1 other paper
1 later
Zhang_AHCPTQ_Accurate_and_Hardware-Compatible_Post-Training_Quantization_for_Segment_Anything_Model_ICCV_2025_paper (2025 (year only))
AHCPTQ: Accurate and Hardware-Compatible Post-Training Quantization for Segment Anything Model
update_specialized_quantizer_config 1 other paper
1 later
Zhang_AHCPTQ_Accurate_and_Hardware-Compatible_Post-Training_Quantization_for_Segment_Anything_Model_ICCV_2025_paper (2025 (year only))
AHCPTQ: Accurate and Hardware-Compatible Post-Training Quantization for Segment Anything Model

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

Segment Anything Model (SAM) has achieved impressive performance in many computer vision tasks. However, as a large-scale model, the immense memory and computation costs hinder its practical deployment. In this paper, we propose a post-training quantization (PTQ) framework for Segment Anything Model, namely PTQ4SAM. First, we investigate the inherent bottleneck of SAM quantization attributed to the bimodal distribution in post-Key-Linear activations. We analyze its characteristics from both per-tensor and per-channel perspectives, and propose a Bimodal Integration strategy, which utilizes a mathematically equivalent sign operation to transform the bimodal distribution into a relatively easy-quantized normal distribution offline. Second, SAM encompasses diverse attention mechanisms (i.e., self-attention and two-way cross-attention), resulting in substantial variations in the post-Softmax distributions. Therefore, we introduce an Adaptive Granularity Quantization for Softmax through searching the optimal power-oftwo base, which is hardware-friendly. Extensive experimental results across various vision tasks (instance segmentation, semantic segmentation and object detection), datasets and model variants show the superiority of PTQ4SAM. For example, when quantizing SAM-L to 6-bit, we achieve lossless accuracy for instance segmentation, about 0.5% drop with theoretical 3.9× acceleration. The code is available at https://github.com/chengtao-lv/PTQ4SAM .

For agents

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

get_harvested_code_for_paper("2405.03144")
get_code_for_paper("2405.03144")
have("2405.03144")

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

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

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

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

Connect an agent — have() is free.