{"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/contrastive-clustering","title":"Contrastive Clustering","arxiv_id":"2009.09687","date":"2020-09-21","proceeding":null,"authors":["Yunfan Li","Peng Hu","Zitao Liu","Dezhong Peng","Joey Tianyi Zhou","Xi Peng"],"abstract":"In this paper, we propose a one-stage online clustering method called Contrastive Clustering (CC) which explicitly performs the instance- and cluster-level contrastive learning. To be specific, for a given dataset, the positive and negative instance pairs are constructed through data augmentations and then projected into a feature space. Therein, the instance- and cluster-level contrastive learning are respectively conducted in the row and column space by maximizing the similarities of positive pairs while minimizing those of negative ones. Our key observation is that the rows of the feature matrix could be regarded as soft labels of instances, and accordingly the columns could be further regarded as cluster representations. By simultaneously optimizing the instance- and cluster-level contrastive loss, the model jointly learns representations and cluster assignments in an end-to-end manner. Extensive experimental results show that CC remarkably outperforms 17 competitive clustering methods on six challenging image benchmarks. In particular, CC achieves an NMI of 0.705 (0.431) on the CIFAR-10 (CIFAR-100) dataset, which is an up to 19\\% (39\\%) performance improvement compared with the best baseline.","url_abs":"https://arxiv.org/abs/2009.09687v1","url_pdf":"https://arxiv.org/pdf/2009.09687v1.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":"contrastive-clustering","repo_url":"https://github.com/Yunfan-Li/Contrastive-Clustering","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"contrastive-clustering","repo_url":"https://github.com/hoper-j/contrastive-disentangling","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"clustering","task_name":"Clustering"},{"task_slug":"contrastive-learning","task_name":"Contrastive Learning"},{"task_slug":"image-clustering","task_name":"Image Clustering"},{"task_slug":"online-clustering","task_name":"Online Clustering"}],"methods":[{"method_slug":"1x1-convolution","method_name":"1x1 Convolution"},{"method_slug":"average-pooling","method_name":"Average Pooling"},{"method_slug":"batch-normalization","method_name":"Batch Normalization"},{"method_slug":"bottleneck-residual-block","method_name":"Bottleneck Residual Block"},{"method_slug":"contrastive-learning","method_name":"Contrastive Learning"},{"method_slug":"convolution","method_name":"Convolution"},{"method_slug":"global-average-pooling","method_name":"Global Average Pooling"},{"method_slug":"kaiming-initialization","method_name":"Kaiming Initialization"},{"method_slug":"relu","method_name":"ReLU"},{"method_slug":"residual-block","method_name":"Residual Block"},{"method_slug":"residual-connection","method_name":"Residual Connection"}],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/image-clustering-on-cifar-10","task":"Image Clustering","dataset":"CIFAR-10","model":"CC","rank_in_archive_order":29,"of":40,"metrics":{"ARI":"0.637","Accuracy":"0.79","Backbone":"ResNet34","NMI":"0.705","Train set":"Train+Test"},"uses_additional_data":false},{"leaderboard":"/sota/image-clustering-on-cifar-100","task":"Image Clustering","dataset":"CIFAR-100","model":"CC","rank_in_archive_order":20,"of":30,"metrics":{"ARI":"0.266","Accuracy":"0.429","NMI":"0.431"},"uses_additional_data":false},{"leaderboard":"/sota/image-clustering-on-imagenet-10","task":"Image Clustering","dataset":"ImageNet-10","model":"CC","rank_in_archive_order":11,"of":18,"metrics":{"ARI":"0.822","Accuracy":"0.893","Image Size":"224","NMI":"0.859"},"uses_additional_data":false},{"leaderboard":"/sota/image-clustering-on-imagenet-dog-15","task":"Image Clustering","dataset":"Imagenet-dog-15","model":"CC","rank_in_archive_order":13,"of":20,"metrics":{"ARI":"0.274","Accuracy":"0.429","Image Size":"224","NMI":"0.445"},"uses_additional_data":false},{"leaderboard":"/sota/image-clustering-on-stl-10","task":"Image Clustering","dataset":"STL-10","model":"CC","rank_in_archive_order":11,"of":29,"metrics":{"Accuracy":"0.85","Backbone":"ResNet34","NMI":"0.764","Train Split":"Train+Test"},"uses_additional_data":true},{"leaderboard":"/sota/image-clustering-on-tiny-imagenet","task":"Image Clustering","dataset":"Tiny-ImageNet","model":"CC","rank_in_archive_order":7,"of":14,"metrics":{"ARI":"0.071","Accuracy":"0.14","NMI":"0.34"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2009.09687","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2009.09687"}},"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/hoper-j/contrastive-disentangling","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/Yunfan-Li/Contrastive-Clustering","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"deterministic:regex_extraction","url":"https://github.com/XLearning-SCU/2021-AAAI-CC","reach":null}],"summary":{"ran":2,"unverified":5},"by_repo_kind":{"official":{"samples":5,"ran":0,"repositories":1},"listed":{"samples":1,"ran":1,"repositories":1},"found_in_text":{"samples":1,"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":"56840f79645c3849","entry":"InstanceLoss","repo":"XLearning-SCU/2021-AAAI-CC","repo_kind":"found_in_text","path":"modules/contrastive_loss.py","file_url":"https://github.com/XLearning-SCU/2021-AAAI-CC/blob/HEAD/modules/contrastive_loss.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"56840f79645c3849"}},{"code_sha256_prefix":"6870e3e8058896be","entry":"InstanceLoss","repo":"hoper-j/contrastive-disentangling","repo_kind":"listed","path":"loss.py","file_url":"https://github.com/hoper-j/contrastive-disentangling/blob/HEAD/loss.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"6870e3e8058896be"}},{"code_sha256_prefix":"f6d031f1affc8b74","entry":"calculate_cost_matrix","repo":"Yunfan-Li/Contrastive-Clustering","repo_kind":"official","path":"evaluation/evaluation.py","file_url":"https://github.com/Yunfan-Li/Contrastive-Clustering/blob/HEAD/evaluation/evaluation.py","link_basis":"plan_row","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":"f6d031f1affc8b74"}},{"code_sha256_prefix":"c5807f4f8acc5c0b","entry":"get_cluster_labels_from_indices","repo":"Yunfan-Li/Contrastive-Clustering","repo_kind":"official","path":"evaluation/evaluation.py","file_url":"https://github.com/Yunfan-Li/Contrastive-Clustering/blob/HEAD/evaluation/evaluation.py","link_basis":"plan_row","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":"c5807f4f8acc5c0b"}},{"code_sha256_prefix":"95c0bf40098a2477","entry":"get_resnet","repo":"Yunfan-Li/Contrastive-Clustering","repo_kind":"official","path":"modules/resnet.py","file_url":"https://github.com/Yunfan-Li/Contrastive-Clustering/blob/HEAD/modules/resnet.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":"95c0bf40098a2477"}},{"code_sha256_prefix":"5464d6586c9a5abf","entry":"inference","repo":"Yunfan-Li/Contrastive-Clustering","repo_kind":"official","path":"cluster.py","file_url":"https://github.com/Yunfan-Li/Contrastive-Clustering/blob/HEAD/cluster.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":"5464d6586c9a5abf"}},{"code_sha256_prefix":"5f0e459393da7338","entry":"yaml_config_hook","repo":"Yunfan-Li/Contrastive-Clustering","repo_kind":"official","path":"utils/yaml_config_hook.py","file_url":"https://github.com/Yunfan-Li/Contrastive-Clustering/blob/HEAD/utils/yaml_config_hook.py","link_basis":"plan_row","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":"5f0e459393da7338"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}