"<!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>DictAS: A Framework for Class-Generalizable Few-Shot Anomaly Segmentation\nvia Dictionary Lookup\n\narXiv:2508.13560v2 [cs.CV] 21 Aug 2025\n\nZhen Qu1, 2\nXingang Wang1, 2\n\nXian Tao1,2,3,4† Xinyi Gong5 ShiChen Qu1, 2 Xiaopei Zhang7\nFei Shen1,2,3,4 Zhengtao Zhang1,2,3 Mukesh Prasad6 Guiguang Ding8\n1\nInstitute of Automation, Chinese Academy of Sciences\n2\nSchool of Artificial Intelligence, University of Chinese Academy of Sciences 3 Casivision\n4\nLongmen Laboratory 5 HDU 6 UTS 7 UCLA 8 Tsinghua University\n\nAbstract\n\nlimited number of normal samples. This task is particularly\nimportant in scenarios where training data is scarce and\npixel-level annotations are limited, such as industrial defect\ndetection [6, 26, 27] and medical image analysis [1, 22, 24].\n\nRecent vision-language models (e.g., CLIP) have demonstrated remarkable class-generalizable ability to unseen\nclasses in few-shot anomaly segmentation (FSAS), leveraging supervised prompt learning or fine-tuning on seen\nclasses. However, their cross-category generalization\nlargely depends on prior knowledge of real seen anomaly\nsamples. In this paper, we propose a novel framework,\nnamely DictAS, which enables a unified model to detect visual anomalies in unseen object categories without any retraining on the target data, only employing a few normal\nreference images as visual prompts. The insight behind DictAS is to transfer dictionary lookup capabilities to the FSAS\ntask for unseen classes via self-supervised learning, instead\nof merely memorizing the normal and abnormal feature patterns from the training set. Specifically, DictAS mainly consists of three components: (1) Dictionary Construction to simulate the index and content of a real dictionary using features from normal reference images. (2) Dictionary\nLookup - to retrieve queried region features from the dictionary via a sparse lookup strategy. When a query feature\ncannot be retrieved, it is classified as an anomaly. (3) Query\nDiscrimination Regularization- to enhance anomaly discrimination by making abnormal features harder to retrieve\nfrom the dictionary. To achieve this, Contrastive Query\nConstraint and Text Alignment Constraint are further proposed. Extensive experiments on seven public industrial\nand medical datasets demonstrate that DictAS consistently\noutperforms state-of-the-art FSAS methods.\n\nExisting FSAS methods typically follow classdependent or class-generalizable setting, as shown in\nFigure 1(a). Class-dependent approaches require finetuning on each unseen class with a limited number of\nnormal samples. Since the training and testing image\nclasses are identical, they primarily focus on modeling the\ndistribution of normal images or learning the boundary between normal and abnormal content through regularization,\nwithout considering the substantial domain gaps across\ncategories [2, 20, 21, 33, 34, 36]. Consequently, such\nmethods encounter significant challenges when applied\nto privacy-sensitive medical applications or dynamic\nindustrial scenarios with frequent production line changes.\nIn contrast, as shown in the right part of Figure 1(a),\nclass-generalizable approaches aim to develop a unified\nmodel capable of detecting anomalies in unseen classes\nwithout retraining on target data, relying solely on a few\nnormal samples as visual prompts [7, 11–13, 15, 16]. The\nearliest work, RegAD [15], introduces feature registration\nto align features but suffers from reduced inference efficiency due to heavy reference image augmentation. FastRecon [11] proposes feature reconstruction using linear regression but is prone to over-reconstruction. More recent\nmethods have increasingly focused on pre-trained visionlanguage models (VLMs), particularly CLIP [30], to enhance zero/few-shot generalization for unseen classes [5, 7,\n13, 16, 28, 29, 41]. Approaches such as WinCLIP [16] and\nAPRIL-GAN [7] introduce memory bank-based visual priors through normal images and enhance FSAS performance\nby exploiting CLIP’s image-text alignment capabilities. Despite their promising performance, these methods often rely\non “empirical knowledge” learned from seen abnormal images during auxiliary training stage, which constrains their\n\n1. Introduction\nFew-shot (few-normal-shot) anomaly segmentation (FSAS)\naims to identify anomalous regions in images given only a\n† Corresponding Author: taoxian2013@ia.ac.cn.\n‡ Project Page: https://github.com/xiaozhen228/DictAS\n\n1\n\n\fClass-Dependent Setting (e.g. PromptAD)\n\nClass-Generalizable Setting (e.g. APRIL-GAN)\nAuxiliary training on seen classes\n\nA few normal images for training\n1-shot\n\n1-shot\n\nReference Image\n\n…\n\n1-shot\n\n…\nPretrained Encoder\nModel 1\n\nFine-tuning\nModel 2\n\n…\n\nModel n\n\n…\nClass 1\n\nClass 2\n\nClass n\n\nTesting\n\nClass 2\n\nWithout\nFine-tuning\n\nTest Images\nClass n from Unseen\nClasses\n\nUnified\nModel\n\nVisual\nPrompts\n\nReference\nFeature\n\nDictionary\nConstruction\n\nFreeze Parameters\nDictionary Lookup\nKey\nQuery\n\n1-shot\n\n(a) Two settings in few-shot anomaly segmentation\n\ng\n\nK\n\ng Value\n\n1-shot\nNormal\nReference\nImages\n\nQuery Image\n\nAnomaly\nSynthesis\n\nSelf-Supervised Training\n\n…\n\nTest\nImages\n\nFine-tuning\n\nReference Image\n\nQuery Image\n\n1-shot\n\nClass 1\n\n…\n\nFine-tuning\n\nRaw Image\n\nData\nTransformation\n\nPretrained Encoder\n\nInference Stage: Segment visual\nanomalies for unseen classes\n\nTraining Stage: Teach model how\nto look up a dictionary\n\nSPM\nW\n\ng\n\nQuery Feature\n\nQ\n\nRetrieved\nResult\n\nV\n\nCosine\nDistance\n\nQuery Loss +\n\nQuery Discrimination\nRegularization\n\nAnomaly\nMap\n\n(b) Motivation of our DictAS\n\nFigure 1. (a) Two settings in few-shot anomaly segmentation. (b) Motivation of our DictAS.\n\nability to generalize to novel classes.\n\nreference) image pairs. To optimize the dictionary lookup\ntask, a query loss is further introduced to minimize the average distance between the normal regions of input Query\nFeature and their counterparts in Retrieved Result generated by the dictionary lookup process.\nTo enhance the anomaly discrimination ability, the\nQuery Discrimination Regularization component is proposed, which makes it harder for anomalous regions in the\nquery image to be retrieved from the dictionary. It consists\nof two parts: the Contrastive Query Constraint (CQC) and\nthe Text Alignment Constraint (TAC). The CQC explicitly\nenforces greater feature distances between the Query Feature and its Retrieved Result in anomalous regions compared to normal regions, ensuring that anomalies are effectively distinguished. Meanwhile, the TAC regularizes the\nretrieved global image representation by aligning it with the\nnormal text embedding space, preventing the model from\nmisinterpreting anomalous content as normal.\nIn summary, our contributions are threefold: 1) We propose DictAS, a novel self-supervised framework that reformulates anomaly segmentation as a dictionary lookup\ntask, enabling models to learn an adaptive retrieval capability for class-generalizable FSAS; 2) We introduce two regularizations strategies—Contrastive Query Constraint and\nText Alignment Constraint—to enhance the robustness of\ndictionary-based querying and improve anomaly discrimination; 3) DictAS achieves state-of-the-art performance on\nseven industrial and medical datasets, demonstrating superior FSAS performance even when trained on auxiliary\ndatasets without pixel-level annotations.\n\nHowever, even novice human inspectors can detect\nanomalies in unseen categories with just a few normal samples as references, without extensive prior experience. We\napproximate this intuition as a dictionary lookup: if a region\nin the query image cannot be retrieved from the dictionary,\nit is classified as anomalous; otherwise, it is normal. Inspired by this, a novel self-supervised framework built on\nCLIP, namely DictAS, is proposed for class-generalizable\nFSAS. The framework comprises three components: Dictionary Construction, Dictionary Lookup, and Query Discrimination Regularization, as depicted in Figure 1(b). Our\nmotivation is to reformulate anomaly segmentation as a\ndictionary lookup task—determining whether a query feature exists in the dictionary. Through self-supervised training, the model acquires a feature-agnostic and dynamically adaptive dictionary lookup capability, enabling classgeneralizable FSAS.\nThe proposed Dictionary Construction component organizes normal reference image features into a structured\ndictionary, where the Dictionary Key and Dictionary Value\nserve as the index and content, respectively. As demonstrated in Figure 1(b), given a query image, its extracted\nfeatures are transformed into a Dictionary Query, which is\nthen matched against the Dictionary Key to retrieve the most\nrelevant normal patterns. To refine this retrieval process,\nwe introduce a sparse lookup strategy within the Dictionary\nLookup component. Specifically, the Query-Key matching results are processed by a Sparse Probability Module\n(SPM), which encourages sparsity in the retrieval process\nand prioritizes the most relevant Dictionary Value. Unlike\nprior VLM-based methods [7, 13, 16] that rely on memorybased visual priors or prior knowledge derived from textimage alignment, DictAS learns dynamically adaptive retrieval weights, enabling flexible adaptation to variations in\nboth query and reference images. For self-supervised training, the raw images are processed using anomaly synthesis and data transformation algorithms to generate (query-\n\n2. Related Works\nClass-Dependent FSAS methods fine-tune a separate\nmodel for each class using only its corresponding normal\nreference images. They primarily focus on: (1) estimating the distribution of a few normal samples [32, 34], or\n(2) learning a discriminative boundary using only normal\ndata [2, 20, 21, 33]. Since these methods do not need to\n2\n\n\fQuery Image X\n\nFql\n\nq\n\nDictionary Lookup\nQuery\nGenerator\n\nQuery-Key\nMatching\n\nTraining Stage\n\nG\nRaw Image\n\nRandom (Rotation,\nFlip, Brightness,\nContrast, …)\n\nFnl\n\n{X }\n\nNormal Text Prompts\n\nInference Stage\n\nRegularization\n\n：\n\nQuery Feature\n\nq\n\nFql\n\n…\n\nSparse Probability Module\n\nImage\nEncoder\n\ni k\nn i=1\n\nŵ\nWighted\nFusion\n\n0.1 0.2 0.1\n\n0\n\n[d ] → 0\n[d ]\n\n0.5\n\n0\n\nRetrieved\nResult\n\nDictionary Construction\nValue\nGenerator\n\nDictionary Value\n\nKey\nGenerator\n\nDictionary Key\n\nLearnable\n\ni k\nn i=1\n\nFnl\n\nFql\nl\nV\n\nF\n\nFKl\n\nFrl\n\n：\n\nCQC\n\nConcat\n\nxr\n\nyq = 0 or 1\n\nGlobal\nPooling\n\nxq\n\nyq = 0\nyq = 1\n\nTAC\n\nFrozen\n\n[d ]\n\nNormal Text\nEmbedding Space\nAbnormal Text\nEmbedding Space\n\n: xr → Normal\n\nNormal query feature from\nAnomaly Map\n\nFql\nFql\n\nAbnormal retrieved result from\n\nM\n\nFrl\n\nAbnormal query feature from\nNormal retrieved result from\n\nCosine\nDistance\n\nDictionary\nConstruction\n\n[d ] \n\nFtext\n\nFql\nDictionary\nLookup\n\nImage\nEncoder\n\n[d ]\n\nLinear\n\nFql\n\nX\nQuery Image\n\nRetrieved Result\n\nFrl\n\n… 0\n…\n\nText\nEncoder\n\n{X }\n\n+ 1 CQC +  2 TACQuery Discrimination\n\nz1 z2 z3 z4 z5 z6 … z HW\n\nX\n\nAbnormal Text Prompts\n\nNormal\nReference\nImages\n\nF\n\nq\n\nDictionary Query\n\nxlQ\n\nxlr\nReference\nImage\n\n=\nl\nQ\n\nFrl\nFrl\n\nAverage distance between patch featrures\nText and global image embedding\nalignment\n\nFigure 2. The framework of DictAS. It mainly consists of three components: Dictionary Construction, Dictionary Lookup and Query\nDiscrimination Regularization. During training, the number of reference images is set to k = 1 for model efficiency. During inference,\nk ≥ 1 normal reference images are used as visual prompts.\n\nto learn adaptive querying and robust dictionary retrieval,\nthereby effectively addressing the FSAS task.\n\naddress domain shifts between training and testing classes,\nthey typically achieve superior performance compared to\nclass-generalizable approaches.\nClass-Generalizable FSAS methods train a unified\nmodel on seen classes from an auxiliary dataset and directly generalize to unseen classes without additional finetuning. Early distance-based approaches [8, 9, 31, 37] detect anomalies by measuring the distance between query\nand reference images or features but are sensitive to image\nperturbations. Meta-learning-based methods [12, 15, 35]\naim to achieve class-generalizable FSAS through task generalization but often require offline construction of auxiliary\ndatasets and involve complex training processes. Feature\nresidual-based methods [38, 42] mitigate inter-class variations by refining features based on the residuals between\nquery and reference image features, though their effectiveness depends on the quality of residual feature extraction.\nVision-language model-based approaches [7, 16] align text\nembeddings with image patch features in a joint embedding space, enabling language-guided anomaly segmentation. Building upon this, AnomalyGPT [13] further incorporates large language models to facilitate multi-turn user\ninteraction, but introduces higher inference overhead.\nUnlike the aforementioned class-generalizable methods,\nour DictAS reformulates FSAS as a dictionary lookup task,\ninspired by human inspectors. This enables us to leverage a large number of pixel-annotation-free images from\nseen classes for self-supervised training, guiding the model\n\n3. Method\nProblem Statement. Class-generalizable FSAS is a challenging task that aims to achieve high performance on unseen classes without requiring fine-tuning on the target data.\nThe seen classes C s in the auxiliary training set and the unseen classes C u in the test set must satisfy C s ∩ C u = ∅.\nThe ultimate goal is to develop a unified model capable of\nsegmenting visual anomalies in novel classes C u , relying\nsolely on k-shot normal samples corresponding to the same\nclass as the visual prompts.\n\n3.1. Overview\nThe framework of our DictAS is illustrated in Figure 2. We\nemploy the transformer-based CLIP model as the backbone,\nin line with recent FSAS approaches [7, 16, 20].\nIn training, we introduce a novel self-supervised learning\nstrategy that eliminates the need for extensive pixel-labeled\ntraining samples. Given a raw image X ∈ Rh×w×3 from a\nseen class C s , we generate k reference images {Xin }ki=1\nby applying data transformations (e.g., random rotation,\nflipping) to simulate normal variations. Simultaneously,\na query image Xq is created by synthesizing anomalies\non X to mimic anomalous scenarios. A pretrained image encoder extracts multi-layer patch-level features from\n3\n\n\fboth {Xin }ki=1 and Xq , denoted as Fln ∈ RkHW ×C and\nFlq ∈ RHW ×C , where l = 1, 2, . . . , L, with H, W , and\nC denoting the height, width, and feature dimension, respectively. These extracted features are utilized in three key\ncomponents of our model: 1) Dictionary Construction:\nThe reference image features Fln are used to construct a\ndictionary for retrieval; 2) Dictionary Lookup: The Query\nFeature Flq serve as queries for retrieval, producing the Retrieved Result Flr ; 3) Query Discrimination Regularization: Two regularization terms are added into the loss function to jointly optimize the model based on (Flr , Flq ), improving the discrimination between normal and anomalous\npatterns.\nDuring inference, the model constructs a dictionary using features Fln extracted from a few normal reference images of unseen classes. Given a query image Xq from the\nsame unseen classes, its features Flq are compared with the\nRetrieved Result Flr . The computed distance guides the\ngeneration of the final anomaly map M.\n\nBy incorporating self-attention, each patch is able to perceive global contextual information, thereby improving the\nrobustness of dictionary construction.\nIn the next subsection, we introduce the dictionary\nlookup process using individual patch features from Flq .\nSpecifically, we denote each patch feature as xlq,p ∈ R1×C ,\nwhere p = 1, 2, · · · , HW . The corresponding Dictionary\nQuery in FlQ is represented as xlQ,p . For simplicity, we omit\nthe subscript p in the following discussion.\n\n3.3. Dictionary Lookup\nIntuitively, if a query image patch contains an anomaly, its\nfeatures xlq cannot be well retrieved from the Dictionary\nValue FlV . Based on this assumption, we propose three dictionary lookup strategies, each consisting of two main steps:\n1) Query-Key Matching: The similarity z between the\nDictionary Query xlQ and the Dictionary Key FlK is comT\n\nputed as: z = xlQ Fl K .\n2) Weighted Fusion: Using the computed similarity z,\nthe Retrieved Result xlr ∈ R1×C is obtained by weighted\nfusion of the Dictionary Value FlV : xlr = ŵFlV , where\nŵ ∈ R1×kHW is a weight vector derived from z, and is\ndetermined by one of the following strategies:\n\n3.2. Dictionary Construction\nA well-constructed dictionary typically consists of two\ncomponents: an index and the corresponding content, referred to as the Dictionary Key and Dictionary Value, respectively. Motivated by this, we design a Key Generator\ngK and a Value Generator gV to transform the extracted normal reference image features Fln into structured dictionary\nrepresentations. Meanwhile, the Query Generator gQ processes the Query Feature Flq to obtain a Dictionary Query,\nwhich is then matched against the Dictionary Key for retrieval. The feature transformations are defined as follows:\n\n  \\hat {\\mathbf {w}} = \\begin {cases} onehot(argmax(\\mathbf {z})) &amp; if\\ \\text {Maximun Lookup}, \\\\ softmax(\\mathbf {z}) &amp; if \\ \\ \\text {Dense Lookup}, \\\\ SPM(\\mathbf {z}) &amp; if \\ \\text {Sparse Lookup} \\end {cases} \n\nSpecifically, for Maximum Lookup, the weight vector\nŵ is a one-hot vector, selecting the Dictionary Value with\nthe highest similarity score. For Dense Lookup, the weight\nvector ŵ is obtained by applying the softmax function to\nz, distributing the weights across all Dictionary Value in a\ndense manner. For Sparse Lookup, we introduce a Sparse\nProbability Module (SPM), adapted from the approach proposed in [23], to sparsify z such that it emphasizes the most\nrelevant Dictionary Value and reduces background redundancy as the number of reference images increases. We\nadopt Sparse Lookup as the default setting in this work.\nSparse Probability Module. The sparse fusion weight\nŵ is computed by solving the optimization problem that\nsparsifies the similarity scores z and satisfies the probability\nsimplex constraint:\n\n \\mathbf {F}_Q^l = g_Q(\\mathbf {F}_q^l) = AttnBlock\\_Q(\\mathbf {F}_q^l)\\\\ \\mathbf {F}_K^l = g_K(\\mathbf {F}_n^l) = AttnBlock\\_K(\\mathbf {F}_n^l) \\\\ \\mathbf {F}_V^l = g_V(\\mathbf {F}_n^l) = \\mathbf {F}_n^l + AttnBlock\\_V(\\mathbf {F}_n^l)\n(3)\nwhere FlQ ∈ RHW ×C , FlK , FlV ∈ RkHW ×C are Dictionary Query, Key and Value, respectively. Here, AttnBlock\nrepresents a self-attention-based transformer block designed for feature adaptation. The additional residual connection in gV helps preserve the fine-grained details of Fln ,\nenhancing feature fidelity in the constructed dictionary.\nDesign of AttnBlock. To enable the dictionary representations to capture meaningful global relationships, we employ a self-attention mechanism within each AttnBlock.\nGiven an input feature Fin ∈ {Flq , Fln }, we first apply linear projections to generate the query, key, and value matrices: Q = ϕQ (Fin ), K = ϕK (Fin ), V = ϕV (Fin ). The\ntransformed features are then passed through a multi-head\nself-attention module followed by a two-layer MLP:\n  \\mathbf {F}_{out} = TwoLayerMLP(softmax(\\frac {\\mathbf {Q}\\mathbf {K}^\\textup {T}}{\\sqrt {C}})\\mathbf {V}) \n\n(5)\n\n  \\operatorname *{arg\\,min}_{\\vartriangle } \\frac {1}{2}\\Vert \\mathbf {w}- \\mathbf {z}\\Vert ^2, \\vartriangle = \\{\\mathbf {w}|\\mathbf {w}_u \\ge 0, \\sum _{u=1}^{kHW}\\mathbf {w}_u = 1\\}  (6)\nwhere △ is the probability simplex constraint. Solving the\noptimization problem yields ŵu = max(zu − τ, 0), where\nŵu denotes the u-th element of ŵ and τ is a dynamic\nthreshold determined by Algorithm 1. By repeating this\nprocess for all query patches, we obtain the final Retrieved\nResult Flr under the sparse lookup strategy.\n\n(4)\n\n4\n\n\fAlgorithm 1 The acquisition of the adaptive threshold τ\n\ntext descriptions, preventing the retrieval of anomalous features from the dictionary.\nInspired by WinCLIP [16], we adopt a two-class text\nprompt design to ensure effective CLIP-based alignment.\nSpecifically, we construct a series of prompt templates and\nperform prompt ensembling by averaging the corresponding\ntext embeddings. For example, the template “a photo of a\n[state] [class]”, where [state] indicates an adjective describing normal or anomalous conditions (e.g., good / damaged),\nand [class] denotes the object category (e.g., wood, bottle).\nThe resulting text embedding is denoted as Ftext ∈ R2×C .\nTo obtain the global representation of the Query Feature,\nFlq ∈ RH×W ×C from different layers are concatenated\nalong the channel dimension and global average pooling is\napplied over the spatial dimensions to obtain a compact representation. A linear layer is finally used to map the pooled\nfeatures into xq in the joint embedding space. The same\nprocess is applied to the Retrieved Result Flr to yield the\nglobal feature xr . The final constraint is formulated as:\n\n1: Sort z in descending order: z1 ≥ z2 ≥ · · · zkHW\nPt\n2: Compute the cumulative sum: Cumt =\nu=1 zt\n3: Compute the candidate threshold: τt = (Cumt − 1)/t\n4: Find the largest t (denoted as t∗ ) satisfying zt &gt; τt ,\n\nthen the final threshold is τ = τt∗\n\nQuery Loss. How can the model acquire a classgeneralizable dictionary lookup ability? Our answer is to\nuse the Query Feature Flq itself as a pseudo-label for selfsupervised training. The core assumption is that normal\npatch features from Flq can always be retrieved from the\nconstructed dictionary. To this end, we minimize the average distance EN [d] between the Query Feature Flq and the\nRetrieved Result Flr in normal regions. The query loss is\ndefined as:\n  \\mathcal {L}_{q} = \\sum _{l}\\mathbb {E}_{\\mathcal {N}}[d] = \\sum _{l}\\Bigl (\\frac {1}{|\\mathcal {N}|}\\sum _{j\\in \\mathcal {N}}d(\\mathbf {F}_{q,j}^l, \\mathbf {F}_{r,j}^l )\\Bigr ) \n\n(7)\n\n  \\mathcal {L}_{TAC} = CE(\\widetilde {\\mathbf {x}}_r \\widetilde {\\mathbf {F}}_{text}^\\textup {T}, 0) + CE(\\widetilde {\\mathbf {x}}_q\\widetilde {\\mathbf {F}}_{text}^\\textup {T}, y_{q}) \nwhere d(Flq,j , Flr,j ) = 1 − ⟨Flq,j , Flr,j ⟩ denotes the cosine\ndistance between the j th patch, and ⟨·, ·⟩ is the cosine similarity. The anomaly mask G ∈ {0, 1}HW is obtained using the anomaly synthesis algorithm in DRÆM [39]. Here,\nN = {j|Gj = 0} represents the index set of normal\npatches, and |N | is its cardinality.\n\nwhere CE(·) represents the cross-entropy loss function [19]\nand yq ∈ {0, 1} is the image-level label derived from the\nsynthesized query image. (g\n·) denotes the L2-normalized\nversion along the embedding dimension. Details of the text\nprompt design are provided in Appendix A.3.\n\n3.5. Training and Inference\n\n3.4. Query Discrimination Regularization\n\nTraining. We train DictAS in a self-supervised manner, allowing any image X without pixel annotations as auxiliary\ndata. The total loss function is defined as:\n\nThe query loss Lq enables the model learn how to retrieve\nfrom the dictionary and detect anomalies by measuring the\ndistance between query features and their retrieved counterparts. However, this strong retrieval capability is a doubleedged sword. If the model becomes excessively powerful\nin both feature extraction and retrieval, it may find combinations of normal features in the dictionary that closely\nmatches any query, including anomalous ones. This weakens segmentation, as the distance can no longer clearly separate normal from abnormal regions. To mitigate this issue,\nwe introduce two constraints:\n1) Contrastive Query Constraint enforces that the average distance between abnormal patches from Flq and their\nretrieved results from Flr is greater than that of normal\npatches, enhancing anomaly separability:\n\n  \\mathcal {L} = \\mathcal {L}_{q} + \\lambda _1 \\mathcal {L}_{CQC} + \\lambda _2 \\mathcal {L}_{TAC} \n\n(10)\n\nwhere λ1 and λ2 are weighting coefficients for the regularization terms. Note that the number of simulated reference\nimages is set to k = 1 for training efficiency.\nInference. During this stage, the dictionary is constructed using k(k ≥ 1) real normal reference images. The\ncosine distance between the query features and their retrieved counterparts is computed to generate the anomaly\nmap. The final anomaly map M ∈ Rh×w is obtained by\naggregating the maps from L layers:\n  \\mathbf {M} = Up\\Bigl (\\frac {1}{2L}\\sum _{l=1}^{L} \\Bigl ( 1 -\\langle \\mathbf {F}_{q}^l,\\mathbf {F}_{r}^l \\rangle \\Bigl )\\Bigl ) \n\n  \\mathcal {L}_{CQC} = \\sum _{l}\\max (0, \\ \\mathbb {E}_{\\mathcal {N}}[d] - \\mathbb {E}_{\\mathcal {A}}[d]) \n\n(9)\n\n(8)\n\n(11)\n\nwhere U p(·) represents the upsampling operation used to\nrestore the original input resolution.\n\nwhere EA [d] represents the average cosine distance between the Query Feature and Retrieved Result in abnormal\nregions, similar to EN [d] in Equation (7).\n2) Text Alignment Constraint leverages CLIP’s textimage matching capability to enforce alignment between\nglobal retrieved results and the embedding space of normal\n\n4. Experiments\n4.1. Experimental Settings\nDatasets. To evaluate the class-generalizable FSAS performance, experiments on seven real-world datasets from\n5\n\n\fTable 1. Comparison with existing state-of-the-art methods under the 4-shot setting. The best results are highlighted in red, and the secondbest results are marked in blue. The symbol † denotes methods based on CLIP, and (a,b,c) represents pixel-level (AUROC, PRO, AP). To\nensure a fair comparison, all methods use the same normal reference images, and all CLIP-based methods employ the same backbone\n(ViT-L-14-336) and input resolution (336 × 336).\nRegAD [15]\n(ECCV 22)\n\nDatasets\n\nAnomalyGPT [13]\n(AAAI 24)\n\n† FastRecon+ [11]\n(ICCV 23)\n\nFastRecon [11]\n(ICCV 23)\n\n† WinCLIP [16]\n(CVPR 23)\n\n† APRIL-GAN [7]\n(CVPR 23)\n\n† PromptAD [20]\n(CVPR 24)\n\n† DictAS\n(Ours)\n\n(92.2, 86.6, 46.6)\n(96.2, 86.6, 30.6)\n(96.4, 89.1, 33.1)\n(95.3, 86.9, 31.4)\n(93.3, 74.6, 50.9)\n(94.7, 84.8, 38.5)\n\n(96.0, 92.4, 57.5)\n(97.9, 89.5, 37.5)\n(97.7, 92.1, 36.9)\n(97.3, 94.0, 40.5)\n(96.6, 80.1, 62.5)\n(97.1, 89.6, 47.0)\n\n(98.6, 95.1, 66.8)\n(98.8, 91.9, 41.8)\n(98.4, 94.9, 44.2)\n(98.4, 95.8, 42.9)\n(98.0, 83.3, 66.8)\n(98.4, 92.2, 52.5)\n\n(93.7, 77.6, 57.3)\n(91.3, 63.0, 40.0)\n(92.5, 70.3, 48.7)\n\n(96.8, 86.8, 71.3)\n(96.6, 77.0, 54.4)\n(96.7, 82.2, 62.9)\n\n(97.5, 89.7, 74.9)\n(97.3, 77.2, 59.3)\n(97.4, 83.4, 67.1)\n\nIndustrial Datasets (AUROC, PRO, AP)\n(95.7, 86.0, 46.5)\n(94.7, 72.8, 21.4)\n(96.9, 89.2, 13.3)\n(94.9, 83.3, 16.4)\n(97.3, 75.5, 44.1)\n(95.9, 81.3, 28.3)\n\n(96.4, 91.2, 52.9)\n(96.5, 65.4, 20.8)\n(96.6, 87.4, 27.8)\n(97.7, 93.2, 40.8)\n(96.2, 73.5, 50.6)\n(96.7, 82.1, 38.6)\n\n(95.9, 79.9, 47.0)\n(96.0, 77.7, 31.1)\n(95.6, 83.6, 12.9)\n(97.0, 87.5, 25.7)\n(88.7, 62.1, 35.5)\n(94.6, 78.2, 30.4)\n\nRESC [14]\nBrasTS [24]\nAverage\n\n(87.9, 60.0, 18.1)\n(93.8, 70.2, 24.8)\n(90.8, 65.1, 21.5)\n\n(86.7, 60.0, 28.5)\n(95.4, 73.6, 41.8)\n(91.0, 66.8, 35.2)\n\n(91.7, 71.7, 30.3)\n(92.5, 63.8, 24.0)\n(92.1, 67.8, 27.1)\n\n\u0000\u001a\u0000\u0013\n\n\u00000\u00009\u00007\u0000H\u0000F\u0000$\u0000'\n\n(96.3, 92.2, 53.9)\n(97.0, 86.2, 32.5)\n(97.1, 91.8, 39.2)\n(97.4, 93.1, 37.8)\n(97.4, 80.8, 62.2)\n(97.0, 88.8, 45.1)\n\nMedical Datasets\n\n\u0000\u0019\u0000\u0018\n\n\u0000\u0019\u0000\u0013\n\n\u0000\u0019\u0000\u0013\n\n\u0000\u0018\u0000\u0018\n\n\u0000\u0018\u0000\u0018\n\n\u0000$\u00003\u0000\u0003\u0000\u000b\u0000\b\u0000\f\n\n\u0000$\u00003\u0000\u0003\u0000\u000b\u0000\b\u0000\f\n\n\u0000\u0019\u0000\u0018\n\n\u0000\u0018\u0000\u0013\n\u0000\u0017\u0000\u0018\n\u0000\u0017\u0000\u0013\n\u0000\u0016\u0000\u0018\n\n\u0000\u0014\n\n\u0000\u0015\n\n\u0000\u0017\n\u00001\u0000X\u0000P\u0000E\u0000H\u0000U\u0000\u0003\u0000R\u0000I\u0000\u0003\u00006\u0000K\u0000R\u0000W\u0000V\n\n\u0000\u001b\n\n\u0000\u0018\u0000\u0013\n\n\u0000\u0016\u0000\u0018\n\n\u0000\u0014\n\n\u0000\u0015\n\n\u00000\u00003\u0000'\u0000'\n\n\u0000\u0017\n\u00001\u0000X\u0000P\u0000E\u0000H\u0000U\u0000\u0003\u0000R\u0000I\u0000\u0003\u00006\u0000K\u0000R\u0000W\u0000V\n\n\u0000\u001b\n\n\u00000\u00009\u00007\u0000H\u0000F\u0000\u0016\u0000'\n\n\u0000\u0017\u0000\u0013\n\n\u0000\u0017\u0000\u0018\n\n\u0000\u0016\u0000\u0018\n\n\u0000\u0017\u0000\u0013\n\n\u0000\u0016\u0000\u0013\n\u0000\u0015\u0000\u0018\n\n\u0000:\u0000L\u0000Q\u0000&amp;\u0000/\u0000,\u00003\n\u0000$\u00003\u00005\u0000,\u0000/\u0000\u0010\u0000*\u0000$\u00001\n\u0000$\u0000Q\u0000R\u0000P\u0000D\u0000O\u0000\\\u0000*\u00003\u00007\n\u00003\u0000U\u0000R\u0000P\u0000S\u0000W\u0000$\u0000'\n\u0000'\u0000L\u0000F\u0000W\u0000$\u00006\u0000\u0003\u0000\u000b\u00002\u0000X\u0000U\u0000V\u0000\f\n\n\u0000\u0017\u0000\u0013\n\n\u0000\u0014\u0000\u0019\n\n(93.1, 75.7, 38.4)\n(93.3, 64.0, 33.4)\n(93.2, 69.8, 35.9)\n\n\u00009\u0000L\u0000V\u0000$\n\n\u0000\u0017\u0000\u0018\n\n\u0000:\u0000L\u0000Q\u0000&amp;\u0000/\u0000,\u00003\n\u0000$\u00003\u00005\u0000,\u0000/\u0000\u0010\u0000*\u0000$\u00001\n\u0000$\u0000Q\u0000R\u0000P\u0000D\u0000O\u0000\\\u0000*\u00003\u00007\n\u00003\u0000U\u0000R\u0000P\u0000S\u0000W\u0000$\u0000'\n\u0000'\u0000L\u0000F\u0000W\u0000$\u00006\u0000\u0003\u0000\u000b\u00002\u0000X\u0000U\u0000V\u0000\f\n\n(AUROC, PRO, AP)\n\n(95.8, 82.8, 68.5)\n(96.1, 73.8, 43.9)\n(96.0, 78.3, 56.2)\n\n\u0000$\u00003\u0000\u0003\u0000\u000b\u0000\b\u0000\f\n\n\u0000$\u0000Y\u0000H\u0000U\u0000D\u0000J\u0000H\u0000\u0003\u0000R\u0000Y\u0000H\u0000U\u0000\u0003\u0000\u001a\u0000\u0003\u0000G\u0000D\u0000W\u0000D\u0000V\u0000H\u0000W\u0000V\n\n\u0000\u001a\u0000\u0013\n\n(92.4, 83.8, 39.2)\n(96.0, 86.5, 25.7)\n(96.6, 87.9, 24.0)\n(97.0, 90.7, 29.3)\n(90.3, 64.7, 28.5)\n(94.5, 82.7, 29.3)\n\n\u0000$\u00003\u0000\u0003\u0000\u000b\u0000\b\u0000\f\n\nMVTecAD [3]\nVisA [43]\nMVTec3D [4]\nMPDD [17]\nBTAD [25]\nAverage\n\n\u0000\u0014\u0000\u0019\n\n\u0000\u0016\u0000\u0013\n\n\u0000:\u0000L\u0000Q\u0000&amp;\u0000/\u0000,\u00003\n\u0000$\u00003\u00005\u0000,\u0000/\u0000\u0010\u0000*\u0000$\u00001\n\u0000$\u0000Q\u0000R\u0000P\u0000D\u0000O\u0000\\\u0000*\u00003\u00007\n\u00003\u0000U\u0000R\u0000P\u0000S\u0000W\u0000$\u0000'\n\u0000'\u0000L\u0000F\u0000W\u0000$\u00006\u0000\u0003\u0000\u000b\u00002\u0000X\u0000U\u0000V\u0000\f\n\n\u0000\u0015\u0000\u0013\n\u0000\u0014\n\n\u0000\u0015\n\n\u0000%\u00007\u0000$\u0000'\n\n\u0000\u0017\n\u00001\u0000X\u0000P\u0000E\u0000H\u0000U\u0000\u0003\u0000R\u0000I\u0000\u0003\u00006\u0000K\u0000R\u0000W\u0000V\n\n\u0000\u001b\n\n\u0000:\u0000L\u0000Q\u0000&amp;\u0000/\u0000,\u00003\n\u0000$\u00003\u00005\u0000,\u0000/\u0000\u0010\u0000*\u0000$\u00001\n\u0000$\u0000Q\u0000R\u0000P\u0000D\u0000O\u0000\\\u0000*\u00003\u00007\n\u00003\u0000U\u0000R\u0000P\u0000S\u0000W\u0000$\u0000'\n\u0000'\u0000L\u0000F\u0000W\u0000$\u00006\u0000\u0003\u0000\u000b\u00002\u0000X\u0000U\u0000V\u0000\f\n\n\u0000\u0015\u0000\u0018\n\n\u0000\u0014\u0000\u0019\n\n\u0000\u0014\n\n\u0000\u0015\n\n\u00005\u0000(\u00006\u0000&amp;\n\n\u0000\u0017\n\u00001\u0000X\u0000P\u0000E\u0000H\u0000U\u0000\u0003\u0000R\u0000I\u0000\u0003\u00006\u0000K\u0000R\u0000W\u0000V\n\n\u0000\u001b\n\n\u0000\u0014\u0000\u0019\n\n\u0000%\u0000U\u0000D\u0000V\u00007\u00006\n\u0000\u0019\u0000\u0018\n\n\u0000\u0017\u0000\u0018\n\u0000\u001a\u0000\u0013\n\n\u0000\u0019\u0000\u0013\n\n\u0000\u0019\u0000\u0013\n\n\u0000\u0017\u0000\u0013\n\n\u0000\u0018\u0000\u0018\n\n\u0000\u0018\u0000\u0013\n\n\u0000$\u00003\u0000\u0003\u0000\u000b\u0000\b\u0000\f\n\n\u0000\u0016\u0000\u0018\n\n\u0000$\u00003\u0000\u0003\u0000\u000b\u0000\b\u0000\f\n\n\u0000$\u00003\u0000\u0003\u0000\u000b\u0000\b\u0000\f\n\n\u0000\u0019\u0000\u0013\n\u0000$\u00003\u0000\u0003\u0000\u000b\u0000\b\u0000\f\n\n\u0000\u0016\u0000\u0018\n\n\u0000\u0018\u0000\u0013\n\n\u0000\u0017\u0000\u0013\n\n\u0000\u0016\u0000\u0013\n\n\u0000:\u0000L\u0000Q\u0000&amp;\u0000/\u0000,\u00003\n\u0000$\u00003\u00005\u0000,\u0000/\u0000\u0010\u0000*\u0000$\u00001\n\u0000$\u0000Q\u0000R\u0000P\u0000D\u0000O\u0000\\\u0000*\u00003\u00007\n\u00003\u0000U\u0000R\u0000P\u0000S\u0000W\u0000$\u0000'\n\u0000'\u0000L\u0000F\u0000W\u0000$\u00006\u0000\u0003\u0000\u000b\u00002\u0000X\u0000U\u0000V\u0000\f\n\n\u0000\u0015\u0000\u0018\n\u0000\u0014\n\n\u0000\u0015\n\n\u0000\u0017\n\u00001\u0000X\u0000P\u0000E\u0000H\u0000U\u0000\u0003\u0000R\u0000I\u0000\u0003\u00006\u0000K\u0000R\u0000W\u0000V\n\n\u0000\u001b\n\n\u0000\u0014\u0000\u0019\n\n\u0000\u0017\u0000\u0013\n\n\u0000:\u0000L\u0000Q\u0000&amp;\u0000/\u0000,\u00003\n\u0000$\u00003\u00005\u0000,\u0000/\u0000\u0010\u0000*\u0000$\u00001\n\u0000$\u0000Q\u0000R\u0000P\u0000D\u0000O\u0000\\\u0000*\u00003\u00007\n\u00003\u0000U\u0000R\u0000P\u0000S\u0000W\u0000$\u0000'\n\u0000'\u0000L\u0000F\u0000W\u0000$\u00006\u0000\u0003\u0000\u000b\u00002\u0000X\u0000U\u0000V\u0000\f\n\n\u0000\u0016\u0000\u0013\n\u0000\u0014\n\n\u0000\u0015\n\n\u0000\u0017\n\u00001\u0000X\u0000P\u0000E\u0000H\u0000U\u0000\u0003\u0000R\u0000I\u0000\u0003\u00006\u0000K\u0000R\u0000W\u0000V\n\n\u0000\u001b\n\n\u0000:\u0000L\u0000Q\u0000&amp;\u0000/\u0000,\u00003\n\u0000$\u00003\u00005\u0000,\u0000/\u0000\u0010\u0000*\u0000$\u00001\n\u0000$\u0000Q\u0000R\u0000P\u0000D\u0000O\u0000\\\u0000*\u00003\u00007\n\u00003\u0000U\u0000R\u0000P\u0000S\u0000W\u0000$\u0000'\n\u0000'\u0000L\u0000F\u0000W\u0000$\u00006\u0000\u0003\u0000\u000b\u00002\u0000X\u0000U\u0000V\u0000\f\n\n\u0000\u0016\u0000\u0013\n\n\u0000\u0014\u0000\u0019\n\n\u0000\u0014\n\n\u0000\u0015\n\n\u0000\u0017\n\u00001\u0000X\u0000P\u0000E\u0000H\u0000U\u0000\u0003\u0000R\u0000I\u0000\u0003\u00006\u0000K\u0000R\u0000W\u0000V\n\n\u0000\u001b\n\n\u0000\u0014\u0000\u0019\n\n\u0000\u0018\u0000\u0013\n\u0000\u0017\u0000\u0018\n\u0000\u0017\u0000\u0013\n\n\u0000:\u0000L\u0000Q\u0000&amp;\u0000/\u0000,\u00003\n\u0000$\u00003\u00005\u0000,\u0000/\u0000\u0010\u0000*\u0000$\u00001\n\u0000$\u0000Q\u0000R\u0000P\u0000D\u0000O\u0000\\\u0000*\u00003\u00007\n\u00003\u0000U\u0000R\u0000P\u0000S\u0000W\u0000$\u0000'\n\u0000'\u0000L\u0000F\u0000W\u0000$\u00006\u0000\u0003\u0000\u000b\u00002\u0000X\u0000U\u0000V\u0000\f\n\n\u0000\u0016\u0000\u0018\n\u0000\u0016\u0000\u0013\n\u0000\u0014\n\n\u0000\u0015\n\n\u0000\u0017\n\u00001\u0000X\u0000P\u0000E\u0000H\u0000U\u0000\u0003\u0000R\u0000I\u0000\u0003\u00006\u0000K\u0000R\u0000W\u0000V\n\n\u0000\u001b\n\n\u0000\u0014\u0000\u0019\n\nFigure 3. Comparison with four representative VLM-based methods under different numbers of shots. The pixel-level AP on seven datasets\nis reported. DictAS demonstrates consistent improvements over the compared methods for all shots. As the number of reference images\nincreases, DictAS shows a greater advantage, unlike some methods that exhibit instability or even a decline (e.g., WinCLIP in BrasTS).\n\nthe industrial and medical domain are conducted. Specifically, five commonly used industrial anomaly segmentation\ndatasets are adopted: MVTecAD [3], VisA [43], MVTec3D\n[4], MPDD [17], and BTAD [25]. Additionally, two medical datasets are included: BraTS [24] for brain tumor segmentation and RESC [14] for retinal lesion detection. For\nMVTec3D, only RGB images in the dataset are adopted.\nFollowing [7, 13, 38], we utilize all normal images from\nthe industrial dataset VisA [43] as auxiliary data for selfsupervised training and directly conduct few-normal-shot\ntesting on remaining industrial and medical datasets. To\nevaluate VisA itself, MVTecAD [3] is adopted for auxiliary training. Notably, since a self-supervised paradigm is\nemployed, any image without pixel-level annotations can\nserve as auxiliary training data, including those from natural scenes. In Appendix C.2, we further analyze the impact\nof different auxiliary training sets through ablation studies.\n\nrics in the main text: Area Under the Receiver Operating\nCharacteristic (AUROC), Per-Region Overlap (PRO), and\nthe Average Precision (AP). As a supplement, we also report anomaly classification metrics in Appendix E.1, where\nthe classification score for each image is obtained following\nthe same strategy as APRIL-GAN [7]. We present the performance for different values of the few-shot normal samples, with k set to 1, 2, 4, 8, and 16.\nImplementation Details. Similar to recent state-of-theart FSAS methods [7, 16, 20], we adopt the CLIP model\n(ViT-L-14-336), pretrained by OpenAI [30], as the default\nbackbone in DictAS. All input images are uniformly resized\nto 336 × 336 before being fed into the model. During training, we extract the 6th, 12th, 18th, and 24th layers from\nthe frozen image encoder as patch-level features, following\nAPRIL-GAN [7]. This multi-level feature selection balances low-level appearance and high-level semantics, and\nfacilitates a fair comparison with prior work. The balancing\ncoefficients λ1 and λ2 for the regularization loss are both\n\nEvaluation Metrics. Since this paper primarily focuses\non anomaly segmentation, we report three pixel-level met6\n\n\flution as our DictAS.\nQuantitative Comparison. Table 1 presents the quantitative results of ZSAS across different datasets under the 4shot setting in both industrial and medical domains. DictAS\nconsistently outperforms existing methods, achieving stateof-the-art FSAS performance. Compared to the suboptimal\nmethod, DictAS improves AUROC, PRO, and AP by 1.3%,\n2.6% and 5.5%, respectively, on industrial datasets, and by\n0.7%, 1.2%, 4.2% on medical datasets. Notably, most of\nthe suboptimal results are achieved on PromptAD, which\nis a class-dependent method that requires fine-tuning a new\nmodel for each unseen class, limiting its scalability. In contrast, our DictAS removes this dependency, enabling classgeneralizable FSAS in a unified model, which is more flexible and efficient. In addition, DictAS outperforms other\nclass-generalizable methods (e.g., WinCLIP, APRIL-GAN)\nby a large margin across all metrics. This is because it\nadopts a self-supervised training paradigm to learn crosscategory dictionary lookup capabilities, rather than relying\non prior knowledge from previous real anomaly samples or\npretraining. Figure 3 further illustrates the variations in AP\nacross seven datasets under different numbers of shots. It\ncan be observed that DictAS demonstrates consistent improvements over the compared methods for all shots. This\nimprovement is attributed to our sparse lookup strategy,\nwhich helps reduce feature redundancy at higher shots.\nQualitative Comparison. In Figure 4, we present visualization results from industrial and medical datasets under the 4-shot setting. Overall, our DictAS achieves more\nprecise and complete anomaly localization, attributed to\nthe global lookup capability learned during self-supervised\ntraining via the designed Dictionary Key/Query/Value Generator.\nEfficiency Comparison. Table 2 compares the efficiency of different methods, including the average inference\ntime per image and the maximum GPU memory usage per\nimage during inference. The experimental results show that\nthe proposed DictAS achieves the fastest inference speed\nand the best FSAS performance. Although few-shot methods are susceptible to variations in reference images, experimental results show that DictAS exhibits greater stability\nwith lower standard deviation compared to other methods.\n\nGroundtruth\n\nWinCLIP\n\nAPRIL-GAN\n\nAnomalyGPT\n\nPromptAD\n\nDictAS\n\nBottle\n\nCable\n\nCashew\n\nPCB\n\nBrain\n\nBrain\n\nRetina\n\nRetina\n\nFigure 4. Qualitative comparison of anomaly segmentation results\nacross different FSAS methods.\nTable 2. The comparison of model efficiency on MVTecAD under\nthe 4-shot setting (mean±std for AP).\nMethod\n\nBackbone\n\nResolution\n\nGPU Cost\n(GB)\n\nTime\n(ms)\n\nAP (%)\n\nRegAD [38]\nAnomalyGPT [13]\nFastRecon [11]\nFastRecon+ [11]\nWinCLIP [16]\nAPRIL-GAN [7]\nPromptAD [20]\n\nResNet18\nImageBind-Huge\nWide-ResNet50\nViT-L-14-336\nViT-L-14-336\nViT-L-14-336\nViT-L-14-336\n\n224 × 224\n224 × 224\n336 × 336\n336 × 336\n336 × 336\n336 × 336\n336 × 336\n\n7.1\n19.1\n1.0\n3.4\n15.8\n3.8\n2.1\n\n5790.1\n1555.2\n110.9\n150.5\n8227.5\n227.6\n81.3\n\n46.5±1.2\n52.9±0.5\n47.0±0.7\n53.9±0.6\n39.2±1.1\n46.6±0.5\n57.5±0.6\n\nDictAS\n\nViT-L-14-336\n\n336 × 336\n\n3.4\n\n73.5\n\n66.8±0.4\n\nset to 0.1 by default. During the auxiliary training stage,\ntwo types of data transformations—Geometric Transformations (e.g., Random Rotation) and Occlusion Augmentations (e.g., Random GridDropout)—are applied to the raw\nimages to generate reference images. We use the Adam optimizer [18] to train DictAS for 30 epochs, with an initial\nlearning rate of 0.0001 and a batch size of 24. All experiments were conducted on a single NVIDIA 3090 with 24GB\nof GPU memory. More details can be found in Appendix A.\n\n4.2. Comparison with State-of-the-art methods\nCompeting Methods. In this study, we compare our DictAS with six state-of-the-art (SOTA) methods: RegAD\n[15], AnomalyGPT [13], FastRecon [11], WinCLIP [16],\nAPRIL-GAN [7], and PromptAD [20]. Among these,\nPromptAD follows a class-dependent FSAS setting, while\nthe other methods adopt a class-generalizable setting. To\nensure a fair comparison, all methods were evaluated using the same k normal reference images and repeated five\ntimes. Additionally, we introduce a variant of FastRecon\nthat incorporates CLIP image encoder as the feature extractor, referred to as FastRecon+. All CLIP-based methods\n[7, 16, 20] utilize the same backbone and input image reso-\n\n4.3. Ablation\nUnless otherwise specified, all ablation experiments in this\nsubsection are conducted on the MVTecAD [3] dataset under the 4-shot setting.\nThe effects of components. Ablation studies on both\nmodules and loss functions are conducted as shown in Table 3. In the module ablation, it can be observed that when\nany generator is removed and the original image features\nare employed instead, the performance of DictAS drops to\nvarying degrees. This is mainly due to the fact that the\n7\n\n\fTable 3. Ablation on different components (%).\n\nTable 5. Ablation on backbone and input resolution (%).\n\nAUROC\n\nPRO\n\nAP\n\nBackbone\n\nResolution\n\nAUROC\n\nPRO\n\nAP\n\nTime (ms)\n\nModule\nAblation\n\nw/o Query Generator\nw/o Key Generator\nw/o Value Generator\n\n97.5\n97.9\n98.0\n\n94.2\n94.5\n94.6\n\n63.5\n63.8\n64.2\n\nLoss\nAblation\n\nw/o LCQC\nw/o LT AC\nw/o LCQC and LT AC\n\n97.4\n98.0\n97.1\n\n94.1\n94.6\n93.5\n\n64.6\n65.0\n63.7\n\nViT-B-16-224\nViT-L-14-224\nViT-L-14-336\nViT-L-14-336\nViT-L-14-336\n\n336 × 336\n336 × 336\n336 × 336\n420 × 420\n518 × 518\n\n98.1\n98.3\n98.6\n98.6\n98.7\n\n93.3\n94.3\n95.1\n95.4\n95.6\n\n64.8\n66.2\n66.8\n67.6\n68.7\n\n43.3\n73.5\n73.5\n130.2\n235.6\n\nDictAS\n\n98.6\n\n95.1\n\n66.8\n\n(a) Without Query Discrimination Regularization\n\npresents an evaluation of various dictionary lookup strategies. The experimental results indicate that the proposed\nSparse Lookup achieves the highest AP across all shot\nsettings. Moreover, compared to other strategies, Sparse\nLookup demonstrates greater advantages when the number\nof reference images increases (e.g., in the 8-shot and 16shot settings). This is primarily because it maintains query\nsparsity while utilizing a larger set of Dictionary Values, effectively mitigating feature redundancy in the dictionary.\nThe effects of backbone and resolution. Table 5 evaluates the impact of different input resolutions and CLIP\nbackbones on DictAS. Despite the significant differences\namong the pre-trained backbones (top three rows), the\nanomaly segmentation performance of DictAS remains relatively stable, especially in terms of AUROC. This indicates\nthat our method is not highly dependent on the original\nvisual representations. The reason is that self-supervised\ntraining on the auxiliary dataset equips the model with\ncategory-agnostic dictionary lookup capabilities, thereby\nreducing reliance on original features. Additionally, with\nthe increase in input resolution, we observe a significant improvement in AP, but the inference time per image also increases considerably. To strike a balance, we adopt a default\nsetting of 3362 resolution with the ViT-L-14-336 backbone.\n\n(b) With Query Discrimination Regularization\n\nFigure 5. Feature t-SNE visualization. (a) / (b) represent the cases\nwithout / with Query Discrimination Regularization, respectively.\nTable 4. Ablation on dictionary lookup strategies. The pixel level\nAP (%) is employed to evaluate under different shots.\nLookup Strategy\n\n1-shot\n\n2-shot\n\n4-shot\n\n8-shot\n\n16-shot\n\nMaximum Lookup\nDense Lookup\nSparse Lookup\n\n52.2\n60.2\n61.1\n\n56.5\n62.9\n63.9\n\n59.1\n63.7\n66.8\n\n59.7\n63.6\n67.0\n\n60.6\n63.8\n68.5\n\ndesigned AttnBlock in the generator provides global attention for dictionary lookup, which facilitates sparse matching of Query-Key pairs and weighted fusion of the Dictionary Value. For the loss function, we performed ablation\non the two regularization constraints and found that they\njointly influence the final FSAS performance. Compared to\nthe constraint LCQC , which affects the global feature space,\nconstraint LT AC enhances the discriminability of anomalous regions in the fine-grained feature space, resulting in\ngreater performance gains (e.g. 2.2% ↑AP vs. 1.8% ↑AP).\nTo further visualize the impact of the proposed Query\nDiscrimination Regularization on the results, we randomly\nselected 40 images from the category cable of MVTecAD\nand performed t-SNE visualization on the feature map\n(Fr −Fq ), which is obtained by taking the residual between\nthe Query Feature and Retrieved Result from the same\nlayer. As shown in Figure 5, without the Query Discrimination Regularization ( w/o LCQC and LT AC ), the boundary between normal and anomalous regions in the residual\nfeatures remains ambiguous. However, when the regularization is applied, the residual features become more distinguishable between normal and anomalous regions, thereby\nfacilitating easier anomaly discrimination.\nThe effects of dictionary lookup strategies. Table 4\n\n5. Conclusion\nIn this paper, we introduce DictAS, a novel framework for class-generalizable few-shot anomaly segmentation (FSAS). Inspired by human inspectors, we reformulate FSAS as a dictionary lookup task. An anomaly is detected when the query feature cannot be retrieved from the\ndictionary constructed from normal reference image features. Through self-supervised training on seen classes\nfrom an auxiliary dataset, DictAS learns a transferable dictionary lookup ability, enabling it to generalize effectively\nto unseen classes in FSAS. To further enhance anomaly\ndiscrimination, we introduce query discrimination regularization, which is jointly optimized with the query loss to\nmake anomalous features less retrievable from the dictionary. The final anomaly map is computed based on the cosine distance between the query feature and its retrieval result. Extensive experiments on seven industrial and medical\ndatasets demonstrate that DictAS surpasses SOTA methods\nin FSAS performance while also achieving the fastest inference speed with comparable stability.\n8\n\n\fAcknowledgement\n\n[10] Mark Everingham, Luc Van Gool, Christopher KI Williams,\nJohn Winn, and Andrew Zisserman. The pascal visual object\nclasses (voc) challenge. International journal of computer\nvision, 88:303–338, 2010. 15, 16\n[11] 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, 6, 7, 14, 18,\n19\n[12] Bin-Bin Gao. Metauas: Universal anomaly segmentation\nwith one-prompt meta-learning. Advances in Neural Information Processing Systems, 37:39812–39836, 2025. 3, 14\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\nProceedings of the AAAI Conference on Artificial Intelligence, pages 1932–1940, 2024. 1, 2, 3, 6, 7, 14, 16, 18,\n19\n[14] Junjie Hu, Yuanyuan Chen, and Zhang Yi. Automated segmentation of macular edema in oct using deep neural networks. Medical image analysis, 55:216–227, 2019. 6, 11,\n19\n[15] Chaoqin Huang, Haoyan Guan, Aofan Jiang, Ya Zhang,\nMichael Spratling, and Yan-Feng Wang. Registration based\nfew-shot anomaly detection. In European Conference on\nComputer Vision, pages 303–319. Springer, 2022. 1, 3, 6,\n7, 14, 18, 19\n[16] Jongheon Jeong, Yang Zou, Taewan Kim, Dongqing Zhang,\nAvinash Ravichandran, and Onkar Dabeer. Winclip: Zero/few-shot anomaly classification and segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision\nand Pattern Recognition, pages 19606–19616, 2023. 1, 2, 3,\n5, 6, 7, 13, 18, 19\n[17] Stepan Jezek, Martin Jonak, Radim Burget, Pavel Dvorak,\nand Milos Skotak. Deep learning-based defect detection of\nmetal parts: evaluating current methods in complex conditions. In 2021 13th International congress on ultra modern telecommunications and control systems and workshops\n(ICUMT), pages 66–71. IEEE, 2021. 6, 11, 19\n[18] Diederik P Kingma and Jimmy Ba. Adam: A method for\nstochastic optimization. arXiv preprint arXiv:1412.6980,\n2014. 7, 13\n[19] Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep\nlearning. nature, 521(7553):436–444, 2015. 5\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 Conference on\nComputer Vision and Pattern Recognition, pages 16838–\n16848, 2024. 1, 2, 3, 6, 7, 13, 14, 18, 19\n[21] Jingyi Liao, Xun Xu, Manh Cuong Nguyen, Adam Goodge,\nand Chuan Sheng Foo.\nCoft-ad: Contrastive finetuning for few-shot anomaly detection. arXiv preprint\narXiv:2402.18998, 2024. 1, 2\n[22] Dwarikanath Mahapatra, Behzad Bozorgtabar, and\nZongyuan Ge. Medical image classification using generalized zero shot learning. In Proceedings of the IEEE/CVF\n\nThis work is supported in part by the National Natural Science Foundation of China under Grant Nos. 62373350 and\n62371179; in part by the Youth Innovation Promotion Association CAS (2023145); in part by the Beijing Nova Program 20240484687; in part by the Beijing Municipal Natural Science Foundation (China) 4252053; in part by the\nLongmen Laboratory “Research and Development Project\nof General-Purpose AI Platform Software Based on Industrial Quality Inspection Large Model”.\n\nReferences\n[1] Syed Muhammad Anwar, Muhammad Majid, Adnan\nQayyum, Muhammad Awais, Majdi Alnowami, and Muhammad Khurram Khan. Medical image analysis using convolutional neural networks: a review. Journal of medical systems,\n42:1–13, 2018. 1\n[2] Niamh Belton, Misgina Tsighe Hagos, Aonghus Lawlor,\nand Kathleen M Curran. Fewsome: One-class few shot\nanomaly detection with siamese networks. In Proceedings\nof the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 2977–2986, 2023. 1, 2\n[3] 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, 7, 11, 14, 16, 19\n[4] Paul Bergmann, Xin Jin, David Sattlegger, and Carsten Steger. The mvtec 3d-ad dataset for unsupervised 3d anomaly\ndetection and localization. arXiv preprint arXiv:2112.09045,\n2021. 6, 11, 14, 19\n[5] Yunkang Cao, Jiangning Zhang, Luca Frittoli, Yuqi Cheng,\nWeiming Shen, and Giacomo Boracchi. Adaclip: Adapting\nclip with hybrid learnable prompts for zero-shot anomaly detection. In European Conference on Computer Vision, pages\n55–72. Springer, 2024. 1\n[6] Qiyu Chen, Huiyuan Luo, Haiming Yao, Wei Luo, Zhen Qu,\nChengkan Lv, and Zhengtao Zhang. Center-aware residual\nanomaly synthesis for multiclass industrial anomaly detection. IEEE Transactions on Industrial Informatics, pages 1–\n11, 2025. 1\n[7] Xuhai Chen, Yue Han, and Jiangning Zhang. April-gan:\nA zero-/few-shot anomaly classification and segmentation\nmethod for cvpr 2023 vand workshop challenge tracks 1&amp;2:\n1st place on zero-shot ad and 4th place on few-shot ad. arXiv\npreprint arXiv:2305.17382, 2023. 1, 2, 3, 6, 7, 13, 16, 17,\n18, 19\n[8] Niv Cohen and Yedid Hoshen.\nSub-image anomaly\ndetection with deep pyramid correspondences. CoRR,\nabs/2005.02357, 2020. 3\n[9] 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. 3\n\n9\n\n\f[34] Shelly Sheynin, Sagie Benaim, and Lior Wolf. A hierarchical\ntransformation-discriminating generative model for few shot\nanomaly detection. In Proceedings of the IEEE/CVF international conference on computer vision, pages 8495–8504,\n2021. 1, 2\n[35] Jhih-Ciang Wu, Ding-Jie Chen, Chiou-Shann Fuh, and TyngLuh Liu. Learning unsupervised metaformer for anomaly detection. In Proceedings of the IEEE/CVF international conference on computer vision, pages 4369–4378, 2021. 3\n[36] Jhih-Ciang Wu, Ding-Jie Chen, Chiou-Shann Fuh, and TyngLuh Liu. Learning unsupervised metaformer for anomaly\ndetection. In Proceedings of the IEEE/CVF International\nConference on Computer Vision, pages 4369–4378, 2021. 1\n[37] Guoyang Xie, Jinbao Wang, Jiaqi Liu, Feng Zheng, and\nYaochu Jin. Pushing the limits of fewshot anomaly detection in industry vision: Graphcore. arXiv preprint\narXiv:2301.12082, 2023. 3\n[38] Xincheng Yao, Zixin Chen, Chao Gao, Guangtao Zhai, and\nChongyang Zhang. Resad: A simple framework for class\ngeneralizable anomaly detection. Advances in Neural Information Processing Systems, 37:125287–125311, 2025. 3, 6,\n7, 14, 16\n[39] 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. 5, 11, 12\n[40] Bolei Zhou, Hang Zhao, Xavier Puig, Sanja Fidler, Adela\nBarriuso, and Antonio Torralba. Scene parsing through\nade20k dataset. In Proceedings of the IEEE conference on\ncomputer vision and pattern recognition, pages 633–641,\n2017. 15, 16\n[41] Qihang Zhou, Guansong Pang, Yu Tian, Shibo He, and Jiming Chen. AnomalyCLIP: Object-agnostic prompt learning\nfor zero-shot anomaly detection. In The Twelfth International Conference on Learning Representations, 2024. 1, 13\n[42] Jiawen Zhu and Guansong Pang. Toward generalist anomaly\ndetection via in-context residual learning with few-shot sample prompts. In Proceedings of the IEEE/CVF Conference\non Computer Vision and Pattern Recognition, pages 17826–\n17836, 2024. 3\n[43] 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, 11, 14, 15, 16, 19\n\ninternational conference on computer vision, pages 3344–\n3353, 2021. 1\n[23] Andre Martins and Ramon Astudillo. From softmax to\nsparsemax: A sparse model of attention and multi-label classification. In International conference on machine learning,\npages 1614–1623. PMLR, 2016. 4\n[24] Bjoern H Menze, Andras Jakab, Stefan Bauer, Jayashree\nKalpathy-Cramer, Keyvan Farahani, Justin Kirby, Yuliya\nBurren, Nicole Porz, Johannes Slotboom, Roland Wiest,\net al. The multimodal brain tumor image segmentation\nbenchmark (brats). IEEE transactions on medical imaging,\n34(10):1993–2024, 2014. 1, 6, 11, 14, 15, 16, 19\n[25] Pankaj Mishra, Riccardo Verk, Daniele Fornasier, Claudio\nPiciarelli, and Gian Luca Foresti. Vt-adl: A vision transformer network for image anomaly detection and localization. In 2021 IEEE 30th International Symposium on Industrial Electronics (ISIE), pages 01–06. IEEE, 2021. 6, 11, 14,\n16, 19\n[26] Shichen Qu, Xian Tao, Xinyi Gong, Zhen Qu, Mukesh\nPrasad, Fei Shen, Zhengtao Zhang, and Guiguang Ding.\nLscad: A large-small model collaboration framework for unsupervised industrial anomaly detection. IEEE Transactions\non Instrumentation and Measurement, 2025. 1\n[27] Zhen Qu, Xian Tao, Fei Shen, Zhengtao Zhang, and Tao Li.\nInvestigating shift equivalence of convolutional neural networks in industrial defect segmentation. IEEE Transactions\non Instrumentation and Measurement, 72:1–17, 2023. 1\n[28] Zhen Qu, Xian Tao, Mukesh Prasad, Fei Shen, Zhengtao\nZhang, Xinyi Gong, and Guiguang Ding. Vcp-clip: A visual\ncontext prompting model for zero-shot anomaly segmentation. In European Conference on Computer Vision, pages\n301–317. Springer, 2024. 1\n[29] Zhen Qu, Xian Tao, Xinyi Gong, Shichen Qu, Qiyu Chen,\nZhengtao Zhang, Xingang Wang, and Guiguang Ding.\nBayesian prompt flow learning for zero-shot anomaly detection. In Proceedings of the Computer Vision and Pattern\nRecognition Conference, pages 30398–30408, 2025. 1\n[30] 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. 1, 6, 13\n[31] Karsten Roth, Latha Pemula, Joaquin Zepeda, Bernhard\nSchölkopf, Thomas Brox, and Peter Gehler. Towards total recall in industrial anomaly detection. In Proceedings\nof the IEEE/CVF conference on computer vision and pattern\nrecognition, pages 14318–14328, 2022. 3\n[32] Marco Rudolph, Bastian Wandt, and Bodo Rosenhahn. Same\nsame but differnet: Semi-supervised defect detection with\nnormalizing flows. In Proceedings of the IEEE/CVF winter\nconference on applications of computer vision, pages 1907–\n1916, 2021. 2\n[33] Eli Schwartz, Assaf Arbelle, Leonid Karlinsky, Sivan\nHarary, Florian Scheidegger, Sivan Doveh, and Raja Giryes.\nMaeday: Mae for few-and zero-shot anomaly-detection.\nComputer Vision and Image Understanding, page 103958,\n2024. 1, 2\n\n10\n\n\fAppendix for DictAS: A Framework for Class-Generalizable Few-Shot Anomaly Segmentation\nvia Dictionary Lookup\nThis appendix includes the following five parts: 1) More experimental details (e.g. datasets, self-supervised training) in\nSection A; 2) Detailed description of SOTA methods and comparison with contemporaneous approaches (e.g., MetaUAS,\nResAD) in Section B; 3) Additional ablation studies (e.g., hyperparameters, auxiliary datasets, data transformations) in\nSection C; 4) Limitations of our methods in Section D; 5) Presentation of more detailed quantitative and qualitative results\nof few-shot anomaly classification / segmentation in Section E.\n\nA. Experimental Details\nA.1. Details of the Datasets\nTable 6. Key statistics of the datasets. (a, b) in the training/testing sets denotes the number of normal and abnormal samples, respectively.\n|C| is the number of categories. Note that anomaly segmentation datasets have only normal images in the training set.\nDomain\n\nDataset\n\nCategory\n\nModality\n\n|C|\n\nTesting Set\n\nTraining Set\n\nUsage\n\nIndustrial\n\nMVTecAD [3]\nVisA [43]\nMVTec3D [4]\nMPDD [17]\nBTAD [25]\n\nObj &amp;texture\nObj\nObj\nObj\nObj\n\nPhotography\nPhotography\nPhotography+Depth\nPhotography\nPhotography\n\n15\n12\n10\n6\n3\n\n(467, 1258)\n(962, 1200)\n(249, 948)\n(176, 282)\n(451, 290)\n\n(3629, 0)\n(8659, 0)\n(2656, 0)\n(888, 0)\n(1799, 0)\n\nIndustrial defect detection\nIndustrial defect detection\nIndustrial defect detection\nIndustrial defect detection\nIndustrial defect detection\n\nMedical\n\nRESC [14]\nBrasTS [24]\n\nRetina\nBrain\n\nPhotography\nRadiology(MRI)\n\n1\n1\n\n(1041, 764)\n(828, 1948)\n\n(4297, 0)\n(4211, 0)\n\nRetinal Lesion Detection\nBrain Tumor Segmentation\n\nIn this study, we conduct extensive experiments on 7 public datasets covering industrial and medical domains to assess\nthe effectiveness of our methods, including MVTecAD [3], VisA [43], MVTec3D [4], MPDD [17], BTAD [25], RESC [14]\nand BrasTS [24]. The key statistics for these datasets are demonstrated in Table 6. In this study, normal reference images are\nrandomly selected from the training set, and all samples from the testing set are used to evaluate the model’s performance.\nBy default, all samples in the VisA training set are treated as seen classes for self-supervised training and are subsequently\ntested on other datasets. For VisA itself, the training set in MVTeAD is used as an auxiliary training dataset.\n\nA.2. Details of Self-Supervised Training\nThis subsection further elaborates on the online construction of auxiliary data for self-supervised training.\nIn the self-supervised training stage,both query and reference images are dynamically constructed from raw images belonging to any seen class. Note that this process is conducted online. Specifically, given a raw image X, we apply random\ntransformations (e.g., random rotation) to generate a corresponding reference image, simulating the few normal reference\nimages Xn available in the real anomaly segmentation process. In DictAS, we by default use Geometric Transformations\nand Occlusion Transformations as shown in Figure 6. Detailed descriptions and parameters for each transformation type are\nprovided in Listing 1. Additional ablation studies investigating the effect of different transformation types can be found in\nSection C.\nFor the query image Xq , it is derived from the raw image using the anomaly synthesis algorithm proposed in DRAEM\n[39]. The detailed strategy for synthesizing the query image during self-supervised training is described in Algorithm A.\nAlongside the synthesized image, the pixel-level pseudo-label G and the image-level pseudo-label yq are also generated\nusing the Berlin noise mask. These pseudo-labels are used to compute the query contrastive loss and the text alignment loss,\nboth of which act as regularization terms during self-supervised training.\n\n11\n\n\fRaw Image\n\nRaw Image\n\nQuery Image\n\nQuery Image\n\nReference Image\n\nReference Image\n\n(a) Acquisition of auxiliary training data from\nnatural images\n\n(b) Acquisition of auxiliary training data from\nindustrial images\n\nFigure 6. Acquisition of the auxiliary training data. Given a raw image without pixel-level annotations, the query image is generated\nusing an anomaly synthesis algorithm [39], while the normal reference image is obtained via data transformations (e.g., random rotation).\nBoth natural images shown in (a) and industrial images shown in (b) can be utilized as sources to construct auxiliary training data.\n\n1\n2\n\nimport albumentations as A\nimport cv2\n\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n\nimg_trans_for_reference = A.Compose([\nA.RandomRotate90(p = 1),\nA.Rotate(limit=[30, 270], p=1.0),\nA.HorizontalFlip(p=0.5),\nA.VerticalFlip(p=0.5),\nA.GridDropout(ratio=0.3, p=0.5),\nA.CoarseDropout(max_holes=8, max_height=32, max_width=32, p=0.5),\n], is_check_shapes=False)\nX_raw = cv2.imread(\"raw_img_path\")\n# Read the raw image\n# Perform data transformation on the raw image to simulate the reference image.\nX_reference = img_trans_for_reference(img = X_raw)\n\nListing 1. Data transformation for generating the reference image in the self-supervised training stage.\n\nAlgorithm 2 Anomaly synthesis strategy for generating the query image in the self-supervised training stage.\nInput: Raw image X; Anomaly source image A; Perlin noise generator P ; Image size H and W ; Noise resolution rx and\nry ; Blending parameter γ; Binarization threshold λ\nOutput: Query image Xq , pixel-level pseudo-label G, image-level pseudo-label yq .\n1: while True do\n2:\nG ← where(P (H, w, rx , ry ) &gt; λ)\n3:\nMA ← G × X\nMA ← 1 - MA\n4:\n5:\nXq ← γ(MA ⊙ A) + (1 − γ)(MA ⊙ X) + MA ⊙ X\n6: end while\n7: if SUM(G) is 0 then\n8:\nyq ← 0\n9: else\n10:\nyq ← 1\n11: end if\n12: return Xq , G, yq\n\n12\n\n\fA.3. Details of Text Prompt Design\nIn this work, two types of text prompts (normal descriptions and anomaly descriptions) are fed into the text encoder of\nCLIP to generate text embeddings. The global image representation obtained from the Retrieved Result Flr is constrained\nto align with the normal text embedding space, thereby enhancing anomaly discrimination capability. Since the design of\ntext prompts is not the focus of this study, we directly follow the design principles of WinCLIP [16] (i.e. text prompt\nensemble). Specifically, to obtain normal text embeddings, the object category name (e.g., bottle) and state are inserted into\npredefined prompt templates to generate multiple semantically similar normal prompts. These prompts are encoded by the\ntext encoder, and the resulting embeddings are averaged to form the final normal text representation. Similarly, the abnormal\ntext embeddings are constructed in the same manner by replacing the state with an anomalous one. The details of the prompt\ntemplate and the settings of normal/abnormal [state] are illustrated in Figure 7.\nState-level (normal)\n\"flawless [class]\"\n\"perfect [class]\"\n\"unblemished [class]\"\n\"normal [class]\"\n\"[class] without flaw\"\n\"[class] without defect\"\n\"[class] without damage\"\n\nState-level (abnormal)\n\"damaged [class]\"\n\"broken [class]\"\n\"abnormal [class]\"\n\"imperfect [class]\"\n\"[class] with flaw\"\n\"[class] with defect\"\n\"[class] with damage\"\n\nTemplate-level\n\"a photo of a/the [state][class].\"\n\"a cropped photo of a/the [state][class].\"\n\"a good photo of the [state][class].\"\n\"a bright photo of a/the [state][class].\"\n\"a photo of my [state][class].\"\n\"a dark photo of a/the [state][class].\"\n\"a photo of the [state][class].\"\n\"a black and white photo of a/the [state][class].\"\n\"a photo of a/the [state][class].\"\n\"a jpeg corrupted photo of a/the [state][class].\"\n\"a photo of a/the small [state][class].\"\n\"a close-up photo of the [state][class].\"\n\"a bad photo of a/the [state][class].\"\n\"There is a/the [state][class] in the scene.\"\n\"a low resolution photo of a/the [state][class].\" \"This is one [state][class] in the scene.\"\n\nFigure 7. Detailed design of prompt template and normal/abnormal [state] words for text prompt ensemble.\n\nA.4. Details of Implementation\nSimilar to recent state-of-the-art FSAS methods [7, 16, 20], we adopt the CLIP model (ViT-L-14-336), pretrained by OpenAI\n[30], as the default backbone for our DictAS. All input images are uniformly resized to 336 × 336 before being fed into the\nmodel. During training, we extract the 6th, 12th, 18th, and 24th layers from the frozen image encoder as patch-level features\nsimilar to [7]. To increase the receptive field, average pooling with a kernel size of 3 is applied to the patch-level features\nextracted from the CLIP image encoder. The regularization loss balancing coefficients, λ1 and λ2 , are both set to 0.1 by\ndefault. During the auxiliary training phase, two types of data transformations—Geometric Transformations (e.g., Random\nRotation) and Occlusion Augmentations (e.g., Random GridDropout)—are applied to the raw images to generate reference\nimages. For computational efficiency, the number of reference images is set to k = 1 during training. During inference,\nk ≥ 1 normal reference images are used as visual prompts. To ensure a fair comparison, all methods are evaluated using the\nsame k normal reference images. Each experiment is repeated five times with different random seeds. DictAS is trained for\n30 epochs using the Adam optimizer [18], with an initial learning rate of 0.0001 and a batch size of 24. All experiments are\nconducted on a single NVIDIA RTX 3090 GPU with 24 GB of memory.\n\nB. State-of-the-art Methods\nB.1. Method Introduction and Comparison Details\n• WinCLIP [16] is one of the earliest works based on CLIP for the zero/few shot anomaly segmentation task. Since the\nvanilla CLIP [30] does not align text with fine-grained image features during pretraining, it addresses this limitation by\ndividing the input image into multiple sub-images using windows of varying scales. The final language-guided anomaly\nsegmentation results are derived by harmoniously aggregating the classification outcomes of sub-images corresponding\nto the same spatial locations. To leverage the few normal reference images, it also employs memory bank-based nearest\nneighbor retrieval to obtain visually guided anomaly maps. For a fair comparison, we report the results using ViT-L-14-336\nas the backbone with an input resolution of 336 × 336, based on the reproduced code from [41].\n• APRIL-GAN [7] adopts the handcrafted textual prompt design strategy from WinCLIP. However, for aligning textual and\nvisual features, it introduces a linear adapter layer to project fine-grained patch features into a joint embedding space. After\nbeing trained on real anomalous samples with pixel-level, it can directly generalize to unseen classes. A memory-bank\nstrategy like WinCLIP [16] is also adopted to enhance text-image alignment results. For a fair comparison, we retrained\nthe model using the official code on ViT-L-14-336 with a resolution of 336 × 336 and re-evaluated it across all industrial\nand medical datasets.\n13\n\n\f• RegAD [15] first proposed a feature registration strategy using a spatial transformer network for class-generalizable FSAS.\nWith a meta-learning training approach, it demonstrates strong generalization to unseen classes. However, its performance\non unseen category objects heavily depends on extensive augmentation of normal reference images and utilizes distribution\nestimation to generate the final anomaly map, making it less memory-efficient. In this work, we retrained RegAD using the\nsame auxiliary dataset as our DictAS, i.e., trained on all classes of the VisA training set and tested on other datasets. For\nevaluation on VisA, the weights were obtained using MVTecAD as the auxiliary training set. Since RegAD has a specific\nbackbone-dependent network structure, the backbone and resolution from the original paper were adopted (ResNet-18,\n224 × 224).\n• Fastrecon [11] models class-generalizable FSAS as a feature reconstruction problem based on linear regression. By\ndesigning a distribution regularization term and solving the analytical solution, it demonstrates excellent cross-category\ngeneralization in a training-free manner. However, as the number of reference images increases, the linear model may\ntheoretically overfit arbitrary features, which means that Fastrecon still faces the challenge of over-reconstruction. In this\nversion, we used the official code and backbone (wide-resnet50, 336×336) from the original paper and tested it across all\ndatasets.\n• Fastrecon+ [11] is a reimplementation of Fastrecon, utilizing the CLIP image encoder as the feature extractor. For a fair\ncomparison, ViT-L-14-336 with a resolution of 336 × 336 is adopted. Following their original paper, we extracted the\ntwo intermediate patch-level features (the 12th and 18th layers) and concatenated them along the embedding dimension to\nconstruct new features. The other experimental hyperparameters are set to be the same as those in the original paper.\n• AnomalyGPT [13] is a class-generalizable FSAS method that integrates a large language model for anomaly segmentation\nand supports multi-turn dialogues with users. It employs supervised training using synthetic anomaly data, allowing the\nmodel to generalize to new classes. We conducted experiments using the official code and evaluated the model’s FSAS\nperformance in the same way as our DictAS. To use the officially pre-trained weights, the original backbone and input\nimage resolution were adopted (ImageBind-Huge, 224 × 224).\n• PromptAD [20] is a class-dependent FSAS method, which is different from other CLIP-based approaches. It directly\ntrains on normal reference images for each class and evaluates on the test set of the same object category. Moreover, it\nproposes a one-class prompt learning method for few-shot anomaly segmentation. Although it outperforms most FSAS\nmethods, the need for fine-tuning on each category limits its practicality in scenarios involving data privacy or rapidly\nchanging environments. For fairness in comparison, we retrained the model on ViT-L-14-336 using an input resolution of\n336 × 336.\n• MetaUAS [12] proposes viewing FSAS as a segmentation change problem. By leveraging meta-learning training on a\nsynthetic dataset, it enables the acquisition of a universal model capable of detecting anomalies in unseen classes. However,\nit is only applicable to situations where a single normal sample is used as the visual prompt (i.e., 1-shot). In this paper, we\nuse it as a concurrent method and compare it with our DictAS.\n• ResAD [38] proposes using learned residual feature distributions to reduce feature variations across different classes for\nclass-generalizable FSAS. It ultimately transforms the anomaly segmentation problem into an out-of-distribution detection\nproblem using a Feature Distribution Estimator, achieving strong performance on unseen classes. In this paper, we employ\nit as a concurrent method and compare its performance with our DictAS.\n\nB.2. Comparison with Concurrent Methods\nTable 7. Comparison with the concurrent state-of-the-art methods. The pixel-level AUROC (%) is reported, and the best results are\nhighlighted in bold. The experimental results of MetaUAS and ResAD are taken from their original papers.\nBackbone\n\nMVTecAD [3]\n\nVisA [43]\n\nBTAD [25]\n\nMVTec3D [4]\n\nBrasTS [24]\n\n1-shot\n\nMetaUAS [12]\nDictAS\nDictAS\n\nEfficientNet-b4\nViT-B-16\nViT-L-14-336\n\n94.6\n97.1\n97.7\n\n92.2\n97.3\n98.0\n\n—\n—\n97.4\n\n—\n—\n97.5\n\n—\n—\n96.5\n\n2-shot\n\nResAD [38]\nDictAS\n\nImageBind-Huge\nViT-L-14-336\n\n95.6\n98.2\n\n95.1\n98.5\n\n96.4\n97.9\n\n97.5\n97.9\n\n94.3\n96.4\n\n4-shot\n\nResAD [38]\nDictAS\n\nImageBind-Huge\nViT-L-14-336\n\n96.9\n98.6\n\n97.5\n98.8\n\n96.8\n98.0\n\n97.9\n98.4\n\n96.1\n97.3\n\nTable 7 compares our DictAS with two contemporary state-of-the-art methods, MetaAUS [12] and ResAD [38]. As\nour method currently applies only to transformer-based architectures, we selected the CLIP pre-trained backbones with\n14\n\n\f\u0000\u001c\u0000\u001c\u0000\u0011\u0000\u0013\n\n\u0000\u001c\u0000\u001a\u0000\u0011\u0000\u0013\n\u0000\u0013\u0000\u0011\u0000\u0014\u0000\u0013\n\n\u0000\u0013\u0000\u0011\u0000\u0014\u0000\u0018\n\n\u00000\u00009\u00007\u0000H\u0000F\u0000$\u0000'\n\u0000%\u00007\u0000$\u0000'\n\n\u0000\u001b\u0000\u001b\n\u0000\u001b\u0000\u0018\n\n\u00000\u00009\u00007\u0000H\u0000F\u0000$\u0000'\n\u0000%\u00007\u0000$\u0000'\n\n\u0000\u0013\u0000\u0011\u0000\u0013\u0000\u0013 \u0000\u0013\u0000\u0011\u0000\u0013\u0000\u0016 \u0000\u0013\u0000\u0011\u0000\u0013\u0000\u0019\n\n\u0000\u001c\u0000\u0014\n\n\u0000\u001b\u0000\u0015\n\n\u0000\u0013\u0000\u0011\u0000\u0015\u0000\u0013\n\n\u0000\u001c\u0000\u001a\u0000\u0011\u0000\u0018\n\u0000\u001c\u0000\u001a\u0000\u0011\u0000\u0013\n\n\u0000\u0013\u0000\u0011\u0000\u0013\u0000\u0013 \u0000\u0013\u0000\u0011\u0000\u0013\u0000\u0016 \u0000\u0013\u0000\u0011\u0000\u0013\u0000\u0019\n\n\u0000\u0013\u0000\u0011\u0000\u0014\u0000\u0013\n\n\u0000\u0013\u0000\u0011\u0000\u0014\u0000\u0018\n\n\u0000\u001c\u0000\u0019\u0000\u0011\u0000\u0018\n\n\u0000\u0013\u0000\u0011\u0000\u0015\u0000\u0013\n\n\u00000\u00009\u00007\u0000H\u0000F\u0000$\u0000'\n\u0000%\u00007\u0000$\u0000'\n\n\u0000\u001c\u0000\u0017\n\n\u0000\u001c\u0000\u001b\u0000\u0011\u0000\u0013\n\n\u00003\u00005\u00002\u0000\u0003\u0000\u000b\u0000\b\u0000\f\n\n\u0000\u001c\u0000\u001a\u0000\u0011\u0000\u0018\n\n\u0000\u001c\u0000\u001b\u0000\u0011\u0000\u0018\n\n\u0000$\u00008\u00005\u00002\u0000&amp;\u0000\u0003\u0000\u000b\u0000\b\u0000\f\n\n\u0000\u001c\u0000\u001b\u0000\u0011\u0000\u0013\n\n\u00003\u00005\u00002\u0000\u0003\u0000\u000b\u0000\b\u0000\f\n\n\u0000$\u00008\u00005\u00002\u0000&amp;\u0000\u0003\u0000\u000b\u0000\b\u0000\f\n\n\u0000\u001c\u0000\u001b\n\n\u0000\u001c\u0000\u0017\n\n\u0000\u001c\u0000\u001b\u0000\u0011\u0000\u0018\n\n\u0000\u001b\u0000\u0019\n\n\u00000\u00009\u00007\u0000H\u0000F\u0000$\u0000'\n\u0000%\u00007\u0000$\u0000'\n\n\u0000\u0013\u0000\u0011\u0000\u0013\u0000\u0013 \u0000\u0013\u0000\u0011\u0000\u0013\u0000\u0016 \u0000\u0013\u0000\u0011\u0000\u0013\u0000\u0019\n\n\u0000\u0013\u0000\u0011\u0000\u0014\u0000\u0013\n\n\u0000\u0013\u0000\u0011\u0000\u0014\u0000\u0018\n\n(a) λ1\n\n\u0000\u001c\u0000\u0013\n\n\u0000\u001b\u0000\u0015\n\n\u0000\u0013\u0000\u0011\u0000\u0015\u0000\u0013\n\n\u0000\u0013\u0000\u0011\u0000\u0013\u0000\u0013 \u0000\u0013\u0000\u0011\u0000\u0013\u0000\u0016 \u0000\u0013\u0000\u0011\u0000\u0013\u0000\u0019\n\n\u0000\u0013\u0000\u0011\u0000\u0014\u0000\u0013\n\n\u0000\u0013\u0000\u0011\u0000\u0014\u0000\u0018\n\n\u0000\u0013\u0000\u0011\u0000\u0015\u0000\u0013\n\n(b) λ2\n\nFigure 8. (a) Ablation study on the weight coefficient λ1 of the query contrastive constraint. (b) Ablation study on the weight coefficient\nλ2 of the text alignment constraint. The experiments are conducted on the MVTecAD and BTAD datasets under the 4-shot setting and the\nmetric pixel-level AUROC and PRO are reported.\nTable 8. Ablation on different auxiliary datasets under 4-shot setting (%).\nAuxiliary\nDataset\n\nMVTecAD\nAUROC PRO\n\nTable 9. Ablation on the scale of auxiliary dataset VisA under\n4-shot setting (%).\n\nBTAD\nAP\n\nAUROC PRO\n\nMVTecAD\n\nScale\nAP\n\nVisA [43]\n\n98.6\n\n95.1\n\n66.8\n\n98.0\n\n83.3\n\n66.8\n\nBrasTS [24]\n\n98.3\n\n95.0\n\n66.2\n\n97.9\n\n83.0\n\n66.2\n\nAde20K [40]\n\n98.4\n\n95.1\n\n66.5\n\n98.1\n\n83.5\n\n66.8\n\nVOC2012 [10]\n\n98.3\n\n94.9\n\n66.4\n\n98.2\n\n83.4\n\n66.9\n\n15%\n35%\n55%\n75%\n95%\n100%\n\nBTAD\n\nAUROC PRO\n\nAP\n\nAUROC PRO\n\nAP\n\n96.8\n97.3\n98.0\n98.3\n98.5\n98.6\n\n62.8\n63.5\n64.6\n66.0\n66.6\n66.8\n\n96.1\n96.6\n97.1\n97.6\n98.0\n98.0\n\n63.3\n63.8\n64.2\n66.5\n66.7\n66.8\n\n92.0\n92.9\n93.5\n94.6\n95.1\n95.1\n\n80.2\n81.7\n82.0\n82.9\n83.2\n83.3\n\nthe smallest (ViT-B-16) and largest (ViT-L-14-336) parameter counts for comparison. The experimental results show that,\namong the reported results, our DictAS achieves state-of-the-art performance in FSAS. Notably, despite using fewer backbone\nparameters than ResAD (which adopts ImageBird-Huge), our ViT-L-14-336-based DictAS performs better, highlighting its\neffectiveness.\n\nC. Additional Ablations\nC.1. Ablation on Hyperparameters\nIn this subsection, we conduct an ablation study on the weighting coefficients λ1 and λ2 , which correspond to the two query\ndiscriminative regularization terms in our method. As shown in Figure 8, the model achieves optimal performance when\nboth hyperparameters are set to approximately 0.1. As the weighting coefficients gradually increase to the equilibrium point\n(0.1), both AUROC and AP exhibit an upward trend. Beyond this point, the model’s performance on unseen classes begins\nto gradually decline.\nReason Analysis. Before analyzing the reasons, it is crucial to clarify the pseudo-labels used during the training process of\nDictAS under the self-supervised learning paradigm. The main loss, i.e., the query loss, is computed using all normal patches\nin the query image, where the query image feature itself serves as the pseudo-label. In contrast, the two query discriminative regularization terms use the synthesized mask G as the pseudo-label, which indicates the location of the synthesized\nanomaly within the query image.From this perspective, the query loss enables the model to acquire a category-agnostic dictionary querying capability, thereby facilitating generalization to unseen categories. Meanwhile, the two regularization losses\nleverage the synthetic anomaly information to enhance anomaly discriminability, making the boundary between normal and\nanomalous regions more distinguishable. Therefore, moderate regularization (e.g., λ1 = λ2 = 0.1) proves beneficial in the\nearly training stages, as it improves the model’s ability to distinguish anomalies without overwhelming the dictionary querying mechanism. However, as the influence of the regularization losses increases, the model’s reliance on the dictionary-based\nquerying diminishes. This shift causes the model to focus more on discriminating the synthesized anomalies during training,\nleading to a loss of generalization capability.\n15\n\n\fTable 10. The details of different types of data transformations .\n\nType\n\nTransformation\n\nParameters\n\nGeo. Trans.\n\nRandomRotate90\nRotate\nHorizontalFlip\nVerticalFlip\n\np = 1.0\n30◦ ∼ 270◦ , p = 1.0\np = 0.5\np = 0.5\n\nColor Trans.\n\nRandomBrightnessContrast\nHueSaturationValue\n\nNoise Dist.\n\nGaussNoise\nMotionBlur\n\nvar = 10.0 ∼ 50.0, p = 0.5\nblur limit = 5, p = 0.5\n\nOccl. Aug.\n\nGridDropout\nCoarseDropout\n\nratio = 0.3, p = 0.5\nmax holes = 8, max size = 32 × 32, p = 0.5\n\np = 0.5\nhue = 20, sat = 30, val = 20, p = 0.5\n\nTable 11. Ablation on different types of data transformations.\n\nGeo. Trans.\n\nColor Trans.\n\nNoise Dist.\n\nOccl. Aug.\n\nAUROC\n\nPRO\n\nAP\n\n✔\n✘\n✘\n✘\n✘\n✔\n✔\n✔\n✔\n\n✘\n✔\n✘\n✘\n✔\n✘\n✔\n✘\n✔\n\n✘\n✘\n✔\n✘\n✔\n✘\n✘\n✔\n✔\n\n✘\n✘\n✘\n✔\n✘\n✔\n✘\n✘\n✔\n\n98.3\n98.2\n98.1\n98.2\n97.9\n98.6\n98.2\n98.2\n98.3\n\n94.9\n94.7\n94.7\n94.8\n94.1\n95.1\n94.7\n94.6\n94.8\n\n66.0\n64.7\n64.8\n64.9\n64.0\n66.8\n64.6\n64.5\n65.5\n\nC.2. Ablation on Auxiliary Datasets\nAs mentioned above, our DictAS by default uses the industrial dataset VisA [43] as an auxiliary dataset for self-supervised\ntraining and then directly performs few-shot anomaly segmentation on unseen classes in other datasets. This setup is designed\nto follow the settings of existing methods for a fairer comparison [7, 13, 38]. Can our method use a more general dataset for\nauxiliary training? If so, how does the scale of the auxiliary data affect the model’s FSAS performance? We will address\nthese two questions in the following discussion.\nDomain of Auxiliary Datasets. In Table 8, we investigate the impact of using auxiliary datasets from different domains for self-supervised training and evaluate their 4-shot performance on MVTecAD [3] and BTAD [25]. Specifically,\nthe VisA dataset [43] from the industrial domain, the BrasTS dataset [24] from the medical domain, and the Ade20K [40]\nand VOC2012 [10] datasets from natural scenes are used as auxiliary datasets. For the natural scene datasets Ade20K [40]\nand VOC2012 [10], we randomly select samples identical to those in the VisA training set for auxiliary training. Since each\nnatural image may contain multiple categories, we use object to replace [class] in the text prompts. Note that our auxiliary\ndatasets do not require pixel-level annotations. Experimental results show that our DictAS is not sensitive to the auxiliary\ndatasets and demonstrates strong robustness across industrial, medical, and natural scene domains. It is attributed to the\nuse of the self-supervised learning paradigm, which demonstrates that DictAS has learned a generalizable dictionary lookup\ncapability and successfully transferred this ability to the class-generalizable FSAS task.\nScale of Auxiliary Datasets. In Table 9, we evaluate the impact of the auxiliary dataset size on model performance.\nSpecifically, (15%, 35%, 55%, 75%, 95%) of the VisA training set samples are randomly selected for self-supervised training,\nand the FSAS performance on MVTecAD and BTAD is assessed under the 4-shot setting. The experimental results show\nthat as the dataset size increases, the FSAS performance of the proposed DictAS also improves. Even when trained on only\n16\n\n\fhalf or less of the auxiliary data, the proposed DictAS already achieves satisfactory results, highlighting the efficiency of our\ntraining strategy. Moreover, DictAS demonstrates promising potential with larger-scale training data, which will be explored\nin our future work.\n\nC.3. Ablation on Types of Data Transformations\nIn this subsection, we conduct an ablation study on the types of data transformations used to generate reference images in the\nself-supervised training process.\nSpecifically, we predefined four types of data transformations: Geometric Transformations (Geo. Trans.), Color Transformations (Color Trans.), Noise Disturbance (Noise Dist.), and Occlusion Augmentation (Occl. Aug). The details and\nhyperparameters of different types of data transformations are presented in Table 10. To investigate the impact of different\ntransformation types on the experiment, we conducted an ablation study on these four types of transformations, as shown\nin Table 11. It can be observed that when only a single transformation type is used, Geometric Transformations provide\nthe greatest performance gain for FSAS, especially in terms of pixel-level AP (66.0%). This is because applying geometric transformations to raw images, such as random rotation and random flipping, simulates the most significant variations\namong normal reference images in real-world anomaly segmentation. During training, self-supervised learning enables the\nmodel to capture the correspondence between query and reference images under geometric transformations, which helps\nDictAS enhance its robustness to different reference images. Furthermore, among different transformation combinations, the\ncombination of Geometric Transformations and Occlusion Augmentation achieved the best results, with scores of 98.6% in\nAUROC, 95.1% in PRO and 66.8% in AP. We attribute this to the occlusion simulating missing parts in real scenarios, further\nenhancing the robustness of the dictionary lookup.\nConsidering the model’s performance, this work defaults to using Geometric Transformations and Occlusion Augmentation as the data transformation methods.\n\nD. Limitations\nOur DictAS has demonstrated the state-of-the-art ZSAD performance in seven industrial and medical datasets. However, it\nstill faces several limitations in practical applications: 1) Our method aims to learn the dictionary lookup ability of human\ninspectors when encountering unseen classes. While this enables generalization to novel categories, the dictionary lookup\ntask imposes a limitation, requiring a few normal reference images to construct the dictionary, making it unsuitable for zeroshot tasks; 2) This work does not investigate the impact of larger-scale auxiliary datasets on the model’s FSAS performance.\nHowever, ablation studies on the VisA dataset suggest that DictAS has the potential to leverage large-scale datasets (even at\nan internet scale) for self-supervised training, enabling continuous performance improvement. In the future, we will further\nenhance the FSAS capability of DictAS by incorporating human prior knowledge, while enabling zero-shot generalization.\nMoreover, larger-scale auxiliary data will be leveraged to enhance the dictionary lookup capability of DictAS.\n\nE. Detailed FSAS Results\nIn this section, we present a detailed comparison of different SOTA methods under the 1-, 2-, and 4-shot settings. As\nmentioned in the main text, since DictAS primarily focuses on anomaly segmentation, pixel-level AUROC, PRO, and AP are\nused as the default evaluation metrics. As a complement, this section also reports image-level AUROC, F1-Max, and AP to\nassess the performance of few-shot anomaly classification. The classification score for each image is obtained following the\nsame strategy as APRIL-GAN [7].\n\n17\n\n\fE.1. Detailed few-shot anomaly classification results\nTable 12. Performance comparison of anomaly classification with other SOTA methods under the 1-shot setting. The best results are\nhighlighted in red, and the second-best results are marked in blue. The symbol † denotes methods based on CLIP, and (a,b,c) represents\nimage-level (AUROC, F1-max, AP). To ensure a fair comparison, all methods use the same normal reference images, and all CLIP-based\nmethods employ the same backbone (ViT-L-14-336) and input resolution (336 × 336).\nDatasets\n\nRegAD [15]\n(ECCV 22)\n\nAnomalyGPT [13]\n(AAAI 24)\n\nFastRecon [11]\n(ICCV 23)\n\nMVTecAD\nVisA\nMVTec3D\nMPDD\nBTAD\nAverage\n\n(73.3, 87.1, 87.2)\n(69.3, 76.2, 72.2)\n(54.0, 88.4, 81.7)\n(47.9, 72.9, 61.5)\n(84.4, 78.2, 80.5)\n(65.8, 80.5, 76.6)\n\n(92.8, 94.3, 96.1)\n(86.4, 84.4, 87.4)\n(76.0, 90.3, 91.9)\n(72.4, 79.3, 75.9)\n(93.6, 89.7, 94.6)\n(84.2, 87.6, 89.2)\n\n(83.7, 90.9, 91.6)\n(80.1, 82.3, 83.1)\n(63.5, 89.6, 86.5)\n(62.2, 77.5, 67.9)\n(86.2, 77.7, 81.7)\n(75.1, 83.6, 82.1)\n\nRESC\nBrasTS\nAverage\n\n(55.9, 60.4, 46.6)\n(58.4, 83.0, 73.2)\n(57.2, 71.7, 59.9)\n\n(86.8, 76.2, 83.4)\n(73.1, 85.8, 82.0)\n(79.9, 81.0, 82.7)\n\n(76.8, 72.5, 59.4)\n(61.8, 84.3, 75.7)\n(69.3, 78.4, 67.6)\n\n† FastRecon+ [11]\n(ICCV 23)\n\nIndustrial Datasets\n\n† APRIL-GAN [7]\n(CVPR 23)\n\n† PromptAD [20]\n(CVPR 24)\n\n† DictAS\n(Ours)\n\n(91.1, 90.9, 95.6)\n(87.1, 83.1, 90.5)\n(75.3, 89.8, 91.1)\n(75.1, 80.1, 80.8)\n(86.5, 84.0, 88.5)\n(83.0, 85.6, 89.3)\n\n(93.0, 93.7, 96.6)\n(85.2, 83.3, 86.8)\n(71.2, 90.1, 89.8)\n(79.3, 81.6, 83.5)\n(93.4, 90.4, 94.4)\n(84.4, 87.8, 90.2)\n\n(96.1, 94.4, 98.3)\n(89.5, 85.9, 91.0)\n(78.6, 91.1, 93.4)\n(81.3, 83.5, 82.6)\n(96.2, 92.8, 97.3)\n(88.3, 89.5, 92.5)\n\n(77.3, 69.5, 69.7)\n(86.8, 88.9, 92.5)\n(82.1, 79.2, 81.1)\n\n(87.4, 78.2, 84.3)\n(81.7, 87.5, 88.5)\n(84.6, 82.8, 86.4)\n\n(89.9, 79.0, 89.6)\n(85.8, 88.0, 92.9)\n(87.8, 83.5, 91.2)\n\n(AUROC, F1-Max, AP)\n\n(92.0, 93.4, 95.6)\n(81.0, 81.4, 82.3)\n(72.8, 90.8, 89.9)\n(76.5, 80.3, 76.1)\n(93.7, 92.0, 95.0)\n(83.2, 87.6, 87.8)\n\nMedical Datasets\n\n† WinCLIP [16]\n(CVPR 23)\n\n(92.6, 92.0, 96.1)\n(84.8, 82.8, 87.0)\n(79.8, 90.3, 93.1)\n(79.9, 80.9, 82.5)\n(89.5, 81.8, 86.3)\n(85.3, 85.5, 89.2)\n\n(AUROC, F1-Max, AP)\n\n(82.8, 71.3, 80.4)\n(76.2, 86.5, 85.1)\n(79.5, 78.9, 82.7)\n\n(57.4, 60.7, 48.1)\n(86.6, 87.4, 92.5)\n(72.0, 74.0, 70.7)\n\nTable 13. Performance comparison of anomaly classification with other SOTA methods under the 2-shot setting. The best results are\nhighlighted in red, and the second-best results are marked in blue. The symbol † denotes methods based on CLIP, and (a,b,c) represents\nimage-level (AUROC, F1-max, AP). To ensure a fair comparison, all methods use the same normal reference images, and all CLIP-based\nmethods employ the same backbone (ViT-L-14-336) and input resolution (336 × 336).\nDatasets\n\nRegAD [15]\n(ECCV 22)\n\nAnomalyGPT [13]\n(AAAI 24)\n\nFastRecon [11]\n(ICCV 23)\n\nMVTecAD\nVisA\nMVTec3D\nMPDD\nBTAD\nAverage\n\n(76.6, 88.8, 88.9)\n(70.4, 75.8, 73.6)\n(55.1, 88.5, 82.0)\n(52.5, 73.6, 62.2)\n(88.9, 89.2, 92.1)\n(68.7, 83.2, 79.8)\n\n(94.4, 95.0, 97.0)\n(87.2, 84.1, 88.8)\n(81.2, 91.5, 94.2)\n(79.7, 82.1, 81.1)\n(93.4, 89.9, 95.0)\n(87.2, 88.5, 91.2)\n\n(88.9, 93.6, 94.7)\n(84.6, 82.9, 86.7)\n(65.5, 89.6, 88.0)\n(67.0, 78.4, 70.6)\n(89.4, 83.2, 86.4)\n(79.1, 85.5, 85.3)\n\nRESC\nBrasTS\nAverage\n\n(59.4, 62.0, 48.0)\n(57.4, 83.5, 72.0)\n(58.4, 72.8, 60.0)\n\n(87.8, 78.2, 83.5)\n(74.9, 86.6, 83.3)\n(81.3, 82.4, 83.4)\n\n(77.6, 72.7, 60.6)\n(65.4, 84.6, 77.4)\n(71.5, 78.7, 69.0)\n\n† FastRecon+ [11]\n(ICCV 23)\n\nIndustrial Datasets\n\n† APRIL-GAN [7]\n(CVPR 23)\n\n† PromptAD [20]\n(CVPR 24)\n\n† DictAS\n(Ours)\n\n(90.1, 91.0, 95.5)\n(86.6, 82.6, 90.4)\n(75.8, 90.0, 91.5)\n(75.1, 79.4, 80.2)\n(86.1, 84.2, 88.5)\n(82.7, 85.4, 89.2)\n\n(95.4, 95.1, 97.7)\n(85.1, 83.0, 87.0)\n(75.6, 90.8, 92.0)\n(83.3, 83.6, 88.2)\n(92.7, 89.0, 94.4)\n(86.4, 88.3, 91.9)\n\n(97.4, 96.6, 98.9)\n(90.2, 86.6, 91.3)\n(82.4, 91.2, 94.7)\n(84.9, 86.4, 85.4)\n(95.6, 92.3, 96.6)\n(90.1, 90.6, 93.4)\n\n(78.3, 70.8, 71.0)\n(87.5, 89.2, 93.0)\n(82.9, 80.0, 82.0)\n\n(89.2, 79.6, 85.9)\n(83.0, 88.1, 89.3)\n(86.1, 83.8, 87.6)\n\n(91.6, 80.6, 90.9)\n(85.5, 88.6, 92.4)\n(88.6, 84.6, 91.7)\n\n(AUROC, F1-Max, AP)\n\n(94.2, 94.5, 96.5)\n(81.1, 81.8, 81.3)\n(76.9, 91.2, 92.2)\n(81.8, 83.0, 81.4)\n(93.8, 90.3, 94.9)\n(85.6, 88.2, 89.3)\n\nMedical Datasets\n\n† WinCLIP [16]\n(CVPR 23)\n\n(93.8, 93.0, 96.6)\n(83.5, 81.3, 85.9)\n(81.4, 90.5, 94.5)\n(81.5, 81.0, 83.3)\n(90.7, 84.2, 87.6)\n(86.2, 86.0, 89.6)\n\n(AUROC, F1-Max, AP)\n\n(87.6, 75.7, 84.9)\n(75.8, 87.2, 83.6)\n(81.7, 81.5, 84.3)\n\n(60.3, 61.0, 50.6)\n(87.0, 88.0, 93.4)\n(73.6, 74.5, 72.0)\n\nTable 14. Performance comparison of anomaly classification with other SOTA methods under the 4-shot setting. The best results are\nhighlighted in red, and the second-best results are marked in blue. The symbol † denotes methods based on CLIP, and (a,b,c) represents\nimage-level (AUROC, F1-max, AP). To ensure a fair comparison, all methods use the same normal reference images, and all CLIP-based\nmethods employ the same backbone (ViT-L-14-336) and input resolution (336 × 336).\nDatasets\n\nRegAD [15]\n(ECCV 22)\n\nAnomalyGPT [13]\n(AAAI 24)\n\nFastRecon [11]\n(ICCV 23)\n\nMVTec-AD\nVisA\nMVTec3D\nMPDD\nBTAD\nAverage\n\n(83.4, 89.8, 91.7)\n(72.0, 77.1, 73.9)\n(57.7, 88.4, 84.1)\n(61.1, 75.9, 66.9)\n(91.3, 91.2, 94.5)\n(73.1, 84.5, 82.2)\n\n(97.0, 95.9, 98.0)\n(91.4, 87.2, 92.6)\n(83.4, 91.6, 95.1)\n(85.9, 88.5, 89.0)\n(93.5, 91.0, 95.9)\n(90.2, 90.8, 94.2)\n\n(94.2, 90.9, 90.4)\n(68.5, 77.1, 72.6)\n(57.9, 88.4, 83.7)\n(79.8, 78.5, 75.7)\n(68.3, 79.1, 75.1)\n(73.7, 82.8, 79.5)\n\nRESC\nBrasTS\nAverage\n\n(64.2, 63.7, 51.0)\n(63.3, 83.9, 75.5)\n(63.7, 73.8, 63.2)\n\n(88.5, 78.8, 85.4)\n(79.4, 86.2, 87.8)\n(83.9, 82.5, 86.6)\n\n(70.8, 65.6, 56.5)\n(54.9, 82.6, 72.4)\n(62.9, 74.1, 64.4)\n\n† FastRecon+ [11]\n(ICCV 23)\n\nIndustrial Datasets\n\n† APRIL-GAN [7]\n(CVPR 23)\n\n† PromptAD [20]\n(CVPR 24)\n\n† DictAS\n(Ours)\n\n(91.0, 91.6, 95.9)\n(87.2, 83.3, 91.1)\n(76.4, 90.0, 91.8)\n(76.5, 80.7, 81.6)\n(86.1, 83.9, 88.4)\n(83.4, 85.9, 89.8)\n\n(95.9, 95.2, 97.5)\n(87.5, 83.9, 89.2)\n(79.5, 91.1, 93.5)\n(88.0, 87.6, 92.6)\n(92.6, 91.0, 94.4)\n(88.7, 89.8, 93.4)\n\n(98.8, 98.2, 99.5)\n(92.3, 88.5, 93.6)\n(84.5, 91.6, 95.3)\n(87.3, 87.8, 89.2)\n(96.5, 92.7, 97.2)\n(91.9, 91.8, 94.9)\n\n(78.3, 70.7, 71.2)\n(88.0, 89.1, 93.5)\n(83.2, 79.9, 82.4)\n\n(90.2, 81.0, 87.3)\n(86.4, 88.2, 92.4)\n(88.3, 84.6, 89.8)\n\n(91.2, 79.6, 90.6)\n(88.4, 88.9, 94.3)\n(89.8, 84.3, 92.5)\n\n(AUROC, F1-Max, AP)\n\n(96.2, 95.3, 97.2)\n(84.4, 82.6, 85.1)\n(81.4, 91.4, 93.7)\n(81.9, 82.8, 81.0)\n(94.4, 91.8, 96.2)\n(87.6, 88.8, 90.6)\n\nMedical Datasets\n\n† WinCLIP [16]\n(CVPR 23)\n\n(95.5, 94.0, 97.3)\n(85.7, 82.8, 87.8)\n(81.3, 90.8, 94.3)\n(84.0, 83.1, 86.1)\n(91.7, 84.3, 88.0)\n(87.6, 87.0, 90.7)\n\n(AUROC, F1-Max, AP)\n\n(87.5, 76.4, 84.6)\n(78.6, 87.6, 86.4)\n(83.0, 82.0, 85.5)\n\n18\n\n(63.8, 62.6, 54.0)\n(87.0, 88.0, 93.4)\n(75.4, 75.3, 73.7)\n\n\fE.2. Detailed few-shot anomaly segmentation results\nTable 15. Performance comparison of anomaly segmentation with other SOTA methods under the 1-shot setting. The best results\nare highlighted in red, and the second-best results are marked in blue. The symbol † denotes methods based on CLIP, and (a,b,c) represents\npixel-level (AUROC, PRO, AP). To ensure a fair comparison, all methods use the same normal reference images, and all CLIP-based\nmethods employ the same backbone (ViT-L-14-336) and input resolution (336 × 336).\nDatasets\n\nRegAD [15]\n(ECCV 22)\n\nAnomalyGPT [13]\n(AAAI 24)\n\nFastRecon [11]\n(ICCV 23)\n\nMVTecAD\nVisA\nMVTec3D\nMPDD\nBTAD\nAverage\n\n(92.3, 76.8, 36.1)\n(93.3, 68.7, 17.9)\n(95.4, 84.5, 8.4)\n(93.2, 74.6, 8.4)\n(95.6, 68.9, 33.1)\n(94.0, 74.7, 20.8)\n\n(95.3, 89.0, 48.8)\n(87.4, 65.3, 16.8)\n(95.5, 84.3, 22.2)\n(96.6, 89.9, 31.3)\n(95.7, 71.7, 49.9)\n(94.1, 80.0, 33.8)\n\n(93.9, 82.6, 48.2)\n(96.5, 81.6, 31.8)\n(95.4, 83.6, 15.9)\n(95.5, 84.1, 20.9)\n(95.9, 67.9, 42.8)\n(95.4, 80.0, 31.9)\n\nRESC\nBrasTS\nAverage\n\n(84.6, 53.2, 14.6)\n(91.3, 62.6, 17.5)\n(88.0, 57.9, 16.0)\n\n(86.0, 58.5, 27.4)\n(94.2, 69.9, 30.1)\n(90.1, 64.2, 28.8)\n\n(93.0, 76.5, 31.7)\n(93.4, 66.8, 25.8)\n(93.2, 71.6, 28.7)\n\n† FastRecon+ [11]\n(ICCV 23)\n\nIndustrial Datasets\n\n† APRIL-GAN [7]\n(CVPR 23)\n\n† PromptAD [20]\n(CVPR 24)\n\n† DictAS\n(Ours)\n\n(91.2, 84.5, 43.8)\n(95.9, 87.0, 29.3)\n(96.1, 88.4, 31.6)\n(94.9, 85.1, 28.3)\n(93.0, 73.4, 50.4)\n(94.2, 83.7, 36.7)\n\n(95.2, 90.9, 53.3)\n(97.2, 88.4, 29.1)\n(97.0, 89.7, 29.9)\n(96.0, 90.4, 30.1)\n(96.1, 79.4, 61.3)\n(96.3, 87.8, 40.8)\n\n(97.7, 92.5, 61.1)\n(98.0, 89.6, 32.7)\n(97.5, 92.1, 34.4)\n(97.4, 92.8, 33.3)\n(97.6, 82.1, 64.6)\n(97.6, 89.8, 45.2)\n\n(93.0, 74.9, 54.1)\n(90.9, 62.7, 38.7)\n(92.0, 68.8, 46.4)\n\n(96.4, 85.8, 68.2)\n(95.9, 74.8, 46.0)\n(96.2, 80.3, 57.1)\n\n(97.2, 88.8, 72.4)\n(96.5, 74.5, 52.1)\n(96.9, 81.6, 62.3)\n\n(AUROC, PRO, AP)\n\n(95.1, 90.8, 50.5)\n(96.1, 84.3, 26.0)\n(96.7, 89.3, 30.8)\n(96.2, 90.1, 30.7)\n(96.8, 80.6, 60.0)\n(96.2, 87.0, 39.6)\n\nMedical Datasets\n\n† WinCLIP [16]\n(CVPR 23)\n\n(91.6, 82.0, 35.5)\n(95.3, 85.2, 19.2)\n(96.2, 86.4, 22.8)\n(95.6, 86.7, 23.6)\n(88.9, 61.7, 26.0)\n(93.5, 80.4, 25.4)\n\n(AUROC, PRO, AP)\n\n(96.0, 83.6, 66.5)\n(95.4, 71.4, 39.0)\n(95.7, 77.5, 52.8)\n\n(92.3, 73.3, 33.4)\n(93.1, 64.2, 33.2)\n(92.7, 68.7, 33.3)\n\nTable 16. Performance comparison of anomaly segmentation with other SOTA methods under the 2-shot setting. The best results\nare highlighted in red, and the second-best results are marked in blue. The symbol † denotes methods based on CLIP, and (a,b,c) represents\npixel-level (AUROC, PRO, AP). To ensure a fair comparison, all methods use the same normal reference images, and all CLIP-based\nmethods employ the same backbone (ViT-L-14-336) and input resolution (336 × 336).\nDatasets\n\nRegAD [15]\n(ECCV 22)\n\nAnomalyGPT [13]\n(AAAI 24)\n\nFastRecon [11]\n(ICCV 23)\n\nMVTecAD\nVisA\nMVTec3D\nMPDD\nBTAD\nAverage\n\n(94.5, 82.7, 42.1)\n(94.3, 70.2, 21.6)\n(95.9, 86.2, 10.0)\n(94.0, 79.3, 13.1)\n(96.9, 74.1, 42.3)\n(95.1, 78.5, 25.8)\n\n(95.9, 90.2, 50.7)\n(87.7, 65.0, 19.7)\n(95.8, 85.5, 24.1)\n(97.3, 91.8, 34.5)\n(96.0, 72.4, 50.6)\n(94.5, 81.0, 35.9)\n\n(95.3, 85.8, 50.5)\n(97.5, 83.9, 37.5)\n(95.8, 85.0, 16.9)\n(96.8, 89.1, 26.2)\n(96.4, 71.1, 45.1)\n(96.4, 83.0, 35.2)\n\nRESC\nBrasTS\nAverage\n\n(85.9, 54.5, 15.1)\n(92.7, 66.0, 20.6)\n(89.3, 60.3, 17.9)\n\n(86.3, 59.0, 27.9)\n(94.1, 70.2, 29.7)\n(90.2, 64.6, 28.8)\n\n(93.5, 75.6, 32.9)\n(93.4, 67.3, 25.6)\n(93.4, 71.4, 29.2)\n\n† FastRecon+ [11]\n(ICCV 23)\n\nIndustrial Datasets\n\n† APRIL-GAN [7]\n(CVPR 23)\n\n† PromptAD [20]\n(CVPR 24)\n\n† DictAS\n(Ours)\n\n(91.6, 85.5, 45.1)\n(96.1, 86.8, 30.1)\n(96.3, 88.8, 32.3)\n(95.1, 86.6, 30.2)\n(93.2, 73.2, 50.8)\n(94.5, 84.2, 37.7)\n\n(95.6, 91.5, 54.8)\n(97.7, 89.4, 34.4)\n(97.2, 90.6, 33.1)\n(96.8, 92.6, 34.5)\n(96.4, 79.6, 62.3)\n(96.7, 88.7, 43.8)\n\n(98.2, 94.2, 63.9)\n(98.5, 91.1, 39.0)\n(97.9, 93.4, 38.8)\n(97.9, 94.6, 38.0)\n(97.9, 82.4, 66.1)\n(98.1, 91.1, 49.2)\n\n(93.4, 76.5, 56.0)\n(90.9, 63.1, 38.8)\n(92.2, 69.8, 47.4)\n\n(96.7, 86.6, 69.9)\n(95.8, 75.2, 45.7)\n(96.3, 80.9, 57.8)\n\n(97.4, 89.6, 74.1)\n(96.4, 73.8, 53.8)\n(96.9, 81.7, 62.0)\n\n(AUROC, PRO, AP)\n\n(95.5, 91.5, 51.9)\n(96.6, 85.2, 30.6)\n(96.8, 90.4, 35.5)\n(96.8, 92.7, 35.7)\n(97.2, 80.5, 61.6)\n(96.6, 88.1, 43.1)\n\nMedical Datasets\n\n† WinCLIP [16]\n(CVPR 23)\n\n(91.9, 82.7, 37.4)\n(95.7, 85.9, 23.6)\n(96.4, 87.0, 23.5)\n(96.5, 89.4, 26.8)\n(89.6, 63.4, 27.5)\n(94.0, 81.7, 27.8)\n\n(AUROC, PRO, AP)\n\n(96.2, 84.7, 68.4)\n(95.2, 71.7, 35.3)\n(95.7, 78.2, 51.9)\n\n(92.7, 74.6, 35.7)\n(93.0, 63.6, 32.9)\n(92.8, 69.1, 34.3)\n\nTable 17. Performance comparison of anomaly segmentation with other SOTA methods under the 4-shot setting. The best results\nare highlighted in red, and the second-best results are marked in blue. The symbol † denotes methods based on CLIP, and (a,b,c) represents\npixel-level (AUROC, PRO, AP). To ensure a fair comparison, all methods use the same normal reference images, and all CLIP-based\nmethods employ the same backbone (ViT-L-14-336) and input resolution (336 × 336).\nDatasets\n\nRegAD [15]\n(ECCV 22)\n\nAnomalyGPT [13]\n(AAAI 24)\n\nFastRecon [11]\n(ICCV 23)\n\nMVTecAD [3]\nVisA [43]\nMVTec3D [4]\nMPDD [17]\nBTAD [25]\nAverage\n\n(95.7, 86.0, 46.5)\n(94.7, 72.8, 21.4)\n(96.9, 89.2, 13.3)\n(94.9, 83.3, 16.4)\n(97.3, 75.5, 44.1)\n(95.9, 81.3, 28.3)\n\n(96.4, 91.2, 52.9)\n(96.5, 65.4, 20.8)\n(96.6, 87.4, 27.8)\n(97.7, 93.2, 40.8)\n(96.2, 73.5, 50.6)\n(96.7, 82.1, 38.6)\n\n(95.9, 79.9, 47.0)\n(96.0, 77.7, 31.1)\n(95.6, 83.6, 12.9)\n(97.0, 87.5, 25.7)\n(88.7, 62.1, 35.5)\n(94.6, 78.2, 30.4)\n\nRESC [14]\nBrasTS [24]\nAverage\n\n(87.9, 60.0, 18.1)\n(93.8, 70.2, 24.8)\n(90.8, 65.1, 21.5)\n\n(86.7, 60.0, 28.5)\n(95.4, 73.6, 41.8)\n(91.0, 66.8, 35.2)\n\n(91.7, 71.7, 30.3)\n(92.5, 63.8, 24.0)\n(92.1, 67.8, 27.1)\n\n† FastRecon+ [11]\n(ICCV 23)\n\nIndustrial Datasets\n\n† APRIL-GAN [7]\n(CVPR 23)\n\n† PromptAD [20]\n(CVPR 24)\n\n† DictAS\n(Ours)\n\n(92.2, 86.6, 46.6)\n(96.2, 86.6, 30.6)\n(96.4, 89.1, 33.1)\n(95.3, 86.9, 31.4)\n(93.3, 74.6, 50.9)\n(94.7, 84.8, 38.5)\n\n(96.0, 92.4, 57.5)\n(97.9, 89.5, 37.5)\n(97.7, 92.1, 36.9)\n(97.3, 94.0, 40.5)\n(96.6, 80.1, 62.5)\n(97.1, 89.6, 47.0)\n\n(98.6, 95.1, 66.8)\n(98.8, 91.9, 41.8)\n(98.4, 94.9, 44.2)\n(98.4, 95.8, 42.9)\n(98.0, 83.3, 66.8)\n(98.4, 92.2, 52.5)\n\n(93.7, 77.6, 57.3)\n(91.3, 63.0, 40.0)\n(92.5, 70.3, 48.7)\n\n(96.8, 86.8, 71.3)\n(96.6, 77.0, 54.4)\n(96.7, 82.2, 62.9)\n\n(97.5, 89.7, 74.9)\n(97.3, 77.2, 59.3)\n(97.4, 83.4, 67.1)\n\n(AUROC, PRO, AP)\n\n(96.3, 92.2, 53.9)\n(97.0, 86.2, 32.5)\n(97.1, 91.8, 39.2)\n(97.4, 93.1, 37.8)\n(97.4, 80.8, 62.2)\n(97.0, 88.8, 45.1)\n\nMedical Datasets\n\n† WinCLIP [16]\n(CVPR 23)\n\n(92.4, 83.8, 39.2)\n(96.0, 86.5, 25.7)\n(96.6, 87.9, 24.0)\n(97.0, 90.7, 29.3)\n(90.3, 64.7, 28.5)\n(94.5, 82.7, 29.3)\n\n(AUROC, PRO, AP)\n\n(95.8, 82.8, 68.5)\n(96.1, 73.8, 43.9)\n(96.0, 78.3, 56.2)\n\n19\n\n(93.1, 75.7, 38.4)\n(93.1, 64.0, 33.4)\n(93.1, 69.8, 35.9)\n\n\fTable 18. Anomaly segmentation performance of our DictAS on MVTecAD for each object category. Pixel-level AUROC, PRO and AP\nare reported.\n\n1-shot\n\nObject\n\n2-shot\n\n4-shot\n\nAUROC\n\nPRO\n\nAP\n\nAUROC\n\nPRO\n\nAP\n\nAUROC\n\nPRO\n\nAP\n\nbottle\ncable\ncapsule\ncarpet\ngrid\nhazelnut\nleather\nmetal nut\npill\nscrew\ntile\ntoothbrush\ntransistor\nwood\nzipper\n\n99.1±0.1\n97.8±0.3\n97.7±0.2\n99.7±0.0\n96.3±0.7\n98.4±0.2\n99.6±0.0\n95.8±0.9\n98.5±0.1\n98.3±0.6\n98.5±0.1\n97.3±0.8\n93.3±2.1\n97.1±0.1\n97.8±0.0\n\n96.7±0.3\n90.1±0.6\n93.1±0.9\n98.4±0.1\n88.4±2.1\n94.2±1.2\n98.8±0.1\n93.3±1.0\n97.8±0.1\n92.0±1.7\n95.8±0.3\n85.4±3.1\n75.9±4.1\n94.5±0.2\n93.9±0.1\n\n87.2±0.9\n66.7±2.5\n37.3±9.4\n85.1±0.3\n33.2±0.5\n62.0±1.8\n57.9±0.4\n74.7±4.2\n77.4±0.8\n30.7±0.7\n82.1±1.2\n40.2±6.0\n56.1±5.7\n70.9±0.3\n55.2±0.3\n\n99.2±0.0\n98.7±0.4\n98.5±0.3\n99.7±0.0\n96.9±0.6\n98.8±0.3\n99.6±0.0\n96.0±0.6\n98.7±0.1\n98.6±0.7\n98.6±0.1\n99.0±0.6\n95.7±1.2\n97.3±0.1\n98.0±0.2\n\n96.7±0.3\n93.7±1.1\n95.6±1.2\n98.5±0.1\n90.2±1.6\n95.5±0.8\n98.8±0.1\n94.3±1.3\n97.9±0.1\n93.5±2.4\n96.1±0.2\n91.2±2.5\n82.8±3.5\n94.5±0.1\n94.4±0.5\n\n87.5±0.5\n76.5±4.2\n43.0±9.2\n85.1±0.3\n33.0±2.3\n64.8±2.5\n57.5±0.5\n75.3±3.2\n80.1±0.9\n26.2±0.2\n83.0±0.6\n52.7±4.3\n63.5±4.4\n71.8±0.3\n58.0±0.7\n\n99.2±0.0\n98.9±0.3\n98.6±0.3\n99.7±0.0\n97.7±0.6\n99.1±0.1\n99.6±0.0\n97.5±0.1\n98.9±0.1\n99.1±0.8\n98.8±0.0\n99.2±0.4\n96.5±0.7\n97.4±0.1\n98.3±0.1\n\n96.6±0.1\n94.8±0.9\n95.6±0.8\n98.4±0.0\n92.9±2.2\n96.2±0.2\n98.7±0.1\n96.3±0.3\n98.0±0.1\n94.7±3.1\n96.3±0.2\n91.4±4.2\n87.2±1.9\n94.5±0.2\n95.0±0.3\n\n87.2±0.6\n78.7±2.1\n45.0±4.4\n85.4±0.3\n36.4±1.0\n67.0±1.7\n58.5±1.0\n82.5±1.0\n81.8±0.9\n37.8±1.0\n85.0±0.1\n56.7±4.5\n66.1±3.0\n72.5±0.7\n60.8±1.2\n\nAverage\n\n97.7±0.1\n\n92.5±0.3\n\n61.1±0.5\n\n98.2±0.1\n\n94.2±0.2\n\n63.9±1.2\n\n98.6±0.0\n\n95.1±0.3\n\n66.8±0.4\n\nTable 19. Anomaly segmentation performance of our DictAS on VisA for each object category. Pixel-level AUROC, PRO and AP are\nreported.\n\n1-shot\n\nObject\n\n2-shot\n\n4-shot\n\nAUROC\n\nPRO\n\nAP\n\nAUROC\n\nPRO\n\nAP\n\nAUROC\n\nPRO\n\nAP\n\ncandle\ncapsules\ncashew\nchewinggum\nfryum\nmacaroni1\nmacaroni2\npcb1\npcb2\npcb3\npcb4\npipe fryum\n\n99.3±0.1\n97.8±0.2\n99.4±0.1\n99.6±0.0\n97.5±0.2\n99.2±0.2\n96.7±0.6\n98.4±0.5\n96.2±0.3\n95.4±0.4\n97.5±0.4\n99.1±0.1\n\n96.3±0.1\n84.6±2.3\n96.1±0.6\n93.0±0.4\n89.5±0.5\n96.5±1.7\n86.7±1.8\n91.3±3.7\n76.0±3.4\n79.5±3.0\n89.0±2.5\n97.0±0.3\n\n23.6±0.9\n37.0±1.2\n60.3±2.8\n78.1±0.5\n41.5±1.1\n10.4±0.7\n2.7±1.3\n43.3±4.6\n12.6±3.7\n13.6±1.4\n18.4±3.7\n50.8±1.6\n\n99.4±0.1\n98.4±0.2\n99.5±0.1\n99.6±0.0\n97.8±0.2\n99.5±0.1\n96.6±0.5\n99.4±0.1\n97.2±0.2\n97.1±0.4\n98.1±0.2\n99.2±0.1\n\n96.4±0.1\n86.0±1.4\n96.2±0.4\n91.8±0.6\n90.1±0.8\n97.5±0.5\n87.5±0.4\n93.7±1.8\n81.8±2.6\n85.7±2.0\n89.8±0.6\n96.8±0.2\n\n23.7±0.5\n39.7±1.1\n66.4±2.8\n78.8±0.5\n42.9±1.4\n12.1±0.7\n5.4±0.8\n73.3±4.0\n19.1±2.7\n25.9±1.4\n29.9±6.3\n50.4±2.5\n\n99.5±0.0\n98.7±0.1\n99.5±0.0\n99.6±0.0\n97.9±0.1\n99.6±0.0\n97.5±0.3\n99.6±0.1\n97.5±0.2\n97.9±0.1\n98.6±0.3\n99.2±0.0\n\n96.7±0.1\n87.6±2.1\n95.7±0.3\n92.4±0.3\n90.8±0.8\n97.6±0.2\n91.0±1.2\n94.9±1.3\n80.1±1.7\n87.8±2.0\n91.8±1.0\n96.8±0.2\n\n24.5±0.6\n40.0±0.7\n67.5±2.1\n78.1±0.3\n44.0±0.3\n15.1±0.4\n7.1±0.8\n81.1±3.8\n20.5±1.9\n30.8±1.1\n40.6±8.8\n51.9±0.7\n\nAverage\n\n98.0±0.1\n\n89.6±0.7\n\n32.7±0.9\n\n98.5±0.1\n\n91.1±0.4\n\n39.0±2.0\n\n98.8±0.1\n\n91.9±0.3\n\n41.8±1.7\n\n20\n\n\fTable 20. Anomaly segmentation performance of our DictAS on MVTec3D for each object category. Pixel-level AUROC, PRO and AP\nare reported.\n\n1-shot\n\nObject\n\n2-shot\n\n4-shot\n\nAUROC\n\nPRO\n\nAP\n\nAUROC\n\nPRO\n\nAP\n\nAUROC\n\nPRO\n\nAP\n\ncookie\ndowel\ncable gland\nrope\npeach\npotato\nbagel\ncarrot\nfoam\ntire\n\n98.7±0.1\n98.1±0.2\n96.1±0.7\n99.2±0.1\n98.5±0.5\n99.4±0.1\n99.5±0.0\n99.4±0.1\n88.6±1.0\n98.0±0.1\n\n94.5±0.2\n92.4±0.7\n88.1±1.7\n96.7±0.3\n94.5±1.8\n97.3±0.2\n98.3±0.2\n97.7±0.2\n69.6±2.1\n91.5±0.3\n\n60.3±2.8\n24.1±2.9\n11.8±2.2\n45.8±1.6\n26.6±15.5\n29.8±2.1\n67.1±1.7\n31.3±1.0\n30.9±0.6\n16.2±0.8\n\n98.9±0.1\n98.4±0.3\n97.2±0.5\n99.2±0.1\n99.1±0.5\n99.3±0.0\n99.5±0.0\n99.4±0.1\n88.8±0.4\n99.1±0.1\n\n95.2±0.3\n94.0±1.2\n91.6±1.5\n96.7±0.3\n96.6±1.8\n97.0±0.2\n98.4±0.2\n98.0±0.2\n70.8±1.1\n95.6±0.4\n\n65.0±1.3\n24.5±3.0\n16.4±5.3\n44.3±1.2\n39.5±16.6\n30.3±1.9\n66.5±0.9\n34.4±2.0\n31.0±0.3\n35.6±0.9\n\n99.1±0.1\n99.1±0.3\n99.1±0.6\n99.3±0.0\n99.6±0.0\n99.5±0.1\n99.6±0.0\n99.5±0.0\n90.0±0.2\n99.3±0.0\n\n96.1±0.4\n96.0±1.2\n97.4±1.5\n97.4±0.1\n98.5±0.2\n97.7±0.3\n98.6±0.3\n98.2±0.2\n72.1±0.6\n96.5±0.3\n\n69.1±1.1\n32.7±6.1\n32.6±3.7\n46.8±0.8\n56.0±1.7\n35.2±2.5\n65.7±1.8\n35.1±1.4\n30.9±0.1\n37.5±0.8\n\nAverage\n\n97.5±0.1\n\n92.1±0.1\n\n34.4±1.5\n\n97.9±0.1\n\n93.4±0.3\n\n38.8±1.7\n\n98.4±0.1\n\n94.9±0.2\n\n44.2±1.1\n\nTable 21. Anomaly segmentation performance of our DictAS on MPDD for each object category. Pixel-level AUROC, PRO and AP are\nreported.\n\n1-shot\n\nObject\n\n2-shot\n\n4-shot\n\nAUROC\n\nPRO\n\nAP\n\nAUROC\n\nPRO\n\nAP\n\nAUROC\n\nPRO\n\nAP\n\nbracket brown\nconnector\ntubes\nmetal plate\nbracket black\nbracket white\n\n94.8±0.4\n97.3±0.4\n99.2±0.1\n98.3±0.0\n95.0±1.5\n99.4±0.1\n\n90.7±0.7\n90.9±1.4\n97.0±0.3\n95.0±0.1\n89.6±5.7\n93.4±3.1\n\n5.3±0.3\n23.0±3.9\n73.0±1.6\n89.8±0.1\n4.0±3.6\n4.8±0.6\n\n95.7±0.3\n97.8±0.2\n99.4±0.1\n99.0±0.0\n95.7±0.7\n99.8±0.1\n\n92.9±1.3\n92.3±0.8\n97.8±0.3\n96.4±0.1\n91.9±2.0\n96.3±1.9\n\n7.1±0.7\n28.8±3.7\n75.5±1.1\n93.3±0.2\n11.8±0.9\n11.8±0.4\n\n96.5±0.3\n98.5±0.2\n99.5±0.1\n99.2±0.1\n96.7±1.4\n99.8±0.2\n\n94.3±1.1\n94.8±0.7\n98.2±0.3\n96.8±0.2\n93.7±4.2\n97.0±0.6\n\n9.7±0.9\n51.2±3.3\n75.8±0.8\n94.4±0.4\n13.4±5.5\n12.7±2.5\n\nAverage\n\n97.4±0.2\n\n92.8±0.5\n\n33.3±0.2\n\n97.9±0.1\n\n94.6±0.3\n\n38.0±1.7\n\n98.4±0.3\n\n95.8±0.8\n\n42.9±1.7\n\nTable 22. Anomaly segmentation performance of our DictAS on BTAD for each object category. Pixel-level AUROC, PRO and AP are\nreported.\n\n1-shot\n\nObject\n\n2-shot\n\n4-shot\n\nAUROC\n\nPRO\n\nAP\n\nAUROC\n\nPRO\n\nAP\n\nAUROC\n\nPRO\n\nAP\n\n01\n02\n03\n\n97.0±0.2\n97.0±0.0\n99.0±0.1\n\n77.2±1.5\n73.1±1.5\n96.0±0.1\n\n60.5±0.9\n74.2±0.4\n59.1±1.4\n\n97.3±0.1\n97.1±0.1\n99.1±0.1\n\n78.9±0.5\n71.5±1.3\n96.6±0.3\n\n61.4±0.5\n74.5±0.8\n62.5±1.6\n\n97.5±0.1\n97.2±0.0\n99.3±0.0\n\n80.6±0.6\n72.2±0.6\n97.2±0.1\n\n61.8±0.4\n74.4±0.3\n64.1±1.8\n\nAverage\n\n97.6±0.1\n\n82.1±0.6\n\n64.6±0.7\n\n97.9±0.1\n\n82.4±0.3\n\n66.1±0.8\n\n98.0±0.0\n\n83.3±0.4\n\n66.8±0.7\n\n21\n\n\fF. Detailed Qualitative Results\n\nFigure 9. Visualization of segmentation results for the bottle class on MVTecAD under the 4-shot setting. The first row displays the input\nimages, with green outlines indicating the ground truth regions. The second row presents the anomaly segmentation results.\n\nFigure 10. Visualization of segmentation results for the cable class on MVTecAD under the 4-shot setting. The first row displays the input\nimages, with green outlines indicating the ground truth regions. The second row presents the anomaly segmentation results.\n\nFigure 11. Visualization of segmentation results for the carpet class on MVTecAD under the 4-shot setting. The first row displays the\ninput images, with green outlines indicating the ground truth regions. The second row presents the anomaly segmentation results.\n\nFigure 12. Visualization of segmentation results for the grid class on MVTecAD under the 4-shot setting. The first row displays the input\nimages, with green outlines indicating the ground truth regions. The second row presents the anomaly segmentation results.\n\n22\n\n\fFigure 13. Visualization of segmentation results for the hazelnut class on MVTecAD under the 4-shot setting. The first row displays the\ninput images, with green outlines indicating the ground truth regions. The second row presents the anomaly segmentation results.\n\nFigure 14. Visualization of segmentation results for the pill class on MVTecAD under the 4-shot setting. The first row displays the input\nimages, with green outlines indicating the ground truth regions. The second row presents the anomaly segmentation results.\n\nFigure 15. Visualization of segmentation results for the tile class on MVTecAD under the 4-shot setting. The first row displays the input\nimages, with green outlines indicating the ground truth regions. The second row presents the anomaly segmentation results.\n\nFigure 16. Visualization of segmentation results for the metal nut class on MVTecAD under the 4-shot setting. The first row displays the\ninput images, with green outlines indicating the ground truth regions. The second row presents the anomaly segmentation results.\n\n23\n\n\fFigure 17. Visualization of segmentation results for the wood class on MVTecAD under the 4-shot setting. The first row displays the input\nimages, with green outlines indicating the ground truth regions. The second row presents the anomaly segmentation results.\n\nFigure 18. Visualization of segmentation results for the screw class on MVTecAD under the 4-shot setting. The first row displays the input\nimages, with green outlines indicating the ground truth regions. The second row presents the anomaly segmentation results.\n\nFigure 19. Visualization of segmentation results for the toothbrush class on MVTecAD under the 4-shot setting. The first row displays\nthe input images, with green outlines indicating the ground truth regions. The second row presents the anomaly segmentation results.\n\nFigure 20. Visualization of segmentation results for the candle class on VisA under the 4-shot setting. The first row displays the input\nimages, with green outlines indicating the ground truth regions. The second row presents the anomaly segmentation results.\n\n24\n\n\fFigure 21. Visualization of segmentation results for the cashew class on VisA under the 4-shot setting. The first row displays the input\nimages, with green outlines indicating the ground truth regions. The second row presents the anomaly segmentation results.\n\nFigure 22. Visualization of segmentation results for the fryum class on VisA under the 4-shot setting. The first row displays the input\nimages, with green outlines indicating the ground truth regions. The second row presents the anomaly segmentation results.\n\nFigure 23. Visualization of segmentation results for the pipe fryum class on VisA under the 4-shot setting. The first row displays the input\nimages, with green outlines indicating the ground truth regions. The second row presents the anomaly segmentation results.\n\nFigure 24. Visualization of segmentation results for the PCB1 class on VisA under the 4-shot setting. The first row displays the input\nimages, with green outlines indicating the ground truth regions. The second row presents the anomaly segmentation results.\n\nFigure 25. Visualization of segmentation results for the PCB4 class on VisA under the 4-shot setting. The first row displays the input\nimages, with green outlines indicating the ground truth regions. The second row presents the anomaly segmentation results.\n\n25\n\n\fFigure 26. Visualization of segmentation results on BTAD under the 4-shot setting. The first row displays the input images, with green\noutlines indicating the ground truth regions. The second row presents the anomaly segmentation results..\n\nFigure 27. Visualization of segmentation results for the metal plate class on MPDD under the 4-shot setting. The first row displays the\ninput images, with green outlines indicating the ground truth regions. The second row presents the anomaly segmentation results.\n\nFigure 28. Visualization of segmentation results for the tubes class on MPDD under the 4-shot setting. The first row displays the input\nimages, with green outlines indicating the ground truth regions. The second row presents the anomaly segmentation results.\n\nFigure 29. Visualization of segmentation results for the bangel class on MVTec3D under the 4-shot setting. The first row displays the\ninput images, with green outlines indicating the ground truth regions. The second row presents the anomaly segmentation results.\n\n26\n\n\fFigure 30. Visualization of segmentation results for the cable gland class on MVTec3D under the 4-shot setting. The first row displays\nthe input images, with green outlines indicating the ground truth regions. The second row presents the anomaly segmentation results.\n\nFigure 31. Visualization of segmentation results for the carrot class on MVTec3D under the 4-shot setting. The first row displays the input\nimages, with green outlines indicating the ground truth regions. The second row presents the anomaly segmentation results.\n\nFigure 32. Visualization of segmentation results for the foam class on MVTec3D under the 4-shot setting. The first row displays the input\nimages, with green outlines indicating the ground truth regions. The second row presents the anomaly segmentation results.\n\nFigure 33. Visualization of segmentation results for the rope class on MVTec3D under the 4-shot setting. The first row displays the input\nimages, with green outlines indicating the ground truth regions. The second row presents the anomaly segmentation results.\n\n27\n\n\fFigure 34. Visualization of segmentation results for the brain class on RESC under the 4-shot setting. The first row displays the input\nimages, with green outlines indicating the ground truth regions. The second row presents the anomaly segmentation results.\n\nFigure 35. Visualization of segmentation results for the retina class on BrasTS under the 4-shot setting. The first row displays the input\nimages, with green outlines indicating the ground truth regions. The second row presents the anomaly segmentation results.\n\n28\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"