Papers › DiffGuard: Semantic Mismatch-Guided Out-of-Distribution Detection using Pre-trained...

DiffGuard: Semantic Mismatch-Guided Out-of-Distribution Detection using Pre-trained Diffusion Models

15 Aug 2023ICCV 2023 1arXiv:2308.07687archive 2025-07-28

Ruiyuan Gao, Chenchen Zhao, Lanqing Hong, Qiang Xu

Given a classifier, the inherent property of semantic Out-of-Distribution (OOD) samples is that their contents differ from all legal classes in terms of semantics, namely semantic mismatch. There is a recent work that directly applies it to OOD detection, which employs a conditional Generative Adversarial Network (cGAN) to enlarge semantic mismatch in the image space. While achieving remarkable OOD detection performance on small datasets, it is not applicable to ImageNet-scale datasets due to the difficulty in training cGANs with both input images and labels as conditions. As diffusion models are much easier to train and amenable to various conditions compared to cGANs, in this work, we propose to directly use pre-trained diffusion models for semantic mismatch-guided OOD detection, named DiffGuard. Specifically, given an OOD input image and the predicted label from the classifier, we try to enlarge the semantic difference between the reconstructed OOD image under these conditions and the original input image. We also present several test-time techniques to further strengthen such differences. Experimental results show that DiffGuard is effective on both Cifar-10 and hard cases of the large-scale ImageNet, and it can be easily combined with existing OOD detection techniques to achieve state-of-the-art OOD detection results.

PaperPDFConference PDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2308.07687")

Code

Syntology Ran 12 of 15 code samples harvested from 1 repository linked to this paper; 3 have no recorded run. Of those that ran: 2 ran · honoured contract; 3 ran · our draft was wrong; 7 ran with no contract checked.

By repository: official repository: 15 samples from 1 repository, 12 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

cure-lab/diffguard officialmentioned in papermentioned on GitHubpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

15 samples harvested; 12 ran; 2 honoured the contract we drafted; 3 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

2ran · honoured contract
3ran · our draft was wrong
7ran
3unverified

Licence: 15 of the 15 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from cure-lab/DiffGuard. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: 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. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

center_crop_arr cure-lab/DiffGuard/guided_diffusion/image_datasets.py official repository ran · our draft was wrong no licence file found · pointer only · 8ab9a97df8161f31 · report
approx_standard_normal_cdf cure-lab/DiffGuard/guided_diffusion/losses.py official repository ran · our draft was wrong fingerprinted no licence file found · pointer only · cfd76fd0d89574a4 · report
betas_for_alpha_bar cure-lab/DiffGuard/guided_diffusion/gaussian_diffusion.py official repository ran · honoured contract no licence file found · pointer only · 2ab2316ac6fdd869 · report
discretized_gaussian_log_likelihood cure-lab/DiffGuard/guided_diffusion/losses.py official repository ran · our draft was wrong no licence file found · pointer only · cd33283d615fb3d7 · report
get_named_beta_schedule cure-lab/DiffGuard/guided_diffusion/gaussian_diffusion.py official repository ran no licence file found · pointer only · adc37dc98fdac1ba · report
get_param_groups_and_shapes cure-lab/DiffGuard/guided_diffusion/fp16_util.py official repository ran no licence file found · pointer only · e41367ad14ff58fd · report
make_master_params cure-lab/DiffGuard/guided_diffusion/fp16_util.py official repository ran no licence file found · pointer only · e20dd5102da3b050 · report
make_output_format cure-lab/DiffGuard/guided_diffusion/logger.py official repository ran no licence file found · pointer only · bcd8b4acab199405 · report
normal_kl cure-lab/DiffGuard/guided_diffusion/losses.py official repository ran · honoured contract fingerprinted no licence file found · pointer only · cf2798b666b231ca · report
normalize_model cure-lab/DiffGuard/ood_tester/classifier_model.py official repository ran no licence file found · pointer only · 88230535c023f15a · report
scale_each cure-lab/DiffGuard/ood_tester/latent_diffusion_model.py official repository ran no licence file found · pointer only · 5c91976bc7d40301 · report
unflatten_master_params cure-lab/DiffGuard/guided_diffusion/fp16_util.py official repository ran no licence file found · pointer only · 64fff1e30802b815 · report
mpi_weighted_mean cure-lab/DiffGuard/guided_diffusion/logger.py official repository unverified no licence file found · pointer only · e515a67f7f32e76d · report
profile cure-lab/DiffGuard/guided_diffusion/logger.py official repository unverified no licence file found · pointer only · 0c6607473a4c4c55 · report
random_crop_arr cure-lab/DiffGuard/guided_diffusion/image_datasets.py official repository unverified no licence file found · pointer only · 53d5be4fdbcfac23 · report

Tasks

Out-of-Distribution Detection

1 archive task tag without a task page not shown.

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

Diffusion

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections