仅用100张图片,让预训练模型跨域识别异常数据。
Geometry over Density: Few-Shot Cross-Domain OOD Detection

- 基于扩散模型的轨迹几何分析,提取能量特征作为判别依据。
- 在12个跨域任务上平均AUROC达93.7%,仅需100张正常样本。
- 训练一次即可部署到任意新任务,无需微调或重训练。
分布外(OOD)检测能识别超出模型训练分布的测试样本,对高风险场景的安全部署至关重要。传统方法在单一数据集上训练,仅能检测该领域偏差。本文研究少样本跨域OOD检测:给定一个预训练模型,能否仅用少量正常样本,在不重新训练的情况下,对任意新领域任务实现OOD检测?我们提出UFCOD框架,通过扩散轨迹的信息几何分析实现此目标。核心洞察是扩散噪声预测为密度梯度(得分函数),从中提取路径能量(积分得分幅值)与动态能量(得分平滑性)两个能量特征,构成离散Sobolev范数,刻画样本与学习扩散过程的交互。关键贡献是“训练一次、随处部署”范式:在单个数据集(如CelebA)上训练的扩散模型,可作为通用特征提取器,应用于语义无关的多领域(如CIFAR-10、SVHN、Textures)的OOD检测。部署时,每项新任务仅需约100张未标注正常样本进行推理,无需重训练、微调或任务适配。使用每任务100张正常样本,UFCOD在12个跨域基准上平均达到93.7%的AUROC,性能媲美需5万至16.3万样本训练的方法,样本效率提升约500倍。
原文摘要 · Abstract (English)
Out-of-distribution (OOD) detection identifies test samples that fall outside a model's training distribution, a capability critical for safe deployment in high-stakes applications. Standard OOD detectors are trained on a specific in-distribution (ID) dataset and detect deviations from that single domain. In contrast, we study few-shot cross-domain OOD detection: given a \emph{single} pre-trained model, can we perform OOD detection on \emph{arbitrary} new ID-OOD task pairs using only a handful of ID samples at inference time, with no additional training? We propose \textbf{UFCOD}, a unified framework that achieves this goal through information-geometric analysis of diffusion trajectories. Our key insight is that diffusion noise predictions are score functions (gradients of log-density), and we extract two energy features: \emph{Path Energy} (integrated score magnitude) and \emph{Dynamics Energy} (score smoothness), that form a discrete Sobolev norm capturing how samples interact with the learned diffusion process. The central contribution is a \textbf{train-once, deploy-anywhere} paradigm: a diffusion model trained on a single dataset (e.g., CelebA) serves as a universal feature extractor for OOD detection across semantically unrelated domains (e.g., CIFAR-10, SVHN, Textures). At deployment, each new task requires only $\sim$100 unlabeled ID samples for inference: no retraining, no fine-tuning, no task-specific adaptation. Using 100 ID samples per task, UFCOD achieves 93.7\% average AUROC across 12 cross-domain benchmarks, competitive with methods trained on 50k--163k samples, demonstrating $\sim$500$\times$ improvement in sample efficiency. See our code in https://github.com/lili0415/UFCOD.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。