"<!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>Bidirectional Multimodal Prompt Learning with Scale-Aware Training for\nFew-Shot Multi-Class Anomaly Detection\nYujin Lee, Sewon Kim, Daeun Moon, Seoyoon Jang, Hyunsoo Yoon*\nYonsei University, South Korea\n\narXiv:2408.13516v2 [cs.CV] 30 Mar 2026\n\n{yjlee9040, sewon3397, dani0403, tjdbs70002, hs.yoon}@yonsei.ac.kr\n\nAbstract\nFew-shot multi-class anomaly detection is crucial in real\nindustrial settings, where only a few normal samples are\navailable while numerous object types must be inspected.\nThis setting is challenging as defect patterns vary widely\nacross categories while normal samples remain scarce. Existing vision–language model–based approaches typically\ndepend on class-specific anomaly descriptions or auxiliary\nmodules, limiting both scalability and computational efficiency. In this work, we propose AnoPLe, a lightweight multimodal prompt learning framework that removes reliance\non anomaly-type textual descriptions and avoids any external modules. AnoPLe employs bidirectional interactions\nbetween textual and visual prompts, allowing class semantics and instance-level cues to refine one another and form\nclass-conditioned representations that capture shared normal patterns across categories. To enhance localization, we\ndesign a scale-aware prefix trained on both global and local\nviews, enabling the prompts to capture both global context\nand fine-grained details. In addition, alignment loss propagates local anomaly evidence to global features, strengthening the consistency between pixel- and image-level predictions. Despite its simplicity, AnoPLe achieves strong performance on MVTec-AD, VisA, and Real-IAD under the fewshot multi-class setting, surpassing prior approaches while\nremaining efficient and free from expert-crafted anomaly\ndescriptions. Moreover, AnoPLe generalizes well to unseen\nanomalies and extends effectively to the medical domain.\n\n1. Introduction\nIn real-world industrial inspection, the cost of model development, per-category maintenance, and high-quality data\ncollection poses significant practical challenges. Manufacturing environments often face a large number of product categories, frequent category updates, and limited opportunities to curate clean datasets. Motivated by these\n* Corresponding Author.\n\nFigure 1. (a) Category-dependent anomaly semantics (top-left).\nNormal samples across categories lie in a shared normal space,\nwhile anomalies diverge along category-specific directions. Textual descriptions may align with feasible defects for each category\n(black), whereas invalid descriptions (red) cause semantic mismatch in text-image alignment. (b) Inference speed comparison on MVTec-AD, VisA, and Real-IAD (top-right). AnoPLe\nachieves superior efficiency by avoiding the overhead of prior\nmethods, including WinCLIP’s sliding-window inference [17] and\nthe additional VV-CLIP [19] or Q-Former [22] forward passes in\nPromptAD and IIPAD. This makes AnoPLe faster and more suitable for industrial deployment. (c) PromptAD’s learned embeddings of MVTec-AD on multi-class setting (bottom). T-SNE\nreveals that abnormal features from heterogeneous categories collapse into overlapping regions (circled), indicating semantic confusion despite distinct anomaly descriptions.\n\nconstraints, the anomaly detection (AD) community has\ngradually shifted from conventional single-class AD toward more realistic scenarios that better mirror industrial\nrequirements—most notably few-shot and multi-class AD.\n\n\fFew-shot anomaly detection (FSAD) aims to model normality using only a handful of verified normal samples\nper category, reducing the need for large curated datasets.\nWith the emergence of vision–language models (VLMs)\n[18, 23], recent FSAD approaches [8, 15, 17, 19, 25] have\nleveraged multimodal priors through handcrafted textual\ntemplates, or learnable context vectors. While effective,\nthese methods commonly rely on category-specific descriptions of defect types, such as “broken fabric” or “missing\nwire.” In parallel, multi-class anomaly detection (MCAD)\n[9, 13, 28, 30] has emerged as a scalable paradigm that unifies heterogeneous categories within a single model, reducing deployment and maintenance costs. However, it introduces a key challenge: while normal samples differ in appearance across categories, the notion of being “intact” is\nlargely shared, whereas anomalies are diverse and categorydependent. This asymmetry makes it difficult to learn generalizable defect cues without relying on class-specific descriptions. Recent findings [7] support this view, showing\nthat lightweight class semantics provide a strong inductive\nbias that organizes heterogeneous categories into a structured representation space. This suggests that categorylevel cues alone can effectively mitigate inter-class confusion, without handcrafted defect descriptions.\nIn real industrial environments, two key challenges typically arise together: only a few normal samples are available, and the system must operate across many object categories. This defines the few-shot MCAD setting [15, 22],\nwhere a single model must infer normality from limited observations and still generalize to diverse object types. While\nthe notion of normality (free from breakage, contamination, or geometric irregularity) tends to be consistent across\ncategories, abnormality is highly class-dependent because\neach category exhibits distinctive defect patterns. To illustrate the inherent limitation of description-based prompts,\nFigure 1-(a, c) shows how anomaly semantics vary across\ncategories and why using generic textual descriptions often\nleads to mismatched text–image alignment.\nRecent methods often overlook this asymmetry. IIPAD\n[22], for example, extends single-class AD to the multiclass scenario by collapsing category-specific anomaly descriptions into a unified pool of object-level prompts. This\nsimplification, however, mixes heterogeneous semantics\nand easily produces confusion, since anomaly characteristics that should remain class-dependent are forced into a\nshared textual space. IIPAD introduces instance-induced\nprompts generated by a large Q-Former with auxiliary textual guidance, allowing prompts to adapt dynamically to\neach sample and partially restoring class-specific sensitivity. Although the concept of instance-induced prompts may\nmitigate semantic confusion, it inevitably adds substantial\ncomputational cost and still depends on descriptions derived\nfrom true abnormal samples. Thus, the limitations inherent\n\nin description-based designs remain unresolved.\nVLMs such as CLIP implicitly encode broad visual concepts of intactness and defectiveness within their latent\nspace, acquired from massive image-text corpora. Instead\nof manually describing defect types or generating instancespecific prompts, a more scalable direction is to steer these\nlatent priors through multimodal interaction. Motivated by\nthese insights, we propose AnoPLe, a simple and scalable few-shot MCAD framework that avoids handcrafted\nanomaly descriptions and heavy auxiliary modules. We propose bi-directional prompt learning between textual and\nvisual branches: class names act as lightweight semantic\nanchors on the textual side, while the visual branch learns\ninstance-level cues directly from image evidence. Leveraging the reciprocal interaction, instance-level prompts refine textual cues with defect-relevant details, and textual\ncues guide visual features toward class-aware structure—\neffectively leveraging CLIP’s latent normality/abnormality\npriors without relying on brittle descriptions.\nTo enhance fine-grained localization, which is crucial\nin industrial inspection, AnoPLe uses scale-aware prompt\nlearning that exposes the model to both global context and\nlocal details during training. Unlike VV-CLIP-based methods [19, 22, 32], our design implicitly encodes multi-scale\ncues into the prompt without additional inference cost. At\ntest time, only the global prefix is used, maintaining fullimage compatibility while retaining strong localization ability. Furthermore, alignment loss propagates pixel-level\nanomaly cues to the global level, promoting coherent normality modeling even under extreme few-shot constraints.\nDespite requiring no expert-crafted prompts or categoryspecific tuning, AnoPLe achieves strong performance\nacross diverse industrial benchmarks. Under the one-shot\nsetting, it attains 94.5%, 86.0%, and 81.2% AUROC on\nMVTec-AD [3], VisA [34], and Real-IAD [26], and accurately localizes anomalies with 90.8%, 87.5%, and 88.8%\nPRO. The method further generalizes robustly to unseen\nanomaly types and even medical scenarios, suggesting applicability beyond industrial use cases. In addition, AnoPLe\nachieves high computational efficiency, running at 27.92,\n26.90, and 29.64 FPS on MVTec-AD, VisA, and Real-IAD\n(Figure 1-(b)). Our main contributions are as follows:\n• We propose AnoPLe, a unified few-shot MCAD framework that avoids handcrafted anomaly descriptions and\nheavy external prompt-generation modules.\n• We introduce bi-directional interactions between textual and visual prompts to learn class-aware yet defectagnostic representations.\n• We improve localization through scale-aware prefix and\nalignment loss that jointly capture global context and\nfine-grained local cues.\n• AnoPLe achieves strong few-shot performance even with\nthe single image, showing its practicality and scalability.\n\n\f2. Related work\n2.1. Multi-Class Anomaly Detection\nMulti-Class Anomaly Detection (MCAD) aims to unify\nanomaly detection across multiple object categories within\na single model [9, 13, 28, 30]. Conventional one-classone-model approaches lack scalability, motivating unified\nframeworks such as feature registration [15], distribution\nnormalization [12], adaptive representation learning [28],\nand training-free component-aware matching frameworks\n[11]. A key insight from recent work is the importance\nof class semantics in improving discrimination across categories. CCL [7] show that explicitly modeling class-aware\nstructure reduces inter-class confusion and yields more discriminative anomaly features, suggesting that class-level\ncues provide a strong inductive bias for MCAD.\nBuilding on this, recent methods incorporate semantic guidance through vision-language models or promptbased representations, such as AnomalyGPT and IIPAD,\nwhich leverage textual or learned semantics to better structure multi-class normality. In contrast, INP-Former [21]\nadopts an entirely vision-only framework, extracting intrinsic normal prototypes to guide a lightweight reconstruction\npipeline. While efficient, relying solely on visual evidence\nlimits the semantic structure available for organizing multiclass representations, which can reduce robustness to unseen categories. Together, these directions highlight two\nkey principles for MCAD: (1) leveraging class semantics\nto structure multi-class representations and (2) maintaining scalability for real-world industrial settings. However,\nexisting semantic-driven approaches often rely on explicit\nanomaly descriptions or additional modules, which limits\ntheir flexibility in practical few-shot settings.\n\n2.2. Few-shot Industrial Anomaly Detection\nFew-shot industrial anomaly detection aims to detect\nanomalies using only limited normal samples. Prior works\nexplore transfer-based methods [15] or learning directly\nfrom limited normal samples [17, 19, 24]. With the advent\nof VLMs such as CLIP [18, 23], several studies adapted\ncross-modal alignment to improve few-shot generalization.\nWinCLIP [17] uses handcrafted prompts, while later works\nintroduce learnable adapters [6, 10, 33] or context vectors\n[19]. These approaches demonstrate the benefit of textual\nconditioning but remain limited to single-category settings\nand often rely on expert-crafted anomaly descriptions, hindering their extension to multi-class scenarios.\nFew-shot MCAD. Combining few-shot industrial anomaly\ndetection with MCAD is challenging due to the combination of limited normal samples per category and the need\nto model diverse normal patterns across multiple classes\nwithin a unified representation. IIPAD [22] provides the\nfirst significant attempt in this direction by introducing\n\ninstance-induced prompts that adapt to individual samples.\nWhile effective for category-agnostic anomaly modeling,\nit relies on a large Q-Former and a pool of expert-defined\nanomaly descriptions, resulting in high computational cost\nand limited scalability. Building on recent MCAD findings on the importance of class-aware semantics [7], our approach leverages class names as lightweight textual anchors\nwhile avoiding anomaly-type-specific prompts.This allows\nAnoPLe to learn unified, class-sensitive, yet anomaly-typeagnostic representations without relying on expert-crafted\nanomaly descriptions or heavyweight auxiliary modules.\n\n3. Method\nAnoPLe addresses few-shot MCAD, where only a few\nnormal samples per category are available and anomalyspecific textual descriptions are unavailable. We simulate\nanomalies in both pixel and latent spaces [20, 29] to learn\nabnormality cues from normal-only training. AnoPLe then\njointly learns textual prompts for class-level semantics and\nvisual prompts for instance-level deviations through bidirectional interactions. This design treats class names as\nsemantic anchors while capturing shared normal patterns\nacross categories without explicit defect descriptions. For\nlocalization, we introduce a scale-aware prefix trained on\nglobal and local crops and a lightweight decoder for pixellevel prediction, without increasing inference cost. During\ninference, AnoPLe further leverages a memory bank of normal features for similarity-based anomaly scoring.\n\n3.1. Multi-Modal Prompts for Anomaly Detection\n3.1.1. Textual Prompt Learning\nA central challenge in few-shot MCAD is the semantic heterogeneity of abnormal patterns across categories, which\nrenders explicit defect-level textual descriptions impractical. To establish a minimal yet effective semantic prior,\nwe condition textual prompts solely on class names, omitting a normality token to preserve an intact class prototype.\nInstead, we introduce a unified abnormality token that encodes a coarse non-normal prior from CLIP pretraining,\nwhich is subsequently refined through bidirectional interactions with visual cues during forward propagation to adapt\nto anomaly detection. [7] show that such class semantics\nprovide a strong inductive bias that structures categories and\nmitigates inter-class confusion. Moreover, class names are\nreadily available and consistent with the anomaly detection\nsetting, where supervision is defined by normal–abnormal\ndistinctions rather than category identity.\nGuided by these observations, we define the textual inputs for normal and abnormal prompts as\n  \\mathbf {e}_0^{+} = [\\texttt {class}], \\qquad \\mathbf {e}_0^{-} = [\\texttt {abnormal}]\\,[\\texttt {class}], \n\n(1)\n\nwhere class denotes a category name and abnormal is\na unified abnormality token shared across all categories.\n\n\fArchitecture\n\nScale-aware Prefix\n\nAnomaly\nScore Map\n\nText Encoder 𝑳\n\n: shared\n\n⊗\n\n𝒘+\n𝒘−\n𝒛−\n\n𝑪𝒐𝒏𝒗 𝟏x𝟏\n\n2D Interpolation\n𝑪𝒐𝒏𝒗 𝟑x𝟑\n\n…\n\nEncoder layer\n\n…\n\nEncoder layer\n\n…\n\n…\n…\n\nEncoder layer\n\n…\n\n[Abnormal] [Classname]\n\n▲ Abnormal text prompt\n\n…\n\nContext vector\n\nTextual\nFeature\n\n: Learnable\n\n𝑪𝒐𝒏𝒗 𝟏x𝟏\n\n𝑭𝒗→𝒕\n𝟏\n\n: Frozen\n⊗ : Matrix Multiplication\n\n𝑭𝒗→𝒕\n𝟐\n𝑭𝒕→𝒗\n𝟏\n\n𝑭𝒗→𝒕\n𝑫\n\n𝑭𝒕→𝒗\n𝟐\n\nDecoder\nScale-aware Prefix\n\n𝑭𝒕→𝒗\n𝑫\n\nSub images\n\n…\n\nEncoder layer\n\n…\n\n…\n\n𝒛−\n𝑙𝑎𝑡𝑒𝑛𝑡\n\n…\n\n…\n\n…\n…\n\n…\n\nOriginal Image\n\nScale-aware\nPrefix 𝒄\n\n⊗\n\n𝒛+\n\n…\n\nNormal\nImage Feature\n\nImage Encoder 𝑽\n\nPrompt-guided\nImage Logits\n[ctx] [ctx] [ctx]\n\n[ctx]\n\n[ctx]\n\nAnomaly\nScore\n\n⊕\n\n…\n\nNormal Image\n\nEncoder layer\n\nCrop\n\nAbnormal\nImage Feature\n\nEncoder layer\n\n…\n\nOriginal Image\n\n…\n\nSub images\n\nPatch Embedding\n\n…\n\nCrop\n\nctx vector [cls] visual token\n\n…\n\n: Harmonic Mean\n\nPseudo Abnormal\nImage\n\nImage 𝐼\n\nMemory-guided\nPixel Logits\n\nCrop\n\nWord Embeddi1ng\n\n[Classname]\n\n▲ Normal text prompt\n\nctx vector\n\nContext vector\n\ntextual token\n\n: train-only\n\nPrompt-guided\nPixel Logits\n\nMemory-guided\nImage Logits\n\n𝜀~Ν(𝜇, 𝜎 2 )\n\nMemory\nBank\n\nEncoder 𝑉\n\nFigure 2. Overview of AnoPLe. AnoPLe employs bidirectional multi-modal deep prompts, establishing strong coupling between textual\nand visual representations learning from pseudo anomalies and unified text prompts. For localization, we introduce a light-weight decoder\nto produce pixel logits and train AnoPLe with mixed-scale inputs with a scale-aware prefix. At inference, the anomaly score is computed\nfrom our prompt learner and a visual memory bank. [ctx] denotes an abbreviation for the context vector.\n\nLearnable textual context vectors Pt0 ∈ RCt ×dt are\nprepended to construct the initial text embeddings:\n  \\mathbf {w}_0^{+} = [\\mathbf {P}_0^{t},\\, \\mathbf {e}_0^{+}], \\qquad \\mathbf {w}_0^{-} = [\\mathbf {P}_0^{t},\\, \\mathbf {e}_0^{-}]. \n\n(2)\n\nWe adopt deep prompting across layers of text encoder\nET . At each layer j, the contextual vectors are concatenated\nwith the previous hidden state:\n  \\mathbf {w}_j = E_T([\\mathbf {P}_j^{t},\\, \\mathbf {w}_{j-1}]), \\qquad j=1,\\dots ,J. \n\n(3)\n\n3.1.2. Visual Prompt Learning\nWhereas textual prompts encode class-level priors, the visual branch contributes instance-level cues essential for\ndistinguishing subtle deviations within the same category.\nAn input image I is tokenized into patch embeddings\nz0 , z1 , . . . , zn , where z0 represents the [CLS] token capturing global image information. Learnable visual context\nvectors Pv0 ∈ RCv ×dv are prepended to form initial visual\nnormal and abnormal embeddings:\n  \\mathbf {V}_0^{+} = [\\mathbf {P}_0^{v},\\, \\mathbf {z}_0^{+}], \\qquad \\mathbf {V}_0^{-} = [\\mathbf {P}_0^{v},\\, \\mathbf {z}_0^{-}]. \n\n(4)\n\nDeep prompting is applied analogously to the textual\nbranch, with EV denoting the vision encoder:\n  \\mathbf {z}_j = E_V([\\mathbf {P}_j^{v},\\, \\mathbf {z}_{j-1}]), \\qquad j=1,\\dots ,J. \n\n(5)\n\nBy operating directly at the instance level, the visual\nprompts capture fine-grained variations critical for modeling category-specific normality and detecting small defects.\n\n3.1.3. Bidirectional Coupling of Multi-Modal Prompts\nSince neither explicit anomaly descriptions nor true abnormal images are available, relying on a single modality may\nyield misaligned or incomplete representations. To enable\nreciprocal refinement between modalities, we design the\ntextual and visual prompts to interact through learnable linear projections fv→t ∈ Rdv ×dt and ft→v ∈ Rdt ×dv , which\nproject visual prompts into the textual embedding space and\nvice versa. At each prompting layer j, we fuse the prompts\nfrom both modalities:\n  \\tilde {\\mathbf {P}}_j^{t} = \\left [\\,\\mathbf {P}_j^{t},\\; f_{v\\rightarrow t}(\\mathbf {P}_j^{v})\\,\\right ], \\; \\tilde {\\mathbf {P}}_j^{v} = \\left [\\,\\mathbf {P}_j^{v},\\; f_{t\\rightarrow v}(\\mathbf {P}_j^{t})\\,\\right ].  (6)\nThese fused prompts are then injected into the textual\nand visual encoders:\n  \\mathbf {w}_j = E_T([\\tilde {\\mathbf {P}}_j^{t}, \\mathbf {w}_{j-1}]), \\qquad \\mathbf {z}_j = E_V([\\tilde {\\mathbf {P}}_j^{v}, \\mathbf {z}_{j-1}]).  (7)\nThis coupling allows class-level textual semantics and\ninstance-level cues to iteratively guide one another, yielding representations that are both class-aware and defectagnostic, aligning with the needs of few-shot MCAD.\n\n3.2. Bootstrapping Local Semantics from CLIP\nScale-Aware Prompt Learning. CLIP limits its ability to\ncapture local semantics needed for anomaly localization.\nRather than modifying CLIP’s architecture or introducing\n\n\fexternal attention modules, we incorporate scale-awareness\ndirectly into the prompt sequence. During training, we\npresent the model with both full-resolution images I0 and\nnon-overlapping sub-image crops {Ii | 1 ≤ i ≤ N } to\nexpose it to global and local semantics. A learnable scaleaware prefix c ∈ R(N +1)×dv encodes the resolution identity, and the corresponding ci is prepended to the visual\nprompt tokens for each input. The resulting behaviors of\nthe global and local prefixes, as well as the c, are illustrated in Fig 2. Crucially, this design maintains inference\nefficiency: only the global scale prefix cN +1 is used at test\ntime, avoiding costly multi-scale processing. Embedding\nscale-awareness directly into the prompts enables CLIP to\nlearn unified representations that respect both global and local cues in a modality-consistent and lightweight manner.\nLightweight Decoder for Local Feature Refinement. To\nobtain pixel-level anomaly maps from CLIP’s patch embeddings, we employ a lightweight decoder D following\n[31]. Patch embeddings z[1:] ∈ Rn×dv are upsampled\nvia bilinear interpolation to produce a spatial feature map\nF ∈ Rh×w×dv , which is refined by D and projected into the\ntext embedding dimension dt . This refinement introduces\nlocal spatial context without increasing inference cost.\n\nwhich aggregates local evidence aligned with anomalous regions. Alignment is enforced by cosine similarity:\n  \\mathcal {L}_{align} = 1 - \\langle \\mathbf {z}_0, \\mathbf {s} \\rangle . \n\n(12)\n\nThe final training objective is\n  \\mathcal {L} = \\mathcal {L}_{pixel} + \\mathcal {L}_{img} + \\mathcal {L}_{align}. \n\n(13)\n\n3.4. Anomaly Score\nFollowing [17, 19], we compute memory-assisted anomaly\nmaps by comparing patch features F from the i-th layer of\nEV with a visual memory bank R:\n  \\mathbf {M}_{mem}^{ij} = \\min _{\\mathbf {r}\\in \\mathbf {R}} \\frac {1}{2}(1 - \\langle \\mathbf {F}_{ij}, \\mathbf {r} \\rangle ). \n\n(14)\n\nWe fuse Mmem and the decoder output M̂q using a harmonic mean:\n  \\mathbf {M}_q = \\frac {1}{(1/\\hat {\\mathbf {M}}_q) + (1/\\mathbf {M}_{mem})}. \n\n(15)\n\nThe final anomaly score aggregates image-level and\npixel-level signals:\n\n3.3. Loss Function\n  \\mathrm {score} = \\frac {1}{(1/\\hat {p}) + (1/\\max \\mathbf {M}_q)}. \n\n3.3.1. Pixel-Level Loss\nPixel-level predictions M̂ = ⟨D(z), w⟩ are supervised using simulated ground-truth masks M. The loss is\n  \\mathcal {L}_{pixel} = \\mathcal {L}_{dice}(\\hat {\\mathbf {M}}, \\mathbf {M}) + \\mathcal {L}_{focal}(\\hat {\\mathbf {M}}, \\mathbf {M}), \n\n(8)\n\nwhere Ldice encourages overlap with anomalous regions\nand Lf ocal accounts for the rarity of anomalous pixels.\n3.3.2. Image-Level Loss\nWe compute image-level normality scores using a contrastive cross-entropy loss:\n  \\hat {p} = \\frac {\\exp (\\langle \\mathbf {z}^{i}_0, \\mathbf {w}^i \\rangle / \\tau )}{\\sum _{i\\in \\{-,+\\}}\\exp (\\langle \\mathbf {z}^{i}_0, \\mathbf {w}^i \\rangle / \\tau )}, \n\n(9)\n\nwhere i ∈ {+, −} denotes normal and abnormal text\nprompts. Text embeddings are averaged across all classes\nfollowing [17]. We include pixel-space perturbations (z− )\n+\nand latent-space perturbations (z−\nlatent = z + ϵ with ϵ ∼\n2\nN (µ, σ )), yielding\n  \\mathcal {L}_{img} = \\mathcal {L}_{ce}(\\mathbf {z}^+, \\mathbf {z}^-, \\mathbf {w}) + \\mathcal {L}_{ce}(\\mathbf {z}^+, \\mathbf {z}^-_{\\mathrm {latent}}, \\mathbf {w}). \n\n(10)\n\n3.3.3. Alignment Between Local and Global Semantics\nTo improve consistency between pixel-level and global representations, we introduce Lalign . Pixel logits M̂ weight\nthe decoder outputs to compute\n  \\mathbf {s} = \\sum _{(i,j)} \\hat {\\mathbf {M}}_{ij} \\circ D_{ij}(\\mathbf {z}), \n\n(11)\n\n(16)\n\n4. Experiments\n4.1. Experimental Details\nWe conduct experiments on three widely used industrial\nanomaly detection benchmarks: MVTec-AD [3], VisA [34],\nand Real-IAD [26]. Following standard practice [3, 24],\nwe report image-level AUROC/AUPR and pixel-level AUROC/PRO to evaluate both detection and localization performance. AnoPLe is built upon the CLIP ViT-B/16+\nbackbone, consistent with recent VLM-based approaches\n[17, 19]. For multi-scale training, input images are resized\nto 480×480 and split into four non-overlapping crops, while\nthe original full-resolution view is resized to 240×240.\nThese global and local views are used to construct the scaleaware prompting scheme. Additional hyperparameters and\ntraining details are provided in the supplementary materials.\n\n4.2. Main Results\nIn Table 1, across all benchmarks, AnoPLe delivers strong\nperformance in both image- and pixel-level metrics under the few-shot multi-class setting. Classical coresetbased methods such as SPADE [5] and PatchCore [24] degrade substantially as category diversity increases (poorly\nperforming in Real-IAD). Recent prompt-based methods\n[17, 19] still suffer from semantic confusion when handcrafted anomaly descriptions are collapsed into a unified\n\n\fTable 1. Anomaly detection and localization performance on the MVTec, VisA, and Real-IAD benchmarks. For MVTec-AD and\nVisA, we reproduce each baseline under our unified training configuration. For Real-IAD, we adopt the reported values from [21]. The\nhighest values are highlighted in bold, while the runner-up methods are underlined.\nMVTec\nSetup\n\n1-shot\n\n2-shot\n\n4-shot\n\nMethod\n\nImage-level\nAUROC AUPR\n\nVisA\n\nPixel-level\nAUROC PRO\n\nImage-level\nAUROC AUPR\n\nReal-IAD\n\nPixel-level\nAUROC PRO\n\nImage-level\nAUROC AUPR\n\nPixel-level\nAUROC PRO\n\nSPADE [5]\nPatchCore [24]\nWinCLIP [17]\nPromptAD [19]\nIIPAD [22]\nINP-Former [21]\nAnoPLe\n\n73.5\n66.5\n77.5\n91.2\n94.2\n94.7\n94.5\n\n87.5\n80.6\n87.2\n95.4\n97.2\n97.1\n97.4\n\n59.2\n88.4\n86.0\n93.5\n96.4\n96.7\n96.0\n\n27.3\n66.9\n70.8\n86.1\n89.8\n90.7\n90.8\n\n68.2\n69.8\n70.0\n82.4\n85.4\n84.0\n86.0\n\n72.3\n70.8\n73.1\n86.0\n87.5\n85.9\n87.7\n\n61.5\n88.8\n84.9\n95.1\n96.9\n96.7\n97.0\n\n37.6\n70.0\n61.2\n77.8\n87.3\n84.0\n87.5\n\n51.2\n59.3\n69.4\n52.2\n–\n84.4\n81.2\n\n45.6\n55.8\n56.8\n41.6\n–\n81.9\n80.1\n\n59.5\n89.6\n91.9\n84.9\n–\n97.9\n96.7\n\n19.3\n60.5\n71.0\n58.4\n–\n88.8\n88.0\n\nSPADE [5]\nPatchCore [24]\nWinCLIP [17]\nPromptAD [19]\nIIPAD [22]\nINP-Former [21]\nAnoPLe\n\n75.5\n72.7\n78.9\n93.4\n95.7\n96.4\n95.8\n\n88.4\n84.8\n88.4\n96.5\n97.9\n98.1\n98.0\n\n59.2\n90.6\n86.2\n94.0\n96.7\n97.2\n96.3\n\n27.1\n72.5\n71.4\n86.7\n90.3\n91.9\n91.4\n\n69.5\n74.0\n70.3\n81.4\n86.7\n88.5\n86.9\n\n74.9\n72.7\n73.5\n85.9\n88.6\n90.6\n88.6\n\n61.5\n90.1\n85.3\n95.1\n97.2\n97.6\n97.3\n\n37.5\n72.1\n62.0\n75.4\n87.9\n87.4\n88.1\n\n50.9\n63.3\n70.9\n57.7\n–\n86.4\n82.8\n\n45.5\n59.7\n58.7\n41.1\n–\n84.1\n82.2\n\n59.5\n92.0\n93.2\n86.4\n–\n98.2\n97.4\n\n19.2\n66.1\n74.7\n61.0\n–\n90.5\n89.9\n\nSPADE [5]\nPatchCore [24]\nWinCLIP [17]\nPromptAD [19]\nIIPAD [22]\nINP-Former [21]\nAnoPLe\n\n77.4\n76.8\n78.7\n94.0\n96.1\n96.6\n96.4\n\n89.1\n87.8\n88.0\n96.9\n98.1\n98.1\n98.4\n\n59.2\n92.1\n86.4\n94.6\n97.0\n97.0\n96.5\n\n27.2\n75.8\n71.9\n88.1\n91.2\n91.8\n91.3\n\n70.5\n79.3\n70.5\n85.9\n88.3\n89.3\n87.5\n\n73.5\n81.8\n73.4\n89.1\n89.6\n90.5\n89.2\n\n61.5\n93.0\n85.6\n95.8\n97.4\n98.0\n97.5\n\n37.5\n80.0\n62.0\n78.2\n88.3\n88.1\n88.5\n\n50.8\n66.0\n73.0\n59.7\n–\n88.3\n83.2\n\n45.8\n62.2\n61.8\n43.5\n–\n85.6\n81.5\n\n59.5\n92.9\n93.8\n86.9\n–\n98.4\n97.4\n\n19.2\n68.6\n76.4\n61.9\n–\n91.0\n89.5\n\nTable 2. Results on unseen classes. “Train” denotes the average\nperformance on classes included during training, and “Held-out”\ndenotes the performance on the excluded unseen class. I-AUC and\nP-AUC refer to Image AUROC and Pixel AUROC, respectively.\nI-AUC\n\nP-AUC\n\nDataset\n\nClass\nINP-F\n\nAnoPLe\n\nINP-F\n\nAnoPLe\n\nMVTec\n\nTrain\nHeld-out\n\n93.9\n67.7 (26.2)\n\n93.8\n87.5 (6.3)\n\n96.7\n81.0 (15.7)\n\n95.0\n89.5 (5.5)\n\nVisa\n\nTrain\nHeld-out\n\n87.0\n58.7 (28.3)\n\n83.9\n72.8 (11.1)\n\n97.1\n89.7 (7.4)\n\n95.8\n91.7 (4.1)\n\nRealIAD\n\nTrain\nHeld-out\n\n83.9\n63.1 (20.8)\n\n79.3\n58.5 (20.8)\n\n97.8\n91.3 (6.5)\n\n96.5\n93.5 (3.0)\n\non VisA image-level across settings), the differences remain within a marginal range of 0.1–1.0 across all benchmarks. More importantly, its lack of textual grounding\nmakes it less stable as category variation increases. AnoPLe\ninstead leverages class-name prompts and multimodal interactions to maintain competitive performance across all\ndatasets while offering significantly improved robustness\nto unseen categories and unseen anomaly types (Table 2).\nThis demonstrates that multimodal prompting provides a\nmore scalable and reliable foundation for real-world fewshot MCAD settings.\n\n4.3. Results in Unseen Anomaly Scenarios\nmulti-class space. As particularly visualized in Figure 1(c), PromptAD’s abnormal embeddings from different categories often collapse into overlapping clusters, indicating semantic confusion when description-based prompts are\nforced into a unified multi-class space. In contrast, the proposed bidirectional prompt learning enables us to extract\nrich multi-modal cues to be shared across categories without relying on defect-type descriptions, producing consistently robust results across datasets.\nWe further compare AnoPLe with INP-Former [21], a\nvision-only MCAD framework. Although INP-Former reports slightly higher values on a few metrics (e.g., +0.2\nAUROC on MVTec image-level under 1-shot and +0.2–0.3\n\nReal-world industrial environments frequently expose models to unseen object categories or previously unobserved\nanomaly types. Methods that depend on detailed defectspecific textual descriptions, such as PromptAD, tend to\ndegrade under such conditions. AnoPLe alleviates this issue by using class names as textual anchors while avoiding dependence on anomaly-type descriptions. This design encourages the formation of category-aware yet defectagnostic representations. In contrast, INP-Former operates\npurely on visual features without textual grounding, making\nit less flexible when encountering new categories.\nTo evaluate these generalization properties, we perform\ntwo complementary experiments. Table 2 presents a leave-\n\n\fTable 3. Results on unseen anomalies for selected categories\nfrom MVTec-AD and VisA, respectively. PromptAD* excludes\nanomaly descriptions from the prompt pool of PromptAD.\nMethod\nPromptAD\nPromptAD*\nAnoPLe (Ours)\n\nMVTec-AD\n\nVisA\n\nscrew\n\nbottle\n\nmacaroni2\n\npcb4\n\n55.7\n44.7 (10.0)\n\n96.9\n93.8 (3.1)\n\n80.0\n73.7 (6.3)\n\n94.6\n90.4 (4.2)\n\n53.9\n\n95.1\n\n78.5\n\n91.2\n\nFigure 5. Attention maps conditioned on the global-view prefix,\nlocal-view prefix, and the [CLS] token. Columns 1, 4 are input\nimages; columns 2, 5 display attention maps; columns 3, 6 show\nattention overlays.\n\nFigure 3. Qualitative results on MVTec-AD, VisA, and RealIAD for 1-shot pixel-level anomaly detection. The top row\nshows ground-truth anomaly masks overlaid on the input images,\nwhile the bottom row displays the anomaly maps from AnoPLe.\n\nting, producing clean and spatially coherent heatmaps that\nclosely align with the ground-truth regions. Despite the\ndiverse texture, shape, and background variations across\ndatasets, the model effectively suppresses false positives\nand captures fine-grained defect areas with high confidence.\nThis demonstrates that the proposed multimodal prompt\nlearning framework generalizes well across visual domains\nwithout category-specific tuning. Additional visual comparisons in the supplementary material show that AnoPLe\nprovides consistently more accurate anomaly localization.\n\nFigure 4. Image-level Feature Visualization using PCA in a 1shot setting. The features “hazelnut” for MVTec, “pipe fryum”\nfor VisA, and “tape” for Real-IAD are used.\n\nTo confirm that our method performs well not only in\npixel-level anomaly detection but also at the image level in\na qualitative manner, Figure 4 visualizes image-level features using PCA in the 1-shot setting. The results show that\nAnoPLe produces well-separated clusters between normal\nand abnormal samples, and that textual features align naturally with their corresponding visual counterparts. This\nalignment confirms that the proposed bidirectional prompt\nlearning not only enhances detection accuracy but also leads\nto semantically interpretable feature spaces across domains.\n\none-class-out analysis, where a category is excluded during\ntraining. AnoPLe shows substantially smaller performance\ndegradation on the unseen class than INP-Former, indicating stronger category-level generalization. Table 3 examines robustness to unseen anomaly types. Removing defecttype descriptions (e.g. “manipulated front,” “with contamination,” “missing,” and “with extra”) from PromptAD to\nconstruct PromptAD* leads to large drops in I-AUROC,\nconfirming its reliance on detailed textual priors. AnoPLe,\nwhich does not require such descriptions, remains stable\neven when encountering anomaly types never referenced\nduring training. These results demonstrate that AnoPLe\nprovides strong robustness to both unseen categories and\nunseen anomaly types, reinforcing its practicality for realworld industrial anomaly detection where new objects and\nnovel defect modes routinely emerge.\n\n4.4. Qualitative Results\nAs shown in Figure 3, AnoPLe successfully localizes\nanomalous regions even in the extremely limited 1-shot set-\n\nBeyond pixel- and image-level behaviors, we further analyze how AnoPLe utilizes multi-scale information during\ntraining. Since the model learns from both global images\nand local sub-images, but relies only on the global view during inference, it is essential to understand how these scaledependent cues are organized internally. To this end, we visualize the attention maps conditioned on the learned scaleaware prefixes (Figure 5). The global-view signal attends\nbroadly to the main object, mirroring the holistic behavior\nexpected at test time, while the local-view signal focuses\non smaller patches consistent with its restricted spatial context. Notably, the [CLS] token, trained for anomaly detection, highlights anomalous regions in defective samples\nwhile maintaining object-level focus in normal ones. These\nvisualizations confirm that AnoPLe successfully disentangles global and local cues during training, enabling stable\ninference despite the inherent train–test disparity in scale.\n\n\fTable 4. Ablation on context vector interaction settings, multiscale training, scale-aware prefix c, and prompt type.\nSetting\n\nMVTec\nI-AUC P-AUC\n\nVisA\nI-AUC P-AUC\n\n(a) Interaction Settings\n93.0\n95.0\n81.7\n95.7\n90.3\n95.2\n82.0\n95.8\n92.4\n95.2\n80.3\n96.0\n93.5\n95.1\n84.2\n95.9\n91.2\n95.0\n82.0\n95.9\n94.5\n96.0\n86.0\n97.0\n(b) Alignment Strategy\nNo align\n93.7\n95.3\n86.0\n95.9\n94.4\n95.1\n85.1\n96.0\nalign with mean\nalign with weighted sum\n94.5\n96.0\n86.0\n97.0\n(c) Multi-scale Training / Prefix c\nsingle-scale &amp; no prefix c\n89.9\n95.1\n82.3\n95.8\n91.8\n95.2\n83.3\n95.8\nmulti-scale &amp; no prefix c\nmulti-scale &amp; prefix c\n94.5\n96.0\n86.0\n97.0\n(d) Prompt Type\n[object]\n92.7\n95.3\n84.3\n95.8\n[class]\n94.5\n96.0\n86.0\n97.0\nText\nImage\nT &amp; I (indep)\nT→I\nI→T\nT↔I\n\nRealiAD\nI-AUC P-AUC\n79.9\n80.3\n80.1\n80.1\n80.0\n81.2\n\n96.5\n96.5\n96.6\n96.5\n96.5\n96.7\n\n73.3\n74.2\n81.2\n\n94.9\n95.7\n96.7\n\n79.5\n80.0\n81.2\n\n96.5\n96.5\n96.7\n\n76.0\n81.2\n\n95.4\n96.7\n\n4.5. Ablations\nTable 4-(a) compares interaction strategies between textual\nand visual context vectors. Uni-modal prompts (“Text” or\n“Image”) perform consistently worse, whereas cross-modal\ninteractions bring clear improvements. The bidirectional\nsetting (T ↔ I) achieves the best results across all benchmarks (94.5 / 96.0 on MVTec-AD, 86.0 / 97.0 on VisA, 81.2\n/ 96.7 on Real-IAD), showing that mutual refinement between modalities yields more discriminative anomaly representations. Independent or one-way variants provide partial\ngains but remain less effective.\nTable 4-(b) evaluates how global features should be\naligned with local evidence. Skipping alignment leads to\nweaker normality modeling, while mean alignment partially\nimproves results. The weighted-sum alignment performs\nbest on all datasets by incorporating anomaly-aware pixel\nprototypes, providing stronger guidance for refining global\nsemantics. Table 4-(c) shows that multi-scale training already boosts both detection and localization. Adding the\nscale-aware prefix c yields the highest overall performance,\nindicating that explicit scale encoding helps maintain consistent anomaly cues across varying object sizes.\nTable 4-(d) compares class-agnostic prompts (“object”)\nwith class-aware prompts (“class”). While the categoryagnostic term appears to be more suitable for multi-class\nsetting, class names consistently improve image-level performance (e.g., +5.2 I-AUROC on Real-IAD), as they serve\nas stronger semantic anchors for modeling normal object\nstructure. We attribute this to the grounding effect of class\nnames: they provide semantically richer anchors that help\nthe visual prompts model normal object structure more precisely. This enhances sensitivity to subtle deviations while\navoiding reliance on defect-specific anomaly descriptions,\nwhich remain harmful to generalization. Further discussion\nis provided in the supplementary material.\n\nTable 5. Comparison of anomaly detection and localization\nperformance on three medical datasets in BMAD: Brain MRI,\nLiver CT, and Retinal OCT (4-shots). The best score is in bold,\nand the second best is underlined.\nBrain MRI [1]\n\nLiver CT [4, 16]\n\nRetinal OCT [14]\n\nI-AUC\n\nP-AUC\n\nI-AUC\n\nP-AUC\n\nI-AUOC\n\nP-AUC\n\nMedCLIP [27]\nPatchCore [24]\nWinCLIP [17]\nPromptAD [19]\nUniVAD [11]\n\n76.9\n73.4\n53.7\n73.9\n82.6\n\n90.9\n96.3\n86.2\n94.3\n97.0\n\n60.7\n54.9\n61.9\n62.1\n72.8\n\n94.4\n96.0\n97.8\n96.4\n97.9\n\n66.6\n65.3\n75.4\n91.2\n88.9\n\n89.6\n83.2\n94.4\n96.6\n95.3\n\nAnoPLe\n\n79.8\n\n97.1\n\n74.8\n\n95.9\n\n91.4\n\n97.0\n\nMethod\n\n4.6. Applicability to Medical Anomaly Detection\nAlthough AnoPLe is primarily designed for industrial domain, we demonstrate its applicability to the medical domain through the BMAD [2] under a 4-shot setting (Table\n5). Despite having access to only a few normal samples\nper class—and without incorporating any medical-specific\nadaptations—AnoPLe consistently delivers strong performance across Brain MRI, Liver CT, and Retinal OCT [1, 4,\n14, 16], achieving the best or second-best results. Notably,\nAnoPLe outperforms both medical-specialized [27] and\nindustrial-domain–targeted anomaly detection approaches\n[17, 19, 24], highlighting its robustness beyond its original\ndesign scope. Moreover, AnoPLe demonstrates competitiveness comparable to the latest universal anomaly detection framework UniVAD [11], whose key strength is strong\ncross-domain generalization. These results indicate that\nAnoPLe is able to learn transferable normality cues, achieving robustness across visually diverse domains—even with\nlimited data and no domain-specific tuning.\n\n5. Conclusion\nWe present AnoPLe, a scalable framework for few-shot\nmulti-class anomaly detection that removes the need for\nhandcrafted anomaly descriptions through unified prompts\nand pseudo anomalies. By bidirectionally coupling textual and visual prompts, AnoPLe forms class-grounded and\ndescription-free representations that capture shared normal\npatterns across categories while detecting deviations purely\nfrom instance-level cues. To support fine-grained localization without additional inference cost, we incorporate\na scale-aware prompting mechanism and a lightweight decoder that refines CLIP’s patch embeddings. Experiments\non MVTec-AD, VisA, and Real-IAD show consistent gains\nover prior approaches in both detection and localization,\nalong with strong robustness to unseen anomaly types, visually distinct domains, and even medical anomaly detection\nscenarios. By mitigating inter-class confusion and avoiding class-specific engineering, AnoPLe provides a simple,\ntransferable, and practical solution for real-world industrial\nanomaly detection.\n\n\fAcknowledgments\nThis work was supported by the Institute of Information &amp;\nCommunications Technology Planning &amp; Evaluation (IITP)\ngrant funded by the Korean government (MSIT) (RS-202502305884).\n\nReferences\n[1] Ujjwal Baid, Satyam Ghodasara, Suyash Mohan, Michel\nBilello, Evan Calabrese, Errol Colak, Keyvan Farahani,\nJayashree Kalpathy-Cramer, Felipe C Kitamura, Sarthak\nPati, et al. The rsna-asnr-miccai brats 2021 benchmark on\nbrain tumor segmentation and radiogenomic classification.\narXiv preprint arXiv:2107.02314, 2021. 8\n[2] Jinan Bao, Hanshi Sun, Hanqiu Deng, Yinsheng He, Zhaoxiang Zhang, and Xingyu Li. Bmad: Benchmarks for medical\nanomaly detection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages\n4042–4053, 2024. 8\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. 2, 5\n[4] Patrick Bilic, Patrick Christ, Hongwei Bran Li, Eugene\nVorontsov, Avi Ben-Cohen, Georgios Kaissis, Adi Szeskin,\nColin Jacobs, Gabriel Efrain Humpire Mamani, Gabriel\nChartrand, et al. The liver tumor segmentation benchmark\n(lits). Medical image analysis, 84:102680, 2023. 8\n[5] Niv Cohen and Yedid Hoshen. Sub-image anomaly detection with deep pyramid correspondences. arXiv preprint\narXiv:2005.02357, 2020. 5, 6\n[6] Hanqiu Deng, Zhaoxiang Zhang, Jinan Bao, and Xingyu Li.\nAnovl: Adapting vision-language models for unified zeroshot anomaly localization. arXiv preprint arXiv:2308.15939,\n2023. 3\n[7] Lei Fan, Junjie Huang, Donglin Di, Anyang Su, Tianyou\nSong, Maurice Pagnucco, and Yang Song. Salvaging the\noverlooked: Leveraging class-aware contrastive learning\nfor multi-class anomaly detection. In Proceedings of the\nIEEE/CVF International Conference on Computer Vision,\npages 21419–21428, 2025. 2, 3\n[8] 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. 2\n[9] Bin-Bin Gao. Learning to detect multi-class anomalies with\njust one normal image prompt. In European Conference on\nComputer Vision, pages 454–470. Springer, 2024. 2, 3\n[10] 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. 3\n[11] Zhaopeng Gu, Bingke Zhu, Guibo Zhu, Yingying Chen,\nMing Tang, and Jinqiao Wang. Univad: A training-free uni-\n\nfied model for few-shot visual anomaly detection. In Proceedings of the Computer Vision and Pattern Recognition\nConference, pages 15194–15203, 2025. 3, 8\n[12] Jia Guo, Haonan Han, Shuai Lu, Weihang Zhang, and\nHuiqi Li. Absolute-unified multi-class anomaly detection\nvia class-agnostic distribution alignment. arXiv preprint\narXiv:2404.00724, 2024. 3\n[13] Haoyang He, Jiangning Zhang, Hongxu Chen, Xuhai Chen,\nZhishan Li, Xu Chen, Yabiao Wang, Chengjie Wang, and Lei\nXie. A diffusion-based framework for multi-class anomaly\ndetection. In Proceedings of the AAAI conference on artificial intelligence, pages 8472–8480, 2024. 2, 3\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. 8\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. 2, 3\n[16] J Igelsias, M Styner, T Langerak, B Landman, Z Xu, and A\nKlein. Miccai multi-atlas labeling beyond the cranial vault–\nworkshop and challenge. In Proc. MICCAI Multi-Atlas Labeling Beyond Cranial Vault—Workshop Challenge, 2015. 8\n[17] 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, 8\n[18] Chao Jia, Yinfei Yang, Ye Xia, Yi-Ting Chen, Zarana Parekh,\nHieu Pham, Quoc Le, Yun-Hsuan Sung, Zhen Li, and Tom\nDuerig. Scaling up visual and vision-language representation learning with noisy text supervision. In International\nconference on machine learning, pages 4904–4916. PMLR,\n2021. 2, 3\n[19] 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, 5, 6, 8\n[20] Zhikang Liu, Yiming Zhou, Yuansheng Xu, and Zilei Wang.\nSimplenet: A simple network for image anomaly detection\nand localization. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages\n20402–20411, 2023. 3\n[21] Wei Luo, Yunkang Cao, Haiming Yao, Xiaotian Zhang,\nJianan Lou, Yuqi Cheng, Weiming Shen, and Wenyong Yu.\nExploring intrinsic normal prototypes within a single image for universal anomaly detection. In Proceedings of the\nComputer Vision and Pattern Recognition Conference, pages\n9974–9983, 2025. 3, 6\n[22] Wenxi Lv, Qinliang Su, and Wenchao Xu. One-for-all fewshot anomaly detection via instance-induced prompt learning. 2025. 1, 2, 3, 6\n[23] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya\nRamesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry,\n\n\fAmanda 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. 2, 3\n[24] Karsten Roth, Latha Pemula, Joaquin Zepeda, Bernhard\nSchölkopf, Thomas Brox, and Peter Gehler. Towards total recall in industrial anomaly detection. In Proceedings of\nthe IEEE/CVF Conference on Computer Vision and Pattern\nRecognition, pages 14318–14328, 2022. 3, 5, 6, 8\n[25] 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[26] Chengjie Wang, Wenbing Zhu, Bin-Bin Gao, Zhenye Gan,\nJiangning Zhang, Zhihao Gu, Shuguang Qian, Mingang\nChen, and Lizhuang Ma. Real-iad: A real-world multi-view\ndataset for benchmarking versatile industrial anomaly detection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 22883–22892,\n2024. 2, 5\n[27] Zifeng Wang, Zhenbang Wu, Dinesh Agarwal, and Jimeng\nSun. Medclip: Contrastive learning from unpaired medical\nimages and text. In Proceedings of the 2022 Conference on\nEmpirical Methods in Natural Language Processing, pages\n3876–3887, 2022. 8\n[28] Zhiyuan You, Lei Cui, Yujun Shen, Kai Yang, Xin Lu,\nYu Zheng, and Xinyi Le. A unified model for multi-class\nanomaly detection. Advances in Neural Information Processing Systems, 35:4571–4584, 2022. 2, 3\n[29] 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. 3\n[30] Ying Zhao. Omnial: A unified cnn framework for unsupervised anomaly localization. In Proceedings of the IEEE/CVF\nConference on Computer Vision and Pattern Recognition,\npages 3924–3933, 2023. 2, 3\n[31] Chong Zhou, Chen Change Loy, and Bo Dai. Extract free\ndense labels from clip. In European Conference on Computer Vision, pages 696–712. Springer, 2022. 5\n[32] 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. 2\n[33] 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[34] 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. 2, 5\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"