{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/clamp-vit-contrastive-data-free-learning-for","title":"CLAMP-ViT: Contrastive Data-Free Learning for Adaptive Post-Training Quantization of ViTs","arxiv_id":"2407.05266","date":"2024-07-07","proceeding":null,"authors":["Akshat Ramachandran","Souvik Kundu","Tushar Krishna"],"abstract":"We present CLAMP-ViT, a data-free post-training quantization method for vision transformers (ViTs). We identify the limitations of recent techniques, notably their inability to leverage meaningful inter-patch relationships, leading to the generation of simplistic and semantically vague data, impacting quantization accuracy. CLAMP-ViT employs a two-stage approach, cyclically adapting between data generation and model quantization. Specifically, we incorporate a patch-level contrastive learning scheme to generate richer, semantically meaningful data. Furthermore, we leverage contrastive learning in layer-wise evolutionary search for fixed- and mixed-precision quantization to identify optimal quantization parameters while mitigating the effects of a non-smooth loss landscape. Extensive evaluations across various vision tasks demonstrate the superiority of CLAMP-ViT, with performance improvements of up to 3% in top-1 accuracy for classification, 0.6 mAP for object detection, and 1.5 mIoU for segmentation at similar or better compression ratio over existing alternatives. Code is available at https://github.com/georgia-tech-synergy-lab/CLAMP-ViT.git","url_abs":"https://arxiv.org/abs/2407.05266v2","url_pdf":"https://arxiv.org/pdf/2407.05266v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"clamp-vit-contrastive-data-free-learning-for","repo_url":"https://github.com/georgia-tech-synergy-lab/clamp-vit","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"contrastive-learning","task_name":"Contrastive Learning"},{"task_slug":"object-detection","task_name":"Object Detection"},{"task_slug":"quantization","task_name":"Quantization"},{"task_slug":"object-detection-1","task_name":"object-detection"}],"methods":[{"method_slug":"contrastive-learning","method_name":"Contrastive Learning"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":null,"atlas_url":"https://app.syntology.ai/?focus=2407.05266","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2407.05266"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/georgia-tech-synergy-lab/clamp-vit","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran_fixture":1,"unverified":5},"by_repo_kind":{"official":{"samples":6,"ran":1,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"3ac6b7d76e8e3584","entry":"drop_path","repo":"georgia-tech-synergy-lab/clamp-vit","repo_kind":"official","path":"models/layers_quant.py","file_url":"https://github.com/georgia-tech-synergy-lab/clamp-vit/blob/HEAD/models/layers_quant.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"3ac6b7d76e8e3584"}},{"code_sha256_prefix":"6a8b68551b219687","entry":"deit_base_patch16_224","repo":"georgia-tech-synergy-lab/clamp-vit","repo_kind":"official","path":"models/vit_quant.py","file_url":"https://github.com/georgia-tech-synergy-lab/clamp-vit/blob/HEAD/models/vit_quant.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"6a8b68551b219687"}},{"code_sha256_prefix":"c8f4e4e0fcd26179","entry":"deit_small_patch16_224","repo":"georgia-tech-synergy-lab/clamp-vit","repo_kind":"official","path":"models/vit_quant.py","file_url":"https://github.com/georgia-tech-synergy-lab/clamp-vit/blob/HEAD/models/vit_quant.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"c8f4e4e0fcd26179"}},{"code_sha256_prefix":"f35ae8e4a352e1cd","entry":"deit_tiny_patch16_224","repo":"georgia-tech-synergy-lab/clamp-vit","repo_kind":"official","path":"models/vit_quant.py","file_url":"https://github.com/georgia-tech-synergy-lab/clamp-vit/blob/HEAD/models/vit_quant.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"f35ae8e4a352e1cd"}},{"code_sha256_prefix":"32acbe97f81ec0b3","entry":"load_weights_from_npz","repo":"georgia-tech-synergy-lab/clamp-vit","repo_kind":"official","path":"models/utils.py","file_url":"https://github.com/georgia-tech-synergy-lab/clamp-vit/blob/HEAD/models/utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"32acbe97f81ec0b3"}},{"code_sha256_prefix":"5436174f8c0e64e0","entry":"trunc_normal_","repo":"georgia-tech-synergy-lab/clamp-vit","repo_kind":"official","path":"models/layers_quant.py","file_url":"https://github.com/georgia-tech-synergy-lab/clamp-vit/blob/HEAD/models/layers_quant.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"5436174f8c0e64e0"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}