"<!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>This CVPR paper is the Open Access version, provided by the Computer Vision Foundation.\nExcept for this watermark, it is identical to the accepted version;\nthe final published version of the proceedings is available on IEEE Xplore.\n\nFastRef: Fast Prototype Refinement for Few-shot Industrial Anomaly Detection\nYufei Li1 Long Tian1,† Yuyang Dai1 Wenchao Chen2,† Liang Bao1 Xiyang Liu1\n{1. School of Computer Science and Technology, 2. School of Electronic Engineering}, Xidian University\n{tianlong, chenwenchao}@xidian.edu.cn\n\nAbstract\nFew-shot industrial anomaly detection (FS-IAD) presents a\ncritical challenge for practical automated inspection systems operating in data-scarce environments. While existing approaches predominantly focus on obtaining prototypes from limited normal images, they neglect to systematically incorporate statistics of query image to enhance prototype representativeness. To address this issue, we propose\nFastRef, a novel and efficient prototype refinement framework for FS-IAD. Our method operates through an iterative updates during inference: (1) characteristic transfer\nfrom query features to the enhanced prototypes, and (2)\nanomaly suppression by aligning the enhanced prototypes\nwith their normal counterparts. The characteristic transfer\nis achieved through linear reconstruction of query features\nfrom prototypes with an optimizable transport matrix, while\nthe anomaly suppression addresses a key observation in FSIAD that unlike conventional IAD with abundant normal\nimages, the limited-sample setting makes anomaly reconstruction more probable in characteristic transfer. Therefore, we employ optimal transport to measure while minimize the gap between normal prototypes and their enhanced\ncounterparts for anomaly suppression. For comprehensive evaluation, we integrate FastRef with three competitive prototype-based FS-IAD methods: PatchCore, WinCLIP, and AnomalyDINO. Extensive experiments across\nfour benchmark datasets of MVTec, ViSA, MPDD and RealIAD demonstrate both the effectiveness and efficiency of\nour approach under 1/2/4-shots. Code will be available at\nhttps://github.com/liyufei25/FastRef.\n\nFigure 1. The black line represents the processing flow of supporting images, and the green line represents the processing flow of\nquery images. Left: Traditional prototype-oriented FS-IAD methods. Right: Our proposed FastRef, it refines prototypes with the\nquery features by suppressing anomalies and transferring characteristics iteratively. The improved performance can be obtained\nthanks to the well enhanced prototypes in low data regime.\n\n1. Introduction\n\nscales [21] , making it difficult for fully supervised methods\n[7, 11]. Therefore, unsupervised IAD methods, trained with\nmassive normal images, have been developed [14, 16]. In\nthe cold start problem, it is not always possible to obtain a\nlarge number of normal images for different products, making existing methods less effective in low data regime [8].\nFew-shot learning (FSL) methods [24, 25, 29] have been\nintroduced to unsupervised IAD, allowing the development\nof a common model generalizing to new products with only\na few normal images, such as 1-shot per product. This new\nparadiagm is known as few-shot IAD [8] (FS-IAD), which\nmainly involves prototype-oriented methods [5, 9]. At training time, these methods typically use the statistics of few\nnormal support images to construct normal prototypes. At\n\nIndustrial Anomaly Detection (IAD) aims to automatically\nidentify defects on product surfaces [13] and has been\nattracting tremendous attention [15, 32, 34]. The fragmented nature of industrial anomalies ranging from subtle\nbruises to obvious breakages, with varying appearances and\n† Corresponding Author\n\n43040\n\n\ftest time, anomaly scores are computed by measuring the\ndifferences between query image and normal prototypes using measurement function. Finally, anomalies are detected\nand localized by comparing the anomaly scores against the\npredefined threshold. Especially, [5] further uses query features to quickly refine prototypes at test time. However,\nwe find that point-to-point reconstruction as in [5] does significantly limits the ability to transfer characteristics from\nquery images to prototypes. Additionally, meta learning\nbased FS-IAD methods [8, 30] have been introduced to\nachieve fast generalization, whose performance is verified\nto be far behind of prototype-oriented methods [31].\nObserving the fact that characteristics of query images\nhave not been fully explored during inference previously\n[5, 22] either from the data perspective [22] or from the\noptimization perspective [5], which may result in suboptimal enhanced prototypes , particularly when the available normal images are extremely limited. As shown in\nFig. 1, we therefore propose FastRef, a fast prototype refinement model which can be easily integrated with other\nprototype-oriented FS-IAD methods. FastRef enhances the\nrepresentativeness of prototypes by transferring characteristics from query features to the enhanced prototypes while\nsuppressing anomalies by aligning the enhanced prototypes\nwith their normal counterparts, making the enhanced prototypes more robust and generalizable. We formulate prototype refinement with query features as a nested optimization\nprocess balancing anomaly suppression and characteristic\ntransfer, with a transport probability and transform matrix\ncapturing these two behaviors, simultaneously. We then develope an efficient algorithm to solve the transport probability and transform matrix iteratively. Specifically, as for\nanomaly suppression, we use Sinkhorn algorithm [3], an\nentropy-regularized optimal transport, to align the distribution between the original normal prototypes and their enhanced counterparts, ensuring that the enhanced prototypes\nare unaffected by anomalies. When it comes to characteristic transfer, we maximize the transferability from query\nfeatures to the enhanced prototypes by minimizing the reconstruction loss between the enhanced prototypes and their\nnormal counterparts with gradient descent in a closed form.\nFinally, we integrate FastRef into three popular prototypeoriented FS-IAD methods, PatchCore [21], WinCLIP [9],\nand AnomalyDINO [4] . Our integrated models consistently improves the performance against their corresponding FS-IAD methods by significant margins across four\nwidely used datasets, including MVTec [1], ViSA [36],\nMPDD [10], and RealIAD [28]. Importantly, we also find\nthat the proper initialization of transform matrix achieves\noptimal efficiency-performance trade-offs and only requires\nless than 10 inner loops by Sinkhorn algorithm, guaranteeing the real-time efficiency of our FastRef in practice. The\nmain contributions can be summarized as follows:\n\n• We propose FastRef, a fast prototype refinement model,\nto transfer characteristics of query features while suppressing anomalies in query features, which can be integrated with other prototype-oriented FS-IAD methods.\n• We formulate FastRef as a nested optimization problem\nand introduce a fast algorithm to solve the problem precisely in a closed form during inference.\n• The experimental results confirm that FastRef is effective in improving FS-IAD performance while maintaining real-time efficiency on the datasets of MVTec, ViSA,\nMPDD, and RealIAD under 1/2/4-shots.\n\n2. Background\n2.1. Task Formulation\nWe formally define the one-class FS-IAD, adhering to the\nstandard FSL. The model is fine-tuned using k normal support images xs1:k and predicts whether the t-th query image\nxqt is anomalous at both the pixel and image levels. In this\npaper, we fully leverage the pre-trained backbone fθ∗ like\nResNet-50 [6] or DINO-V2 [17], parameterized by θ ∗ , to\nextract features from both support and query images following the previous FS-IAD methods [4, 9, 21], denoted as:\n  \\begin {split} \\boldsymbol {f}^{\\rm {s}}=f_{\\boldsymbol {\\theta }^*}(\\boldsymbol {x}_{1:{\\rm {k}}}^{\\rm {s}}), \\quad \\boldsymbol {f}_{\\rm {t}}^{\\rm {q}}=f_{\\boldsymbol {\\theta }^*}(\\boldsymbol {x}_{\\rm {t}}^{\\rm {q}}) \\end {split}\ns\n\n(k×h×w)×c\n\n(1)\n\nare normal features, and f qt\ns\n\nwhere f ∈ R\n∈\nR(h×w)×c is a query image’s features. f tend to be redundant, we use Coreset [23] to construct prototypes Ms ∈\nR(α×k×h×w)×c by selecting the most representative normal\nfeatures from f s with a downsampling ratio α ∈ (0, 1). For\nsimplicity, we denote m = h × w and n = α × k × h × w\nfor the reminder of this paper.\n\n2.2. Optimal Transport\nAlthough optimal transport (OT) has a rich theory, we limit\nour discussion to OT for discrete distributions and refer the\nreaders to [19] for details. Let us consider P and Q as two\ndiscrete probability distributions on theParbitrary space X ∈\nm\nRc , which can be formulated as P = i=1 ai δxi , and Q =\nP\nn\nm\nn\nm\nj=1 bj δy j . In this case, a ∈ Σ and b ∈ Σ , where Σ\nm\ndenotes the probability simplex of R . The OT distance\nbetween a and b can be defined as:\n  \\begin {split} {\\rm {OT}}(P,Q)={\\rm {min}}_{\\boldsymbol {T} \\in U(P,Q)} \\left \\langle \\boldsymbol {T}, \\boldsymbol {C} \\right \\rangle \\end {split}\n\n(2)\nm×n\n\n43041\n\nwhere ⟨·, ·⟩ denotes the Frobenius dot-product, C ∈ R\nis the cost matrix with element Ci,j = C(xi , y j ), and\nC(·, ·) is usually distance function like Euclidean or cosine.\nT ∈ Rm×n is the doubly stochastic\ntransport\nPm\nPprobability\nn\nsuch that U (P, Q) := {T | i=1 T i,j = bj , j=1 T i,j =\nai }. To relax the time-consuming problem when minimizing the OT distance,\nP [3] introduced the entropic regularization, H = − i,j T i,j lnT i,j , leading to the widely-used\nSinkhorn algorithm for discrete OT problems.\n\n\f3. Method\nWe first formulate FastRef as a nested optimization problem between characteristic transfer and anomaly suppression from query features to the enhanced prototypes. Then\nwe introduce a fast and efficient algorithm to solve FastRef\nby updating transform matrix and transport probability iteratively. Finally, we implement the industrial anomaly detection and localization through reconstruction using query\nfeatures and the enhanced prototypes.\n\n3.1. Modeling of FastRef\nWe aim to refine prototypes by transferring characteristics\nwhile suppressing anomalies from query images. We propose a nested optimization for modeling such behaviors as:\n  \\label {eq: obj} \\begin {split} \\boldsymbol {W}^*, \\boldsymbol {T}^* = \\mathop {\\arg \\min }\\limits _{\\boldsymbol {W}, \\boldsymbol {T}} {\\rm {dis}}(\\boldsymbol {f}_{{\\rm {t}}}^{{\\rm {q}}},\\boldsymbol {W} \\boldsymbol {\\mathcal {M}}_{\\rm {s}})+\\lambda {\\rm {OT}}(P, Q) \\end {split} (3)\nwhere dis(·, ·) is the point-wise distance between two sets\nlike Euclidean, with its specific form dependent on the\nfollow-up applications in Sec. 4. W ∈ Rm×n is the\ntransform matrix used to transfer the characteristics of\nquery features f qt for obtaining the enhanced prototypes\nw\nm×c\nMw\n. Notably, differs = W Ms , where Ms ∈ R\nent from prototype refinement that takes place along the\nfeature dimension, we refer to our transform as composition refinement, the meaning of which is reconstructing\nquery features by selecting items from the normal prototypes Ms . T ∈ Rm×n is the transport probability having been discussed in Sec.2. It is used to suppress anomalies potentially present in query features f qt by minimizing\nOT(P, Q). P and Q P\nare distributions expanded\nMw\ns\nPn by\nm 1\n1\nand Ms , where P = i=1 m δMws,i , Q = j=1 n δMs,j ,\nc\nand Ms,i , Mw\ns,j ∈ R . λ is the balanced coefficient.\nRemark: Minimizing the second term in Eq. 3 makes\nthe enhanced prototypes Mw\ns much more similar with the\nnormal prototypes Ms , thus suppressing potential anomalies in query features. To better understand this, let us consider a case that P contains anomaly features as shown in\nFig. 2, where the detailed expressions on W and T will\nbe discussed later, and P\nwe omit the index t for simplicity.\n1\nWith the constraint of j T i,j = m\n, although the transport probability may pay attention to the anomaly features\nin Mw\ns , in order to minimize the second term in Eq. 3,\nin the next round of optimization on W , theoretically, it\nmay ignore those anomaly features by adjusting the corresponding weights in W . Therefore, the anomalies could\nbe suppressed. On the contrary, if we only adopt point-wise\ndistance like Euclidean between f qt and W Ms as shown in\nthe first term of Eq. 3. Then the enhanced prototypes may\nbe misled by anomalies in f qt so that the distance between\nf qt and W Ms can be smaller. Additionally, the OT-based\n\nFigure 2. The roles of transform matrix W and transport probability T . Top: W -based f qt reconstruction restores normal features\nbut may propagate anomalies, causing similar anomaly score (AScore) in defective and normal regions. Bottom: T -adjusted W\nenables effective anomaly suppression, making defective regions’\nAScore distinguishable. The indexes between anomaly GT mask\nand T show that T primarily activates on anomalous areas.\n\nregularization in Eq. 3 does not rely on Gaussian assumption of (enhanced) prototypes, making it more adaptable for\nreal-world FS-IAD, as discussed in the Appendix F.\nWe then use Sinkhorn algorithm [3] and rewrite the second term in Eq. 3 as follows:\n  \\label {eq: ot} \\begin {split} {\\rm {OT}}_{\\epsilon }(P_{\\rm {s}},Q_{\\rm {s}}):=\\sum _{{\\rm {i}},{\\rm {j}}}^{{\\rm {m}},{\\rm {n}}} \\boldsymbol {C}_{{\\rm {i}},{\\rm {j}}} \\boldsymbol {T}_{{\\rm {i}},{\\rm {j}}} + \\epsilon \\sum _{{\\rm {i}},{\\rm {j}}}^{{\\rm {m}},{\\rm {n}}} \\boldsymbol {T}_{{\\rm {i}},{\\rm {j}}} {\\rm {ln}} \\boldsymbol {T}_{{\\rm {i}},{\\rm {j}}} \\end {split}\n\n(4)\n\nwhere ϵ &gt; 0 is another balanced coefficient, C ∈ Rm×n is\ntypically formulated with simple distance function dis(·, ·)\nm×n\nlike Euclidean.\nPnRecalling that\nPTm ∈ R 1 must satisfy\n1\nU (P, Q) := { j=1 T i,j = m , i=1 T i,j = n } in FS-IAD,\nwhere T i,j denotes the transport probability between the ith enhanced prototype and the j-th prototype, serving as an\nupper-bounded positive metric. Consequently, T naturally\nweights the importance of each enhanced prototype in relation the set of original normal prototypes.\n\n3.2. Solving of FastRef\n\n43042\n\nIt is obvious that the optimal parameters for the transport\nprobability T ∗ and the transform matrix W ∗ are interdependent accoridng to Eq. 3, which motivates us to develop an iterative algorithm for solving FastRef. Conceptually, at the l-th iteration, for the purpose of anomaly suppression, we keep the transform matrix W l fixed and update the transport probability T l by minimizing the second\nterm of Eq. 3 using Sinkhorn algorithm [3] to derive T l+1 .\nFor characteristic transfer, we keep the transport probability\nT l+1 fixed and update transform matrix W l by minimizing\nEq. 3, denoted as L(f qt , Ms ; W , T ), using gradient de∂L(f q\nt ,Ms ;W l ,T l+1 )\n,\nscent denoted by W l+1 = W l + β\n∂W l\nβ is learning rate. After L steps, the enhanced prototypes with optimal representativeness can be expressed as\nMw∗\n= W ∗ Ms , where W ∗ = W L and T ∗ = T L .\ns\nWhen we choose dis(·, ·) in Eq. 3 as Euclidean or cosine\n\n\fAlgorithm 1 FS-IAD of FastRef\nInput: Maximum iteration number L, prototypes Ms , the\nt-th query features f qt\nParameter: Initial transform matrix W 0\nOutput: Results of FS-IAD\n1: Calculate Q using Ms\n2: while l ≤ L − 1 do\n3:\nCalculate P using W l Ms\n4:\nUpdate T l+1 by minimizing OTϵ (P, Q) while fix\nWl\n5:\nUpdate W l+1 according to Eq. 5 while fix T l+1\n6: end while\n∗\nw∗\n∗\n7: Set W = W L , Ms = W Ms\n8: Implement FS-IAD according to Eq. 6\n9: return FS-IAD results\n\ndistance, W l+1 has a closed-form solution, and we have:\n\n  \\label {eq: updatew} \\begin {split} \\boldsymbol {W}_{l+1}=\\frac {(\\boldsymbol {f}_t^q\\boldsymbol {\\mathcal {M}}_s^T+\\lambda \\boldsymbol {T}_l\\boldsymbol {\\mathcal {M}}_s\\boldsymbol {\\mathcal {M}}_s^T)(\\boldsymbol {\\mathcal {M}}_s\\boldsymbol {\\mathcal {M}}_s^T)^{-1}}{1+\\lambda \\boldsymbol {T}_l \\cdot \\textbf {1}} \\end {split}\n\n(5)\n\nwhere Ms MTs ∈ Rn×n , we can compute the inverse of\nthe matrix in advance and prepare to reuse it for improving\nefficiency. Additionally, the direct computation of pseudoinverse proved numerically stable in experments. In order\nto take a balance between accuracy and inference speed, we\nuse Coreset [23] to compress Ms and set n small. Additionally, updating T l at each iteration is another important computation bottleneck, we find that proper initialization with W 0 = (f qt MTs )(Ms MTs )−1 achieves optimal efficiency-performance trade-offs and only requires\nless than LOT = 10 inner loops by Sinkhorn algorithm,\nthe real-time efficiency for which is also reported in the Appendix E. We also find that L = 2 yields promising performance, as reported in Table 4. All of these evidences\nindicate that the developed algorithm for solving FastRef\nsatisfies real-time requirements at test time. The derivation\nof Eq. 5 is presented in the Appendix B.\n\nminimalistic ”decoder”) efficiently captures feature differences with minimal parameters (Eq. 6); iii) Built-in shortcut resistance: our OT-based anomaly suppression aligns\nwith the design principles of reconstruction-based methods,\nfurther preventing shortcuts without added complexity.\n\n3.4. Convergence Analysis\n\n3.3. Anomaly Detection and Localization\n\nThe algorithm to solve FastRef by iteratively updating\ntransform matrix and transport probability discussed above\nis convergent and the following inequality holds:\n\nOnce the optimal enhanced prototypes Mw∗\ns are obtained\nby solving FastRef, the anomaly score map s for the t-th\nquery image xqt can be defined by calculating the similariq\nq\nties between Mw∗\ns and f t , the features of xt , as follows:\n  \\label {eq: det} \\begin {split} \\boldsymbol {s}_{\\rm {j}} = {\\rm {dis}}(\\boldsymbol {f}_{\\rm {t},\\rm {j}}^{\\rm {q}}, \\boldsymbol {{\\mathcal {M}}}^{\\rm {w}*}_{{\\rm {s}},{\\rm {j}}}), \\quad {\\rm {j}}=1,...,{\\rm {m}} \\end {split}\n\n  \\label {eq: conv} \\begin {split} \\mathcal {L}(\\boldsymbol {W}_{l+1},\\boldsymbol {T}_{l+1}) &amp; \\leq \\mathcal {L}(\\boldsymbol {W}_l,\\boldsymbol {T}_l)-\\frac {\\mu }{2} \\|\\boldsymbol {W}_{l+1}-\\boldsymbol {W}_l\\|_{\\rm {F}}^2 \\end {split}\n\n(7)\n\nwhere L(·, ·) is the objective same with Eq. 3. Since the\nobjective associated with the transform matrix W is convex (see the Appendix), the convergent speed of FastRef by\nminimizing L(·, ·) should be quick, which is also verified in\nour follow-up experiments. The proof of the inequality can\nbe found in the Appendix C.\n\n(6)\n\nwhere the distance function dis(·, ·) is consistent with that\nin Eq. 3. For image-level anomaly detection, we represent the maximum score s∗ among all values in s ∈ Rm as\ns∗ = maxj∈[1,m] sj . For pixel-level localization, we first upscale the anomaly score map s using bi-linear interpolation\nto match the original input resolution. We smooth the score\nmap using a Gaussian kernel following [21]. Additionally,\nthe pseudo-code is provided in Alg. 1.\nRemark: Notably, our reconstruction-based anomaly\ndetection demonstrates unique advantages over memorybased and other reconstruction-based approaches, an aspect\noften overlooked in prior work: i) Structure-aware detection (Eq. 6): Unlike patch-wise matching in memory-based\nmethods (sj := minr∈Ms dis(f qt,j , r) for j = 1, ..., m),\nour approach leverages the structural relationships between\nquery features and their reconstructions, proving particularly effective in low-data regimes; ii) Parameter efficiency versus overfitting: While methods like UniAD [32]\nand HVQTrans [15] employ complex decoders to mitigate\nshortcut learning, they risk overfitting due to excessive parameters. In contrast, our lightweight transform matrix (a\n\n4. Applications to Prototype-oriented Methods\nOur proposed FastRef is applied to three popular prototypeoriented FS-IAD methods, including PatchCore [21], WinCLIP [9], and AnomalyDINO [4].\n\n4.1. PatchCore+: Application to PatchCore\n\n43043\n\nPatchCore [21] is originally introduced for one-class IAD\nwith a large number of normal images. Recently, however, it has also been applied to FS-IAD, thanks to its flexible prototype-oriented design [22]. A notable drawback of\nPatchCore is that its prototypes remain fixed during inference, causing it to overlook the characteristics of the query\nimage features. Therefore, we propose PatchCore+ by incorporating FastRef to enhance the representativeness of\nprototypes in PatchCore. Specifically, we use Euclidean\ndistance in line with PatchCore, and substitute it into Eq.\n\n\fTable 1. Image AUROC (%) ↑ versus different variants of FastRef\n(Variant and FastRecon) with different regularization, results are\nreported on MPDD dataset under 2-shots.\n\n3 and Eq. 6, allowing us to rewrite the nested optimization\nproblem and anomaly score map as:\n  \\label {eq: patchcore+} \\begin {split} &amp; \\boldsymbol {W}^*, \\boldsymbol {T}^* := \\mathop {\\arg \\min }\\limits _{\\boldsymbol {W}, \\boldsymbol {T}} \\|\\boldsymbol {f}_{{\\rm {t}}}^{{\\rm {q}}}-\\boldsymbol {W} \\boldsymbol {\\mathcal {M}}_{\\rm {s}}\\|^2+\\lambda {\\rm {OT}}(P,Q) \\\\ &amp; \\boldsymbol {s}_{\\rm {j}}:={\\rm {min}}_{\\boldsymbol {r} \\in \\boldsymbol {{\\mathcal {M}}}^{\\rm {w}*}_{\\rm {s}}} \\|\\boldsymbol {f}_{{\\rm {t}, \\rm {j}}}^{{\\rm {q}}}- \\boldsymbol {r}\\|^2, \\quad {\\rm {j}}=1,...,{\\rm {m}} \\end {split}\n(8)\n\nName\nFastRef\nVariant\nFastRecon\n\nAnomaly detection and localization can finally be implemented by using reconstruction-based metric in Sec. 3.3.\n\nRegularizations\nP\n2\nT\n∥W\ni,j\ni,: Ms − Ms (j, :)∥2\nPn i,j\nPm\n1\n1\ni=1 W i,: Ms − m\nj=1=1 Ms (j, :)\nn\n∥W Ms − µ∥22\n\nAUROC\n78.2\n76.9\n76.4\n\n4.2. WinCLIP+: Application to WinCLIP\nUnlike PatchCore whose features are extracted by CNNs\n[26, 33], WinCLIP [9] extracts features using a CLIP-based\nvisual language model [20]. Although it had been demonstrated superior in FS-IAD, WinCLIP also neglects the\nimportance of efficiently transferring characteristics from\nquery images to enhance the prototypes. We propose WinCLIP+ by applying FastRef to WinCLIP, it uses cosine distance to rewrite Eq. 3 and Eq. 6 as:\n  \\begin {split} &amp; \\boldsymbol {W}^*, \\boldsymbol {T}^* := \\mathop {\\arg \\min }\\limits _{\\boldsymbol {W}, \\boldsymbol {T}} \\frac {1}{2} [1 - {\\rm {cos}}( \\boldsymbol {f}_{\\rm {t}}^{\\rm {q}}, \\boldsymbol {W} \\boldsymbol {\\mathcal {M}}_{\\rm {s}})] +\\lambda {\\rm {OT}}_{\\epsilon }(P,Q) \\\\ &amp; \\boldsymbol {s}_{\\rm {j}}:={\\rm {min}}_{\\boldsymbol {r} \\in \\boldsymbol {{\\mathcal {M}}}^{\\rm {w}*}_{\\rm {s}}} \\frac {1}{2} [1 - {\\rm {cos}}( \\boldsymbol {f}_{\\rm {t},\\rm {j}}^{\\rm {q}}, \\boldsymbol {r})], \\quad {\\rm {j}}=1,...,{\\rm {m}} \\end {split}\n\n(9)\n= W ∗ Ms . To conduct FS-IAD for f qt , we\nwhere Mw∗\ns\ncombine the maximum value of s above with the WinCLIP\nzero-shot anomaly score s0 : Rc → [0, 1] [9], which provide complementary information, one from query features\nand the other from CLIP knowledge by:\n  \\label {eq: zerofew} \\begin {split} s^* = \\frac {1}{2}[s_0(\\boldsymbol {f}_{\\rm {t}}^{\\rm {q}})+{\\rm {max}}_{{j} \\in [1,{\\rm {m}}]}\\boldsymbol {s}_j] \\end {split}\n\n(10)\n\nFinally, the anomaly detection and localization can be\nachieved by using reconstruction-based metric in Sec. 3.3.\n\n4.3. AnomalyDINO+: Application to AnomalyDINO\nAnomalyDINO [4] employs more scalable foundation\nTransformer, DINOv2 [17], compared with CLIP-based\nWinCLIP [9] for FS-IAD above. We propose AnomalyDINO+ by integrating our FastRef with AnomalyDINO.\nSpecifically, we first use cosine distance in Eq. 3 and Eq.\n6, and then substitute the normal prototypes (also called the\nmemory bank in AnomalyDINO) and query features collected from AnomalyDINO into Eq. 3 and Eq.6 to obtain\nthe enhanced prototypes at test time per query image. According to the above two steps, the formulations of objective function and anomaly score map are same with those\nof WinCLIP+. Similar to AnomalyDINO [4], we compute\nimage-level anomaly score s∗ by averaging the top 1% values of the anomaly map s, namely, s∗ = mean(smax\n0.01 ),\nwhere smax\nis\nthe\nsubset\ncontaining\nthe\ntop\n1%\nhighest\nval0.01\nues in s. This statistic can be understood as an empirical\n\nestimate of the extreme-tail anomaly intensity . Selecting\ntop 1% values effectively suppresses noise while retaining\nthe most informative anomaly evidence.\n\n4.4. Comparison to FastRecon\nSimilar with FastRef, FastRecon [5] also enhances prototypes by transferring query image features. However, these\ntwo methods still differs from each other significantly:\nPk\n• FastRecon constructs prototypes by µ = k1 i=1 f si . It\nis obvious that prototypes are ordered since the shapes of\nµ and W Ms are the same. FastRef employs the Coreset\nof support features as normal prototypes, which is disordered. We have verified the importance of disorder in\nFS-IAD and report results in Table 1.\n• FastRecon assumes the enhanced prototypes and their\nnormal counterparts are isotropic Gaussian distributions.\nThus, it uses Euclidean distance for anomaly suppression\nby ∥W Ms −µ∥22 . FastRef only requires that the features\nbe sampleable which should be more precise and flexible\nthan FasRecon, as shown in Table 1 and Appendix F.\nTo sum up, FastRecon can be regarded as a special case of\nour method when we assume prototypes are Gaussian distributed and normal prototypes are ordered. That is, setting T =P\nI and substituting µ into our anomaly suppression term i,j T i,j ∥W i,: Ms −Ms (j, :)∥22 , it degrades into\n∥W Ms − µ∥22 , which is exactly the form of FastRecon.\n\n5. Experiments\nWe first evaluate both image and pixel-level performance\ncorresponding to the tasks of anomaly detection and localization to demonstrate the effectiveness of FastRef. Then,\nablation studies and hyper-parameters’ impacts are implemented to validate the improvements of different components in FastRef. We report the inference time of FastRef in\nAppendix D verifying its efficiency.\n\n5.1. Experiment Setup\n(1) Datasets. We use MVTec [1], VisA [36], MPDD [10],\nand RealIAD [28] datasets under 1/2/4-shots settings. More\ndetails of datasets can be found in the Appendix A.\n(2) Competing Methods. We compare our developed\nPatchCore+, WinCLIP+, and AnomalyDINO+ with most\n\n43044\n\n\fFigure 3. From top to bottom are visualizations of anomaly localization on MVTec, ViSA, MPDD, and RealIAD under 4-shots.\n\n5.2. Comparisons with SOTA Methods\n\nrecently proposed FS-IAD methods or those applicable in\nlow-data regimes, including RegAD [8], PatchCore [21],\nFastRecon [5], WinCLIP [9], AnomalyDINO [4], GraphCore [31], FOCT [27], and PromptAD [12]. For fairness,\nwe report results on all the four datasets by implementing\nexperiments with the official codes of PaDiM, PromptAD,\nPatchCore, FastRecon, WinCLIP, and AnomalyDINO using\nthe same few normal images. We report results of RegAD,\nFOCT, and GraphCore from their original papers.\n(3) Evaluation Protocols. We evaluate the performance of\nfew-shot anomaly detection and localization separately using Image and Pixel-level AUROC following [9].\n\n(1) Image level Comparison. We present anomaly detection results in Table 2. Comparing the results of RegAD\n[8], PatchCore [22], and FastRecon [5], we find that: i)\nPrototype-oriented methods outperform the meta-learning\nbased methods, demonstrating superior flexibility of their\nfeatures; ii) FastRecon outperforms PatchCore, highlighting the importance of incorporating characteristics from\nquery images. When comparing PatchCore and FasRecon\nto WinCLIP [9], WinCLIP achieves a substantial performance gain except on the MPDD dataset. We attribute this\nto two factors: i) Generally, the representations from pretrained CLIP models are more powerful than those from\nCNNs; ii) Unlike MVTec, VisA and RealIAD, MPDD is a\nmetal dataset with rotation variations that may not be wellrepresented during CLIP pre-training. We observe consistent performance gain when the scale of pre-trained model\nincreases by comparing the results between WinCLIP and\nAnomalyDINO. This discrepancy motivates us to demonstrate the effectiveness of our model using pre-trained models with various scale. And there are two key observations:\ni) Prototype-based FS-IAD methods with pre-trained models of various scale may benefit from our proposed FastRef\nconsistently with minimum modifications; ii) The performance improvement of FastRef is more pronounced in scenarios where the pre-trained model is weaker, the dataset is\nmore challenging, or both factors interact synergistically.\n(2) Pixel level Comparison. Pixel-level anomaly localization results are also presented in Table 2. When comparing PatchCore+, WinCLIP+, and AnomalyDINO+ with\nother methods, the trend in pixel-level AUROC is consistent with that of the image-level AUROC. It suggests that\n\n(4) Implementation Details. We separately follow the basic settings of PatchCore [21], WinCLIP [9], and AnomalyDINO [4] to implement experiments. For PatchCore, FasRecon and PatchCore+, we use the pretrained WRN-50 [33]\nto extract features from the intermediate layers, following\n[21]. Images are all resized to 256×256. Balanced coefficient λ = 0.3 and Coreset sampling ratio α = 0.05\nfor all the datasets. As for WinCLIP+, we resize all images to 240×240 and use the pre-trained CLIP model with\nViT-B/16+ to extract features following [9]. For developing AnomalyDINO+, we use the smallest model of DINOv2\n[17], and evaluate input resolution with 448 pixels following [4]. For the last two variants WinCLIP+ and AnomalyDINO+, λ = 0.1 and α = 0.5, 0.3, 0.2, 0.1 for MVTecAD, VisA, MPDD, and RealIAD datasets. At test time, the\nbatch size equals to 1 to isolate the performance gains from\nour method. All experiments are conducted on a NVIDIA\nGTX 3090 GPU. To conveniently verify the effectiveness\nof the proposed method integrated with AnomalyDINO, we\ndo not employ foreground masking or image rotation.\n\n43045\n\n\fTable 2. FS-IAD performance on MVTec, MPDD, ViSA, and RealIAD datasets. FR is the abbreviation of FastRef. ∆ is improvement.\nImage- and pixel-level results are reported in AUROC (%) ↑. The best and the second best results are separately bold with black and blue.\n\nSetup\n\n1-shot\n\n2-shot\n\n4-shot\n\nMethod\n\nFR\n\nMVTec\n\nMPDD\n\nViSA\n\nRealIAD\n\nImage\n\nPixel\n\nImage\n\nPixel\n\nImage\n\nPixel\n\nImage\n\nPixel\n\nRegAD (ECCV’22)\nGraphCore (ICLR’23)\nFOCT (ACMMM’24)\nFastRecon (ICCV’23)\nPromptAD (CVPR’24)\n\n×\n×\n×\n×\n×\n\n82.9\n89.9\n87.1\n85.7\n92.9\n\n92.5\n95.6\n94.4\n93.2\n95.1\n\n60.9\n84.7\n78.9\n74.1\n73.1\n\n92.6\n95.2\n96.2\n96.3\n95.1\n\n–\n–\n–\n76.2\n86.5\n\n–\n–\n–\n96.7\n96.2\n\n–\n–\n–\n71.2\n67.8\n\n–\n–\n–\n95.7\n91.6\n\nPatchCore (CVPR’22)\nPatchCore+ (Ours)\n∆\n\n×\n✓\n✓\n\n84.1\n85.9\n+1.8\n\n92.3\n93.7\n+1.4\n\n71.0\n74.9\n+3.9\n\n96.3\n96.6\n+0.3\n\n71.0\n78.3\n+7.3\n\n96.1\n97.1\n+1.0\n\n70.9\n75.9\n+5.0\n\n91.2\n96.3\n+5.1\n\nWinCLIP (CVPR’23)\nWinCLIP+ (Ours)\n∆\n\n×\n✓\n✓\n\n93.5\n93.8\n+0.3\n\n93.6\n95.7\n+2.1\n\n70.5\n72.5\n+2.0\n\n96.3\n96.9\n+0.6\n\n83.4\n83.9\n+0.5\n\n94.7\n95.8\n+1.1\n\n73.8\n74.4\n+0.6\n\n94.3\n94.8\n+0.5\n\nAnomalyDINO (WACV’25)\nAnomalyDINO+ (Ours)\n∆\n\n×\n✓\n✓\n\n96.4\n97.0\n+0.6\n\n95.8\n96.5\n+0.7\n\n72.0\n76.7\n+4.7\n\n95.9\n97.1\n+1.2\n\n82.2\n84.6\n+2.4\n\n96.3\n97.2\n+0.9\n\n73.3\n77.8\n+4.5\n\n95.4\n96.2\n+0.8\n\nRegAD (ECCV’22)\nGraphCore (ICLR’23)\nFOCT (ACMMM’24)\nFastRecon (ICCV’23)\nPromptAD (CVPR’24)\n\n×\n×\n×\n×\n×\n\n85.7\n91.9\n90.5\n88.3\n93.4\n\n94.6\n96.9\n94.8\n94.5\n95.4\n\n63.4\n85.4\n82.4\n76.4\n80.1\n\n93.2\n95.4\n96.5\n96.7\n95.8\n\n–\n–\n–\n86.1\n86.7\n\n–\n–\n–\n97.6\n96.5\n\n–\n–\n–\n72.5\n74.5\n\n–\n–\n–\n95.9\n93.5\n\nPatchCore (CVPR’22)\nPatchCore+ (Ours)\n∆\n\n×\n✓\n✓\n\n87.1\n88.8\n+1.7\n\n93.3\n94.7\n+1.4\n\n71.4\n78.2\n+6.8\n\n96.5\n96.9\n+0.4\n\n80.0\n87.1\n+7.1\n\n96.9\n98.0\n+1.1\n\n71.7\n76.9\n+5.2\n\n91.3\n96.5\n+5.2\n\nWinCLIP (CVPR’23)\nWinCLIP+ (Ours)\n∆\n\n×\n✓\n✓\n\n93.7\n93.9\n+0.2\n\n93.8\n96.2\n+2.4\n\n72.5\n76.0\n+3.5\n\n96.5\n97.3\n+0.8\n\n83.8\n84.1\n+0.3\n\n95.1\n96.4\n+1.3\n\n75.0\n75.9\n+0.9\n\n94.6\n95.2\n+0.6\n\nAnomalyDINO (WACV’25)\nAnomalyDINO+ (Ours)\n∆\n\n×\n✓\n✓\n\n96.7\n97.2\n+0.5\n\n96.0\n96.7\n+0.7\n\n75.2\n78.4\n+3.2\n\n96.3\n97.4\n+1.1\n\n82.5\n84.8\n+2.3\n\n96.7\n97.3\n+0.6\n\n77.8\n79.8\n+2.0\n\n96.1\n96.8\n+0.7\n\nRegAD (ECCV’22)\nGraphCore (ICLR’23)\nFOCT (ACMMM’24)\nFastRecon (ICCV’23)\nPromptAD (CVPR’24)\n\n×\n×\n×\n×\n×\n\n88.2\n92.9\n93.2\n91.3\n95.5\n\n95.8\n97.4\n96.2\n96.1\n96.3\n\n68.3\n85.7\n83.2\n79.7\n80.4\n\n93.9\n95.7\n96.7\n96.9\n96.2\n\n–\n–\n–\n88.2\n88.8\n\n–\n–\n–\n98.0\n96.8\n\n–\n–\n–\n73.2\n78.5\n\n–\n–\n–\n96.0\n94.9\n\nPatchCore (CVPR’22)\nPatchCore+ (Ours)\n∆\n\n×\n✓\n✓\n\n90.0\n92.1\n+2.1\n\n95.1\n96.1\n+1.0\n\n76.2\n80.3\n+4.1\n\n97.2\n97.2\n+0.0\n\n84.2\n90.4\n+6.2\n\n97.5\n98.2\n+0.7\n\n75.9\n77.4\n+1.5\n\n93.0\n96.7\n+3.7\n\nWinCLIP (CVPR’23)\nWinCLIP+ (Ours)\n∆\n\n×\n✓\n✓\n\n95.3\n95.5\n+0.2\n\n94.2\n96.7\n+2.5\n\n75.0\n82.0\n+7.0\n\n96.8\n97.6\n+0.8\n\n84.1\n85.0\n+0.9\n\n95.4\n96.6\n+1.2\n\n76.4\n77.3\n+0.9\n\n94.8\n95.3\n+0.5\n\nAnomalyDINO (WACV’25)\nAnomalyDINO+ (Ours)\n∆\n\n×\n✓\n✓\n\n97.1\n97.4\n+0.3\n\n96.4\n96.8\n+0.4\n\n80.3\n82.1\n+1.8\n\n96.9\n97.6\n+0.7\n\n86.8\n87.1\n+0.3\n\n97.1\n97.9\n+0.8\n\n79.2\n81.3\n+2.1\n\n96.4\n96.7\n+0.3\n\nour model not only effectively detects anomalous images\nbut also accurately localizes the anomalous regions. We\nattribute these gains to the representativeness of enhanced\n\n43046\n\nprototypes with the help of our proposed FastRef. Visualization results of our FastRef-enhanced methods including PatchCore+, WinCLIP+, and AnomalyDINO+ versus\n\n\fFigure 4. From left to right are results on hyper-parameters of α, λ, and L versus AUROC (%) ↑ using MVTec under 4-shots.\nTable 3. Ablation studies of WinCLIP+ with image/pixelAUROC (%) ↑ under 2-shots. The best results are in bold.\nW∗\n×\n✓\n✓\n\nT∗\n×\n×\n✓\n\nMVTec\n\nVisA\n\nover 0.7% in Pixel AUROC on all the three datasets.\n(2) Impact of W ∗ . According to Table 3, W ∗ consistently improves performance. However, in same cases we\nobserve that the gains from using T ∗ are more pronounced\nthan those from W ∗ . For example, image-level AUROC\non MPDD, the gain from using W ∗ is 2.4%, whereas further using T ∗ results in a 1.1% improvement. This suggests that relying solely on W ∗ may introduce anomalies,\nthereby limiting overall performance improvements.\n\nMPDD\n\nImage\n\nPixel\n\nImage\n\nPixel\n\nImage\n\nPixel\n\n93.7\n93.8\n93.9\n\n93.8\n94.7\n96.2\n\n83.8\n84.0\n84.1\n\n95.1\n96.2\n96.4\n\n72.5\n74.9\n76.0\n\n96.5\n96.8\n97.3\n\n5.4. Hyper-parameters Analysis\n\nFigure 5. Anomaly localization under 2-shots.\n\nother competitive methods including PatchCore, FasRecon,\nWinCLIP, and AnomalyDINO in Fig. 3. More visualizations of our methods among different datasets are shown\nin the Appendix G. Additionally, to avoid any ambiguity\nor vagueness, it is necessary to provide the clarification that\nFastRecon+ is the same with PatchCore+ (according to Sec.\n4.1), thus we omit reporting results of FastRecon+ in Fig. 3,\nwhich is also consistent with Table 2.\n\n5.3. Ablative Analysis\nWe use WinCLIP+ to assess the impact of transport probability T ∗ for anomaly suppression and transform matrix\nW ∗ for characteristic transfer under 2-shots on the three\ndatasets. The results are reported in Table 3, with visualizations on the datasets of VisA and MPDD are shown\nin Fig. 5, where w.o T ∗ means WinCLIP+ without T ∗ ,\nw.o T ∗ &amp;W ∗ denotes WinCLIP.\n(1) Impact of T ∗ . Anomalies in query image negatively\naffect performance due to the limited diversity and representativeness of normal prototypes. Therefore, leveraging\nquery image through effective anomaly suppression is crucial. As shown in Table 3, anomaly suppression yields averaged improvements of over 0.4% in Image AUROC while\n\n43047\n\nWe report results of hyperparameters’ impacts using WinCLIP+ under 4-shots setting on MVTec in Fig. 4 , including the Coreset sampling ratio α, the balanced coefficient λ,\nand the updating iteration L.\n(1) Impact of α. We find that α is crucial for determining\nFS-IAD performance in Fig. 4 (left), since it controls the\nrepresentativeness of normal prototypes.\n(2) Impact of λ. According to the results of Fig. 4 (middle),\nWe observe a similar trend as in α that the performance\nfirst improves and then declines. This phenomenon suggests\nthat characteristic transfer should dominate the success of\nprototype refinement, aligning with our design.\n(3) Impact of L. The enhanced prototypes are obtained iteratively, thus, we investigate the impact of L. Results in\nFig. 4 (right) indicate that the WinCLIP+ achieves the best\nperformance when L = 2, demonstrating the efficiency of\nour closed form solution for FastRef.\n\n6. Conclusion\nIn this work, we propose FastRef, a lightweight prototype\nrefinement module for few-shot industrial anomaly detection. It formulates refinement as a nested optimization\nwith a closed-form solution, enabling efficient characteristic transfer and anomaly suppression. Experiments on four\nbenchmarks show consistent improvements in detection and\nlocalization across backbones. FastRef offers a simple, general mechanism for strengthening prototype representations\nunder few-shot constraints and can serve as a useful building block for scalable anomaly detection.\n\n\f7. Acknowledgement\nThis work was supported by the National Natural Science Foundation of China (62506277, 62571396, and\n82172860), the Fundamental Research Funds for the\nCentral Universities, the Postgraduate Innovation Fund\nof Xidian University, Shaanxi Province Key R&amp;D\nPlan(2024GX-ZDCYL-01-11), and Guangxi Unveiling\nSystem Science and Technology Project(JB2504240003).\n\nReferences\n[1] 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[2] Sébastien Bubeck et al. Convex optimization: Algorithms\nand complexity. Foundations and Trends® in Machine\nLearning, 8(3-4):231–357, 2015.\n[3] Marco Cuturi. Sinkhorn distances: Lightspeed computation\nof optimal transport. Advances in neural information processing systems, 26, 2013. 2, 3\n[4] Simon Damm, Mike Laszkiewicz, Johannes Lederer, and\nAsja Fischer. Anomalydino: Boosting patch-based few-shot\nanomaly detection with dinov2. In 2025 IEEE/CVF Winter Conference on Applications of Computer Vision (WACV),\npages 1319–1329. IEEE, 2025. 2, 4, 5, 6\n[5] 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, 2, 5, 6\n[6] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun.\nDeep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern\nrecognition, pages 770–778, 2016. 2\n[7] Kaiming He, Georgia Gkioxari, Piotr Dollár, and Ross Girshick. Mask r-cnn. In Proceedings of the IEEE international\nconference on computer vision, pages 2961–2969, 2017. 1\n[8] 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, 2, 6\n[9] 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, 4,\n5, 6\n[10] 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. 2, 5\n\n[11] Pooja Kamat and Rekha Sugandhi. Anomaly detection for\npredictive maintenance in industry 4.0-a survey. In E3S web\nof conferences, page 02007. EDP Sciences, 2020. 1\n[12] 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. 6\n[13] Jiaqi Liu, Guoyang Xie, Jinbao Wang, Shangnian Li,\nChengjie Wang, Feng Zheng, and Yaochu Jin. Deep industrial image anomaly detection: A survey. Machine Intelligence Research, 21(1):104–135, 2024. 1\n[14] 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. 1\n[15] Ruiying Lu, YuJie Wu, Long Tian, Dongsheng Wang, Bo\nChen, Xiyang Liu, and Ruimin Hu. Hierarchical vector\nquantized transformer for multi-class unsupervised anomaly\ndetection. arXiv preprint arXiv:2310.14228, 2023. 1, 4\n[16] Ruiying Lu, YuJie Wu, Long Tian, Dongsheng Wang, Bo\nChen, Xiyang Liu, and Ruimin Hu. Hierarchical vector\nquantized transformer for multi-class unsupervised anomaly\ndetection. Advances in Neural Information Processing Systems, 36, 2024. 1\n[17] Maxime Oquab, Timothée Darcet, Théo Moutakanni, Huy\nVo, Marc Szafraniec, Vasil Khalidov, Pierre Fernandez,\nDaniel Haziza, Francisco Massa, Alaaeldin El-Nouby, et al.\nDinov2: Learning robust visual features without supervision.\narXiv preprint arXiv:2304.07193, 2023. 2, 5, 6\n[18] Kaare Brandt Petersen, Michael Syskind Pedersen, et al. The\nmatrix cookbook. Technical University of Denmark, 7(15):\n510, 2008.\n[19] Gabriel Peyré, Marco Cuturi, et al. Computational optimal\ntransport: With applications to data science. Foundations\nand Trends® in Machine Learning, 11(5-6):355–607, 2019.\n2\n[20] 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. 5\n[21] 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. 1, 2, 4, 6\n[22] João Santos, Triet Tran, and Oliver Rippel. Optimizing\npatchcore for few/many-shot anomaly detection. arXiv\npreprint arXiv:2307.10792, 2023. 2, 4, 6\n[23] Ozan Sener and Silvio Savarese. Active learning for convolutional neural networks: A core-set approach. arXiv preprint\narXiv:1708.00489, 2017. 2, 4\n\n43048\n\n\f[24] Jake Snell, Kevin Swersky, and Richard Zemel. Prototypical\nnetworks for few-shot learning. Advances in neural information processing systems, 30, 2017. 1\n[25] Flood Sung, Yongxin Yang, Li Zhang, Tao Xiang, Philip HS\nTorr, and Timothy M Hospedales. Learning to compare: Relation network for few-shot learning. In Proceedings of the\nIEEE conference on computer vision and pattern recognition, pages 1199–1208, 2018. 1\n[26] Mingxing Tan.\nEfficientnet: Rethinking model scaling for convolutional neural networks. arXiv preprint\narXiv:1905.11946, 2019. 5\n[27] Long Tian, Hongyi Zhao, Ruiying Lu, Rongrong Wang, YuJie Wu, Liming Wang, Xiongpeng He, and Xiyang Liu. Foct:\nFew-shot industrial anomaly detection with foregroundaware online conditional transport. In ACM Multimedia\n2024. 6\n[28] 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[29] Yaqing Wang, Quanming Yao, James T Kwok, and Lionel M\nNi. Generalizing from a few examples: A survey on few-shot\nlearning. ACM computing surveys (csur), 53(3):1–34, 2020.\n1\n[30] 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. 2\n[31] Guoyang Xie, Jingbao Wang, Jiaqi Liu, Feng Zheng, and\nYaochu Jin. Pushing the limits of fewshot anomaly detection\nin industry vision: Graphcore. ICLR, 2023. 2, 6\n[32] Zhiyuan You, Lei Cui, Yujun Shen, Kai Yang, Xin Lu,\nYu Zheng, and Xinyi Le. A unified model for multi-class\nanomaly detection. Advances in Neural Information Processing Systems, 35:4571–4584, 2022. 1, 4\n[33] Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. arXiv preprint arXiv:1605.07146, 2016. 5, 6\n[34] 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. 1\n[35] Bo Zong, Qi Song, Martin Renqiang Min, Wei Cheng, Cristian Lumezanu, Daeki Cho, and Haifeng Chen. Deep autoencoding gaussian mixture model for unsupervised anomaly\ndetection. In International conference on learning representations, 2018.\n[36] Yang Zou, Jongheon Jeong, Latha Pemula, Dongqing Zhang,\nand Onkar Dabeer. Spot-the-difference self-supervised pretraining for anomaly detection and segmentation. In European Conference on Computer Vision, pages 392–408.\nSpringer, 2022. 2, 5\n\n43049\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"