Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

KeepAD: Keep the Needle, Prune the Haystack

arXiv Code coming soon

Yanning Hou · Jingyuan Zhang · Xiaoyun Wang · Qixiang Ma · Sihang Zhou · Ke Xu

Official repository for “Keep the Needle, Prune the Haystack: Defect-Preserving Token Pruning for Efficient Zero-Shot Anomaly Detection.”

Paper  ·  Code (Coming Soon)

Important

The code, pretrained models, and training/evaluation instructions are being prepared for release. Please stay tuned.

Overview

KeepAD is a defect-preserving token pruning framework for zero-shot anomaly detection. It treats token pruning as a high-recall, anomaly-aware routing problem: removing background tokens is usually harmless, while dropping a single subtle defect token can erase the only evidence of an anomaly.

KeepAD combines:

  • Coverage-preserving early selection over local patch neighborhoods with deterministic anomaly rescue.
  • Prototype-guided deep selection with an image-adaptive token budget.
  • Dense-to-sparse self-distillation to supervise early token routing without adding inference overhead.

Across six industrial and seven medical benchmarks, KeepAD reduces final token retention to below 20% while limiting the average image- and pixel-level AUROC drop to at most 2.7 percentage points. At its most aggressive operating point, it achieves a 7.9× speedup over the strongest CLIP-based baseline reported in the paper.

News

  • August 2026: The paper is available on arXiv.
  • Coming soon: Source code, pretrained checkpoints, and reproducibility instructions.

Citation

If you find this work useful, please cite:

@article{hou2026keepad,
  title   = {Keep the Needle, Prune the Haystack: Defect-Preserving Token
             Pruning for Efficient Zero-Shot Anomaly Detection},
  author  = {Hou, Yanning and Zhang, Jingyuan and Wang, Xiaoyun and Ma, Qixiang
             and Zhou, Sihang and Xu, Ke},
  journal = {arXiv preprint arXiv:2608.03681},
  year    = {2026}
}

Acknowledgments

This project builds on AnomalyCLIP and uses OpenAI CLIP. We thank the authors of these projects and the benchmark datasets used in our work.

License

This project is released under the MIT License.

About

Keep the Needle, Prune the Haystack: Defect-Preserving Token Pruning for Efficient Zero-Shot Anomaly Detection.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors