Papers › A Unified Model for Multi-class Anomaly Detection

A Unified Model for Multi-class Anomaly Detection

8 Jun 2022arXiv:2206.03687archive 2025-07-28

Zhiyuan You, Lei Cui, Yujun Shen, Kai Yang, Xin Lu, Yu Zheng, Xinyi Le

Despite the rapid advance of unsupervised anomaly detection, existing methods require to train separate models for different objects. In this work, we present UniAD that accomplishes anomaly detection for multiple classes with a unified framework. Under such a challenging setting, popular reconstruction networks may fall into an "identical shortcut", where both normal and anomalous samples can be well recovered, and hence fail to spot outliers. To tackle this obstacle, we make three improvements. First, we revisit the formulations of fully-connected layer, convolutional layer, as well as attention layer, and confirm the important role of query embedding (i.e., within attention layer) in preventing the network from learning the shortcut. We therefore come up with a layer-wise query decoder to help model the multi-class distribution. Second, we employ a neighbor masked attention module to further avoid the information leak from the input feature to the reconstructed output feature. Third, we propose a feature jittering strategy that urges the model to recover the correct message even with noisy inputs. We evaluate our algorithm on MVTec-AD and CIFAR-10 datasets, where we surpass the state-of-the-art alternatives by a sufficiently large margin. For example, when learning a unified model for 15 categories in MVTec-AD, we surpass the second competitor on the tasks of both anomaly detection (from 88.1% to 96.5%) and anomaly localization (from 89.5% to 96.8%). Code is available at https://github.com/zhiyuanyou/UniAD.

PaperPDFCodeCode 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="2206.03687")

Code

Syntology Ran 8 of 15 code samples harvested from 1 repository linked to this paper; 7 have no recorded run. Of those that ran: 2 ran · fixture could not drive it; 6 ran with no contract checked.

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

zhiyuanyou/uniad 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; 8 ran; 0 honoured the contract we drafted; 7 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 · fixture could not drive it
6ran
7unverified

Licence: 0 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 zhiyuanyou/uniad. “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.

PositionEmbeddingLearned zhiyuanyou/uniad/models/reconstructions/uniad.py official repository ran · metamorphic tier: invariant fingerprinted Apache-2.0 (permissive) · 09b9c17fbe0d29e4 · report
PositionEmbeddingSine zhiyuanyou/uniad/models/reconstructions/uniad.py official repository ran · metamorphic tier: invariant fingerprinted Apache-2.0 (permissive) · c74afaad75da67ca · report
TransformerDecoder zhiyuanyou/uniad/models/reconstructions/uniad.py official repository ran · metamorphic tier: invariant fingerprinted Apache-2.0 (permissive) · 2e15a94ae3c582d9 · report
TransformerDecoderLayer zhiyuanyou/uniad/models/reconstructions/uniad.py official repository ran fingerprinted Apache-2.0 (permissive) · d32327f0af382e01 · report
TransformerEncoder zhiyuanyou/uniad/models/reconstructions/uniad.py official repository ran · metamorphic tier: invariant fingerprinted Apache-2.0 (permissive) · ff5b931728384843 · report
TransformerEncoderLayer zhiyuanyou/uniad/models/reconstructions/uniad.py official repository ran · metamorphic tier: invariant fingerprinted Apache-2.0 (permissive) · 4b270121cf640133 · report
build_position_embedding zhiyuanyou/UniAD/models/reconstructions/uniad.py official repository ran · fixture could not drive it Apache-2.0 (permissive) · d5b20d47c0675398 · report
build_position_embedding zhiyuanyou/uniad/models/reconstructions/uniad.py official repository ran · fixture could not drive it Apache-2.0 (permissive) · 0c617154b24e553f · report
Transformer zhiyuanyou/uniad/models/reconstructions/uniad.py official repository unverified Apache-2.0 (permissive) · d93d5baaaf4faa9b · report
UniAD zhiyuanyou/uniad/models/reconstructions/uniad.py official repository unverified Apache-2.0 (permissive) · b78aca6c49077d11 · report
init_weights_msra zhiyuanyou/uniad/models/reconstructions/uniad.py official repository unverified Apache-2.0 (permissive) · 5b5f3715b5e5582a · report
init_weights_normal zhiyuanyou/uniad/models/reconstructions/uniad.py official repository unverified Apache-2.0 (permissive) · 05bee06c0fc81a84 · report
init_weights_xavier zhiyuanyou/uniad/models/reconstructions/uniad.py official repository unverified Apache-2.0 (permissive) · 240526ea95ba0d0c · report
initialize zhiyuanyou/uniad/models/reconstructions/uniad.py official repository unverified Apache-2.0 (permissive) · 9599fed324e3b1f2 · report
initialize_from_cfg zhiyuanyou/uniad/models/reconstructions/uniad.py official repository unverified Apache-2.0 (permissive) · 0d7628c3c2441737 · report

Tasks

Anomaly DetectionAnomaly LocalizationMulti-class Anomaly DetectionUnsupervised Anomaly Detectionmodel

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Multi-class Anomaly Detection MVTec AD UniAD Detection AUROC 96.5 #13 of 13 Archive leaderboard report
Multi-class Anomaly Detection MVTec AD UniAD Segmentation AUROC 96.8 #13 of 13 Archive leaderboard report

Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.

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