"<!DOCTYPE html>\n<html lang=\"zh\" data-theme=\"light\">\n<head>\n<meta charset=\"utf-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<title>fulltext.txt — Vercel Design System</title>\n<link rel=\"preconnect\" href=\"https://fonts.googleapis.com\">\n<link rel=\"preconnect\" href=\"https://fonts.gstatic.com\" crossorigin>\n<link href=\"https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500;600&display=swap\" rel=\"stylesheet\">\n<link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/katex@0.16.8/dist/katex.min.css\">\n<style>\n\n:root {\n  /* Vercel Palette */\n  --geist-foreground: #171717;\n  --geist-background: #ffffff;\n  --geist-secondary: #4d4d4d;\n  --geist-tertiary: #666666;\n  --geist-quaternary: #808080;\n  --geist-border: #ebebeb;\n  --geist-surface-tint: #fafafa;\n  \n  /* Workflow Accents */\n  --develop-blue: #0a72ef;\n  --preview-pink: #de1d8d;\n  --ship-red: #ff5b4f;\n  \n  /* Interactive & Status */\n  --link-blue: #0072f5;\n  --ds-focus-color: hsla(212, 100%, 48%, 1);\n  --badge-blue-bg: #ebf5ff;\n  --badge-blue-text: #0068d6;\n  \n  /* Shadow-as-Border Philosophy */\n  --shadow-border: rgba(0, 0, 0, 0.08) 0px 0px 0px 1px;\n  --shadow-border-hover: rgba(0, 0, 0, 0.16) 0px 0px 0px 1px;\n  --shadow-card: rgba(0, 0, 0, 0.08) 0px 0px 0px 1px, rgba(0, 0, 0, 0.04) 0px 2px 2px, #fafafa 0px 0px 0px 1px;\n  --shadow-card-hover: rgba(0, 0, 0, 0.12) 0px 0px 0px 1px, rgba(0, 0, 0, 0.06) 0px 4px 6px, #fafafa 0px 0px 0px 1px;\n  --shadow-card-full: rgba(0, 0, 0, 0.08) 0px 0px 0px 1px, rgba(0, 0, 0, 0.04) 0px 2px 2px, rgba(0, 0, 0, 0.04) 0px 8px 8px -8px, #fafafa 0px 0px 0px 1px;\n  --shadow-ring: rgb(235, 235, 235) 0px 0px 0px 1px;\n  \n  /* Radius Scale */\n  --radius-xs: 2px;\n  --radius-sm: 4px;\n  --radius-md: 6px;\n  --radius-lg: 8px;\n  --radius-xl: 12px;\n  --radius-pill: 9999px;\n}\n\n[data-theme=\"dark\"] {\n  --geist-foreground: #ededed;\n  --geist-background: #000000;\n  --geist-secondary: #a1a1a1;\n  --geist-tertiary: #888888;\n  --geist-quaternary: #666666;\n  --geist-border: #222222;\n  --geist-surface-tint: #0a0a0a;\n  \n  --shadow-border: rgba(255, 255, 255, 0.14) 0px 0px 0px 1px;\n  --shadow-border-hover: rgba(255, 255, 255, 0.28) 0px 0px 0px 1px;\n  --shadow-card: rgba(255, 255, 255, 0.12) 0px 0px 0px 1px, rgba(0, 0, 0, 0.4) 0px 2px 4px, #111111 0px 0px 0px 1px;\n  --shadow-card-hover: rgba(255, 255, 255, 0.2) 0px 0px 0px 1px, rgba(0, 0, 0, 0.5) 0px 6px 12px, #111111 0px 0px 0px 1px;\n  --shadow-card-full: rgba(255, 255, 255, 0.12) 0px 0px 0px 1px, rgba(0, 0, 0, 0.5) 0px 8px 16px -4px, #111111 0px 0px 0px 1px;\n  --shadow-ring: rgb(40, 40, 40) 0px 0px 0px 1px;\n  \n  --badge-blue-bg: rgba(10, 114, 239, 0.15);\n  --badge-blue-text: #70b5ff;\n}\n\n* { box-sizing: border-box; }\nhtml { scroll-behavior: smooth; }\nbody {\n  margin: 0;\n  font-family: \"Geist\", Arial, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif;\n  background-color: var(--geist-background);\n  color: var(--geist-foreground);\n  font-feature-settings: \"liga\" 1;\n  -webkit-font-smoothing: antialiased;\n  min-height: 100vh;\n}\n\na {\n  color: inherit;\n  text-decoration: none;\n  transition: color 0.15s ease;\n}\n\n/* 导航栏 (Vercel Clean Sticky Nav) */\n.vercel-nav {\n  position: sticky;\n  top: 0;\n  background-color: var(--geist-background);\n  box-shadow: var(--shadow-border);\n  z-index: 100;\n  padding: 0 24px;\n  height: 64px;\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n}\n.nav-brand {\n  display: flex;\n  align-items: center;\n  gap: 12px;\n}\n.vercel-triangle {\n  width: 22px;\n  height: 19px;\n  fill: var(--geist-foreground);\n}\n.nav-title {\n  font-size: 16px;\n  font-weight: 600;\n  letter-spacing: -0.32px;\n  color: var(--geist-foreground);\n}\n.nav-badge-pill {\n  font-family: \"Geist Mono\", ui-monospace, monospace;\n  font-size: 11px;\n  font-weight: 500;\n  text-transform: uppercase;\n  background: var(--badge-blue-bg);\n  color: var(--badge-blue-text);\n  padding: 2px 8px;\n  border-radius: var(--radius-pill);\n}\n\n.nav-links {\n  display: flex;\n  align-items: center;\n  gap: 24px;\n}\n.nav-link {\n  font-size: 14px;\n  font-weight: 500;\n  color: var(--geist-secondary);\n  text-decoration: none;\n  transition: color 0.15s;\n}\n.nav-link:hover, .nav-link.active {\n  color: var(--geist-foreground);\n}\n.nav-link.active {\n  font-weight: 600;\n}\n\n.nav-actions {\n  display: flex;\n  align-items: center;\n  gap: 12px;\n}\n\n/* 按钮规范 */\n.btn-primary-dark {\n  background: var(--geist-foreground);\n  color: var(--geist-background);\n  border: none;\n  padding: 8px 16px;\n  border-radius: var(--radius-md);\n  font-size: 14px;\n  font-weight: 500;\n  cursor: pointer;\n  text-decoration: none;\n  display: inline-flex;\n  align-items: center;\n  gap: 6px;\n  transition: opacity 0.15s;\n}\n.btn-primary-dark:hover {\n  opacity: 0.9;\n}\n.btn-secondary-white {\n  background: var(--geist-background);\n  color: var(--geist-foreground);\n  box-shadow: var(--shadow-border);\n  border: none;\n  padding: 8px 16px;\n  border-radius: var(--radius-md);\n  font-size: 14px;\n  font-weight: 500;\n  cursor: pointer;\n  text-decoration: none;\n  display: inline-flex;\n  align-items: center;\n  gap: 6px;\n  transition: background 0.15s, box-shadow 0.15s;\n}\n.btn-secondary-white:hover {\n  background: var(--geist-surface-tint);\n  box-shadow: var(--shadow-border-hover);\n}\n.theme-toggle-btn {\n  background: transparent;\n  border: none;\n  box-shadow: var(--shadow-border);\n  border-radius: var(--radius-md);\n  width: 36px;\n  height: 36px;\n  cursor: pointer;\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  color: var(--geist-foreground);\n}\n\n/* 核心容器 */\n.vercel-container {\n  max-width: 1200px;\n  margin: 0 auto;\n  padding: 56px 24px 100px;\n}\n\n/* Hero Section (Gallery Emptiness + Negative Letter-spacing) */\n.vercel-hero {\n  text-align: center;\n  max-width: 860px;\n  margin: 0 auto 56px;\n}\n.hero-stage-badge {\n  display: inline-flex;\n  align-items: center;\n  gap: 8px;\n  background: var(--geist-surface-tint);\n  box-shadow: var(--shadow-border);\n  padding: 4px 14px;\n  border-radius: var(--radius-pill);\n  font-size: 13px;\n  font-weight: 500;\n  color: var(--geist-secondary);\n  margin-bottom: 24px;\n}\n.stage-dot {\n  width: 7px;\n  height: 7px;\n  border-radius: 50%;\n}\n.vercel-hero h1 {\n  font-size: 48px;\n  font-weight: 600;\n  line-height: 1.05;\n  letter-spacing: -2.4px;\n  color: var(--geist-foreground);\n  margin: 0 0 16px;\n}\n.vercel-hero p {\n  font-size: 20px;\n  font-weight: 400;\n  line-height: 1.80;\n  color: var(--geist-secondary);\n  margin: 0 auto 28px;\n}\n\n/* Workflow Pipeline (Develop -> Preview -> Ship) */\n.workflow-pipeline {\n  display: grid;\n  grid-template-columns: repeat(3, 1fr);\n  gap: 16px;\n  margin-bottom: 48px;\n}\n@media (max-width: 768px) {\n  .workflow-pipeline { grid-template-columns: 1fr; }\n}\n.workflow-step {\n  background: var(--geist-background);\n  box-shadow: var(--shadow-card);\n  border-radius: var(--radius-lg);\n  padding: 20px 22px;\n  transition: box-shadow 0.2s;\n}\n.workflow-step:hover {\n  box-shadow: var(--shadow-card-hover);\n}\n.step-mono-label {\n  font-family: \"Geist Mono\", monospace;\n  font-size: 12px;\n  font-weight: 500;\n  text-transform: uppercase;\n  letter-spacing: 0.5px;\n  margin-bottom: 8px;\n  display: flex;\n  align-items: center;\n  gap: 6px;\n}\n.step-title {\n  font-size: 20px;\n  font-weight: 600;\n  letter-spacing: -0.96px;\n  color: var(--geist-foreground);\n  margin-bottom: 6px;\n}\n.step-desc {\n  font-size: 14px;\n  color: var(--geist-secondary);\n  line-height: 1.5;\n}\n\n/* Metric Cards (Section 4 Spec) */\n.metric-grid {\n  display: grid;\n  grid-template-columns: repeat(4, 1fr);\n  gap: 16px;\n  margin-bottom: 48px;\n}\n@media (max-width: 900px) {\n  .metric-grid { grid-template-columns: repeat(2, 1fr); }\n}\n.metric-card {\n  background: var(--geist-background);\n  box-shadow: var(--shadow-card);\n  border-radius: var(--radius-lg);\n  padding: 20px;\n}\n.metric-number {\n  font-size: 40px;\n  font-weight: 600;\n  line-height: 1.0;\n  letter-spacing: -2.4px;\n  color: var(--geist-foreground);\n  margin-bottom: 8px;\n  font-feature-settings: \"tnum\" 1;\n}\n.metric-label {\n  font-size: 14px;\n  color: var(--geist-secondary);\n  line-height: 1.4;\n}\n\n/* VAD 专栏 Banner (Ship Red & Vercel Clean) */\n.vad-showcase {\n  background: var(--geist-background);\n  box-shadow: var(--shadow-card-full);\n  border-radius: var(--radius-xl);\n  padding: 32px;\n  margin-bottom: 48px;\n  position: relative;\n}\n.vad-header-row {\n  display: flex;\n  align-items: baseline;\n  justify-content: space-between;\n  flex-wrap: wrap;\n  gap: 12px;\n  margin-bottom: 12px;\n}\n.vad-header-row h2 {\n  font-size: 32px;\n  font-weight: 600;\n  letter-spacing: -1.28px;\n  color: var(--geist-foreground);\n  margin: 0;\n}\n.vad-pillars-grid {\n  display: grid;\n  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));\n  gap: 14px;\n  margin-top: 24px;\n}\n.vad-pillar-item {\n  background: var(--geist-surface-tint);\n  box-shadow: var(--shadow-border);\n  border-radius: var(--radius-md);\n  padding: 14px 16px;\n}\n.vad-pillar-title {\n  font-size: 14px;\n  font-weight: 600;\n  color: var(--ship-red);\n  margin-bottom: 4px;\n}\n.vad-pillar-text {\n  font-size: 13px;\n  color: var(--geist-secondary);\n  line-height: 1.5;\n}\n.vad-filter-bar {\n  display: flex;\n  flex-wrap: wrap;\n  align-items: center;\n  justify-content: space-between;\n  gap: 12px;\n  margin: 24px 0 16px;\n  padding: 12px 16px;\n  background: var(--geist-surface-tint);\n  border-radius: var(--radius-md);\n  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);\n}\n.vad-filter-btn {\n  font-family: 'Geist', sans-serif;\n  font-size: 13px;\n  font-weight: 500;\n  padding: 6px 14px;\n  border-radius: 9999px;\n  border: none;\n  background: transparent;\n  color: var(--geist-secondary);\n  cursor: pointer;\n  transition: all 0.15s ease;\n}\n.vad-filter-btn:hover {\n  color: var(--geist-foreground);\n  background: rgba(0,0,0,0.05);\n}\n.vad-filter-btn.active {\n  background: #171717;\n  color: #ffffff;\n}\n.vad-search-input {\n  font-family: 'Geist', sans-serif;\n  font-size: 13px;\n  padding: 7px 12px;\n  border-radius: 6px;\n  border: 1px solid var(--geist-border);\n  background: #ffffff;\n  color: var(--geist-foreground);\n  width: 280px;\n  outline: none;\n  transition: border-color 0.15s, box-shadow 0.15s;\n}\n.vad-search-input:focus {\n  border-color: #0a72ef;\n  box-shadow: 0 0 0 2px rgba(10, 114, 239, 0.2);\n}\n\n/* 控制栏：搜索、视图、筛选 */\n.control-bar {\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  gap: 16px;\n  margin-bottom: 24px;\n  flex-wrap: wrap;\n}\n.search-input-wrap {\n  position: relative;\n  flex: 1;\n  max-width: 480px;\n}\n.search-input {\n  width: 100%;\n  height: 40px;\n  padding: 0 38px 0 14px;\n  font-family: \"Geist\", sans-serif;\n  font-size: 14px;\n  color: var(--geist-foreground);\n  background: var(--geist-background);\n  box-shadow: var(--shadow-border);\n  border: none;\n  border-radius: var(--radius-md);\n  outline: none;\n  transition: box-shadow 0.15s;\n}\n.search-input:focus {\n  outline: 2px solid var(--ds-focus-color);\n  box-shadow: none;\n}\n.search-kbd {\n  position: absolute;\n  right: 12px;\n  top: 50%;\n  transform: translateY(-50%);\n  font-family: \"Geist Mono\", monospace;\n  font-size: 11px;\n  color: var(--geist-quaternary);\n  background: var(--geist-surface-tint);\n  box-shadow: var(--shadow-border);\n  padding: 2px 6px;\n  border-radius: var(--radius-sm);\n}\n\n.view-switcher {\n  display: flex;\n  box-shadow: var(--shadow-border);\n  border-radius: var(--radius-md);\n  background: var(--geist-background);\n  padding: 2px;\n}\n.view-btn {\n  background: transparent;\n  border: none;\n  font-size: 13px;\n  font-weight: 500;\n  color: var(--geist-tertiary);\n  padding: 6px 12px;\n  border-radius: var(--radius-sm);\n  cursor: pointer;\n  transition: color 0.15s, background 0.15s;\n}\n.view-btn.active {\n  background: var(--geist-surface-tint);\n  color: var(--geist-foreground);\n  font-weight: 600;\n}\n\n/* 筛选芯片行 (Filter Pill Strip) */\n.filter-group-strip {\n  display: flex;\n  flex-direction: column;\n  gap: 12px;\n  margin-bottom: 28px;\n  padding: 16px 20px;\n  background: var(--geist-surface-tint);\n  box-shadow: var(--shadow-border);\n  border-radius: var(--radius-lg);\n}\n.filter-row {\n  display: flex;\n  align-items: center;\n  gap: 8px;\n  flex-wrap: wrap;\n}\n.filter-label-mono {\n  font-family: \"Geist Mono\", monospace;\n  font-size: 11px;\n  font-weight: 500;\n  text-transform: uppercase;\n  color: var(--geist-quaternary);\n  min-width: 68px;\n}\n.pill-badge {\n  background: var(--geist-background);\n  color: var(--geist-secondary);\n  box-shadow: var(--shadow-border);\n  border: none;\n  padding: 3px 12px;\n  border-radius: var(--radius-pill);\n  font-size: 12px;\n  font-weight: 500;\n  cursor: pointer;\n  transition: all 0.15s;\n  display: inline-flex;\n  align-items: center;\n  gap: 6px;\n}\n.pill-badge:hover {\n  color: var(--geist-foreground);\n  box-shadow: var(--shadow-border-hover);\n}\n.pill-badge.active {\n  background: var(--geist-foreground);\n  color: var(--geist-background);\n  font-weight: 600;\n  box-shadow: none;\n}\n.pill-badge.active-blue {\n  background: var(--develop-blue);\n  color: #ffffff;\n  box-shadow: none;\n}\n.pill-badge.active-red {\n  background: var(--ship-red);\n  color: #ffffff;\n  box-shadow: none;\n}\n\n/* Bento Grid Cards (Section 4 & 6 Spec) */\n.card-grid-bento {\n  display: grid;\n  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));\n  gap: 16px;\n}\n.vercel-card {\n  background: var(--geist-background);\n  box-shadow: var(--shadow-card);\n  border-radius: var(--radius-lg);\n  padding: 20px;\n  display: flex;\n  flex-direction: column;\n  justify-content: space-between;\n  transition: box-shadow 0.2s, transform 0.2s;\n  text-decoration: none;\n  color: inherit;\n  overflow: hidden;\n  min-width: 0;\n  word-break: break-word;\n}\n.vercel-card:hover {\n  box-shadow: var(--shadow-card-hover);\n  transform: translateY(-2px);\n}\n.card-top {\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  margin-bottom: 12px;\n  gap: 8px;\n}\n.card-tag-mono {\n  font-family: \"Geist Mono\", monospace;\n  font-size: 11px;\n  font-weight: 500;\n  text-transform: uppercase;\n  color: var(--geist-quaternary);\n  letter-spacing: 0.5px;\n}\n.status-pill-badge {\n  padding: 2px 8px;\n  border-radius: var(--radius-pill);\n  font-size: 11px;\n  font-weight: 500;\n  flex-shrink: 0;\n}\n.pub-accepted { background: #ebfdf2; color: #027a48; }\n.pub-workshop { background: #eff8ff; color: #175cd3; }\n.pub-submitted { background: #fff8e6; color: #b54708; }\n.pub-preprint { background: #f2f4f7; color: #475467; }\n.pub-other { background: #f9f5ff; color: #6941c6; }\n\n[data-theme=\"dark\"] .pub-accepted { background: rgba(2, 122, 72, 0.2); color: #32d583; }\n[data-theme=\"dark\"] .pub-workshop { background: rgba(23, 92, 211, 0.2); color: #84caff; }\n[data-theme=\"dark\"] .pub-submitted { background: rgba(181, 71, 8, 0.2); color: #fec84b; }\n[data-theme=\"dark\"] .pub-preprint { background: rgba(71, 84, 103, 0.2); color: #98a2b3; }\n[data-theme=\"dark\"] .pub-other { background: rgba(105, 65, 198, 0.2); color: #d6bbfb; }\n\n/* 必读标杆徽章 (Vercel Amber Accent) */\n.milestone-badge {\n  display: inline-flex;\n  align-items: center;\n  gap: 3px;\n  padding: 2px 7px;\n  border-radius: var(--radius-pill);\n  font-size: 11px;\n  font-weight: 600;\n  white-space: nowrap;\n  flex-shrink: 0;\n  transition: all 0.15s ease;\n}\n.milestone-badge.ms-idea, .milestone-badge:not([class*=\"ms-\"]) {\n  color: #b54708;\n  background: #fff8e6;\n  border: 1px solid rgba(247, 144, 9, 0.35);\n  box-shadow: 0 1px 2px rgba(181, 71, 8, 0.05);\n}\n[data-theme=\"dark\"] .milestone-badge.ms-idea, [data-theme=\"dark\"] .milestone-badge:not([class*=\"ms-\"]) {\n  color: #fec84b;\n  background: rgba(181, 71, 8, 0.22);\n  border-color: rgba(254, 200, 75, 0.35);\n}\n.milestone-badge.ms-writing {\n  color: #6941c6;\n  background: #f9f5ff;\n  border: 1px solid rgba(105, 65, 198, 0.3);\n  box-shadow: 0 1px 2px rgba(105, 65, 198, 0.05);\n}\n[data-theme=\"dark\"] .milestone-badge.ms-writing {\n  color: #d6bbfb;\n  background: rgba(105, 65, 198, 0.22);\n  border-color: rgba(214, 187, 251, 0.35);\n}\n.milestone-badge.ms-value {\n  color: #027a48;\n  background: #ebfdf2;\n  border: 1px solid rgba(2, 122, 72, 0.3);\n  box-shadow: 0 1px 2px rgba(2, 122, 72, 0.05);\n}\n[data-theme=\"dark\"] .milestone-badge.ms-value {\n  color: #32d583;\n  background: rgba(2, 122, 72, 0.22);\n  border-color: rgba(50, 213, 131, 0.35);\n}\n\n/* 论文正文图表与插图卡片样式 (Geist Design) */\n.paper-figure, .article-body figure {\n  margin: 32px auto;\n  text-align: center;\n  max-width: 100%;\n}\n.paper-figure img, .article-body img {\n  max-width: 96%;\n  height: auto;\n  border-radius: var(--radius-md);\n  border: 1px solid var(--geist-border);\n  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);\n  background: #ffffff;\n  transition: transform 0.2s ease, box-shadow 0.2s ease;\n  display: block;\n  margin: 0 auto;\n}\n.paper-figure img:hover, .article-body img:hover {\n  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);\n}\n.paper-figure figcaption, .article-body figcaption {\n  font-size: 13px;\n  color: var(--geist-secondary);\n  margin-top: 10px;\n  line-height: 1.6;\n  font-style: italic;\n  max-width: 850px;\n  margin-left: auto;\n  margin-right: auto;\n}\n\n/* VAD 视图切换器 View Switcher */\n.vad-view-switcher {\n  display: inline-flex;\n  padding: 3px;\n  background: var(--geist-secondary-bg);\n  border: 1px solid var(--geist-border);\n  border-radius: 8px;\n  margin-bottom: 20px;\n  gap: 2px;\n}\n.view-switch-btn {\n  display: inline-flex;\n  align-items: center;\n  gap: 6px;\n  padding: 6px 14px;\n  font-size: 13px;\n  font-weight: 500;\n  color: var(--geist-secondary);\n  border-radius: 6px;\n  text-decoration: none;\n  transition: all 0.15s ease;\n}\n.view-switch-btn:hover {\n  color: var(--geist-foreground);\n  background: rgba(0, 0, 0, 0.04);\n}\n[data-theme=\"dark\"] .view-switch-btn:hover {\n  background: rgba(255, 255, 255, 0.06);\n}\n.view-switch-btn.active {\n  background: var(--geist-background);\n  color: var(--geist-foreground);\n  font-weight: 600;\n  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n}\n\n/* 关系图谱 Graph View Styles */\n.graph-container {\n  position: relative;\n  width: 100%;\n  height: 720px;\n  background: var(--geist-background);\n  border: 1px solid var(--geist-border);\n  border-radius: var(--radius-lg);\n  overflow: hidden;\n  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);\n  margin-bottom: 40px;\n}\n.graph-toolbar {\n  position: absolute;\n  top: 14px;\n  left: 14px;\n  right: 14px;\n  z-index: 10;\n  display: flex;\n  justify-content: space-between;\n  align-items: center;\n  background: var(--geist-background);\n  border: 1px solid var(--geist-border);\n  padding: 8px 14px;\n  border-radius: 8px;\n  box-shadow: 0 4px 16px rgba(0,0,0,0.06);\n  flex-wrap: wrap;\n  gap: 8px;\n}\n.graph-tool-title {\n  font-size: 13px;\n  font-weight: 700;\n  display: flex;\n  align-items: center;\n  gap: 6px;\n  color: var(--geist-foreground);\n}\n.graph-filter-group {\n  display: flex;\n  gap: 6px;\n  align-items: center;\n  flex-wrap: wrap;\n}\n.graph-chip {\n  font-size: 11px;\n  padding: 3px 8px;\n  border-radius: 4px;\n  border: 1px solid var(--geist-border);\n  background: var(--geist-background);\n  color: var(--geist-foreground);\n  cursor: pointer;\n  transition: all 0.15s ease;\n}\n.graph-chip:hover { background: var(--geist-secondary-bg); }\n.graph-chip.active {\n  background: var(--geist-foreground);\n  color: var(--geist-background);\n  border-color: var(--geist-foreground);\n}\n.graph-search-input {\n  padding: 3px 8px;\n  font-size: 11px;\n  border-radius: 4px;\n  border: 1px solid var(--geist-border);\n  background: var(--geist-background);\n  color: var(--geist-foreground);\n  outline: none;\n  width: 150px;\n}\n#vad-graph-svg {\n  width: 100%;\n  height: 100%;\n  cursor: grab;\n}\n#vad-graph-svg:active { cursor: grabbing; }\n.graph-legend {\n  position: absolute;\n  bottom: 14px;\n  left: 14px;\n  background: var(--geist-background);\n  border: 1px solid var(--geist-border);\n  border-radius: 8px;\n  padding: 10px 14px;\n  font-size: 11px;\n  box-shadow: 0 4px 16px rgba(0,0,0,0.06);\n  z-index: 10;\n  line-height: 1.6;\n  pointer-events: none;\n}\n.graph-legend-row { display: flex; align-items: center; gap: 8px; }\n.graph-legend-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }\n.graph-info-drawer {\n  position: absolute;\n  top: 66px;\n  right: 14px;\n  width: 310px;\n  max-height: 620px;\n  background: var(--geist-background);\n  border: 1px solid var(--geist-border);\n  border-radius: 8px;\n  box-shadow: 0 8px 30px rgba(0,0,0,0.12);\n  z-index: 10;\n  padding: 16px;\n  overflow-y: auto;\n  display: none;\n  backdrop-filter: blur(10px);\n  transition: transform 0.2s ease, opacity 0.2s ease;\n}\n.graph-drawer-close {\n  position: absolute;\n  top: 10px;\n  right: 12px;\n  cursor: pointer;\n  font-size: 16px;\n  color: var(--geist-tertiary);\n}\n.graph-drawer-badge {\n  display: inline-block;\n  padding: 2px 6px;\n  border-radius: 4px;\n  font-size: 10px;\n  font-weight: 600;\n  margin-bottom: 6px;\n}\n.graph-drawer-title {\n  font-size: 13px;\n  font-weight: 700;\n  line-height: 1.4;\n  margin-bottom: 8px;\n  color: var(--geist-foreground);\n}\n.graph-drawer-meta {\n  font-size: 11px;\n  color: var(--geist-secondary);\n  margin-bottom: 12px;\n}\n.graph-drawer-core {\n  font-size: 12px;\n  line-height: 1.6;\n  color: var(--geist-foreground);\n  background: var(--geist-secondary-bg);\n  padding: 8px 10px;\n  border-radius: 6px;\n  margin-bottom: 12px;\n  border: 1px solid var(--geist-border);\n}\n.graph-drawer-link {\n  display: block;\n  text-align: center;\n  padding: 7px 12px;\n  background: var(--geist-foreground);\n  color: var(--geist-background);\n  border-radius: 6px;\n  font-size: 12px;\n  font-weight: 600;\n  text-decoration: none;\n  transition: opacity 0.15s ease;\n  margin-bottom: 6px;\n}\n.graph-drawer-link:hover { opacity: 0.85; }\n.graph-drawer-pdf-link {\n  display: block;\n  text-align: center;\n  padding: 6px 12px;\n  background: var(--geist-secondary-bg);\n  color: var(--geist-foreground);\n  border: 1px solid var(--geist-border);\n  border-radius: 6px;\n  font-size: 11px;\n  font-weight: 500;\n  text-decoration: none;\n  transition: all 0.15s ease;\n}\n.graph-drawer-pdf-link:hover { background: var(--geist-border); }\n.node-circle {\n  cursor: pointer;\n  transition: r 0.2s, stroke-width 0.2s;\n}\n.node-label {\n  font-size: 10px;\n  font-weight: 600;\n  fill: var(--geist-foreground);\n  pointer-events: none;\n  text-shadow: 0 1px 2px var(--geist-background);\n}\n.link-line {\n  stroke: var(--geist-border);\n  stroke-opacity: 0.6;\n  stroke-width: 1.2;\n  transition: stroke 0.2s, stroke-width 0.2s, stroke-opacity 0.2s;\n}\n.link-label {\n  font-size: 9px;\n  fill: var(--geist-tertiary);\n  pointer-events: none;\n  text-anchor: middle;\n}\n\n/* 引用框与警示框 Alerts */\n.callout-alert {\n  margin: 20px 0;\n  padding: 14px 18px;\n  border-radius: var(--radius-md);\n  transition: all 0.15s ease;\n}\n.callout-important, .callout-idea {\n  border-left: 4px solid #b54708;\n  background: rgba(181, 71, 8, 0.06);\n  box-shadow: inset 0 0 0 1px rgba(247, 144, 9, 0.3);\n}\n[data-theme=\"dark\"] .callout-important, [data-theme=\"dark\"] .callout-idea {\n  border-left-color: #fec84b;\n  background: rgba(181, 71, 8, 0.18);\n  box-shadow: inset 0 0 0 1px rgba(254, 200, 75, 0.25);\n}\n.callout-writing {\n  border-left: 4px solid #6941c6;\n  background: rgba(105, 65, 198, 0.06);\n  box-shadow: inset 0 0 0 1px rgba(105, 65, 198, 0.3);\n}\n[data-theme=\"dark\"] .callout-writing {\n  border-left-color: #d6bbfb;\n  background: rgba(105, 65, 198, 0.18);\n  box-shadow: inset 0 0 0 1px rgba(214, 187, 251, 0.25);\n}\n.callout-value {\n  border-left: 4px solid #027a48;\n  background: rgba(2, 122, 72, 0.06);\n  box-shadow: inset 0 0 0 1px rgba(2, 122, 72, 0.3);\n}\n[data-theme=\"dark\"] .callout-value {\n  border-left-color: #32d583;\n  background: rgba(2, 122, 72, 0.18);\n  box-shadow: inset 0 0 0 1px rgba(50, 213, 131, 0.25);\n}\n\n.card-title {\n  font-size: 16.5px;\n  font-weight: 600;\n  line-height: 1.42;\n  letter-spacing: -0.4px;\n  color: var(--geist-foreground);\n  margin: 0 0 10px;\n  word-break: break-word;\n  overflow-wrap: anywhere;\n  hyphens: auto;\n}\n.card-title a {\n  color: var(--geist-foreground);\n  text-decoration: none;\n  display: inline;\n  transition: color 0.15s ease;\n}\n.card-title a:hover {\n  color: var(--develop-blue);\n  text-decoration: none;\n}\n.card-id-mono {\n  font-family: \"Geist Mono\", monospace;\n  font-size: 13px;\n  font-weight: 500;\n  color: var(--geist-quaternary);\n  margin-right: 5px;\n}\n.card-meta-row {\n  display: flex;\n  gap: 6px;\n  flex-wrap: wrap;\n  margin-bottom: 12px;\n}\n.meta-token {\n  font-size: 12px;\n  color: var(--geist-tertiary);\n  background: var(--geist-surface-tint);\n  box-shadow: var(--shadow-ring);\n  padding: 2px 7px;\n  border-radius: var(--radius-sm);\n  white-space: nowrap;\n}\n.card-body-text {\n  font-size: 13.5px;\n  color: var(--geist-secondary);\n  line-height: 1.6;\n  margin-bottom: 16px;\n  flex-grow: 1;\n  word-break: break-word;\n  overflow-wrap: anywhere;\n}\n.card-body-text strong {\n  color: var(--geist-foreground);\n  font-weight: 600;\n}\n\n.card-footer {\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  border-top: 1px solid var(--geist-border);\n  padding-top: 14px;\n}\n.card-link-action {\n  font-size: 13.5px;\n  font-weight: 500;\n  color: var(--link-blue);\n  display: inline-flex;\n  align-items: center;\n  gap: 4px;\n  text-decoration: none;\n  transition: all 0.15s ease;\n}\n.card-link-action:hover {\n  opacity: 0.85;\n  transform: translateX(2px);\n}\na.meta-token {\n  transition: all 0.15s ease;\n  cursor: pointer;\n  text-decoration: none;\n}\na.meta-token:hover {\n  background: var(--geist-selection);\n  color: var(--geist-foreground);\n  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);\n}\n\n/* 紧凑列表视图 (List View) */\n.card-list-view {\n  display: flex;\n  flex-direction: column;\n  gap: 8px;\n}\n.list-row-item {\n  background: var(--geist-background);\n  box-shadow: var(--shadow-card);\n  border-radius: var(--radius-md);\n  padding: 12px 18px;\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  gap: 16px;\n  transition: box-shadow 0.15s;\n}\n.list-row-item:hover {\n  box-shadow: var(--shadow-card-hover);\n}\n\n/* 阅读详情页 (Report Detail) */\n.reading-container {\n  display: grid;\n  grid-template-columns: minmax(0, 1fr) 260px;\n  gap: 40px;\n  align-items: start;\n}\n@media (max-width: 960px) {\n  .reading-container { grid-template-columns: 1fr; }\n  .reading-sidebar { display: none; }\n}\n\n.report-header-card {\n  background: var(--geist-background);\n  box-shadow: var(--shadow-card);\n  border-radius: var(--radius-lg);\n  padding: 28px 32px;\n  margin-bottom: 28px;\n}\n.crumb-bar {\n  font-size: 13px;\n  color: var(--geist-tertiary);\n  margin-bottom: 10px;\n}\n.report-title {\n  font-size: 32px;\n  font-weight: 600;\n  letter-spacing: -1.28px;\n  margin: 0 0 16px;\n  color: var(--geist-foreground);\n}\n.report-action-buttons {\n  display: flex;\n  align-items: center;\n  gap: 10px;\n  flex-wrap: wrap;\n  border-top: 1px solid var(--geist-border);\n  padding-top: 16px;\n  margin-top: 16px;\n}\n\n.article-body {\n  background: var(--geist-background);\n  box-shadow: var(--shadow-card-full);\n  border-radius: var(--radius-lg);\n  padding: 36px 42px 80px;\n  font-size: 16px;\n  line-height: 1.75;\n  color: var(--geist-foreground);\n}\n.article-body h1, .article-body h2, .article-body h3 {\n  color: var(--geist-foreground);\n  scroll-margin-top: 80px;\n}\n.article-body h1 { font-size: 28px; font-weight: 600; letter-spacing: -1.28px; border-bottom: 1px solid var(--geist-border); padding-bottom: 8px; margin-top: 32px; }\n.article-body h2 { font-size: 24px; font-weight: 600; letter-spacing: -0.96px; border-bottom: 1px solid var(--geist-border); padding-bottom: 6px; margin-top: 36px; }\n.article-body h3 { font-size: 18px; font-weight: 600; letter-spacing: -0.32px; margin-top: 26px; }\n.article-body table {\n  width: 100%;\n  border-collapse: collapse;\n  margin: 24px 0;\n  font-size: 14px;\n  box-shadow: var(--shadow-border);\n  border-radius: var(--radius-md);\n  overflow: hidden;\n}\n.article-body th, .article-body td {\n  padding: 10px 14px;\n  text-align: left;\n  border-bottom: 1px solid var(--geist-border);\n}\n.article-body th {\n  background: var(--geist-surface-tint);\n  font-weight: 600;\n  color: var(--geist-foreground);\n}\n.article-body blockquote {\n  border-left: 2px solid var(--geist-foreground);\n  margin: 20px 0;\n  padding: 8px 18px;\n  color: var(--geist-secondary);\n  font-style: normal;\n}\n.article-body code {\n  font-family: \"Geist Mono\", monospace;\n  font-size: 13.5px;\n  box-shadow: var(--shadow-ring);\n  background: var(--geist-surface-tint);\n  padding: 2px 6px;\n  border-radius: var(--radius-sm);\n}\n.article-body pre {\n  position: relative;\n  background: #000000;\n  color: #ededed;\n  box-shadow: var(--shadow-border);\n  border-radius: var(--radius-md);\n  padding: 18px;\n  margin: 24px 0;\n  overflow-x: auto;\n}\n.article-body pre code {\n  background: transparent;\n  box-shadow: none;\n  padding: 0;\n  color: inherit;\n  font-size: 13px;\n}\n.copy-code-btn {\n  position: absolute;\n  top: 8px;\n  right: 10px;\n  font-family: \"Geist Mono\", monospace;\n  font-size: 11px;\n  background: #171717;\n  color: #ffffff;\n  border: 1px solid #333333;\n  padding: 3px 8px;\n  border-radius: var(--radius-sm);\n  cursor: pointer;\n}\n\n/* 侧边大纲 (TOC) */\n.reading-sidebar {\n  position: sticky;\n  top: 80px;\n  background: var(--geist-background);\n  box-shadow: var(--shadow-card);\n  border-radius: var(--radius-lg);\n  padding: 20px;\n  max-height: calc(100vh - 100px);\n  overflow-y: auto;\n}\n.sidebar-toc-title {\n  font-family: \"Geist Mono\", monospace;\n  font-size: 12px;\n  font-weight: 500;\n  text-transform: uppercase;\n  letter-spacing: 0.5px;\n  color: var(--geist-quaternary);\n  margin-bottom: 12px;\n}\n.reading-sidebar ul {\n  list-style: none;\n  padding-left: 0;\n  margin: 0;\n  font-size: 13px;\n}\n.reading-sidebar li {\n  margin: 6px 0;\n}\n.reading-sidebar ul ul {\n  padding-left: 14px;\n}\n.reading-sidebar a {\n  color: var(--geist-secondary);\n  text-decoration: none;\n  transition: color 0.15s;\n}\n.reading-sidebar a:hover, .reading-sidebar a.active {\n  color: var(--geist-foreground);\n  font-weight: 600;\n}\n\n/* 后台管理 (/admin) */\n.admin-card-container {\n  background: var(--geist-background);\n  box-shadow: var(--shadow-card-full);\n  border-radius: var(--radius-lg);\n  padding: 32px;\n  margin-bottom: 32px;\n}\n.form-row-2 {\n  display: grid;\n  grid-template-columns: 1fr 1fr;\n  gap: 16px;\n  margin-bottom: 16px;\n}\n@media (max-width: 600px) {\n  .form-row-2 { grid-template-columns: 1fr; }\n}\n.form-field {\n  display: flex;\n  flex-direction: column;\n  gap: 6px;\n  margin-bottom: 16px;\n}\n.form-field label {\n  font-size: 13px;\n  font-weight: 500;\n  color: var(--geist-foreground);\n}\n.form-field input, .form-field select, .form-field textarea {\n  font-family: \"Geist\", sans-serif;\n  font-size: 14px;\n  padding: 9px 12px;\n  background: var(--geist-background);\n  box-shadow: var(--shadow-border);\n  border: none;\n  border-radius: var(--radius-md);\n  color: var(--geist-foreground);\n  outline: none;\n}\n.form-field input:focus, .form-field select:focus, .form-field textarea:focus {\n  outline: 2px solid var(--ds-focus-color);\n  box-shadow: none;\n}\n\n/* 语法高亮 (Console Blue / Purple / Pink) */\n.codehilite .k, .codehilite .kd, .codehilite .kn { color: #eb367f; font-weight: 500; }\n.codehilite .s, .codehilite .s1, .codehilite .s2 { color: #0070f3; }\n.codehilite .nf, .codehilite .na { color: #7928ca; font-weight: 500; }\n.codehilite .c, .codehilite .c1 { color: #666666; font-style: italic; }\n.codehilite .mi, .codehilite .mf { color: #ff5b4f; }\n\n</style>\n\n</head>\n<body>\n\n    <nav class=\"vercel-nav\">\n      <div class=\"nav-brand\">\n        <a href=\"/\" style=\"display:flex;align-items:center;gap:10px;text-decoration:none\">\n          <svg class=\"vercel-triangle\" viewBox=\"0 0 76 65\" fill=\"none\">\n            <path d=\"M37.5274 0L75.0548 65H0L37.5274 0Z\" fill=\"currentColor\"/>\n          </svg>\n          <span class=\"nav-title\">Agent Harness KB</span>\n        </a>\n        <span class=\"nav-badge-pill\">Geist 2.0</span>\n      </div>\n\n      <div class=\"nav-links\">\n        <a class=\"nav-link \" href=\"/\">全景总览</a>\n        <a class=\"nav-link \" href=\"/vad\" style=\"color:var(--ship-red)\">🎯 VAD 专栏 (144)</a>\n        <a class=\"nav-link\" href=\"https://m0rtzz.github.io/paper-notes/\" target=\"_blank\" rel=\"noopener\">顶会 669 篇 ↗</a>\n        <a class=\"nav-link\" href=\"/download/all\">整库打包</a>\n        \n      </div>\n\n      <div class=\"nav-actions\">\n        \n        <button class=\"theme-toggle-btn\" id=\"theme-toggle-btn\" onclick=\"toggleTheme()\" title=\"切换亮暗主题\">🌙</button>\n      </div>\n    </nav>\n    \n<main class=\"vercel-container\">\n\n        <div class=\"report-header-card\">\n          <div class=\"crumb-bar\"><a href=\"/\">Home</a> / <b>fulltext.txt</b></div>\n          <h1 class=\"report-title\">fulltext.txt</h1>\n          <div class=\"report-action-buttons\">\n            <a class=\"btn-primary-dark\" href=\"?dl=1\">Download Text</a>\n          </div>\n        </div>\n        <article class=\"article-body\"><pre><code>Unseen Visual Anomaly Generation\nHan Sun\nEPFL, Switzerland\n\nYunkang Cao\nHUST, China\n\nHao Dong\nETH Zurich, Switzerland\n\nOlga Fink\nEPFL, Switzerland\n\narXiv:2406.01078v4 [cs.CV] 11 Jun 2025\n\n{han.sun, olga.fink}@epfl.ch, cyk hust@hust.edu.cn, hao.dong@ibk.baug.ethz.ch\n\nAbstract\nVisual anomaly detection (AD) presents significant challenges due to the scarcity of anomalous data samples. While\nnumerous works have been proposed to synthesize anomalous samples, these synthetic anomalies often lack authenticity or require extensive training data, limiting their applicability in real-world scenarios. In this work, we propose Anomaly Anything (AnomalyAny), a novel framework that leverages Stable Diffusion (SD)’s image generation capabilities to generate diverse and realistic unseen anomalies. By conditioning on a single normal sample during test time, AnomalyAny is able to generate unseen anomalies for arbitrary object types with text descriptions. Within AnomalyAny, we propose attention-guided\nanomaly optimization to direct SD’s attention on generating\nhard anomaly concepts. Additionally, we introduce promptguided anomaly refinement, incorporating detailed descriptions to further improve the generation quality. Extensive experiments on MVTec AD and VisA datasets demonstrate AnomalyAny’s ability in generating high-quality unseen anomalies and its effectiveness in enhancing downstream AD performance. Our demo and code are available\nat https://hansunhayden.github.io/AnomalyAny.github.io/.\n\n1. Introduction\nVisual anomaly detection (AD) [5] aims to identify unusual\nor unexpected patterns in image data that deviate from a\nnormal distribution of features, and is essential in fields\nsuch as industrial inspection and quality control [3]. Since\nanomalies are rare and difficult to collect, most existing AD\nmethods rely on unsupervised learning [12, 22, 32] using\nsolely normal samples. Despite recent advancements in the\nAD field, the scarcity of anomalous samples for training remains a persistent challenge. To address this, various studies have explored visual anomaly generation, as illustrated\nin Fig. 1. Some approaches [33, 35] augment normal samples by cropping and pasting random patterns, either from\nnatural patterns in other datasets or from the images them-\n\nselves. While this generates diverse anomalous samples and\nis applicable to unseen objects without training, these samples often appear unrealistic. Another approach involves\ngenerating visual anomalies using generative models [17],\nwhich produce more realistic images but require sufficient\nand representative normal and abnormal samples for training, which is typically challenging to obtain for AD. Given\nthe rarity and variability of anomalies, collecting a representative set of anomalous samples is difficult. Additionally, the diversity of product variants and configurations in\nindustrial applications often results in a lack of representative normal samples [18], presenting an additional challenge. These limitations lead to a shortage of both abnormal\nand normal samples. Consequently, generative models are\noften not suitable for real-world applications with limited\ndata and may be biased towards the few available training\nobservations.\nGiven the limitations of existing visual anomaly generation methods, we aim to generate diverse and realistic\nunseen anomalies using minimal normal data without any\nanomalous samples. The goal motivates us to explore Stable Diffusion (SD) [27], a latent text-to-image diffusion\nmodel known for generating diverse images across various domains. Although SD demonstrates impressive image generation capabilities, it is not specifically designed\nfor visual anomaly generation. Consequently, when applied\ndirectly for anomaly generation, SD may produce images\nthat deviate from the desired normal distribution and fail to\naccurately represent realistic anomaly patterns (Fig. 3 (b)).\nPrior approaches [17, 35] suggest fine-tuning SD on available normal or anomalous samples, but this approach is constrained in data scarcity scenarios and can compromise SD’s\nability to generalize to unseen data and anomaly types.\nIn this work, we propose Anomaly Anything (AnomalyAny) for realistic and diverse unseen visual anomaly generation. We leverage SD for unseen visual anomaly generation with anomaly text descriptions, which can be defined manually or automatically acquired from GPT-4 [24]\nwith object category as input. Instead of fine-tuning SD on\nnormal data, we introduce test-time normal sample condi-\n\n\fNatural Patterns\n\nAnomalous Samples\n\nText Prompts\n\n“A photo of a [cls]\nthat is damaged”\nTrainable\nCut&amp;Paste\n\nStable Diffusion\n\nNot\nApplicable\n\nUniversal/Unrealistic\n\nSpecific/Realistic\n\n(a) DRAEM\n\n(b) AnomalyDiffusion\n\nStable Diffusion\n\nFrozen\n\nUniversal/Realistic\n(c) Our AnomalyAny\n\nFigure 1. Comparison between different visual anomaly generation methods. In comparison to existing methods, AnomalyAny can\ngenerate diverse and realistic unseen anomalies without training.\n\ntioning, guiding the generation process on a single normal\nsample. This approach preserves the diversity and generalization ability of SD, enabling anomaly generation on novel\ndata and new anomaly types. With a single model, we can\ngenerate realistic and diverse anomalous samples for any\nnew objects and from arbitrary anomaly descriptions. We\nobserve that the original SD struggles to generate realistic anomaly samples due to two inherent challenges: first,\nanomalies are comparatively rare in SD’s training data; second, unlike common objects and patterns, anomalous patterns typically occupy only a small region of the image,\nmaking them easily overlooked in generation. To address\nthis, we propose attention-guided anomaly optimization to\nenforce the model’s attention on generating anomaly concepts by maximizing the attention value correlated with the\nanomaly token. To further guide and refine the generation\nresults, we propose prompt-guided anomaly refinement,\nwhich leverages more detailed anomaly descriptions as additional semantic guidance. Our main contributions are:\n• We propose AnomalyAny, a visual anomaly generation\nframework for unseen anomalies. Users can provide arbitrary normal images of objects and anomaly descriptions\nto generate realistic and diverse anomalous samples.\n• We introduce attention-guided anomaly optimization\nalong with prompt-guided anomaly refinement to overcome the limitations of SD in anomaly generation. Our\nproposed method achieves more authentic generation results than existing methods, without requiring additional\ntraining or abundant normal/abnormal data samples.\n• We demonstrate the effectiveness of our proposed\nAnomalyAny in both generation quality and in facilitating\nthe training of the downstream anomaly detection models.\n\n2. Related Works\n2.1. Anomaly Generation\nThe scarcity of anomalous data has motivated numerous\nstudies to synthesize anomaly samples [10]. One approach\naugments normal training samples by cropping and pasting\nabnormal patterns from few-shot abnormal samples in the\ntest set [21, 30] , natural patterns of external datasets [7, 33],\n\nor directly from the normal image itself [19, 29]. Despite being simple and effective, these methods lack authenticity and diversity in the generated samples. Another approach employs generative models, such as generative adversarial networks (GANs) to synthesize anomalies [11, 34]. More recently, advancements in diffusion\nmodels [14, 17, 31, 35] have enabled methods that finetune these models on anomaly data to produce more diverse and realistic anomalies. However, these methods typically require substantial amounts of normal and/or abnormal data samples to learn the dataset-specific distribution,\nwhich is often impractical in data-limited scenarios. Also,\nthese methods can only generate samples similar to the\ntraining set, i.e., seen anomalies, but fail in generating unseen anomalies. In real-world applications, however, it is\noften impractical to assume prior knowledge of all possible anomalies, highlighting the need for methods that can\ngeneralize to unseen types. To generate unseen yet realistic\nanomalies, AnomalyAny directly deploys the pretrained SD\nmodel for anomaly synthesis without additional training,\noffering a more flexible solution for high-quality anomaly\ngeneration across arbitrary objects.\n\n2.2. Anomaly Detection\nThe scarcity of available anomalous samples has made unsupervised AD [4, 9, 28] the dominant paradigm in the AD\nfield, where the goal is to model the normal distribution\nand then identify anomalies as outliers [4, 9, 28]. However, these methods rely on the availability of a sufficient\namount of normal samples that adequately represent the underlying distribution. Due to the lack of representative normal samples across the wide range of product variations and\nindustrial configurations, few-shot AD has gained increasing attention [22, 32]. Existing few-shot methods typically\nleverage additional knowledge from vision-language models pretrained on large-scale datasets, such as Contrastive\nLanguage-Image Pre-training (CLIP) [25], to compute similarities between data samples and the normal or abnormal\ntext prompts [13, 18, 20]. Nevertheless, training AD models solely with normal samples remains challenging due to\na lack of awareness of anomaly distributions, underscoring\n\n\fthe need for realistic anomalous samples to enhance AD\nperformance.\n\n3. Preliminary: Stable Diffusion\nDiffusion models. Denoising diffusion probabilistic models (DDPMs) [15] learn the desired data distribution by\ndefining a Markov chain of length T . In the forward pass,\nthis chain gradually adds noise to a given data sample x0\nto obtain a sequence of noisy samples xt , t ∈ T . In the reverse process, a model ϵθ parameterized by θ is learned to\npredict the noise added for each step t. Our method is based\non SD [27], a latent diffusion model (LDM) that applies the\ndenoising diffusion process to the latent representation z of\nx in the latent space of a variational auto-encoder (VAE)\nwith the learning objective of predicting the added noise at\neach time step t as:\nh\ni\n2\nLLDM := EE(x),ϵ∼N (0,1),t ∥ϵ − ϵθ (zt , t)∥2 , (1)\nwhere zt represents the noised latent representation at time\nstep t. During inference, the reverse process starts with a\nrandom noise xT ∼ N (0, I) and gradually generates an\nimage sample from the noise from step T to 0.\nText condition. SD introduces text guidance via a crossattention mechanism. The denoising UNet network in the\nlatent space of SD consists of self-attention layers followed\nby cross-attention layers at resolutions P ∈ (64, 32, 16, 8).\nGiven a text prompt c composed of N tokens, a guidance\nvector τ (c) is then obtained via the CLIP text-encoder τ\n[26]. τ (c) is then mapped to intermediate feature maps of\nthe DDPM model ϵθ through each cross-attention layer as\nfollows:\n\u0012\nA = softmax\n\nQK T\n√\nd\n\n(i)\n\n\u0013\n· V,\n\nA ∈ [P, P, N ],\n(i)\n\n(2)\n(i)\n\nQ = WQ · φi (zt ) , K = WK · τ (c), V = WV · τ (c),\n\n(3)\n\nwhere φi (zt ) is the intermediate feature of the UNet.\nA, Q, K, V denote the attention, query, key, and value matrices. W (i) represents learnable projection matrices. Based\non image-captioning pairs {x, c}, the text-conditioned diffusion model can be learned with the objective:\n\u0002\n\u0003\nLLDM := EE(x),c,ϵ∼N (0,1),t ∥ϵ − ϵθ (zt , t, τ (c))∥22 .\n\n(4)\n\ntypes. During generation, we introduce a two-stage optimization process: Attention-Guided Anomaly Optimization (Sec. 4.2) first focuses generation on hard anomaly\nconcepts, followed by Prompt-guided Anomaly Refinement\n(Sec. 4.3) that leverages detailed text descriptions to further\nenhance the generation quality.\n\n4.1. Test-time Normal Sample Conditioning\nIn our work, we leverage SD to generate unseen visual\nanomalies. While SD is effective for image generation, the\ninherent diversity of its underlying distribution causes the\ngenerated images to significantly differ from the normal images in a specific AD dataset, as shown in Fig. 3 (b). To\ngenerate images that align with the target normal distribution, instead of fine-tuning SD, we incorporate information\nfrom normal samples directly during the generation process.\nGiven a normal sample xnormal and its latent representation z normal = E(xnormal ) encoded by the VAE encoder,\nwe get a sequence of samples z1normal , z2normal , ..., zTnormal\nwith progressively added noise controlled by the DDPM\nnoise scheduler. Instead of starting the inference from\nzT ∼ N (0, I), we begin from step tstart = T · (1 − γ) with\n, which conveys corthe noisy latent representation ztnormal\nstart\nrupted features from the guidance normal image xnormal .\nThis enables the generation of anomalies for novel object\ntypes during test time without requiring additional training.\nThe parameter γ controls the starting step, i.e., the noise\nscale added to the guidance data sample. In our experiments, we set γ = 0.25 to balance similarity to the original distribution with inference steps that promote diverse\noutcomes.\nFor more precise control conditioned on a given normal\nsample, we use a mask input as an optional constraint to\nspecify the location of the generated anomalies. This mask\ncan function either as a foreground mask to restrict anomalies to the intended object or as a detailed, pre-defined mask\nthat accurately defines the anomaly region. For the predicted latent representation zt at time step t, we apply the\nfollowing operation:\nzt = mask ⊙ zt + (1 − mask) ⊙ ztnormal .\n\n(5)\n\nThis formulation preserves the distribution of the normal\nguidance sample outside the masked region, ensuring that\nmodifications are restricted solely to the specified area.\n\n4. Methodology\n\n4.2. Attention-Guided Anomaly Optimization\n\nIn this work, we propose AnomalyAny, a novel framework\nfor generating realistic, promptable anomalies on unseen\nobjects and anomaly types, as illustrated in Fig. 2. AnomalyAny comprises three core modules. The framework begins with Test-time Normal Sample Conditioning (Sec. 4.1)\nto guide the generation process on a single normal sample,\nenabling anomaly generation on novel objects and anomaly\n\nWe generate anomalous samples of a specific object type,\ndenoted as [cls] (e.g., bottle), by providing anomaly text\ndescriptions, such as ”A photo of a [cls] that is damaged”.\nDue to the challenging nature of anomaly generation as\nintroduced, the desired anomaly semantics are often neglected in the generated images, as shown in Fig. 3 (d).\nTo overcome this challenge, we introduce attention-guided\n\n\fBackward Pass of LDM\n𝜏(𝑐)\n\nTrainable\nDenoising\nUNet\n\n…\n\nDenoising\nUNet\n\n𝑧!$!%&amp;!\n\nDenoising\nUNet\n\nPrompt-Guided Optimization\n“A bottle that is damaged”\n“A bottle that has a damaged area\nwith rugged, uneven texture”\n\nText\nEncoder\n\n𝜏(𝑐)\n\nAttention-Guided Optimization\n\n𝓛𝒑𝒓𝒐𝒎𝒑𝒕\n\n𝑄\n𝐾𝑉\n\n𝜏(𝑐′)\n\nVAE\nDecoder\n\n𝑧!\n𝓛𝒊𝒎𝒈\n\nCLIP\n\n𝐴&amp;*: damaged\n\n𝑧*\n\n𝑧\"\n\n𝑧!\n\n“bottle”\n\nGPT-4\n\n…\n\n𝑄\n𝐾𝑉\n\n𝑄\n𝐾𝑉\n\nSD Denoising\n\n𝐴\"!\n\n𝐴$!\n\n𝐴#!\n\n𝐴%!\n\n𝐴&amp;!\n\nA\n\nbottle\n\nthat\n\nis\n\ndamaged\n\n𝓛𝒂𝒕𝒕\n\n𝑥G!\n\n𝑧!\n\nFigure 2. Illustration of AnomalyAny with details of the attention-guided &amp; prompt-guided optimization process at time step t.\n\n(a)\n\n(b)\n\n(c)\n\n(d)\n\n(e)\n\n(f)\n\n' (𝑐′) attention map of damage. We present (a) Normal guidance image, and the\nFigure 3. Examples of generated anomaly samples𝜏and\nresults generated by (b) Stable Diffusion, (c) Ours w/o normal sample conditioning, (d) Ours w/o attention-guided optimization, (e) Ours\nw/o prompt-guided optimization, and (f) Our proposed AnomalyAny.\n\nanomaly optimization to enforce the generation of these\ncritical yet difficult-to-capture anomaly concepts. First, we\naggregate the attention maps from SD for subsequent optimization. As introduced in Sec. 3, SD introduces text\nguidance using a cross-attention mechanism. Given a text\nprompt c composed of N tokens, at each inference step t,\nwe obtain a collection of attention maps At ∈ P × P × N\ncorresponding to c at different resolutions. These attention maps capture the cross-correlation with each text token,\nwhere A[:, :, i] represents the probability assigned to token\nci , i ∈ (1, N ). Following the methodology of [6], we average all the attention maps at a resolution of 16×16, as these\nare identified to be the most semantically informative. The\nresulting attention map Āt is then normalized across the token dimension and smoothed using a Gaussian(·) function:\nĀt = Gaussian(softmax(Āt )),\n\nĀt ∈ 16 × 16 × N. (6)\n\nWe enforce the generated image to convey the semantic\nmeaning of the anomaly type token cj from the given c, e.g.,\n”damaged” in ”A photo of a [cls] that is damaged” via op-\n\ntimization guided by Āt . During the generation process, at\neach time step t, we optimize the intermediate latent representation zt by maximizing the attention associated with the\nanomaly description. The optimized latent representation is\nthen denoised to obtain zt−1 , which is used in the subsequent optimization and denoising steps. as shown in Fig. 2.\nSpecifically, during optimization at step t, we extract the\nattention map Ājt = Āt [:, :, j] correlated with the anomaly\ntoken cj . We then compute the gradient update for zt by\napplying the loss function Latt to Ājt . Furthermore, we increase controllability by allowing masks as optional inputs\nand restricting the optimization of zt to within the specified\nmask. The optimization at step t is formulated as follows:\n\u0010\n\u0011\nLatt = 1 − max Ājt ⊙ mask ,\n(7)\nzt ← zt − αt · ∇zt Latt ⊙ mask,\n\n(8)\n\nwhere αt is a scalar defining the step size. This objective\nencourages a high maximum value of Ājt to strengthen the\nactivations of the anomaly token. Through iterative opti-\n\n\fStep = 251\n\nStep = 101\n\nStep = 2\n\nFigure 4. Visualization of intermediate generation results and\nthe attention maps of anomaly tokens at different denoising steps.\n\n(a)\n\n(b)\n\n(a)\n\n(b)\n\n(a)\n\n(b)\n\nFigure 5. Examples of anomalies generated after attention-based\noptimization on anomaly tokens (a) w/o and (b) w/ localizationaware scheduler.\n\nmization, we progressively integrate the semantic characteristics of anomalies into the generated image, as illustrated\nin Fig. 4.\nOur empirical results demonstrate that the iterative updates described above can cause redundant attention on specific pixels, resulting in image artifacts. To mitigate overoptimization, we propose a localization-aware scheduler.\nStarting with the initial generation result ztstart and its\nanomaly attention map Ājtstart , we determine the number\nof activated pixels ntstart by counting pixels with attention\nvalues exceeding the mean in the smoothed attention map.\nAt each optimization step t, we calculate the activated pixel\ncount nt and compute the scalar αt as follows:\nαt = λ(1 + ∆t · t) ·\n\nnt\nntstart\n\n,\n\n(9)\n\nwhere λ is a scaling factor that controls the strength of the\noptimization, and ∆t adjusts the step size to gradually decrease the update rate. As the activated pixels become increasingly localized, we reduce αt to mitigate overfitting.\nAs illustrated in Fig. 5, this strategy significantly mitigates\nunrealistic artifacts in the generated samples.\n\n4.3. Refined Anomaly Generation via PromptGuided Optimization\nAttention-based optimization enforces the generation of\nanomaly keywords consisting of one to two tokens. However, the limited token length often results in ambiguous\ndescriptions, thereby reducing the authenticity and richness\nof the generated context. To enhance semantic guidance\nand improve the generation quality, we propose a promptguided optimization for anomaly refinement that incorporates detailed anomaly descriptions. To enrich the generated anomaly distribution, we leverage GPT-4 [1] to generate potential anomaly types cj for a given object, along\n\nwith their corresponding detailed descriptions c′ . For example, given the object as bottle, we prompt GPT-4 to identify possible anomaly types and their descriptions, such as\n”damaged” → ”close-up of a bottle that has a damaged\narea with rugged, uneven texture”, thereby providing more\nnuanced guidance for generating a diverse range of damage\ntypes or anomalies.\nTo incorporate the semantic guidance from these longtext descriptions during the generation process, we introduce a CLIP-based image generation loss in the final denoising steps to ensure semantic consistency between the\ngenerated image and text guidance. At time step t, given\nthe latent representation zt , we obtain the decoded generation result x̃t = D(zt ). We then minimize its distance from\nc′ in the CLIP [26] embedding space as follows:\nLimg = 1.0 − cosine(ΦT (c′ ), ΦV (x̃t )),\n\n(10)\n\nwhere ΦT (·) and ΦV (·) denotes the CLIP text and visual encoders, respectively. Minimizing this similarity loss aligns\nthe generated anomalies more closely with the semantic attributes of c′ , refining the anomaly type with detailed descriptions. We then jointly optimize zt for attention and\nsemantic alignment as:\nL = Limg + αt · Latt ,\n\nzt ← zt − ∇zt L ⊙ mask. (11)\n\nTo further incorporate semantic guidance, we adapt c to\nthe finer guidance c′ by computing their similarity and optimize the prompt embedding as:\nLprompt = 1.0 − cosine(τ (c), τ (c′ )),\n\n(12)\n\nτ (c) ← τ (c) − ∇τ (c) (Lprompt + Limg ).\n\n(13)\n\nThis process enriches the semantic information within\nthe original prompt embedding τ (c) to guide the generation process effectively. In our framework, we optimize\nthis joint loss in the final 30 of the total inference steps.\nThis integrated guidance not only strengthens semantic consistency but also mitigates unrealistic artifacts often encountered with standalone attention-based optimization, enabling more precise, contextually rich anomaly generation\naligned with detailed prompt specifications.\nWith our proposed AnomalyAny framework, we achieve\npromptable unseen anomaly generation. Notably, since\nAnomalyAny is not trained on specific datasets, it is unrestricted by the distribution of available normal samples,\nmaking it applicable across a broad range of unseen object\ncategories and anomaly types. Additionally, the attention\nmaps define a probability distribution over each text token,\nallowing us to use the final smoothed attention map Āj0 at\ntime step 0 as pixel-level annotation to localize the anomaly\ndescribed by cj .\n\n\fReference\n\nscratched\n\nrust\n\nbent\n\nNSA [29]\n\nCategory\n\nRealNet [35] AnoDiff [17]\n\nOurs\n\nWeb Images\n\nMVTec AD\n\nIS ↑ IC-L ↑ IS ↑ IC-L ↑ IS ↑ IC-L ↑ IS ↑ IC-L ↑\n\nReference\n\nhole\n\nscratched\n\ncolored\n\nReference\n\ndamaged\n\nscratched\n\nbent\n\nReference\n\ndamaged\n\nscratched\n\ncolored\n\nFigure 6. Anomaly generation results for arbitrary objects and\nanomaly descriptions. The bottom right presents the attention\nmaps of the anomaly tokens.\n\nbottle\n1.35\ncable\n1.55\ncapsule 1.38\ncarpet 1.03\n2.26\ngrid\nhazelnut 2.04\nleather 1.07\nmetal nut 1.66\npill\n1.34\n1.20\nscrew\ntile\n1.31\ntoothbrush 1.18\ntransistor 1.34\nwood\n1.30\nzipper 1.52\naverage 1.44\n\nDatasets. We conduct extensive experiments on MVTec\nAD [2] and VisA [36], two benchmarks for industrial\nanomaly detection. MVTec AD includes 5, 000 images\nacross 15 object and texture categories with pixel-level annotations for defects, while VisA contains 10, 821 images\nfrom 12 categories with annotations.\nEvaluation Metrics. To evaluate the anomaly generation\nresults quantitatively, we employ Inception Score (IS) to\nmeasure the generation quality and Intra-cluster pairwise\nLPIPS distance (IC-LPIPS) [23] to evaluate the generation\ndiversity. We also validate the effectiveness of our generated image samples by training anomaly detection frameworks using our generated data. For the anomaly detection\ntask, we employ five metrics to thoroughly evaluate the detection performance: image-level and pixel-level Area Under the Receiver Operating Characteristic (AUROC), denoted as I-AUC and P-AUC, respectively, the image-level\nand pixel-level max-F1 scores [18], denoted as I-F1 and PF1, and Per-Region-Overlap [3] denoted as PRO.\nImplementation Details. For anomaly generation, we deploy the pretrained SD model with T = 100 and γ = 0.25.\nFollowing [35], we apply binary thresholding to extract a\nforeground mask for each normal guidance image, which\nacts as mask guidance for generation. More implementation details are provided in the supplementary material.\n\n5.2. Anomaly Generation Results\nUnseen Anomaly Generation. In Fig. 6, we present the\ngeneration results of AnomalyAny on MVTec AD and web\n\n1.58\n1.65\n1.62\n1.03\n2.24\n2.21\n1.67\n1.67\n1.45\n1.20\n1.57\n1.19\n1.49\n2.22\n1.88\n1.64\n\n0.16\n0.41\n0.18\n0.25\n0.37\n0.31\n0.36\n0.24\n0.26\n0.31\n0.48\n0.18\n0.30\n0.41\n0.24\n0.30\n\n1.58\n2.13\n1.59\n1.16\n2.04\n2.13\n1.94\n1.96\n1.61\n1.28\n2.54\n1.68\n1.57\n2.33\n1.39\n1.80\n\n0.19\n0.41\n0.21\n0.24\n0.44\n0.31\n0.41\n0.30\n0.26\n0.30\n0.55\n0.21\n0.34\n0.37\n0.25\n0.32\n\n1.73\n2.06\n2.16\n1.10\n2.31\n2.55\n2.26\n1.82\n2.91\n1.33\n2.66\n1.64\n1.66\n1.93\n2.14\n2.02\n\n0.17\n0.41\n0.23\n0.34\n0.38\n0.32\n0.41\n0.27\n0.30\n0.32\n0.53\n0.22\n0.28\n0.41\n0.33\n0.33\n\nTable 1. Comparisons between anomaly generation quality\nand diversity with different anomaly generation methods. AnoDiff: AnomalyDiffusion.\n\n5. Experiment\n5.1. Experimental Setup\n\n0.11\n0.38\n0.17\n0.22\n0.36\n0.31\n0.26\n0.23\n0.24\n0.31\n0.37\n0.17\n0.22\n0.32\n0.22\n0.26\n\nBottle\n\nCapsule\n\nWood\n\nHazelnut\n\nTransistor\n\n(a)\n\n(b)\n\n(c)\n\n(d)\n\n(e)\n\n(f)\n\nFigure 7. Qualitative comparisons between existing anomaly\ngeneration methods. (a) Reference, (b) AnomalyDiffusion, (c)\nDREAM, (d) NSA, (e) RealNet, (f) Our AnomalyAny.\n\nimages. Compared to existing data generation methods\nlike [16, 17, 34], our AnomalyAny requires no training on\nnormal or anomalous samples. Thus, AnomalyAny is not\nconstrained by the limited available training data distribution, presenting universal anomaly generation capabilities\non unseen data and arbitrary anomaly types. This shows\n\nHazelnu\n\n\fMetrics →\n\nMVTec AD\n\nVisA\n\nMethods ↓\n\nI-AUC\n\nI-F1\n\nP-AUC\n\nP-F1\n\nPRO\n\nI-AUC\n\nI-F1\n\nP-AUC\n\nP-F1\n\nPRO\n\nPaDiM [8]\nPatchCore [28]\nWinCLIP+ [18]\nAnomalyGPT [13]\nPromptAD [20]\n\n76.6±3.1\n83.4±3.0\n93.1±2.0\n94.1±1.1\n94.6±1.7\n\n88.2±1.1\n90.5±1.5\n93.7±1.1\n-\n\n89.3±0.9\n92.0±1.0\n95.2±0.5\n95.3±0.1\n95.9±0.5\n\n40.2±2.1\n50.4±2.1\n55.9±2.7\n-\n\n73.3±2.0\n79.7±2.0\n87.1±1.2\n-\n\n62.8±5.4\n79.9±2.9\n83.8±4.0\n87.4±0.8\n86.9±2.3\n\n75.3±1.2\n81.7±1.6\n83.1±1.7\n-\n\n89.9±0.8\n95.4±0.6\n96.4±0.4\n96.2±0.1\n96.7±0.4\n\n17.4±1.7\n38.0±1.9\n41.3±2.3\n-\n\n64.3±2.4\n80.5±2.5\n85.1±2.1\n-\n\nAnomalyAny (Ours)\n\n94.9±0.4\n\n94.7±0.4\n\n95.4±0.2\n\n57.3±0.0\n\n91.9±0.0\n\n89.7±0.8\n\n85.8±0.5\n\n97.7±0.4\n\n43.2±0.4\n\n92.5±0.1\n\nTable 2. Comparison of 1-shot anomaly detection on MVTec AD and VisA. Results are reported over 5 runs. The best results are in\nbold, and the second-best results are underlined.\nMetrics →\n\nMVTec AD\n\nVisA\n\nMethods ↓\n\nI-AUC\n\nI-F1\n\nP-AUC\n\nP-F1\n\nPRO\n\nI-AUC\n\nI-F1\n\nP-AUC\n\nP-F1\n\nPRO\n\nAnomalyDiffusion [17]\nDRAEM [33]\nNSA [29]\nRealNet [35]\n\n94.4±0.3\n93.6±0.3\n94.0±0.5\n92.7±0.7\n\n94.4±0.2\n94.2±0.4\n94.2±0.3\n93.6±0.3\n\n95.3±0.5\n95.1±0.1\n95.1±0.1\n95.1±0.1\n\n57.3±3.0\n56.0±0.9\n56.1±0.5\n56.3±1.3\n\n92.2±1.0\n91.8±0.1\n91.8±0.2\n91.7±0.1\n\n86.0±0.7\n86.2±2.0\n86.0±1.4\n\n83.0±0.9\n83.1±1.2\n82.9±1.1\n\n97.5±0.1\n97.4±0.1\n97.5±0.2\n\n42.6±0.7\n40.8±0.5\n41.9±1.8\n\n92.6±0.6\n92.3±0.3\n92.8±0.3\n\nAnomalyAny (Ours)\n\n94.9±0.4\n\n94.7±0.4\n\n95.4±0.2\n\n57.3±0.0\n\n91.9±0.0\n\n89.7±0.8\n\n85.8±0.5\n\n97.7±0.4\n\n43.2±0.4\n\n92.5±0.1\n\nTable 3. Comparisons between 1-shot anomaly detection performance with different anomaly generation methods. Since AnomalyDiffusion utilizes anomalous data for training and results in data leakage, we exclude it from ranking. Results are reported over 5 runs.\nThe best results are in bold, and the second-best results are underlined.\n\nour method’s great potential in personalized anomaly generation with arbitrary normal patterns and anomalous descriptions, and may greatly contribute to the enhancement\nof anomaly detection models for a specific category even\nwithout real collected anomalous samples. Additional generation results are provided in the supplementary material.\nComparison with other anomaly generation methods.\nWe compare the generation quality of AnomalyAny on\nMVTec AD with several existing anomaly generation methods, including DRAEM [33], NSA [29], RealNet [35], and\nAnomalyDiffusion [17]. Among these methods, AnomalyDiffusion trains on 1/3 anomalous data from the test set.\nFig. 7 presents the generated anomalies of these methods.\nWe include more examples in the supplementary material.\nThe examples clearly show that DRAEM, NSA, and RealNet introduce inauthentic patterns, while AnomalyDiffusion and AnomalyAny can generate more realistic anomalous samples. Notably, AnomalyDiffusion and RealNet rely\non available anomalous training data, while AnomalyAny\ngenerates without training and generalizes to unseen object\ntypes and anomalies during inference.\nWe present quantitative evaluations of generation quality\nin Tab. 1. For NSA, RealNet, and AnomalyAny, we condition on MVTec AD training images to generate anomaly\nsamples. As DRAEM crops random textures from external datasets, we do not include it for comparison [17]. The\nresult demonstrates that our model generates anomaly data\nwith both the highest quality and diversity. Additionally, a\nuser study on anomaly generation quality is included in the\nsupplementary material, providing further evidence of the\nsuperior generation quality achieved by AnomalyAny.\n\n5.3. Anomaly Detection Results\nThe key advantage of our method lies in its capability\nto generate unseen anomalies without needing any normal\nor abnormal samples for training, making it highly effective under scenarios with data scarcity. To further demonstrate the effectiveness of our method, we evaluate it under\nthe challenging 1-shot anomaly detection scenario, where\nonly one single normal sample is accessible and no abnormal samples are available. Following the method proposed\nin [13], we condition on a single normal image to generate 100 random anomalous samples. We use the generated\nsamples with the attention map of the anomaly token cj as\nthe corresponding anomaly mask to facilitate anomaly detection training. Further details on the generation process\nand anomaly detection training are provided in the supplementary material. Tab. 2 presents the comparison results between our AnomalyAny and existing few-shot AD methods,\nincluding two full-shot methods [8, 28] in the few-shot settings, and three CLIP-based few-shot methods [13, 18, 20].\nAs can be seen, our generated anomalous samples consistently outperform other alternatives in the majority of the\nmetrics.\nTo further compare with other anomaly generation methods under the data scarcity scenarios, we follow the same\n1-shot setup and substitute the synthetic training data with\nanomalous samples generated by alternative methods. For\nDRAEM, NSA, and RealNet, we condition on the same single normal sample as for our method and generate 100 random anomalous samples for training. We report the results\nin Tab. 3. The results indicate that anomalous samples generated by AnomalyAny yield the best detection results. Ad-\n\n\f(a) Normal image\n\n(a) Normal image\n\n(c)\n\n𝑐′ = \"Top view of a bottle\nshowing a large, irregular scuff\nwith a rough, reflective surface,\nindicating significant wear. \"\n\n(d)\n\n𝑐′ = \"Top view of a bottle\nwhich has a concentrated\nchip and scuff, revealing a\nlighter, rough patch. \"\n\n(a)\n\n(c)\n\n𝑐′ = \"Close-up of a hazelnut\nwith a large, jagged crack\nexposing the interior.\"\n\n(b)\n\n(d)\n\n𝑐′ = \"Close-up of a hazelnut\nwith a long, narrow crack along\none side, showing a slight\nopening in the shell. \"\n\nBottle\n(a)\n\n(b)\n𝑐 = damaged\nHazelnut\n\n𝑐 = cracked\n\nFigure 8. Ablations on different types of prompt guidance. (a)\nNormal image, (b) Generation results given anomaly type prompt\nc and (c)(d) Generation results given c and detailed prompt c′ .\n\nditionally, we compare with AnomalyDiffusion, which has\nseen all the training samples and some of the test anomalous samples and thus introduced data leakage. Despite not\nbeing trained with test set anomalous samples, our method\nproduces comparable anomaly detection performance.\n\n5.4. Ablations\nAblation on different types of prompt guidance. We\ncompare the generation results under different types of\nguidance in our AnomalyAny. The results in Fig. 8 demonstrate that our method reflects the semantics of the anomaly\nprompts c generated by GPT-4. By providing the detailed\nprompt description c′ , we are able to get more fine-grained\nand realistic generation results with more diversity.\nAblation on attention-guided &amp; prompt-guided optimization. We evaluate the effectiveness of attention-guided\noptimization and prompt-guided optimization separately, as\nillustrated in Fig. 3 (d-f), with additional results shown\nin Fig. 9. Our results show that attention guidance successfully enforces the generation of the specified anomaly description, ensuring it is not overlooked by SD. Furthermore,\ndetailed prompt guidance enhances the realism of the generated samples. We also analyze the impact of different loss\nterms in Eq. (11) and Eq. (13) for optimizing z and τ (c)\nrespectively, as shown in Fig. 10. The attention loss term\nimproves focus on the anomaly region, while prompt-based\nterms help enhance generation quality. Notably, when the\nanomaly type is unambiguous (e.g., ”rust”), prompt guidance has a reduced impact on the generation quality. Additional visual results from the ablation study are provided in\nthe supplementary material.\n\nseeds =\n[57705,\n84693,\nOurs\nw/o prompt-guided 42537,\nw/o attention-guided\noptimization\noptimization\nOurs\nw/o prompt-guided\nw/o 9.\nattention-guided\n4921,\nFigure\nAblation on optimization\nstrategies.\nAnomaly types\noptimization\noptimization\nare ”hole” and ”melted” respectively.\n32284,\n44978,\n21273,\n51084,\n23238,\nw/o 𝐿\nw/o63186]\n𝐿\nReference\nw/o 𝐿\nOurs\nReference\n\nw/o 𝐿!\"\"\n\nw/o 𝐿#$%\n\n!\"\"\n\nw/o 𝐿&amp;'($&amp;\"\n\n#$%\n\nOurs\n\n&amp;'($&amp;\"\n\nFigure 10. Ablation on prompt-guided optimization objectives.\nAnomaly types are ”rust” and ”hole” respectively.\n\n[14891, 8911,\n12797, 32525,\n6. Conclusion\n65339,\n91205,\nIn this paper, we propose AnomalyAny,\na novel framework\nthat utilizes SD for unseen anomaly generation, allowing\n39164, 73231,\nusers to generate realistic anomalous samples from arbitrary\nnormal images of objects and anomaly text descriptions.\n76154, 5763]\nOur framework incorporates attention-guided anomaly optimization to direct SD’s attention toward anomaly concepts and prompt-guided anomaly refinement to enhance\nthe authenticity of generated samples. Compared to existing\nmethods, AnomalyAny achieves authentic unseen anomaly\ngeneration without additional training. Extensive experimental results demonstrate the effectiveness of AnomalyAny in generating high-quality anomalies that improve\nthe performance of downstream anomaly detection tasks.\nCurrently, AnomalyAny relies on normal image guidance and textual descriptions for anomaly generation.\nWhile text prompts offer flexibility, they can sometimes\nlack sufficient guidance due to CLIP’s limited understanding of lengthy and specialized descriptions as well as the\nprecision required for complex anomalies. Future work\ncould address this by incorporating additional inputs, such\nas one-shot anomalous image. This would increase AnomalyAny’s versatility, enabling more precise anomaly generation across various applications. With its demonstrated\ngeneration capabilities and ability to generalize to unseen\nanomalies, AnomalyAny has significant potential to advance foundation models for anomaly detection.\n\n\fReferences\n[1] Josh Achiam, Steven Adler, Sandhini Agarwal, Lama Ahmad, Ilge Akkaya, Florencia Leoni Aleman, Diogo Almeida,\nJanko Altenschmidt, Sam Altman, Shyamal Anadkat, et al.\nGpt-4 technical report. arXiv preprint arXiv:2303.08774,\n2023. 5\n[2] Paul Bergmann, Michael Fauser, David Sattlegger, and\nCarsten Steger. Mvtec ad–a comprehensive real-world\ndataset for unsupervised anomaly detection. In Proceedings\nof the IEEE/CVF conference on computer vision and pattern\nrecognition, pages 9592–9600, 2019. 6\n[3] Paul Bergmann, Kilian Batzner, Michael Fauser, David Sattlegger, and Carsten Steger. The MVTec anomaly detection\ndataset: A comprehensive real-world dataset for unsupervised anomaly detection. International Journal of Computer\nVision, 129(4):1038–1059, 2021. 1, 6\n[4] Yunkang Cao, Xiaohao Xu, Zhaoge Liu, and Weiming Shen.\nCollaborative discrepancy optimization for reliable image\nanomaly localization. IEEE Transactions on Industrial Informatics, pages 1–10, 2023. 2\n[5] Yunkang Cao, Xiaohao Xu, Jiangning Zhang, Yuqi Cheng,\nXiaonan Huang, Guansong Pang, and Weiming Shen. A survey on visual anomaly detection: Challenge, approach, and\nprospect. arXiv preprint arXiv:2401.16402, 2024. 1\n[6] Hila Chefer, Yuval Alaluf, Yael Vinker, Lior Wolf, and\nDaniel Cohen-Or. Attend-and-excite: Attention-based semantic guidance for text-to-image diffusion models. ACM\nTransactions on Graphics (TOG), 42(4):1–10, 2023. 4, 1\n[7] Mircea Cimpoi, Subhransu Maji, Iasonas Kokkinos, Sammy\nMohamed, and Andrea Vedaldi. Describing textures in the\nwild. In Proceedings of the IEEE conference on computer\nvision and pattern recognition, pages 3606–3613, 2014. 2\n[8] Thomas Defard, Aleksandr Setkov, Angelique Loesch, and\nRomaric Audigier. Padim: a patch distribution modeling\nframework for anomaly detection and localization. In International Conference on Pattern Recognition, pages 475–489.\nSpringer, 2021. 7\n[9] Hanqiu Deng and Xingyu Li. Anomaly detection via reverse\ndistillation from one-class embedding. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages\n9737–9746, 2022. 2\n[10] Hao Dong, Gaëtan Frusque, Yue Zhao, Eleni Chatzi,\nand Olga Fink. NNG-Mix: Improving Semi-supervised\nAnomaly Detection with Pseudo-anomaly Generation. arXiv\npreprint arXiv:2311.11961, 2023. 2\n[11] Yuxuan Duan, Yan Hong, Li Niu, and Liqing Zhang. Fewshot defect image generation via defect-aware feature manipulation. In Proceedings of the AAAI Conference on Artificial\nIntelligence, pages 571–578, 2023. 2\n[12] Zheng Fang, Xiaoyang Wang, Haocheng Li, Jiejie Liu, Qiugui Hu, and Jimin Xiao. Fastrecon: Few-shot industrial anomaly detection via fast feature reconstruction. In\nProceedings of the IEEE/CVF International Conference on\nComputer Vision, pages 17481–17490, 2023. 1\n[13] Zhaopeng Gu, Bingke Zhu, Guibo Zhu, Yingying Chen,\nMing Tang, and Jinqiao Wang. Anomalygpt: Detecting industrial anomalies using large vision-language models. In\n\nProceedings of the AAAI Conference on Artificial Intelligence, pages 1932–1940, 2024. 2, 7, 1\n[14] Guan Gui, Bin-Bin Gao, Jun Liu, Chengjie Wang, and Yunsheng Wu. Few-shot anomaly-driven generation for anomaly\nclassification and segmentation. In European Conference on\nComputer Vision (ECCV 2024), pages –, 2024. 2\n[15] Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Advances in neural information\nprocessing systems, 33:6840–6851, 2020. 3\n[16] Jie Hu, Yawen Huang, Yilin Lu, Guoyang Xie, Guannan Jiang, and Yefeng Zheng. Anomalyxfusion: Multimodal anomaly synthesis with diffusion. arXiv preprint\narXiv:2404.19444, 2024. 6\n[17] Teng Hu, Jiangning Zhang, Ran Yi, Yuzhen Du, Xu Chen,\nLiang Liu, Yabiao Wang, and Chengjie Wang. Anomalydiffusion: Few-shot anomaly image generation with diffusion\nmodel. In Proceedings of the AAAI Conference on Artificial\nIntelligence, pages 8526–8534, 2024. 1, 2, 6, 7\n[18] Jongheon Jeong, Yang Zou, Taewan Kim, Dongqing Zhang,\nAvinash Ravichandran, and Onkar Dabeer. Winclip: Zero/few-shot anomaly classification and segmentation. In\nIEEE/CVF Conference on Computer Vision and Pattern\nRecognition (CVPR), pages 19606–19616, 2023. 1, 2, 6, 7\n[19] Chun-Liang Li, Kihyuk Sohn, Jinsung Yoon, and Tomas\nPfister. Cutpaste: Self-supervised learning for anomaly detection and localization. In Proceedings of the IEEE/CVF\nconference on computer vision and pattern recognition,\npages 9664–9674, 2021. 2\n[20] Xiaofan Li, Zhizhong Zhang, Xin Tan, Chengwei Chen,\nYanyun Qu, Yuan Xie, and Lizhuang Ma. Promptad: Learning prompts with only normal samples for few-shot anomaly\ndetection. In Proceedings of the IEEE/CVF International\nConference on Computer Vision, 2024. 2, 7\n[21] Dongyun Lin, Yanpeng Cao, Wenbin Zhu, and Yiqun Li.\nFew-shot defect segmentation leveraging abundant defectfree training samples through normal background regularization and crop-and-paste operation. In 2021 IEEE International Conference on Multimedia and Expo (ICME), pages\n1–6. IEEE, 2021. 2\n[22] Ruiying Lu, YuJie Wu, Long Tian, Dongsheng Wang, Bo\nChen, Xiyang Liu, and Ruimin Hu. Hierarchical vector\nquantized transformer for multi-class unsupervised anomaly\ndetection. In Advances in Neural Information Processing\nSystems, pages 8487–8500, 2023. 1, 2\n[23] Utkarsh Ojha, Yijun Li, Jingwan Lu, Alexei A Efros,\nYong Jae Lee, Eli Shechtman, and Richard Zhang. Few-shot\nimage generation via cross-domain correspondence. In Proceedings of the IEEE/CVF conference on computer vision\nand pattern recognition, pages 10743–10752, 2021. 6\n[24] OpenAI, Josh Achiam, Steven Adler, et al. Gpt-4 technical\nreport. arXiv preprint arXiv:2303.08774, 2024. 1\n[25] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya\nRamesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry,\nAmanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In International Conference on Machine Learning,\npages 8748–8763, 2021. 2, 1\n\n\f[26] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya\nRamesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry,\nAmanda Askell, Pamela Mishkin, Jack Clark, et al. Learning\ntransferable visual models from natural language supervision. In International conference on machine learning, pages\n8748–8763. PMLR, 2021. 3, 5\n[27] Robin Rombach, Andreas Blattmann, Dominik Lorenz,\nPatrick Esser, and Björn Ommer. High-resolution image\nsynthesis with latent diffusion models. In Proceedings of\nthe IEEE/CVF conference on computer vision and pattern\nrecognition, pages 10684–10695, 2022. 1, 3\n[28] Karsten Roth, Latha Pemula, Joaquin Zepeda, Bernhard\nSchölkopf, Thomas Brox, and Peter Gehler. Towards total\nrecall in industrial anomaly detection. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages\n14318–14328, 2022. 2, 7\n[29] Hannah M Schlüter, Jeremy Tan, Benjamin Hou, and Bernhard Kainz. Natural synthetic anomalies for self-supervised\nanomaly detection and localization. In European Conference\non Computer Vision, pages 474–489. Springer, 2022. 2, 6, 7\n[30] Jake Snell, Kevin Swersky, and Richard Zemel. Prototypical\nnetworks for few-shot learning. Advances in neural information processing systems, 30, 2017. 2\n[31] Shuai Yang, Zhifei Chen, Pengguang Chen, Xi Fang, Yixun\nLiang, Shu Liu, and Yingcong Chen. Defect spectrum: A\ngranular look of large-scale defect datasets with rich semantics. In European Conference on Computer Vision, pages\n187–203. Springer, 2025. 2\n[32] Zhiyuan You, Lei Cui, Yujun Shen, Kai Yang, Xin Lu,\nYu Zheng, and Xinyi Le. A unified model for multi-class\nanomaly detection. In Advances in Neural Information Processing Systems, pages 4571–4584, 2022. 1, 2\n[33] Vitjan Zavrtanik, Matej Kristan, and Danijel Skočaj. Draema discriminatively trained reconstruction embedding for surface anomaly detection. In Proceedings of the IEEE/CVF\nInternational Conference on Computer Vision, pages 8330–\n8339, 2021. 1, 2, 7\n[34] Gongjie Zhang, Kaiwen Cui, Tzu-Yi Hung, and Shijian Lu.\nDefect-gan: High-fidelity defect synthesis for automated\ndefect inspection. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, pages\n2524–2534, 2021. 2, 6\n[35] Ximiao Zhang, Min Xu, and Xiuzhuang Zhou. Realnet: A\nfeature selection network with realistic synthetic anomaly for\nanomaly detection. In IEEE/CVF Conference on Computer\nVision and Pattern Recognition (CVPR), 2024. 1, 2, 6, 7\n[36] Yang Zou, Jongheon Jeong, Latha Pemula, Dongqing Zhang,\nand Onkar Dabeer. Spot-the-difference self-supervised pretraining for anomaly detection and segmentation. In European Conference on Computer Vision, pages 392–408.\nSpringer, 2022. 6\n\n\fUnseen Visual Anomaly Generation\nSupplementary Material\nOverview\nThe supplementary material presents the following sections\nto strengthen the main manuscript:\n\nsimilarity can then be obtained as follows:\nSV L = softmax(Fimage · FTtext ),\n\n(14)\n!\n\nMV L = Upsample\n\nX\n\nsoftmax(F̂ipatch · FTtext ) ,\n\ni∈H\n\n— Sec. A shows more implementation details.\n— Sec. B presents a user study on anomaly generation\nquality.\n— Sec. C presents more anomaly generation results.\n— Sec. D presents results on mask controllability.\n— Sec. E shows ablations on hyperparameters.\n— Sec. F shows more ablations on attention-guided\nand prompt-guided optimization.\n— Sec. G shows more anomaly detection results.\n\nA. More Implementation Details\nStable Diffusion For our proposed AnomalyAny, we set the\ninference steps to 100 and γ = 0.25 with stable-diffusionv1-5. For optimization, we set λ = 10 and ∆t to 1.0/T .\nAs implemented in [6], the maximum value threshold to\nstop the iterative optimization at one time step t is set to\n0.05, 0.5, 0.8, increasing with the denoising diffusion process. All experiments are run on a single NVIDIA A100SXM4-80GB GPU.\nAnomaly detection framework We adapt the anomaly detection framework proposed in AnomalyGPT [13], which\ndeploys CLIP [25] to compute the vision-language and\nvision-vision similarities and aggregate these similarities\nfor anomaly detection. The similarity between visual tokens and text embeddings for normal/anomalous states can\nindicate the abnormal level of visual tokens [18]. Specifically, for a given image, we first extract its patch tokens\nFipatch ∈ RHi ×Wi ×Ci and image token Fimage ∈ R1×C\nusing the CLIP visual encoder, where i indicates the tokens\nthat are extracted from the i-th stage of the image encoder.\nThen, text embeddings Ftext ∈ R2×C representing normal/abnormal states are extracted via the CLIP text encoder.\nSince the extracted patch tokens have not undergone the final image-text alignment and cannot be directly compared\nwith text features, we use a lightweight feature adapter comprising only a linear layer to project patch tokens for both\nfine-tuning and dimension alignment between visual and\ntext embeddings, producing F̂ipatch ∈ RHi ×Wi ×C . The\ndetection and localization results based on vision-language\n\n(15)\nwhere H is the list of selected stages, and SV L and MV L\ndenote the image- and pixel-level anomaly scores, respectively. When some normal samples are available, we utilize\nthe same visual encoder and feature adapter to extract multihierarchy normal patch tokens and store them in memory\nbanks Bi ∈ RNi ×C . Then, for the testing patch tokens, we\ncompute the distance between each token and its most similar counterpart in the memory bank, and the localization\nresult MV V based on vision-vision similarities is yielded as\nfollows:\n!\nX\nMV V = Upsample\n(1 − max(F̂ipatch · (Bi )T ))\ni∈H\n\n(16)\nThe maximum value of MV V is taken as the imagelevel anomaly scores SV V . The predictions from visionlanguage and vision-vision similarities are summed up as\nfinal predictions. We train the anomaly detection model on\nthe available normal sample and the synthetic samples for\n200 epochs with batch size 16. We use Adam optimizer\nwith a learning rate of 1e4 and the CosineAnnealingLR\nscheduler.\n\nB. User Study on Anomaly Generation Quality\nTo better assess the quality of our generated anomalous\nsamples, we conducted a user study with 20 participants.\nThe participants were shown exemplar normal samples of\nthe five tested categories and asked to choose the most realistic anomalous images. We provided the participants\nwith two groups of samples, as shown in Figure 11. In\ngroup 1, we randomly sampled three images each from\n100 anomalous samples generated by Cut&amp;Paste, DRAEM,\nNSA, AnomalyDiffusion, and our proposed AnomalyAny.\nParticipants were asked to choose the three most realistic images for each category. For this group, we get\na total vote of 300: 20(participants) · 5(categories) ·\n3(selected samples per category). In group 2, we randomly sampled two images each from real anomalies in the\ntest set and from the 100 images generated by our method.\nParticipants were then asked to choose the two most realistic images for each category. For this group, we get\n\n\f(a) Normal References\n\n(b) Group 1\n\n(c) Group 2\n\nFigure 11. Samples for user study. (a) Normal references. (b) Group1: Samples of each column from left to right are generated by:\nCut&amp;Paste; DRAEM; NSA; AnomalyDiffusion; the proposed AnomalyAny; (c) Group2: Samples of each column from left to right are\nreal anomalous data samples from the dataset and anomalous images generated by our method AnomalyAny.\n\n\fa total vote of 200: 20(participants) · 5(categories) ·\n2(selected samples per category). The survey results are\nreported in Table 4 where we show the total votes from the\n20 participants for each group. It is evident that our method\nsurpasses other anomaly generation methods in terms of\nauthenticity, even compared to AnomalyDiffusion, which\nleverages real test samples for training. Additionally, when\nmixed with real normal samples, our generated anomalous\nimages are realistic enough to be misclassified.\nGroup 1\n\nReference\n\nAnomaly\nDiffusion\n\nDRAEM\n\nNSA\n\nRealNet\n\nOurs\n\nCarpet\n\nGrid\n\nHazelnut\n\nGroup 2\n\nCut&amp;Paste\n\nDRAEM\n\nNSA\n\nAnomalyDiffusion\n\nOurs\n\nReal\n\nOurs\n\n6\n\n33\n\n61\n\n64\n\n136\n\n99\n\n101\n\nTable 4. Results of user study for anomaly generation quality\nassessment across two groups.\n\nC. More Anomaly Generation Results\nMore comparisons of anomaly generation results between other anomaly generation methods and AnomalyAny\nare provided in Figure 12. Additionally, to show the generalization ability and controllability of AnomalyAny, Figure\n13 show more generation results with different object types\nand anomaly types with descriptions provided in Table 5.\n\nD. Ablations on Mask Control\nIn Figure 14, we show results using manually labeled regional masks for more precise anomaly locations, demonstrating our finer controllability over anomaly regions when\nneeded.\n\nE. Ablations on Hyperparameters\nIn Figure 15, we present the visual results ablations on the\nhyperparameters λ and ∆t in Equation (9). It shows that\na large λ value causes artifacts due to overly fast updates,\nwhile a small λ value results in insufficient optimization. A\nlarge ∆t introduces artifacts from fast updates early in the\nprocess, while a small ∆t leads to artifacts from inadequate\ndetail refinement in the final steps.\n\nF. More Ablations on attention-guided &amp;\nprompt-guided optimization\nIn Figure 16, we provide more results from ablations\non different optimization strategies, as shown in (b)(c)(d),\nand on prompt-guided optimization objectives, as shown in\n(d)(e)(f)(g). The results from ablations on different optimization strategies further validate that our attention guidance module effectively enforces the generation of specified\n\nPill\n\nCandle\n\nCashew\n\nChewinggum\n\nFigure 12. Qualitative comparisons between existing anomaly\ngeneration methods. Since AnomalyDiffusion does not provide\nresults on VisA, its corresponding generation results are replaced\nby a blank.\n\nanomalies, while the detailed prompt guidance module enhances semantic richness and improves generation quality.\nFor the prompt-guided optimization objectives, the best\noverall results are achieved with our proposed method,\nwhich incorporates all optimization objectives. We observe\nthat in some cases (as shown in the first two rows for capsule and leather examples), the image and prompt optimization objectives significantly improve generation results for\nchallenging concepts. In other cases, the difference is less\npronounced. Across all scenarios, Limg consistently helps\ngenerate more salient anomaly patterns in the image with\nmore concentrated anomaly attention maps. Meanwhile,\nin cases where the anomaly description is less ambiguous\n(e.g., ”rust” or ”hole”), the impact of Lprompt on optimization is relatively minor.\n\nG. More Anomaly Detection Results\nIn this section, we present additional results in Table 6 for\n2-shot and 4-shot anomaly detection. Specifically, we condition on 2 and 4 normal images, generating 200 and 400\nsynthetic anomalous images respectively for training. Additionally, we provide per-category few-shot anomaly de-\n\n\fGPT-Generated Detailed Descriptions\n\nScrew\n\nDamaged\nScratched\nBroken on the top\nBent\nRust\n\nThe head of the screw is damaged or worn-out.\nA screw with several deep, thin scratches.\nThe screw is partially broken on the tip.\nThe screw is bent along its shaft, making it difficult to use.\nThe screw is covered in rust, weakening its structure and making it difficult to use.\n\nLeather\n\nDamaged\nScratched\nCut\nStained\nWet\n\nLeather that has dried out or aged can develop damaged cracks.\nLeather that has been scratched with deep, gouging lines.\nThe leather has a visible cut, creating a split in its surface.\nLeather that is discolorations caused by spills (oil, ink, or dyes).\nLeather that appears darker, unevenly discolored, and may develop a tacky texture or water spots as it dries.\n\nBowl\n\nBroken\nDirty\nColored\nCracked\nStained\n\nA broken bowl that has visible cracks with jagged or uneven edges.\nA dirty bowl that has visible stains on its surface.\nThe bowl has uneven patches of color, giving it a stained or discolored appearance.\nThe bowl has a visible crack running through its surface, compromising its strength and usability.\nThe bowl has visible stains, with patches of discoloration or residue marring its surface.\n\nVase\n\nBroken\nCracked\nColored\nHole\nDeformed\n\nThe vase has fragments missing, making it unusable.\nThe vase has a visible crack running along its surface, threatening its structural integrity.\nThe vase has patches of uneven hues that alter its original appearance.\nThe vase has a hole piercing its surface, preventing it from holding liquids properly.\nThe vase is misshapen, with uneven curves.\n\nPhone Screen\n\nScratched\nBroken\nCracked\nColored\nFingerprint\n\nThe phone screen has visible scratches, with fine lines marring its smooth surface.\nThe phone screen is shattered, with pieces of glass splintered or missing.\nThe phone screen has a crack running across it\nThe phone screen displays abnormal patches of 𝜆color,\nsuch as1rainbow10streaks.20\n= 0.1\nThe phone screen has a smudged fingerprint, leaving an oily mark on its surface.\n1/50\n1/100\n1/200\n∆𝑡 =generation\nTable 5. Corresponding descriptions for anomaly\nin Figure\n13 1/500\n\n30\n\n50\n\n100\n\n1/1000\n\n1/2000\n\n1/5000\n\nw/\n\n[Anomaly State]\n\nw/o\n\n[CLS]\n\nScrew\n\nReference\n\nDamaged\n\nScratched\n\nBroken on the tip\n\nBent\n\nRust\n\nDamaged\n\nScratched\n\nCut\n\nStained\n\nWet\n\nLeather\n\nMask\nBowl\n\nReference\n\nInput Normal Image\n\nGenerated Anomaly\n\nBroken\n\nDirty\n\nColored\n\nCracked\n\n𝜆 = 0.1\n\n1\n\n10\n\n20\n\n30\n\n50\n\n100\n\n∆𝑡 = 1/50\n\n1/100\n\n1/200\n\n1/500\n\n1/1000\n\n1/2000\n\n1/5000\n\nStained\n\nVase\n\nReference\n\nBroken\n\nCracked\n\nColored\n\nw/\n\nFigure 14. Ablation on mask control.\n\nHole\n\nw/o\n\nReference\n\nDeformed\n\nFigure 15. Ablation on hyperparameters.\n\nPhone screen\n\nInput\n\nin Figure 17. Full-shot detection results are listed in Table 7 with per-category results in Table 14 and Table 15.\nSpecifically, we condition on all normal images, generating\nFigure 13. Anomaly generation results for arbitrary objects and\nInput\nNormal\nImageedges” Generated Anomaly\n\"A broken bowl that hasMask\nvisible cracks\nwith jagged\nor uneven\nanomaly\ndescriptions.\n3-5 anomalous\nimages\nwith\neach normal image for training.\na dirty bowl that has visible stains on its surface,\n“The head of the screw is damaged or worn-out”\n\" \"The bowlWe\nhas uneven\npatchest-test\nof color,results\ngiving it a stained\nor discolored anomaly\nappearance.\" detection in\n“a screw with several deep, thin scratches”\nprovide\nof few-shot\n\"The bowl has a visible crack running through its surface, compromising its strength and\n\"The screw is partially broken on the tip”\nusability.” Table 16 for statistical completeness.\n\"The screw is bent along its shaft, making it difficult to use.”\nReference\n\nScratched\n\nBroken\n\nCracked\n\nColored\n\nFingerprint\n\n\"The screw is covered in rust, weakening its structure and making it difficult to use.\"\n\n\"The bowl has visible stains, with patches of discoloration or residue marring its surface.\"\n\nBroken\ntection results on MVTec and VisA in Table 8 to Table 13.•Vase:\n•Vase: Cracked\n\"Leather that\nhas dried of\nout or\naged can develop\ndamaged cracks.”\nVisual\nresults\nfew-shot\nanomaly\ndetection\nare\nprovided\nstructural integrity.\"\n“\"Leather that has been scratched with deep, gouging lines.”\n\"The leather has a visible cut, creating a split in its surface.\"\n\" Leather that is discolorations caused by spills (oil, ink, or\ndyes)”\n“ Leather that appears darker, unevenly discolored, and may\ndevelop a tacky texture or water spots as it dries.”\n\n•Vase: Colored\n•Vase: Hole - \"The vase has a hole piercing its surface, preventing it from holding liquids\nproperly.\"\n•Vase: Deformed\n\n•Phone Screen: Scratched - \"The phone screen has visible scratches, with fine lines\nmarring its smooth surface.\"\n•Phone Screen: Broken - \"The phone screen is shattered, with pieces of glass splintered or\nmissing.\"\n•Phone Screen: Cracked - \"The phone screen has a crack running across it\n\n\f𝑐 = “broken”\n\n𝑐′ = “A capsule that is broken with a large poked area,\nexposing the white matter inside”\n\n𝑐 = “damaged”\n\n𝑐′ = \"Leather that has dried out or aged can develop damaged\ncracks.\"\n\n𝑐 = “hole”\n\n𝑐′ = “A grid that has a small hole with rough edges”\n\n𝑐 = “scratched”\n\n𝑐′ = “A wood surface with wide, deep scratches that cut into the\nwood grain”\n\n𝑐 = “rust”\n\n𝑐′ = “A screw that has reddish-brown or dark orange patches,\ngiving it a rough, uneven texture, with areas that appear flaky\nor crusty.”\n\n(a) Reference\n\n(b) w/o\nattention-guided\noptimization\n\n(c) w/o\nprompt-guided\noptimization\n\n(d) Ours\n\n(e) w/o 𝐿$%%\n\nFigure 16. Ablation on optimization strategies and objectives.\n\n(f) w/o 𝐿!\"#\n\n(g) w/o 𝐿&amp;'(\"&amp;%\n\n\fFigure 17. Anomaly detection results in the 4-shot setup. For each pair, the original image, ground truth, and detection results are listed\nfrom the top to the bottom.\n\n\fSetup\n\nMVTec AD\n\nMethods\n\nVisA\n\nI-AUC\n\nI-F1\n\nP-AUC\n\nP-F1\n\nPRO\n\nI-AUC\n\nI-F1\n\nP-AUC\n\nP-F1\n\nPRO\n\n1-shot\n\nPaDiM\nPatchCore\nWinCLIP+\nAnomalyGPT\nPromptAD\nOurs\n\n76.6±3.1\n83.4±3.0\n93.1±2.0\n94.1±1.1\n94.6±1.7\n94.9±0.4\n\n88.2±1.1\n90.5±1.5\n93.7±1.1\n94.7±0.4\n\n89.3±0.9\n92.0±1.0\n95.2±0.5\n95.3±0.1\n95.9±0.5\n95.4±0.2\n\n40.2±2.1\n50.4±2.1\n55.9±2.7\n57.3±0.0\n\n73.3±2.0\n79.7±2.0\n87.1±1.2\n91.9±0.0\n\n62.8±5.4\n79.9±2.9\n83.8±4.0\n87.4±0.8\n86.9±2.3\n89.7±0.8\n\n75.3±1.2\n81.7±1.6\n83.1±1.7\n85.8±0.5\n\n89.9±0.8\n95.4±0.6\n96.4±0.4\n96.2±0.1\n96.7±0.4\n97.7±0.4\n\n17.4±1.7\n38.0±1.9\n41.3±2.3\n43.2±0.4\n\n64.3±2.4\n80.5±2.5\n85.1±2.1\n92.5±0.1\n\n2-shot\n\nPaDiM\nPatchCore\nWinCLIP+\nAnomalyGPT\nPromptAD\nOurs\n\n78.9±3.1\n86.3±3.3\n94.4±1.3\n95.5±0.8\n95.7±1.5\n95.8±0.2\n\n89.2±1.1\n92.0±1.5\n94.4±0.8\n95.2±0.2\n\n91.3±0.7\n93.3±0.6\n96.0±0.3\n95.6±0.2\n96.2±0.3\n96.0±0.2\n\n43.7±1.5\n53.0±1.7\n58.4±1.7\n58.8±0.2\n\n78.2±1.8\n82.3±1.3\n88.4±0.9\n92.6±0.1\n\n67.4±5.1\n81.6±4.0\n84.6±2.4\n88.6±0.7\n88.3±2.0\n91.3±0.4\n\n75.7±1.8\n82.5±1.8\n83.0±1.4\n87.2±0.6\n\n92.0±0.7\n96.1±0.5\n96.8±0.3\n96.4±0.1\n97.1±0.3\n97.9±0.4\n\n21.1±2.4\n41.0±3.9\n43.5±3.3\n44.9±0.3\n\n70.1±2.6\n82.6±2.3\n86.2±1.4\n92.7±0.1\n\n4-shot\n\nPaDiM\nPatchCore\nWinCLIP+\nAnomalyGPT\nPromptAD\nOurs\n\n80.4±2.5\n88.8±2.6\n95.2±1.3\n96.3±0.3\n96.6±0.9\n96.4±0.1\n\n90.2±1.2\n92.6±1.6\n94.7±0.8\n95.1±0.1\n\n92.6±0.7\n94.3±0.5\n96.2±0.3\n96.2±0.1\n96.5±0.2\n96.2±0.1\n\n46.1±1.8\n55.0±1.9\n59.5±1.8\n59.8±0.1\n\n81.3±1.9\n84.3±1.4\n89.0±0.8\n93.0±0.0\n\n72.8±2.9\n85.3±2.1\n87.3±1.8\n90.6±0.7\n89.1±1.7\n91.7±1.0\n\n78.0±1.2\n84.3±1.3\n84.2±1.6\n87.1±0.1\n\n93.2±0.5\n96.8±0.3\n97.2±0.2\n96.7±0.1\n97.4±0.4\n97.8±0.4\n\n24.6±1.8\n43.9±3.1\n47.0±3.0\n47.9±0.2\n\n72.6±1.9\n84.9±1.4\n87.6±0.9\n93.4±0.1\n\nTable 6. Comparison of few-shot anomaly detection on MVTec AD and VisA. Results are reported over 5 runs. The best results are in\nbold, and the second-best results are underlined.\n\nMVTec AD\n\nMethods\nUniAD\nSimpleNet\nDiAD\nAnomalyGPT\nOurs\n\nVisA\n\nI-AUC\n\nI-F1\n\nP-AUC\n\nP-F1\n\nPRO\n\nI-AUC\n\nI-F1\n\nP-AUC\n\nP-F1\n\nPRO\n\n96.5\n95.3\n97.2\n97.4\n98.4\n\n98.8\n98.4\n99.0\n96.9\n\n96.8\n96.9\n96.8\n93.1\n97.4\n\n43.4\n45.9\n52.6\n65.1\n\n90.7\n86.5\n90.7\n94.7\n\n88.8\n87.2\n86.8\n95.8\n\n90.8\n87.0\n88.3\n91.9\n\n98.3\n96.8\n96.0\n98.7\n\n33.7\n34.7\n26.1\n58.7\n\n85.5\n81.4\n75.2\n97.7\n\nTable 7. Comparison of full-shot anomaly detection on MVTec AD and VisA. The best results are in bold, and the second-best results\nare underlined.\n\n\fCategory\nbottle\ncable\ncapsule\ncarpet\ngrid\nhazelnut\nleather\nmetal nut\npill\nscrew\ntile\ntoothbrush\ntransistor\nwood\nzipper\nAverage\n\nI-AUC\n98.9±0.1\n89.1±7.6\n93.8±1.6\n100.0±0.0\n97.3±1.3\n99.9±0.0\n100.0±0.0\n95.6±9.3\n93.7±0.4\n74.9±3.1\n99.6±0.0\n94.1±2.7\n91.4±2.1\n99.6±0.0\n96.4±0.8\n94.9±0.4\n\nI-F1\n97.9±0.5\n87.8±4.5\n94.4±0.5\n100.0±0.0\n96.1±2.2\n99.3±0.2\n100.0±0.0\n95.3±4.3\n96.0±0.1\n87.2±1.3\n98.8±0.2\n93.1±5.6\n80.7±4.4\n98.5±0.1\n96.1±0.4\n94.7±0.4\n\nP-AUC\n96.3±0.0\n91.7±0.0\n97.3±0.0\n99.0±0.0\n97.2±0.0\n98.4±0.0\n99.7±0.0\n91.6±0.1\n94.3±0.0\n97.8±0.0\n95.6±0.0\n98.5±0.0\n79.6±0.0\n96.6±0.0\n97.4±0.0\n95.4±0.2\n\nP-F1\n71.0±0.2\n36.4±2.2\n44.8±0.0\n75.1±0.1\n49.8±0.1\n63.5±0.1\n62.2±0.2\n58.8±0.5\n56.6±0.2\n42.5±0.3\n73.2±0.0\n56.6±1.3\n37.1±0.2\n70.0±0.0\n61.4±0.4\n57.3±0.0\n\nPRO\n92.7±0.0\n82.8±0.2\n96.2±0.0\n97.5±0.0\n92.0±0.1\n97.3±0.0\n99.5±0.0\n90.7±0.0\n97.0±0.0\n92.3±0.0\n93.3±0.0\n94.7±0.0\n64.0±0.2\n96.8±0.0\n91.4±0.0\n91.9±0.0\n\nTable 8. Per-category anomaly detection performance on\nMVTec AD in the 1-shot setup. We report the mean and standard deviation over 5 random seeds for each measurement.\nCategory\nbottle\ncable\ncapsule\ncarpet\ngrid\nhazelnut\nleather\nmetal nut\npill\nscrew\ntile\ntoothbrush\ntransistor\nwood\nzipper\nAverage\n\nI-AUC\n99.5±0.1\n89.3±1.4\n95.1±1.1\n100.0±0.0\n95.4±1.2\n99.8±0.0\n100.0±0.0\n99.8±0.0\n96.4±0.8\n78.8±3.2\n100.0±0.0\n93.4±0.9\n88.9±2.0\n99.4±0.0\n99.4±0.0\n95.8±0.1\n\nI-F1\n98.6±0.1\n86.5±2.0\n94.6±0.9\n100.0±0.0\n93.5±1.9\n98.9±0.1\n100.0±0.0\n99.1±0.4\n96.8±0.3\n88.4±0.1\n99.9±0.1\n93.1±0.1\n82.5±4.1\n97.7±0.1\n98.3±0.4\n95.2±0.2\n\nP-AUC\n93.2±0.1\n94.9±0.0\n96.6±0.2\n99.3±0.0\n98.2±0.0\n98.0±0.0\n99.7±0.0\n94.6±0.1\n94.8±0.0\n98.2±0.0\n97.1±0.0\n98.7±0.0\n85.1±0.2\n96.9±0.0\n97.7±0.0\n96.0±0.2\n\nP-F1\n62.3±1.8\n41.1±0.8\n44.9±0.0\n76.5±0.1\n52.2±0.2\n57.4±0.3\n66.1±0.3\n66.7±0.5\n59.0±0.3\n46.6±0.2\n74.5±0.0\n59.5±1.0\n41.2±0.0\n70.9±0.1\n63.6±1.5\n58.8±0.2\n\nPRO\n88.7±0.4\n86.0±0.3\n96.1±0.1\n98.1±0.0\n93.9±0.0\n96.9±0.0\n99.5±0.0\n93.2±0.1\n96.9±0.0\n93.5±0.0\n94.8±0.0\n94.3±0.0\n67.6±0.7\n97.0±0.0\n92.8±0.4\n92.6±0.1\n\nTable 9. Per-category anomaly detection performance on\nMVTec AD in the 2-shot setup. We report the mean and standard deviation over 5 random seeds for each measurement.\n\nCategory\n\nI-AUC\n\nI-F1\n\nP-AUC\n\nP-F1\n\nPRO\n\nbottle\ncable\ncapsule\ncarpet\ngrid\nhazelnut\nleather\nmetal nut\npill\nscrew\ntile\ntoothbrush\ntransistor\nwood\nzipper\n\n99.2±0.0\n90.6±0.8\n96.4±0.4\n100.0±0.0\n98.4±0.8\n98.9±0.2\n100.0±0.0\n99.3±0.3\n97.3±0.1\n85.5±0.1\n99.8±0.0\n94.3±1.3\n87.5±1.9\n99.5±0.0\n98.8±0.1\n\n98.0±0.5\n87.1±3.1\n95.8±0.2\n100.0±0.0\n96.9±2.6\n97.6±0.4\n100.0±0.0\n98.4±0.4\n97.4±0.1\n88.6±0.1\n98.7±0.1\n94.1±0.8\n75.9±4.1\n97.9±0.2\n98.5±0.2\n\n96.9±0.0\n93.7±0.0\n98.1±0.0\n99.2±0.0\n98.1±0.0\n98.6±0.0\n99.7±0.0\n93.2±0.0\n94.9±0.0\n98.3±0.0\n95.9±0.0\n98.6±0.0\n82.8±0.0\n96.5±0.0\n97.9±0.0\n\n73.0±0.1\n43.4±0.9\n46.9±0.1\n75.7±0.0\n52.4±0.0\n63.1±0.3\n63.2±0.2\n64.7±0.1\n59.4±0.1\n49.0±0.3\n73.3±0.0\n60.2±0.9\n39.5±0.2\n69.6±0.0\n64.5±0.1\n\n93.7±0.0\n86.6±0.1\n97.3±0.0\n97.8±0.0\n93.6±0.0\n97.3±0.0\n99.4±0.0\n92.8±0.0\n97.3±0.0\n93.6±0.0\n93.6±0.0\n94.2±0.1\n67.4±0.1\n96.7±0.0\n93.2±0.0\n\nAverage\n\n96.4±0.1\n\n95.1±0.1\n\n96.2±0.1\n\n59.8±0.1\n\n93.0±0.0\n\nTable 10. Per-category anomaly detection performance on\nMVTec AD in the 4-shot setup. We report the mean and standard deviation over 5 random seeds for each measurement.\n\nCategory\n\nI-AUC\n\nI-F1\n\nP-AUC\n\nP-F1\n\nPRO\n\ncandle\ncapsules\ncashew\nchewinggum\nfryum\nmacaroni1\nmacaroni2\npcb1\npcb2\npcb3\npcb4\npipe fryum\n\n90.8±0.3\n91.1±2.6\n88.9±16.6\n97.4±0.1\n96.2±0.9\n86.6±5.2\n79.2±2.1\n90.8±2.0\n84.3±4.1\n78.0±5.2\n96.8±1.0\n96.4±0.6\n\n85.3±0.7\n88.5±0.4\n88.9±5.1\n95.2±0.3\n94.7±0.8\n79.6±5.9\n73.0±1.2\n86.1±1.5\n78.1±4.7\n74.3±1.7\n92.4±3.7\n93.1±2.3\n\n98.9±0.0\n98.2±0.0\n96.6±0.1\n99.6±0.0\n95.4±0.0\n99.7±0.0\n98.4±0.0\n98.5±0.0\n96.2±0.0\n94.9±0.0\n96.9±0.0\n98.5±0.0\n\n37.6±0.1\n47.9±2.0\n59.3±0.9\n77.1±0.2\n40.8±0.1\n30.1±0.8\n28.3±1.0\n49.5±4.6\n30.8±0.4\n32.7±11.4\n36.1±0.3\n47.7±0.1\n\n98.0±0.0\n94.2±0.1\n95.6±0.0\n92.6±0.1\n92.2±0.0\n96.2±0.1\n90.5±0.7\n93.6±0.0\n83.7±0.0\n86.0±0.0\n90.2±0.3\n97.6±0.0\n\nAverage\n\n89.7±0.8\n\n85.8±0.5\n\n97.7±0.4\n\n43.2±0.4\n\n92.5±0.1\n\nTable 11. Per-category anomaly detection performance on\nVisA in the 1-shot setup. We report the mean and standard deviation over 5 random seeds for each measurement.\n\nCategory\n\nI-AUC\n\nI-F1\n\nP-AUC\n\nP-F1\n\nPRO\n\ncandle\ncapsules\ncashew\nchewinggum\nfryum\nmacaroni1\nmacaroni2\npcb1\npcb2\npcb3\npcb4\npipe fryum\n\n90.5±0.5\n94.5±1.1\n90.7±0.7\n97.6±0.2\n97.0±0.1\n89.6±0.1\n77.4±19.9\n92.0±0.5\n86.7±2.0\n84.6±0.4\n97.0±0.2\n97.9±0.0\n\n84.4±0.9\n91.0±1.1\n89.5±0.2\n95.2±0.5\n95.0±0.2\n82.4±0.6\n72.7±6.9\n87.7±0.5\n80.2±2.0\n78.6±0.2\n93.2±0.2\n95.2±0.9\n\n98.9±0.0\n98.3±0.0\n97.0±0.0\n99.5±0.0\n96.1±0.0\n99.7±0.0\n98.4±0.0\n98.5±0.0\n96.8±0.0\n95.4±0.0\n97.1±0.0\n98.7±0.0\n\n39.0±0.1\n49.3±0.5\n59.6±0.1\n76.5±0.3\n44.9±0.1\n29.3±0.3\n28.3±0.4\n49.3±3.0\n34.5±1.9\n40.5±4.5\n35.9±0.2\n51.2±0.1\n\n98.0±0.0\n94.5±0.2\n95.9±0.0\n92.4±0.0\n92.6±0.1\n96.3±0.0\n88.8±0.0\n93.9±0.0\n84.5±0.1\n86.1±0.1\n91.1±0.2\n97.6±0.0\n\nAverage\n\n91.3±0.4\n\n87.2±0.6\n\n97.9±0.4\n\n44.9±0.3\n\n92.7±0.1\n\nTable 12. Per-category anomaly detection performance on\nVisA in the 2-shot setup. We report the mean and standard deviation over 5 random seeds for each measurement.\n\nCategory\n\nI-AUC\n\nI-F1\n\nP-AUC\n\nP-F1\n\nPRO\n\ncandle\ncapsules\ncashew\nchewinggum\nfryum\nmacaroni1\nmacaroni2\npcb1\npcb2\npcb3\npcb4\npipe fryum\n\n92.8±0.3\n94.7±0.9\n89.9±13.4\n97.2±0.3\n96.4±1.1\n89.3±2.0\n79.8±16.4\n88.3±11.4\n87.8±1.0\n89.6±1.2\n97.1±0.6\n97.3±1.7\n\n86.1±0.9\n91.6±2.3\n89.5±5.2\n95.1±0.1\n93.7±1.2\n82.2±2.8\n74.7±8.8\n81.3±17.4\n80.5±1.9\n82.3±3.6\n93.0±2.3\n94.9±1.2\n\n99.0±0.0\n98.4±0.0\n97.1±0.0\n99.5±0.0\n96.3±0.0\n99.7±0.0\n98.7±0.0\n99.2±0.0\n97.1±0.0\n96.2±0.0\n97.5±0.0\n98.8±0.0\n\n39.8±0.1\n50.5±0.3\n62.6±0.3\n75.8±0.4\n46.2±0.1\n29.0±2.2\n29.0±0.5\n70.1±1.1\n35.7±0.6\n47.2±1.3\n36.9±0.0\n52.3±0.6\n\n98.3±0.0\n94.6±0.1\n95.8±0.0\n92.5±0.3\n93.1±0.0\n96.8±0.0\n90.9±0.1\n93.9±0.0\n85.7±0.1\n89.0±0.1\n92.6±0.1\n97.6±0.0\n\nAverage\n\n91.7±1.0\n\n87.1±0.1\n\n97.8±0.4\n\n47.9±0.2\n\n93.4±0.1\n\nTable 13. Per-category anomaly detection performance on\nVisA in the 4-shot setup. We report the mean and standard deviation over 5 random seeds for each measurement.\n\n\fCategory\n\nI-AUC\n\nI-F1\n\nP-AUC\n\nP-F1\n\nPRO\n\nbottle\ncable\ncapsule\ncarpet\ngrid\nhazelnut\nleather\nmetal nut\npill\nscrew\ntile\ntoothbrush\ntransistor\nwood\nzipper\n\n99.7\n94.9\n98.3\n100.0\n99.8\n99.7\n100.0\n100.0\n98.5\n96.6\n100.0\n96.9\n94.3\n99.7\n98.0\n\n98.4\n92.6\n97.3\n99.4\n99.1\n98.6\n100.0\n100.0\n98.3\n95.1\n99.4\n95.2\n84.2\n98.4\n96.7\n\n97.5\n95.9\n98.5\n99.3\n99.1\n99.4\n99.7\n95.8\n96.3\n99.0\n97.2\n99.5\n88.0\n97.1\n98.8\n\n74.9\n53.0\n51.7\n75.3\n52.7\n76.3\n60.4\n73.9\n63.6\n60.6\n74.6\n71.5\n45.2\n70.9\n71.5\n\n94.7\n90.6\n98.0\n98.2\n96.6\n98.5\n99.5\n95.2\n97.9\n96.0\n94.8\n97.8\n70.0\n97.0\n96.3\n\nAverage\n\n98.4\n\n96.9\n\n97.4\n\n65.1\n\n94.7\n\nTable 14. Per-category anomaly detection performance on MVTec\nAD in the full-shot setup.\n\nCategory\n\nI-AUC\n\nI-F1\n\nP-AUC\n\nP-F1\n\nPRO\n\ncandle\ncapsules\ncashew\nchewinggum\nfryum\nmacaroni1\nmacaroni2\npcb1\npcb2\npcb3\npcb4\npipe fryum\n\n95.6\n96.2\n97.4\n98.7\n98.4\n95.3\n84.7\n95.9\n94.1\n95.9\n99.4\n98.4\n\n90.0\n93.8\n94.5\n97.0\n97.5\n88.5\n79.3\n91.8\n88.2\n90.4\n96.6\n95.9\n\n99.3\n99.1\n98.2\n99.5\n97.4\n99.9\n99.6\n98.8\n98.2\n97.5\n98.4\n99.1\n\n40.1\n60.1\n70.4\n75.3\n53.6\n36.4\n28.9\n41.8\n40.3\n52.9\n46.5\n58.7\n\n98.2\n96.6\n94.6\n91.8\n93.9\n98.5\n96.7\n95.4\n91.5\n93.4\n94.9\n97.9\n\nAverage\n\n95.8\n\n91.9\n\n98.7\n\n50.4\n\n95.3\n\nTable 15. Per-category anomaly detection performance on VisA in\nthe full-shot setup.\n\nMethod PaDiM PatchCore WinCLIP+ AnomalyGPT PromptAD\np-value 5e − 7 8e − 5\n1e − 7\n0.005\n0.7\n\nTable 16. t-test on anomaly detection results.\n\n\f</code></pre></article>\n        \n</main>\n\n<script src=\"https://cdn.jsdelivr.net/npm/katex@0.16.8/dist/katex.min.js\"></script>\n<script src=\"https://cdn.jsdelivr.net/npm/katex@0.16.8/dist/contrib/auto-render.min.js\"></script>\n<script>\n\nfunction initTheme() {\n  const saved = localStorage.getItem('kb-theme') || 'light';\n  document.documentElement.setAttribute('data-theme', saved);\n  updateThemeIcon(saved);\n}\nfunction toggleTheme() {\n  const cur = document.documentElement.getAttribute('data-theme') || 'light';\n  const next = cur === 'light' ? 'dark' : 'light';\n  document.documentElement.setAttribute('data-theme', next);\n  localStorage.setItem('kb-theme', next);\n  updateThemeIcon(next);\n}\nfunction updateThemeIcon(t) {\n  const btn = document.getElementById('theme-toggle-btn');\n  if (btn) btn.innerHTML = t === 'dark' ? '☀️' : '🌙';\n}\ndocument.addEventListener('DOMContentLoaded', initTheme);\n\nfunction setViewMode(m) {\n  const grid = document.getElementById('bento-grid-view');\n  const list = document.getElementById('list-table-view');\n  const bGrid = document.getElementById('view-grid-btn');\n  const bList = document.getElementById('view-list-btn');\n  if (m === 'list') {\n    if (grid) grid.style.display = 'none';\n    if (list) list.style.display = 'flex';\n    if (bGrid) bGrid.classList.remove('active');\n    if (bList) bList.classList.add('active');\n  } else {\n    if (grid) grid.style.display = 'grid';\n    if (list) list.style.display = 'none';\n    if (bGrid) bGrid.classList.add('active');\n    if (bList) bList.classList.remove('active');\n  }\n  localStorage.setItem('kb-view', m);\n}\ndocument.addEventListener('DOMContentLoaded', () => {\n  const s = localStorage.getItem('kb-view') || 'grid';\n  setViewMode(s);\n});\n\ndocument.addEventListener('DOMContentLoaded', () => {\n  document.querySelectorAll('pre').forEach(pre => {\n    const b = document.createElement('button');\n    b.className = 'copy-code-btn';\n    b.innerText = 'Copy';\n    b.onclick = () => {\n      const c = pre.querySelector('code') ? pre.querySelector('code').innerText : pre.innerText;\n      navigator.clipboard.writeText(c).then(() => {\n        b.innerText = 'Copied!';\n        setTimeout(() => { b.innerText = 'Copy'; }, 2000);\n      });\n    };\n    pre.appendChild(b);\n  });\n});\n\nwindow.addEventListener('keydown', (e) => {\n  if ((e.key === '/' || (e.metaKey && e.key === 'k')) && document.activeElement.tagName !== 'INPUT' && document.activeElement.tagName !== 'TEXTAREA') {\n    e.preventDefault();\n    const q = document.getElementById('global-search-input');\n    if (q) q.focus();\n  }\n});\n\n// Scrollspy for TOC\nwindow.addEventListener('scroll', () => {\n  const headers = document.querySelectorAll('.article-body h1, .article-body h2, .article-body h3');\n  const scrollPos = window.scrollY + 100;\n  headers.forEach(h => {\n    if (h.offsetTop <= scrollPos) {\n      const id = h.getAttribute('id');\n      if (id) {\n        document.querySelectorAll('.reading-sidebar a').forEach(a => {\n          a.classList.toggle('active', a.getAttribute('href') === '#' + id);\n        });\n      }\n    }\n  });\n});\n\ndocument.addEventListener(\"DOMContentLoaded\", function() {\n  if (window.renderMathInElement) {\n    renderMathInElement(document.body, {\n      delimiters: [\n        {left: '$$', right: '$$', display: true},\n        {left: '$', right: '$', display: false},\n      ],\n      throwOnError : false\n    });\n  }\n});\n</script>\n\n</body>\n</html>\n"