{"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/vim-out-of-distribution-with-virtual-logit","title":"ViM: Out-Of-Distribution with Virtual-logit Matching","arxiv_id":"2203.10807","date":"2022-03-21","proceeding":"CVPR 2022 1","authors":["Haoqi Wang","Zhizhong Li","Litong Feng","Wayne Zhang"],"abstract":"Most of the existing Out-Of-Distribution (OOD) detection algorithms depend on single input source: the feature, the logit, or the softmax probability. However, the immense diversity of the OOD examples makes such methods fragile. There are OOD samples that are easy to identify in the feature space while hard to distinguish in the logit space and vice versa. Motivated by this observation, we propose a novel OOD scoring method named Virtual-logit Matching (ViM), which combines the class-agnostic score from feature space and the In-Distribution (ID) class-dependent logits. Specifically, an additional logit representing the virtual OOD class is generated from the residual of the feature against the principal space, and then matched with the original logits by a constant scaling. The probability of this virtual logit after softmax is the indicator of OOD-ness. To facilitate the evaluation of large-scale OOD detection in academia, we create a new OOD dataset for ImageNet-1K, which is human-annotated and is 8.8x the size of existing datasets. We conducted extensive experiments, including CNNs and vision transformers, to demonstrate the effectiveness of the proposed ViM score. In particular, using the BiT-S model, our method gets an average AUROC 90.91% on four difficult OOD benchmarks, which is 4% ahead of the best baseline. Code and dataset are available at https://github.com/haoqiwang/vim.","url_abs":"https://arxiv.org/abs/2203.10807v1","url_pdf":"https://arxiv.org/pdf/2203.10807v1.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":"vim-out-of-distribution-with-virtual-logit","repo_url":"https://github.com/haoqiwang/vim","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"NOASSERTION"}},{"paper_slug":"vim-out-of-distribution-with-virtual-logit","repo_url":"https://github.com/jingkang50/openood","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"image-classification","task_name":"Image Classification"},{"task_slug":"out-of-distribution-detection","task_name":"Out-of-Distribution Detection"}],"methods":[{"method_slug":"softmax","method_name":"Softmax"}],"datasets_introduced":[{"slug":"imagenet-k-vs-openimage-o","name":"ImageNet-1k vs OpenImage-O","full_name":""},{"slug":"imagenet-1k-vs-openimage-o","name":"OpenImage-O","full_name":""}],"methods_introduced":[],"results":[{"leaderboard":"/sota/out-of-distribution-detection-on-imagenet-1k-1","task":"Out-of-Distribution Detection","dataset":"ImageNet-1K vs ImageNet-O","model":"ViM (ViT-B/16)","rank_in_archive_order":2,"of":3,"metrics":{"AUROC":"92.55","FPR95":"36.75"},"uses_additional_data":true},{"leaderboard":"/sota/out-of-distribution-detection-on-imagenet-1k-11","task":"Out-of-Distribution Detection","dataset":"ImageNet-1k vs OpenImage-O","model":"ViM (ViT-B/16)","rank_in_archive_order":2,"of":7,"metrics":{"AUROC":"97.61","FPR95":"12.61"},"uses_additional_data":false},{"leaderboard":"/sota/out-of-distribution-detection-on-imagenet-1k-10","task":"Out-of-Distribution Detection","dataset":"ImageNet-1k vs Textures","model":"ViM (BiT)","rank_in_archive_order":1,"of":34,"metrics":{"AUROC":"98.92"},"uses_additional_data":false},{"leaderboard":"/sota/out-of-distribution-detection-on-imagenet-1k-10","task":"Out-of-Distribution Detection","dataset":"ImageNet-1k vs Textures","model":"ViM (ViT-B/16)","rank_in_archive_order":10,"of":34,"metrics":{"AUROC":"95.34","FPR95":"20.31"},"uses_additional_data":true},{"leaderboard":"/sota/out-of-distribution-detection-on-imagenet-1k-10","task":"Out-of-Distribution Detection","dataset":"ImageNet-1k vs Textures","model":"ViM (BiT-S-R101×1)","rank_in_archive_order":29,"of":34,"metrics":{"FPR95":"4.69"},"uses_additional_data":false},{"leaderboard":"/sota/out-of-distribution-detection-on-imagenet-1k-3","task":"Out-of-Distribution Detection","dataset":"ImageNet-1k vs iNaturalist","model":"ViM (ViT-B/16)","rank_in_archive_order":4,"of":28,"metrics":{"AUROC":"99.41","FPR95":"2.60"},"uses_additional_data":false}],"syntology":{"syntology_url":null,"atlas_url":"https://app.syntology.ai/?focus=2203.10807","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2203.10807"}},"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/jingkang50/openood","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"deterministic:regex_extraction","url":"https://github.com/haoqiwang/vim","reach":{"status":"ok","spdx":"NOASSERTION"}}],"summary":{"ran":1},"by_repo_kind":{"listed":{"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":"22df54ca2c7fe8f0","entry":"VIMPostprocessor","repo":"jingkang50/openood","repo_kind":"listed","path":"openood/postprocessors/vim_postprocessor.py","file_url":"https://github.com/jingkang50/openood/blob/HEAD/openood/postprocessors/vim_postprocessor.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"22df54ca2c7fe8f0"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}