"<!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>Published as a conference paper at ICLR 2026\n\nD UAL D ISTILLATION FOR F EW-S HOT A NOMALY D E TECTION\nLe Dong1 , Qinzhong Tan1,⋆ , Chunlei Li2 , Jingliang Hu2 , Yilei Shi2 , Weisheng Dong1 ,\nXiao Xiang Zhu3 , and Lichao Mou2,†\n1\n\nXidian University, China\nMedAI Technology (Wuxi) Co. Ltd., China\nlichao.mou@medimagingai.com\n3\nTechnical University of Munich, Germany\n\narXiv:2603.01713v1 [cs.CV] 2 Mar 2026\n\n2\n\nA BSTRACT\nAnomaly detection is a critical task in computer vision with profound implications\nfor medical imaging, where identifying pathologies early can directly impact patient\noutcomes. While recent unsupervised anomaly detection approaches show promise,\nthey require substantial normal training data and struggle to generalize across\nanatomical contexts. We introduce D2 4FAD, a novel dual distillation framework\nfor few-shot anomaly detection that identifies anomalies in previously unseen tasks\nusing only a small number of normal reference images. Our approach leverages\na pre-trained encoder as a teacher network to extract multi-scale features from\nboth support and query images, while a student decoder learns to distill knowledge\nfrom the teacher on query images and self-distill on support images. We further\npropose a learn-to-weight mechanism that dynamically assesses the reference value\nof each support image conditioned on the query, optimizing anomaly detection\nperformance. To evaluate our method, we curate a comprehensive benchmark\ndataset comprising 13,084 images across four organs, four imaging modalities,\nand five disease categories. Extensive experiments demonstrate that D2 4FAD\nsignificantly outperforms existing approaches, establishing a new state-of-the-art\nin few-shot medical anomaly detection. Code is available at https://github.\ncom/ttttqz/D24FAD.\n\n1\n\nI NTRODUCTION\n\nThe automatic detection of anomalies in medical images is a crucial yet challenging task in clinical\npractice. Finding abnormalities early through automated screening enables timely intervention,\nleading to improved patient outcomes. However, developing robust algorithms for this task remains\ndifficult due to the diverse manifestations of anatomical and pathological abnormalities in different\npatients. Furthermore, obtaining annotated datasets of verified anomalies is prohibitively expensive\nand time-consuming in medical contexts. These challenges have driven significant research interest\nin unsupervised anomaly detection methods, which can identify anomalies without requiring labeled\nabnormal training data.\nRecent years have witnessed substantial advances in unsupervised anomaly detection approaches.\nGenerative models, including autoencoders (Shvetsova et al., 2021) and generative adversarial\nnetworks (GANs) (Jiang et al., 2019), have shown promising results by learning to reconstruct\nnormal patterns and identifying anomalies through reconstruction errors. Various architectural\ninnovations have further improved detection performance, such as memory banks for storing and\nretrieving prototypical normal patterns (Gong et al., 2019), normalizing flows to model complex\ndata distributions (Yu et al., 2021), and self-supervised learning for better feature representations (Li\net al., 2021). Knowledge distillation has also emerged as an effective paradigm (Deng and Li, 2022),\n⋆ Work done during an internship at MedAI Technology (Wuxi) Co. Ltd.\n† Corresponding author.\n\n1\n\n\fPublished as a conference paper at ICLR 2026\n\nwhere a student network learns to emulate a teacher’s behavior on normal samples, allowing anomaly\ndetection through discrepancy analysis.\nThese approaches, however, typically require large amounts of normal training data from target\ndomains—data that may not be readily available in many clinical scenarios (Pachetti and Colantonio,\n2024). In addition, they often struggle to generalize across different anomaly detection tasks, limiting\ntheir practical utility (Fernando et al., 2021; Cai et al., 2025). This highlights the need for few-shot\nanomaly detection, where models can adapt to new anatomical contexts using only a small number of\nnormal reference images. Critically, these models are evaluated on novel tasks unseen during training\nto assess their ability to generalize across different anatomical structures and imaging conditions. In\nthis paradigm, both training and inference are performed in an episodic manner, with each episode\ncontaining a support set of few normal images and a query image to be evaluated. This approach\nis particularly relevant in clinical practice, where physicians often have access to limited normal\nreference cases when examining new patients or encountering rare conditions. Despite its practical\nimportance, few-shot anomaly detection in medical imaging remains relatively unexplored in the\nliterature.\nTo address this important yet underexplored problem, we propose D2 4FAD, a dual distillation\nframework for few-shot anomaly detection. Our approach leverages a pre-trained encoder as a teacher\nnetwork to extract multi-scale feature maps from support and query images through parallel pathways\nwith shared weights. A student decoder, trained exclusively on normal samples, learns to distill\nknowledge from the teacher network on query images while self-distilling on support images. This\ndesign enables anomaly detection at inference time by analyzing feature discrepancies between\nquery and support representations, thereby using normal reference images as a basis for anomaly\nidentification. Note that some works refer to this process as feature reconstruction. In this work, for\nconsistency with prior anomaly detection methods (Salehi et al., 2021; Deng and Li, 2022; Gu et al.,\n2023; Ma et al., 2023; Zhou et al., 2022), we use the term distillation. Furthermore, we introduce a\nlearn-to-weight mechanism that dynamically assigns importance to each support image, optimizing\ntheir reference values for different query images.\nTo facilitate research in this direction, we curate a comprehensive medical image dataset comprising\nfour organs, four imaging modalities, and five disease categories, totaling 13,084 images. This dataset\nprovides a standardized benchmark for evaluating few-shot anomaly detection methods across diverse\nmedical contexts.\nOur key contributions are:\n• We formalize the few-shot medical anomaly detection task and establish a benchmark dataset\nspanning multiple organs, modalities, and pathologies.\n• We propose a dual distillation framework that effectively leverages limited normal reference\nimages through knowledge distillation for anomaly detection.\n• We propose a learn-to-weight mechanism that evaluates the reference value of each support\nimage conditioned on query images to enhance anomaly detection performance.\n• We demonstrate through extensive experiments that our approach achieves state-of-the-art\nresults, significantly outperforming existing methods.\n\n2\n\nM ETHODOLOGY\n\n2.1\n\nP ROBLEM D EFINITION\n\nWe formulate few-shot medical anomaly detection as follows. Given a training set comprising several\ndistinct tasks, each containing exclusively normal samples, we aim to develop an anomaly detection\nmodel with strong generalization capabilities for unseen anomaly detection tasks. During training,\nfollowing the few-shot learning paradigm, we select one normal image as a query and several fixed\nnormal images from the identical task as support samples to facilitate the learning of normal patterns.\nThis task-agnostic model is not optimized for specific tasks but instead learns a universal anomaly\ndetection strategy applicable across diverse medical images.\nDuring inference, our test set contains both normal and abnormal images from novel target tasks\nunseen during training. We select K normal samples from each target task to form a support set,\n2\n\n\fPublished as a conference paper at ICLR 2026\n\nINFERENCE\n\nTRAINING\n\nTeacher\n\nSupport Images\nfrozen layers\n\nz2\n\nQuery Image\n\nQuery Image\n\nx1\n\nx2\n\nTeacher\n\nStudent\nx3\n\nz3\n\nlearnable layers\n\nz2\n\nz3\n\nQuery Data\nz1\n\nStudent\ncos·sim z1\n\nz1\n\nz3\n\nSupport Images\nteacher-student distillation\n\nSupport Data\n\nstudent self-distillation\n\nz2\n\nfeature similarity\n\nFigure 1: Overview of our dual distillation framework for few-shot anomaly detection. The architecture incorporates a frozen pre-trained teacher encoder and a learnable student decoder. During\ntraining, the teacher encoder processes both query and support images, while the student learns to\nreconstruct multi-scale feature representations through our proposed dual distillation approach. At\ninference time, for previously unseen tasks, anomalies are identified by analyzing discrepancies\nbetween query and support image features in the student network. In addition, we introduce a\nlearn-to-weight mechanism that enhances model performance by dynamically assessing the reference\nvalue of each support image relative to a specific query (cf. Section 2.3).\nwhere K ∈ {2, 4, 8} in our experiments. This support set enables the model to adapt to previously\nunseen tasks when determining whether a test query image contains anomalies.\n2.2\n\nD UAL D ISTILLATION\n\nFigure 1 illustrates our proposed dual distillation framework. We prioritize architectural simplicity,\nwith the network comprising only two components: a fixed pre-trained encoder and a learnable\ndecoder. The encoder, functioning as a teacher, extracts visual features from both query and support\nimages, while the decoder, acting as a student, reconstructs multi-scale feature representations from\nthe encoder’s output. We introduce two distillation strategies—teacher-student distillation and student\nself-distillation—that work in tandem for few-shot anomaly detection. The following subsections\nelaborate on these strategies.\nTeacher-Student Distillation We leverage a pre-trained encoder as the teacher network, which has\nbeen exposed to diverse visual patterns through training on large-scale datasets such as ImageNet.\nThis teacher encapsulates rich semantic knowledge that we transfer to guide our student decoder,\nproviding a reference point for anomaly detection through consistency enforcement. We apply this\ndistillation mechanism specifically to query images.\ni\nFormally, given a query image, let xiqry and zqry\ndenote feature maps from the i-th layer of the\nteacher encoder and student decoder, respectively. For knowledge transfer, we define the following\nloss function:\nX 1 X\ni\nLtsd =\n1 − sim(xiqry [h, w], zqry\n[h, w]) ,\n(1)\nH\nW\ni\ni\ni\nh,w\n\ni\nwhere (h, w) indexes all spatial locations in feature maps xiqry and zqry\n, Hi and Wi represent the\nheight and width of the feature maps at the i-th layer, and sim(a, b) = aT b/∥a∥ ∥b∥.\n\nAfter training exclusively on normal data, the teacher encoder and student decoder become aligned to\nrepresent normal patterns with high similarity. For normal test query samples that conform to patterns\nobserved during training, the student’s representations closely match the teacher’s, resulting in low\ndistillation loss. Conversely, when presented with anomalous query samples, the student decoder fails\nto adequately reconstruct the teacher’s feature maps, producing discrepancies in their representations.\nStudent Self-Distillation Teacher-student distillation provides a solid foundation but is incomplete\nfor few-shot anomaly detection since it does not make use of support images. Given limited normal\nreferences available in few-shot settings, we introduce student self-distillation to capitalize on\nthese valuable normal examples. By performing self-distillation on support images, we establish a\nconsistent reference base of what “normal” looks like, against which query images can be compared.\nThis design aligns with clinical diagnostic practices, where distinguishing pathological abnormalities\nfrom normal anatomical variations requires reliable reference data.\n3\n\n\fPublished as a conference paper at ICLR 2026\n\nk,i\nFormally, given a support set, let zspt\ndenote feature maps of the k-th support image from the i-th\nlayer of the student encoder. We define a student self-distillation loss that aggregates multi-scale\ndiscrepancies as:\n1 XX 1 X\nk,i\ni\nLssd =\n[h, w], zqry\n[h, w]) ,\n(2)\n1 − sim(zspt\nK\nH\nW\ni\ni\ni\nk\n\nh,w\n\nwhere K represents the number of support images.\nBy minimizing this loss, the student network learns to align the query’s representations with normal\nreferences, which is crucial for few-shot anomaly detection. This self-distillation mechanism enables\nthe model to learn more discriminative features, even with the constraint of having access to only\nnormal training samples.\nTraining Objective In summary, we train our model by optimizing a combination of the two\ndistillation losses:\nL = λLtsd + Lssd ,\n(3)\nwhere λ is a hyperparameter that balances the teacher-student distillation and student self-distillation\nto the overall learning objective.\n2.3\n\nL EARN - TO -W EIGHT\n\nIn Eq. (2), we initially assign equal weights to all support images. However, we observe that\nthis assumption is often suboptimal—the reference value provided by each support image varies\nfor different query images. This phenomenon is particularly prevalent in medical imaging, where\nindividual anatomical variability leads to significant differences in shape and appearance among\nsupport images, resulting in varied reference values for the same query.\nTo better utilize the support set, we propose a learn-to-weight mechanism that adaptively weights\nsupport samples based on their relevance to a given query. Specifically, we learn reference values of\nsupport images conditioned on the query as follows:\nT\n\nwi = softmax(\n\ni\ni\nzqry\n× ϕ(zspt\n)\n√\n),\nCi\n\n(4)\n\nwhere ϕ is a linear projection implemented as a 1×1 convolution. Note that appropriate reshaping operi\ni\nations are performed: zqry\n∈ RCi ×Hi ×Wi is reshaped to R1×(Ci ×Hi ×Wi ) and zspt\n∈ RK×Ci ×Hi ×Wi\nK×(Ci ×Hi ×Wi )\nis reshaped to R\n.\nWe then reformulate the student self-distillation loss by incorporating our learn-to-weight mechanism\nas:\nT\n\nLssd_l2w =\n\nX\ni\n\ni\ni\nzqry\n× ϕ(zspt\n)\n1 X\ni\ni\n√\n)zspt\n[h, w], zqry\n[h, w]) .\n1 − sim(softmax(\nHi Wi\nCi\n\n(5)\n\nh,w\n\nThe overall training objective is updated to:\nL = λLtsd + Lssd_l2w .\n\n(6)\n\nOur learn-to-weight mechanism enables more effective knowledge transfer from support to query\nimages by dynamically assessing the importance of each support sample based on its relevance to the\nspecific query being evaluation.\n2.4\n\nA NOMALY S CORING\n\nAt inference time, given a test query image and K support images of a novel task (representing an\nunseen imaging modality and/or disease), we compute a similarity map at each scale using Eq. (5).\nThese multi-scale similarity maps are then aggregated to derive a comprehensive anomaly map. The\nfinal anomaly score for the input image is obtained by computing the mean value of this aggregated\nanomaly map, providing a scalar quantification of anomalousness.\n4\n\n\fPublished as a conference paper at ICLR 2026\n\n3\n\nR ELATED W ORK\n\nGiven the expense and time required to obtain verified anomalies in medical imaging, unsupervised anomaly detection methods have become mainstream. Reconstruction-based approaches have\nemerged as a leading paradigm in this field. Schlegl et al. (2017) pioneer the use of GANs with\nAnoGAN (Li et al., 2018), later introducing f-AnoGAN (Schlegl et al., 2019), which improves efficiency by incorporating an encoder to map images to a latent space. Various autoencoder architectures\nhave been explored, including variational autoencoders (Zimmerer et al., 2018) and vector-quantized\nvariational autoencoders (Naval Marimont and Tarroni, 2021). To address the overgeneralization\nproblem, where abnormal images are reconstructed too accurately, Gong et al. (2019) and Park et al.\n(2020) introduce memory banks to store normal patterns for comparison during inference. Several\nworks (Rudolph et al., 2021; Gudovskiy et al., 2022; Yu et al., 2021) leverage normalizing flows,\nenabling exact likelihood estimation for image modeling, and achieve strong performance in anomaly\ndetection.\nSelf-supervised learning (Jing and Tian, 2021) has also been applied to anomaly detection, typically\nfollowing two paradigms. One-stage approaches train models to detect synthetic anomalies and\ndirectly apply them to real abnormalities (Tan et al., 2021; Schlüter et al., 2022). Two-stage approaches first learn self-supervised representations on normal data, followed by constructing one-class\nclassifiers (Li et al., 2021; Sohn et al., 2021). Recently, knowledge distillation from pre-trained\nmodels presents another promising approach for unsupervised anomaly detection (Salehi et al.,\n2021; Deng and Li, 2022; Batzner et al., 2024). In these methods, a student network distilled by a\npre-trained teacher network on normal samples can only extract normal features, leading to detectable\ndiscrepancies when anomalies are encountered during inference.\nHowever, these methods typically require numerous normal samples for effective training—a requirement that becomes impractical in scenarios with limited data availability. This limitation motivates\nthe need for more efficient anomaly detection methods that can achieve strong performance with few\ntraining samples.\nFew-shot anomaly detection aims to generalize to novel tasks using limited reference samples. Early\napproaches such as TDG (Sheynin et al., 2021) and DiffNet (Rudolph et al., 2021) primarily focus\non training with a small set of normal samples, adhering to a one-model-per-task paradigm that\nnecessitates retraining for each new anomaly detection task. RegAD (Huang et al., 2022) addresses\nthis limitation by leveraging registration as a task-agnostic proxy, enabling generalization across\nunseen tasks. It is noteworthy that these methods are primarily designed for industrial defects and fail\nto account for the high variability present in medical imaging, where data span diverse modalities (e.g.,\nMRI and CT) and anatomical regions. In addition, their reliance on aggressive data augmentation\n(e.g., random rotation) is impractical for medical images with strict structural constraints.\nIn medical imaging, recent efforts like MediCLIP (Zhang et al., 2024) improve performance by\nsynthesizing anomalies from limited normal data but remain confined to single-task scenarios. MVFA\n(Huang et al., 2024) introduces multi-level visual feature adapters to align CLIP’s visual and language\nrepresentations, yet demands pixel-level annotations and anomalous samples during training, which\nare costly to acquire in many scenarios. InCTRL (Zhu and Pang, 2024) achieves cross-domain\ngeneralization via contextual residual learning but still requires anomalous data for optimization.\nINP-Former (Luo et al., 2025) achieves reference-free anomaly detection by extracting intrinsic\nnormal prototypes from test images. However, this approach is designed for natural images and\nshows limited performance on medical imaging data. In contrast, our method is trained solely on\nnormal samples and, during inference, adapts to unseen anomaly detection tasks using only a few\nnormal reference images, eliminating the need for annotated anomalies or retraining. This approach\nreduces deployment costs while maintaining strong generalization across medical modalities and\nanatomical regions.\n\n4\n\nE XPERIMENTS\n\n4.1\n\nE XPERIMENTAL S ETTINGS\n\nDatasets To evaluate our method, we compile a comprehensive dataset spanning diverse anatomical\nregions, lesion types, and imaging modalities by integrating several widely used medical anomaly\n5\n\n\fPublished as a conference paper at ICLR 2026\n\nTable 1: Anomaly detection performance comparison on multiple medical imaging datasets (HIS,\nLAG, APTOS, RSNA, and Brain Tumor). Performance is measured using image-level AUROC\n(%) with the best-performing method highlighted in bold. We compare our approach against both\nunsupervised (♠) and few-shot (♥) methods.\nHIS\nLAG\nAPTOS\nRSNA\nBrain Tumor\n2-shot\n4-shot\n8-shot 2-shot 4-shot 8-shot\n2-shot\n4-shot\n8-shot\n2-shot\n4-shot\n8-shot\n2-shot\n4-shot 8-shot\nUAE\n44.8±1.3 54.9±7.4 48.5±6.0 57.7±0.0 64.7±7.7 60.5±5.7 71.8±4.7 68.5±0.1 68.7±0.5 43.0±2.2 42.0±5.0 48.0±5.5 68.4±0.3 68.8±0.7 69.2±1.9\nf-AnoGAN\n67.4±2.3 49.5±11.1 54.0±9.5 51.1±3.6 55.0±2.9 37.1±8.1 35.5±8.0 31.3±5.2 30.5±3.7 38.6±6.2 43.1±1.2 42.2±2.6 34.7±5.3 53.9±4.5 65.3±2.0\nFastFlow\n73.1±1.4 75.1±0.7 71.2±1.4 66.3±2.8 66.5±2.1 72.2±1.5 87.8±1.4 90.0±0.9 84.1±1.3 74.4±0.7 77.9±0.7 79.6±0.5 90.8±0.4 90.3±1.1 91.0±0.6\nPatchCore\n67.8±0.1 64.7±0.5 59.6±0.9 69.1±0.6 67.5±1.1 77.1±0.7 67.3±1.4 69.1±1.3 71.9±0.6 65.0±0.2 70.9±0.3 74.6±0.1 64.1±1.9 74.0±2.3 78.1±1.6\nSimpleNet\n66.5±4.5 64.5±1.1 55.1±5.6 70.3±1.3 69.3±2.9 74.9±1.2 72.8±6.8 73.4±1.9 73.2±4.9 62.1±2.0 69.7±1.3 76.9±1.3 63.5±2.5 70.8±4.5 77.4±5.6\n♠ CutPaste\n57.9±9.6 74.6±0.2 73.9±0.1 60.2±2.0 77.2±0.4 78.1±1.6 51.8±8.1 89.6±0.2 85.9±0.2 67.3±4.5 74.5±0.6 83.3±0.1 79.3±5.8 87.7±0.4 89.3±0.2\nNSA\n38.8±4.1 51.1±5.8 50.8±7.9 57.1±2.2 51.6±2.6 48.3±5.1 39.9±7.4 46.6±9.0 52.6±1.9 58.8±9.7 51.7±10.1 48.6±8.7 39.9±14.7 38.9±6.5 44.1±9.8\nReContrast\n58.5±5.0 65.2±0.6 64.4±2.1 64.6±0.7 72.7±2.8 77.3±0.2 52.6±8.5 75.3±3.7 82.4±0.7 71.1±0.6 75.5±0.2 75.3±0.2 56.7±3.6 63.1±3.6 71.4±2.0\nRD++\n39.6±4.6 40.3±3.5 41.8±5.5 42.7±2.3 41.9±2.6 43.5±2.0 54.6±6.8 47.0±7.5 52.4±5.7 59.1±5.1 60.0±2.2 58.5±2.2 26.0±4.9 25.5±3.3 24.4±3.4\nRD4AD\n73.2±1.0 68.1±0.2 68.1±0.7 65.7±2.0 71.7±1.3 77.0±0.9 51.3±4.4 68.1±4.7 67.4±2.0 60.7±1.7 68.2±1.4 76.1±0.7 62.2±6.0 74.6±1.9 81.4±1.2\nSCRD4AD\n68.6±1.9 69.5±1.0 69.5±2.2 68.1±1.4 67.1±0.3 68.8±1.9 82.9±0.7 84.9±3.3 83.6±1.7 67.7±0.7 67.9±1.0 67.3±0.4 76.5±4.8 81.8±1.0 81.4±1.7\nRegAD\n54.5±1.5 57.0±2.1 51.4±2.8 51.9±5.3 54.4±1.3 68.1±1.6 53.0±2.4 59.4±2.8 61.2±0.8 46.1±0.4 50.9±1.5 64.5±2.4 68.4±13.3 70.2±4.0 75.8±4.1\nWinCLIP\n58.0±0.0 58.8±0.0 57.2±0.0 55.0±0.0 53.8±0.0 55.0±0.0 53.1±0.0 53.1±0.0 53.0±0.0 69.6±0.0 70.8±0.0 71.8±0.0 38.2±0.0 45.0±0.0 43.4±0.0\nMediCLIP\n61.4±1.9 66.8±1.7 65.1±0.7 71.7±2.4 72.3±1.3 73.2±2.3 77.6±1.7 77.7±1.3 78.5±1.1 50.7±4.5 54.4±3.2 59.4±4.3 89.9±1.2 88.2±1.2 88.7±1.6\nMVFA-AD\n76.4±7.6 80.6±1.0 80.7±2.8 73.1±4.3 77.2±3.1 81.0±3.8 86.1±6.7 87.4±3.6 89.6±4.1 74.6±6.8 87.4±3.5 84.9±1.0 92.8±3.7 93.7±3.4 96.3±0.8\n♥\nInCTRL\n71.8±0.0 73.5±0.0 72.7±0.0 71.7±0.0 71.1±0.0 71.1±0.0 95.6±0.0 94.5±0.0 89.5±0.0 79.5±0.0 81.4±0.0 82.7±0.0 90.6±0.0 91.8±0.0 91.8±0.0\nINP-Former 63.6±3.5 66.6±1.2 65.8±1.5 71.8±2.6 71.8±1.9 74.7±1.5 89.6±3.2 90.4±2.4 91.1±4.6 76.1±3.5 79.1±2.1 78.5±2.8 74.7±8.6 78.4±6.0 81.4±4.8\nAnomalyGPT 47.9±1.1 47.1±0.5 48.3±0.4 57.6±1.3 58.1±0.8 57.5±1.0 76.2±0.7 78.7±0.4 77.6±1.1 62.8±0.4 63.0±1.0 62.7±0.8 76.9±3.1 78.9±2.4 78.9±2.7\nOurs\n94.2±2.3 94.2±3.3 94.3±3.5 94.7±2.2 96.2±1.4 97.3±0.8 100.0±0.0 100.0±0.0 100.0±0.0 88.9±10.4 97.9±1.2 99.2±0.5 95.5±0.7 95.3±1.0 95.5±0.8\nMethod\n\ndetection benchmarks. We provide detailed information on dataset composition and train/test splits\nbelow to ensure transparency and reproducibility.\n• HIS: Derived from Camelyon16 * , which contains 6,091 normal and 997 abnormal patches\nfrom breast cancer patients, we allocate 700 normal images for training and create a balanced\ntest set comprising 400 normal and 400 abnormal images.\n• LAG: This dataset (Li et al., 2019) consists of 6,882 normal retinal fundus images and 4,878\nabnormal images exhibiting glaucoma. Following Cai et al. (2022), we utilize 1,500 normal\nimages for training and evaluate on 811 normal and 911 abnormal images.\n• APTOS: This collection† of retinal images from diabetic retinopathy patients provides 1,000\nnormal samples for our training set, while the test set comprises 805 normal samples and\n1,857 anomalous samples.\n• RSNA: This chest X-ray dataset‡ contains 8,851 normal and 6,012 lung opacity images. In\naccordance with Cai et al. (2022), we select 1,000 normal images for training and construct\na balanced test set with 1,000 normal and 1,000 abnormal images.\n• Brain Tumor: This dataset§ encompasses 2,000 MRI slices without tumors, 1,621 with\ngliomas, and 1,645 with meningiomas. We classify both glioma and meningioma slices\nas anomalies. The normal cases originate from Br35H5 and Saleh et al. (2020), while the\nanomalous cases come from Saleh et al. (2020) and Cheng et al. (2015). Following Cai et al.\n(2022), our experimental protocol uses 1,000 normal slices for training and evaluates on a\ntest set containing 600 normal and 600 abnormal slices (equally distributed between glioma\nand meningioma).\nThese datasets present significant challenges, including subtle pathological manifestations, heterogeneous lesion morphologies, and complex tissue architectures, thereby providing a rigorous testbed for\nevaluating our model’s generalization capabilities across multiple medical imaging scenarios.\nImplementation Details We employ WideResNet-50 (Zagoruyko and Komodakis, 2016) pretrained on ImageNet as the backbone for our teacher encoder. Parameters are optimized using the\nAdam optimizer with β1 = 0.5 and β2 = 0.999 (Kingma and Ba, 2014). Our model is trained for 70\nepochs with a batch size of 64, and all images are resized to 128 × 128 pixels. All experiments are\nconducted on a single NVIDIA A100 GPU.\n* https://camelyon16.grand-challenge.org/Data/\n†\n\nhttps://www.kaggle.com/c/aptos2019-blindness-detection\nhttps://www.kaggle.com/c/rsna-pneumonia-detection-challenge\n§\nhttps://www.kaggle.com/datasets/masoudnickparvar/brain-tumor-mri-dataset\n‡\n\n6\n\n\fPublished as a conference paper at ICLR 2026\n\nTable 2: Ablation study results across five medical imaging datasets (HIS, LAG, APTOS, RSNA and\nBrain Tumor). We examine the impact of student self-distillation (ssd), teacher-student distillation\n(tsd), and learn-to-weight mechanism (l2w). Performance is reported as image-level AUROC (%)\nwith the best configuration highlighted in bold.\nHIS\nLAG\nAPTOS\nRSNA\nBrain Tumor\n2-shot 4-shot 8-shot 2-shot 4-shot 8-shot 2-shot 4-shot 8-shot 2-shot 4-shot 8-shot 2-shot 4-shot 8-shot\n- 66.1 66.7 74.1 64.4 70.2 75.9 58.2 60.8 63.9 57.0 66.5 74.1 55.5 73.8 81.1\n- 90.0 91.0 92.9 92.7 93.9 94.0 92.7 98.8 99.2 84.9 92.7 98.1 93.9 93.6 94.2\n- 94.3 94.5 95.8 95.8 96.5 97.0 100.0 100.0 100.0 98.7 98.7 99.5 94.9 95.3 96.4\n✓ 92.6 93.6 94.3 93.1 93.8 98.6 99.5 99.8 99.9 88.1 96.8 98.4 94.0 94.2 94.7\n✓ 96.7 98.4 99.0 97.6 97.9 98.0 100.0 100.0 100.0 99.0 99.1 99.8 95.1 96.3 96.8\n\nssd tsd l2w\n✓\n✓\n✓\n✓\n\n✓\n✓\n✓\n\nCompeting Methods Following prior works (Jeong et al., 2023; Huang et al., 2024; Gu et al., 2024),\nwe compare our approach against both unsupervised and few-shot methods. We include a broad set of\nstate-of-the-art methods, including the unsupervised approaches (UAE (Mao et al., 2020), f-AnoGAN\n(Schlegl et al., 2019), FastFlow (Yu et al., 2021), PatchCore (Roth et al., 2022), SimpleNet (Liu\net al., 2023), CutPaste (Li et al., 2021), NSA (Schlüter et al., 2022), ReContrast (Guo et al., 2023),\nRD++ (Tien et al., 2023), RD4AD (Deng and Li, 2022) and SCRD4AD(Li et al., 2025)) and the\nfew-shot methods (RegAD (Huang et al., 2022), WinCLIP (Jeong et al., 2023), MediCLIP (Zhang\net al., 2024), MVFA (Huang et al., 2024), InCTRL (Zhu and Pang, 2024), INP-Former (Luo et al.,\n2025) and AnomalyGPT (Gu et al., 2024)). For unsupervised methods and few-shot methods without\ngeneralization capability (MediCLIP, MVFA, and INP-Former), we utilize K support (normal)\nimages as training data to train the models and evaluate them on the same task. For few-shot methods\nwith generalization capability (RegAD, WinCLIP, InCTRL, AnomalyGPT, and ours), we adopt a\nleave-one-out training and testing protocol, where networks are trained on all datasets except the\none being used for testing. Note that some baselines, such as PatchCore and RD4AD, compute\nimage-level anomaly scores by applying max-pooling over the pixel-level anomaly maps.\nEvaluation Metrics Following prior works (Cao et al., 2023; Pang et al., 2023; Zhu and Pang,\n2024), we focus on image-level tasks, as many medical datasets do not provide pixel-level annotations.\nWe use AUROC to quantify model performance, which is the standard metric for anomaly detection\ntasks.\n4.2\n\nR ESULTS AND D ISCUSSION\n\nWe present our experimental results in Table 1. Across all evaluated settings (K = 2, 4, 8), our\nproposed method consistently outperforms competing approaches on the HIS, LAG, APTOS, and\nRSNA datasets, demonstrating significant improvements over the second-best methods. On the\nBrain Tumor dataset, our approach achieves performance comparable to MVFA. Unsupervised\nanomaly detection methods generally exhibit limited performance, likely due to insufficient training\nsamples. In contrast, few-shot anomaly detection algorithms demonstrate superior performance, with\nour proposed approach showing particularly strong generalization abilities across diverse medical\nimaging datasets. With only two normal reference images (K = 2), our method achieves 100%\nprecision on the APTOS dataset. Note that results for MediCLIP and InCTR differ from those\nreported in their original papers due to evaluation on different datasets.\nFor qualitative analysis, we demonstrate our method’s anomaly localization capability through\nexample anomaly maps in Appendix E.\nIn addition, we find that our model is not sensitive to the choice of support images (see Appendix C).\n4.3\n\nA BLATION S TUDIES\n\nTo evaluate each component’s contribution to our approach, we conduct comprehensive ablation\nstudies across five datasets, with results presented in Table 2.\nStudent Self-Distillation Student self-distillation plays a critical role in our few-shot anomaly\ndetection framework. Without it, our network effectively degenerates into an unsupervised approach.\n7\n\n\fPublished as a conference paper at ICLR 2026\n\nHIS\n\nLAG\n\nAPTOS\n\nRSNA\n\nBrain Tumor\n\nFigure 2: Distribution of abnormality scores for normal (blue) and abnormal (red) samples across\nfive datasets, visualized using raincloud plots and boxplots. For each dataset, the left subplot presents\nresults without the learn-to-weight mechanism, while the right subplot shows results with the mechanism applied. Reduced overlap between red and blue distributions indicates superior discrimination\nperformance. Each boxplot displays the median value and interquartile range (IQR), with whiskers\nextending to the extrema within 1.5× IQR from the quartiles, illustrating the significance of our\napproach.\nTable 3: Analysis of weight coefficient λ and its impact on anomaly detection performance.\nHIS\nLAG\nAPTOS\nRSNA\nBrain Tumor\n2-shot 4-shot 8-shot 2-shot 4-shot 8-shot 2-shot 4-shot 8-shot 2-shot 4-shot 8-shot 2-shot 4-shot 8-shot\n1.0 95.3 96.0 96.4 94.9 96.7 97.9 100.0 100.0 100.0 96.7 98.7 99.5 94.7 95.6 95.9\n0.5 96.0 97.4 98.0 96.6 98.5 98.8 100.0 100.0 100.0 93.0 99.3 99.4 94.9 96.0 96.2\n0.1 96.7 98.4 99.0 97.6 97.9 98.0 100.0 100.0 100.0 99.0 99.1 99.8 95.1 96.3 96.8\n0.05 95.8 97.5 97.6 95.1 95.9 97.3 100.0 100.0 100.0 86.7 97.0 99.4 94.7 93.6 95.6\n0.01 95.2 96.9 97.4 92.7 95.8 99.2 99.4 100.0 100.0 90.1 97.4 99.5 94.2 94.5 95.3\nλ\n\nTo rigorously validate its importance, we conduct an ablation study (see Table 2, first row). The\nresults demonstrate a significant performance degradation when student self-distillation is removed,\nconfirming its efficacy and necessity in the few-shot setting.\nTeacher-Student Distillation Our results demonstrate that teacher-student distillation substantially\nenhances model performance. Under various few-shot settings (K = 2, 4, 8), AUROC scores across\nthe five datasets improve by margins ranging from 0.66% to 13.76% (cf. Table 2). We include a\nqualitative t-SNE visualization in Appendix D to further examine the underlying mechanism.\nLearn-to-Weight Mechanism Experimental results confirm the effectiveness of the proposed learnto-weight mechanism, as evidenced in Figure 2. Without this mechanism, histograms of normal and\nabnormal samples exhibit significant overlaps. As detailed in Table 2, incorporating this component\nyields an average AUROC improvement of 1.91% across the five datasets for K = 2, 4, 8, with peak\nimprovement reaching 6.81%. Moreover, this module is domain-agnostic and can be integrated into\nvarious few-shot learning frameworks.\nWeight Coefficient The weight coefficient λ balances the contribution between teacher-student\ndistillation and student self-distillation in the overall objective function. To determine its optimal\nvalue, we conducted a grid search over λ ∈ {1.0, 0.5, 0.1, 0.05, 0.01} using a dedicated validation\nset containing 100 normal and 100 anomalous images per task. Results in Table 3 indicate that setting\nλ = 0.1 yields the best average performance across all datasets on the test set.\n4.4\n\nI MPACT OF D IFFERENT BACKBONES\n\nTable 4 presents a quantitative comparison of different backbones serving as the teacher network. As\nexpected, deeper and wider networks demonstrate superior representational capacity, contributing\nto more accurate anomaly detection. Notably, our dual distillation approach maintains competitive\nperformance even when employing more compact architectures (e.g., ResNet-34 (Koonce, 2021)).\nInterestingly, we observe that extremely large models such as Swin Transformer (Liu et al., 2021)\n8\n\n\fPublished as a conference paper at ICLR 2026\n\nTable 4: Quantitative performance comparison of various backbone architectures employed as the\nteacher network across all datasets.\nHIS\nLAG\nAPTOS\nRSNA\nBrain Tumor\n2-shot 4-shot 8-shot 2-shot 4-shot 8-shot 2-shot 4-shot 8-shot 2-shot 4-shot 8-shot 2-shot 4-shot 8-shot\nResNet-34\n87.0 90.3 92.0 92.8 95.9 96.1 100.0 100.0 100.0 92.1 93.9 95.3 89.2 93.0 94.9\nResNet-50\n91.4 93.9 95.4 92.5 96.3 96.4 100.0 100.0 100.0 94.2 97.1 98.3 94.6 95.3 96.4\nSwin-S\n74.8 74.9 82.1 75.5 82.7 90.7 99.9 100.0 100.0 67.8 68.2 69.2 89.1 93.1 96.4\nSwin-B\n64.7 67.9 80.1 78.8 76.6 70.2 98.4 98.3 99.3 61.6 62.6 63.2 82.6 90.4 90.9\nCLIP\n88.5 91.2 93.5 90.3 93.1 93.8 97.8 99.9 99.9 85.7 90.4 93.1 92.8 93.5 95.2\nBiomedCLIP\n89.2 92.1 94.3 91.5 95.2 95.7 99.9 99.9 100.0 91.2 94.3 96.2 91.7 94.6 98.1\nWideResNet-50 96.7 98.4 99.0 97.6 97.9 98.0 100.0 100.0 100.0 99.0 99.1 99.8 95.1 96.3 96.8\nBackbone\n\nyield suboptimal results despite their theoretical capacity advantage. This counter-intuitive finding\nsuggests that excessive complexity in the teacher network may impede effective knowledge transfer\nto the student network, creating a representational gap that the distillation process struggles to bridge.\nThe phenomenon highlights an important trade-off in our teacher-student architecture where the ideal\nteacher model balances representational power with distillation compatibility.\nI NFERENCE T IME AND PARAMETERS\n\nWe compare our model with competing few-shot\nanomaly detection methods and a representative\nunsupervised method (RD4AD) in terms of AUROC, inference time, and memory usage during\ninference, averaged across all five datasets (see\nFigure 3). All evaluations are conducted on a\nNVIDIA RTX 3090 GPU (24 GB VRAM). Our\nD2 4FAD achieves the highest AUROC score\nfor anomaly detection while demonstrating significant computational efficiency—running 2×\nfaster than MVFA, 2.5× faster than InCTRL\nand RegAD, and 3× faster than AnomalyGPT\nand WinCLIP. In addition, D2 4FAD requires\nonly 5 GB of memory for inference, positioning it among the most memory-efficient fewshot anomaly detection methods. These results\ndemonstrate the superior practical value of our\napproach compared to competitors.\n\n5\n\n\u0000\u0014\u0000\u0013\u0000\u0013\n\n\u0000'\u0000ð\u0000\u0017\u0000)\u0000$\u0000'\n\n\u0000\u001c\u0000\u0013\n\n\u0000$\u00008\u00005\u00002\u0000&amp;\u0000\u0003\u0000\u000b\u0000\b\u0000\f\n\n4.5\n\n\u0000\u001b\u0000\u0013\n\u0000\u001a\u0000\u0013\n\u0000\u0019\u0000\u0013\n\n\u00000\u0000H\u0000G\u0000L\u0000&amp;\u0000/\u0000,\u00003\n\n\u00000\u00009\u0000)\u0000$\n\n\u0000,\u0000Q\u0000&amp;\u00007\u00005\u0000/\n\u0000$\u0000Q\u0000R\u0000P\u0000D\u0000O\u0000\\\u0000*\u00003\u00007\n\n\u00005\u0000'\u0000\u0017\u0000$\u0000'\n\u00005\u0000H\u0000J\u0000$\u0000'\n\n\u0000\u0018\u0000\u0013\n\u0000\u0014\u0000\u0013\n\n\u0000\u0015\u0000\u0013\n\n\u0000\u0016\u0000\u0013\n\n\u0000\u0017\u0000\u0013\n\n\u0000\u0018\u0000\u0013\n\n\u0000,\u0000Q\u0000I\u0000H\u0000U\u0000H\u0000Q\u0000F\u0000H\u0000\u0003\u00007\u0000L\u0000P\u0000H\u0000\u0003\u0000\u000b\u0000P\u0000V\u0000\f\n\n\u0000:\u0000L\u0000Q\u0000&amp;\u0000/\u0000,\u00003\n\u0000\u0019\u0000\u0013\n\n\u0000\u001a\u0000\u0013\n\n\u0000\u001b\u0000\u0013\n\nFigure 3: Performance comparison of anomaly detection methods across three dimensions: AUROC\nscore (vertical axis), inference time (horizontal\naxis), and memory footprint (circle radius).\n\nC ONCLUSION\n\nIn this paper, we introduce D2 4FAD, a novel dual distillation framework for few-shot anomaly\ndetection in medical imaging. By leveraging a pre-trained encoder as a teacher network and employing\na student decoder that distills knowledge from the teacher on query images while self-distilling on\nsupport images, our approach effectively identifies anomalies in novel tasks using only a small set of\nnormal reference images. The learn-to-weight mechanism we proposed further enhances performance\nby dynamically assessing the reference value of each support image conditioned on the query.\nOur extensive experiments on a comprehensive benchmark dataset comprising 13,084 images across\nmultiple organs, imaging modalities, and disease categories demonstrate that D2 4FAD significantly\noutperforms existing methods in few-shot medical anomaly detection. Specifically, our approach\nachieves superior AUROC scores while maintaining computational efficiency. Furthermore, D2 4FAD\nexhibits remarkable memory efficiency, requiring only 5 GB for inference, which positions it among\nthe most resource-efficient few-shot anomaly detection methods.\nThe clinical significance of our work is particularly notable in medical settings where obtaining large\nannotated datasets is challenging due to privacy concerns, rare pathologies, or resource constraints.\nBy requiring only a few normal samples, D2 4FAD enables practical anomaly detection across diverse\nmedical imaging scenarios without extensive data collection efforts. This makes our approach\n9\n\n\fPublished as a conference paper at ICLR 2026\n\nespecially valuable for detecting anomalies in uncommon anatomical structures or rare disease\npresentations where comprehensive datasets are unavailable.\n\nACKNOWLEDGMENTS\nThis work was supported in part by the Shaanxi Province Young Talent Support Program and the Qin\nChuangyuan Innovation and Entrepreneurship Talent Project (H023360002), and in part by the China\nPostdoctoral Science Foundation (Nos. 2023M742737 and 2023TQ0257).\n\nE THICS S TATEMENT\nThe authors acknowledge that this work adheres to the ICLR Code of Ethics.\n\nR EFERENCES\nKilian Batzner, Lars Heckler, and Rebecca König. EfficientAD: Accurate visual anomaly detection at\nmillisecond-level latencies. In Proceedings of the IEEE/CVF Winter Conference on Applications\nof Computer Vision (WACV), pages 128–138, 2024.\nAntoni Buades, Bartomeu Coll, and J-M Morel. A non-local algorithm for image denoising. In 2005\nIEEE computer society conference on computer vision and pattern recognition (CVPR), volume 2,\npages 60–65, 2005.\nYu Cai, Hao Chen, Xin Yang, Yu Zhou, and Kwang-Ting Cheng. Dual-distribution discrepancy for\nanomaly detection in chest X-rays. In International Conference on Medical Image Computing and\nComputer-Assisted Intervention (MICCAI), pages 584–593, 2022.\nYu Cai, Weiwen Zhang, Hao Chen, and Kwang-Ting Cheng. Medianomaly: A comparative study of\nanomaly detection in medical images. Medical Image Analysis, page 103500, 2025.\nTri Cao, Jiawen Zhu, and Guansong Pang. Anomaly detection under distribution shift. In Proceedings\nof the IEEE/CVF International Conference on Computer Vision (ICCV), pages 6511–6523, 2023.\nJun Cheng, Wei Huang, Shuangliang Cao, Ru Yang, Wei Yang, Zhaoqiang Yun, Zhijian Wang, and\nQianjin Feng. Enhanced performance of brain tumor classification via tumor region augmentation\nand partition. Public Library of Science One, 10(10):e0140381, 2015.\nHanqiu Deng and Xingyu Li. Anomaly detection via reverse distillation from one-class embedding.\nIn Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR),\npages 9737–9746, 2022.\nTharindu Fernando, Harshala Gammulle, Simon Denman, Sridha Sridharan, and Clinton Fookes.\nDeep learning for medical anomaly detection–A survey. ACM Computing Surveys (CSUR), 54(7):\n1–37, 2021.\nDong Gong, Lingqiao Liu, Vuong Le, Budhaditya Saha, Moussa Reda Mansour, Svetha Venkatesh,\nand Anton van den Hengel. Memorizing normality to detect anomaly: Memory-augmented deep\nautoencoder for unsupervised anomaly detection. In Proceedings of the IEEE/CVF International\nConference on Computer Vision (ICCV), pages 1705–1714, 2019.\nZhaopeng Gu, Bingke Zhu, Guibo Zhu, Yingying Chen, Ming Tang, and Jinqiao Wang. AnomalyGPT:\nDetecting industrial anomalies using large vision-language models. In Proceedings of the AAAI\nConference on Artificial Intelligence (AAAI), pages 1932–1940, 2024.\nZhihao Gu, Liang Liu, Xu Chen, Ran Yi, Jiangning Zhang, Yabiao Wang, Chengjie Wang, Annan\nShu, Guannan Jiang, and Lizhuang Ma. Remembering normality: Memory-guided knowledge\ndistillation for unsupervised anomaly detection. In Proceedings of the IEEE/CVF International\nConference on Computer Vision (ICCV), pages 16401–16409, 2023.\n10\n\n\fPublished as a conference paper at ICLR 2026\n\nDenis Gudovskiy, Shun Ishizaka, and Kazuki Kozuka. CFLOW-AD: Real-time unsupervised anomaly\ndetection with localization via conditional normalizing flows. In Proceedings of the IEEE/CVF\nWinter Conference on Applications of Computer Vision (WACV), pages 98–107, 2022.\nJia Guo, Shuai Lu, Lize Jia, Weihang Zhang, and Huiqi Li. ReContrast: Domain-specific anomaly\ndetection via contrastive reconstruction. In Proceedings of the International Conference on Neural\nInformation Processing Systems (NeurIPS), pages 10721–10740, 2023.\nChaoqin Huang, Haoyan Guan, Aofan Jiang, Ya Zhang, Michael Spratling, and Yan-Feng Wang.\nRegistration based few-shot anomaly detection. In European Conference on Computer Vision\n(ECCV), pages 303–319, 2022.\nChaoqin Huang, Aofan Jiang, Jinghao Feng, Ya Zhang, Xinchao Wang, and Yanfeng Wang. Adapting\nvisual-language models for generalizable anomaly detection in medical images. In Proceedings of\nthe IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 11375–\n11385, 2024.\nJongheon Jeong, Yang Zou, Taewan Kim, Dongqing Zhang, Avinash Ravichandran, and Onkar\nDabeer. WinCLIP: Zero-/few-shot anomaly classification and segmentation. In Proceedings of the\nIEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 19606–19616,\n2023.\nWenqian Jiang, Yang Hong, Beitong Zhou, Xin He, and Cheng Cheng. A GAN-based anomaly\ndetection approach for imbalanced industrial time series. IEEE Access, 7:143608–143619, 2019.\nLonglong Jing and Yingli Tian. Self-supervised visual feature learning with deep neural networks:\nA survey. IEEE Transactions on Pattern Analysis and Machine Intelligence, 43(11):4037–4058,\n2021.\nDiederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint\narXiv:1412.6980, 2014.\nBrett Koonce. Resnet 34. In Convolutional Neural Networks with Swift for TensorFlow: Image\nRecognition and Dataset Categorization, pages 51–61. 2021.\nChun-Liang Li, Kihyuk Sohn, Jinsung Yoon, and Tomas Pfister. CutPaste: Self-supervised learning\nfor anomaly detection and localization. In Proceedings of the IEEE/CVF Conference on Computer\nVision and Pattern Recognition (CVPR), pages 9664–9674, 2021.\nChunlei Li, Yilei Shi, Jingliang Hu, Xiao Xiang Zhu, and Lichao Mou. Scale-Aware contrastive\nreverse distillation for unsupervised medical anomaly detection. In The Thirteenth International\nConference on Learning Representations (ICLR), 2025. Poster presentation.\nDan Li, Dacheng Chen, Jonathan Goh, and See-Kiong Ng. Anomaly detection with generative\nadversarial networks for multivariate time series. arXiv preprint arXiv:1809.04758, 2018.\nLiu Li, Mai Xu, Xiaofei Wang, Lai Jiang, and Hanruo Liu. Attention based glaucoma detection: A\nlarge-scale database and CNN model. In Proceedings of the IEEE/CVF conference on computer\nvision and pattern recognition (CVPR), pages 10571–10580, 2019.\nZe Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo.\nSwin transformer: Hierarchical vision transformer using shifted windows. In Proceedings of the\nIEEE/CVF international conference on computer vision (ICCV), pages 10012–10022, 2021.\nZhikang Liu, Yiming Zhou, Yuansheng Xu, and Zilei Wang. SimpleNet: A simple network for image\nanomaly detection and localization. In Proceedings of the IEEE/CVF Conference on Computer\nVision and Pattern Recognition (CVPR), pages 20402–20411, 2023.\nWei Luo, Yunkang Cao, Haiming Yao, Xiaotian Zhang, Jianan Lou, Yuqi Cheng, Weiming Shen,\nand Wenyong Yu. Exploring intrinsic normal prototypes within a single image for universal\nanomaly detection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern\nRecognition (CVPR), pages 9974–9983, 2025.\n11\n\n\fPublished as a conference paper at ICLR 2026\n\nYe Ma, Xu Jiang, Nan Guan, and Wang Yi. Anomaly detection based on multi-teacher knowledge\ndistillation. Journal of systems architecture, 138:102861, 2023.\nYifan Mao, Fei-Fei Xue, Ruixuan Wang, Jianguo Zhang, Wei-Shi Zheng, and Hongmei Liu. Abnormality detection in chest X-ray images using uncertainty prediction autoencoders. In International\nConference on Medical Image Computing and Computer-Assisted Intervention (MICCAI), pages\n529–538, 2020.\nXueyan Mei, Zelong Liu, Philip M Robson, Brett Marinelli, Mingqian Huang, Amish Doshi, Adam\nJacobi, Chendi Cao, Katherine E Link, Thomas Yang, et al. Radimagenet: An open radiologic\ndeep learning research dataset for effective transfer learning. Radiology: Artificial Intelligence, 4\n(5):e210315, 2022.\nSergio Naval Marimont and Giacomo Tarroni. Anomaly detection through latent space restoration\nusing vector quantized variational autoencoders. In IEEE International Symposium on Biomedical\nImaging (ISBI), pages 1764–1767, 2021.\nEva Pachetti and Sara Colantonio. A systematic review of few-shot learning in medical imaging.\nArtificial Intelligence in Medicine, 156:102949, 2024.\nGuansong Pang, Chunhua Shen, Huidong Jin, and Anton Van Den Hengel. Deep weakly-supervised\nanomaly detection. In Proceedings of the 29th ACM SIGKDD Conference on Knowledge Discovery\nand Data Mining (KDD), pages 1795–1807, 2023.\nHyunjong Park, Jongyoun Noh, and Bumsub Ham. Learning memory-guided normality for anomaly\ndetection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 14372–14381, 2020.\nKarsten Roth, Latha Pemula, Joaquin Zepeda, Bernhard Schölkopf, Thomas Brox, and Peter Gehler.\nTowards total recall in industrial anomaly detection. In Proceedings of the IEEE/CVF Conference\non Computer Vision and Pattern Recognition (CVPR), pages 14318–14328, 2022.\nMarco Rudolph, Bastian Wandt, and Bodo Rosenhahn. Same same but differnet: Semi-supervised\ndefect detection with normalizing flows. In Proceedings of the IEEE/CVF Winter Conference on\nApplications of Computer Vision (WACV), pages 1907–1916, 2021.\nAhmad Saleh, Rozana Sukaik, and Samy S. Abu-Naser. Brain tumor classification using deep\nlearning. In International Conference on Assistive and Rehabilitation Technologies (iCareTech),\npages 131–136, 2020.\nMohammadreza Salehi, Niousha Sadjadi, Soroosh Baselizadeh, Mohammad H. Rohban, and Hamid R.\nRabiee. Multiresolution knowledge distillation for anomaly detection. In Proceedings of the\nIEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 14902–14912,\n2021.\nThomas Schlegl, Philipp Seeböck, Sebastian M. Waldstein, Ursula Schmidt-Erfurth, and Georg Langs.\nUnsupervised anomaly detection with generative adversarial networks to guide marker discovery.\nIn Information Processing in Medical Imaging (IPMI), page 146–157, 2017.\nThomas Schlegl, Philipp Seeböck, Sebastian M. Waldstein, Georg Langs, and Ursula Schmidt-Erfurth.\nf-AnoGAN: Fast unsupervised anomaly detection with generative adversarial networks. Medical\nImage Analysis, 54:30–44, 2019.\nHannah M. Schlüter, Jeremy Tan, Benjamin Hou, and Bernhard Kainz. Natural synthetic anomalies\nfor self-supervised anomaly detection and localization. In European Conference on Computer\nVision (ECCV), pages 474–489, 2022.\nShelly Sheynin, Sagie Benaim, and Lior Wolf. A hierarchical transformation-discriminating generative model for few shot anomaly detection. In Proceedings of the IEEE/CVF International\nConference on Computer Vision (ICCV), pages 8495–8504, 2021.\nNina Shvetsova, Bart Bakker, Irina Fedulova, Heinrich Schulz, and Dmitry V. Dylov. Anomaly\ndetection in medical imaging with deep perceptual autoencoders. IEEE Access, 9:118571–118583,\n2021.\n12\n\n\fPublished as a conference paper at ICLR 2026\n\nKihyuk Sohn, Chun-Liang Li, Jinsung Yoon, Minho Jin, and Tomas Pfister. Learning and evaluating representations for deep one-class classification. In International Conference on Learning\nRepresentations (ICLR), 2021.\nJeremy Tan, Benjamin Hou, Thomas G. Day, John M. Simpson, Daniel Rueckert, and Bernhard Kainz.\nDetecting outliers with poisson image interpolation. In International Conference on Medical Image\nComputing and Computer-Assisted Intervention (MICCAI), pages 581–591, 2021.\nTran Dinh Tien, Anh Tuan Nguyen, Nguyen Hoang Tran, Ta Duc Huy, Soan Duong, Chanh D. Tr.\nNguyen, and Steven Q. H. Truong. Revisiting reverse distillation for anomaly detection. In\nProceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR),\npages 24511–24520, 2023.\nJiawei Yu, Ye Zheng, Xiang Wang, Wei Li, Yushuang Wu, Rui Zhao, and Liwei Wu. FastFlow:\nUnsupervised anomaly detection and localization via 2D normalizing flows. arXiv preprint\narXiv:2111.07677, 2021.\nSergey Zagoruyko and Nikos Komodakis. Wide residual networks. arXiv preprint arXiv:1605.07146,\n2016.\nXimiao Zhang, Min Xu, Dehui Qiu, Ruixin Yan, Ning Lang, and Xiuzhuang Zhou. MediCLIP:\nAdapting CLIP for few-shot medical image anomaly detection. In International Conference on\nMedical Image Computing and Computer-Assisted Intervention (MICCAI), pages 458–468, 2024.\nQihang Zhou, Shibo He, Haoyu Liu, Tao Chen, and Jiming Chen. Pull &amp; push: Leveraging\ndifferential knowledge distillation for efficient unsupervised anomaly detection and localization.\nIEEE Transactions on Circuits and Systems for Video Technology, 33(5):2176–2189, 2022.\nJiawen Zhu and Guansong Pang. Toward generalist anomaly detection via in-context residual learning\nwith few-shot sample prompts. In Proceedings of the IEEE/CVF Conference on Computer Vision\nand Pattern Recognition (CVPR), pages 17826–17836, 2024.\nDavid Zimmerer, Simon A. A. Kohl, Jens Petersen, Fabian Isensee, and Klaus H. Maier-Hein.\nContext-encoding variational autoencoder for unsupervised anomaly detection. arXiv preprint\narXiv:1812.05941, 2018.\n\nA PPENDIX\nA\n\nU SE OF L ARGE L ANGUAGE M ODELS\n\nLarge language models were used solely for light editing tasks including grammar correction, spelling\nchecks, and minor phrasing improvements to enhance clarity and concision.\n\nB\n\nA NALYSIS OF P RE - TRAINING DATA FOR THE T EACHER N ETWORK\n\nTo examine how the teacher’s pre-training domain influences performance, we compare ResNet-50\nmodels trained on ImageNet (natural images) and RadImageNet (Mei et al., 2022) (medical images).\nAs shown in Table 5, the medically pre-trained teacher provides an average improvement of 0.91%,\nindicating that domain-aligned representations enhance accuracy. This also reinforces our main\nclaim that the proposed distillation framework is flexible and can readily incorporate stronger or\ndomain-specific teacher models.\n\nC\n\nI MPACT OF S UPPORT I MAGE S ELECTION\n\nTo evaluate the robustness of our method, we study the effect of support image choice. We perform\nfive trials, each with randomly selected support examples, and report the mean and standard deviation.\nAs shown in Table 6, performance with randomly selected support images differs only slightly from\nthat with a fixed set, indicating that support sample selection has minimal impact on the results.\n13\n\n\fPublished as a conference paper at ICLR 2026\n\nTable 5: Performance comparison between different pre-training datasets on ResNet-50 backbone.\nHIS\nLAG\nAPTOS\nRSNA\nBrain Tumor\n2-shot 4-shot 8-shot 2-shot 4-shot 8-shot 2-shot 4-shot 8-shot 2-shot 4-shot 8-shot 2-shot 4-shot 8-shot\nImageNet\n91.4 93.9 95.4 92.5 96.3 96.4 100.0 100.0 100.0 94.2 97.1 98.3 94.6 95.3 96.4\nRadImageNet 93.6 95.2 95.6 93.0 95.9 96.8 99.9 100.0 100.0 97.4 98.0 98.6 95.3 97.7 98.4\n\nTable 6: Performance comparison between fixed (top) and randomly sampled (bottom) support sets.\n2-shot\n\nHIS\n4-shot\n\n8-shot\n\n2-shot\n\nLAG\n4-shot\n\n8-shot\n\n2-shot\n\nAPTOS\n4-shot\n\n8-shot\n\n2-shot\n\nRSNA\n4-shot\n\n8-shot\n\nBrain Tumor\n2-shot 4-shot 8-shot\n\nD24FADfix 93.8±1.1 93.5±1.5 93.2±1.1 94.4±1.5 96.1±1.3 97.1±0.4 100.0±0.1 100.0±0.0 100.0±0.0 88.4±9.7 97.3±1.4 98.9±0.4 95.8±1.1 95.3±1.0 95.2±0.4\nD24FADrnd 92.6±2.2 93.4±1.1 93.5±0.9 94.8±1.9 95.8±1.3 96.5±0.8 99.8±0.5 100.0±0.0 100.0±0.0 93.4±6.9 96.9±2.1 98.4±0.9 94.7±0.5 96.0±1.3 96.1±0.6\n\nD\n\nT EACHER -S TUDENT D ISTILLATION\n\nWe visualize feature representations from the student network using t-SNE on the RSNA dataset. As\nillustrated in Figure 4, using teacher student distillation produces more compact and discriminative\nfeature clusters, validating its effectiveness.\n\u00001\u0000R\u0000U\u0000P\u0000D\u0000O\n\u0000$\u0000Q\u0000R\u0000P\u0000D\u0000O\u0000\\\n\n\u0000\u0015\u0000\u0013\n\n\u00001\u0000R\u0000U\u0000P\u0000D\u0000O\n\u0000$\u0000Q\u0000R\u0000P\u0000D\u0000O\u0000\\\n\n\u0000\u0016\u0000\u0013\n\u0000\u0015\u0000\u0013\n\n\u0000\u0014\u0000\u0013\n\n\u0000\u0014\u0000\u0013\n\n\u0000\u0013\n\n\u0000\u0013\n\n\u0000\u0014\u0000\u0013\n\n\u0000\u0014\u0000\u0013\n\n\u0000\u0015\u0000\u0013\n\n\u0000\u0015\u0000\u0013\n\n\u0000\u0016\u0000\u0013\n\n\u0000\u0016\u0000\u0013\n\u0000\u0017\u0000\u0013\n\n\u0000\u0015\u0000\u0013\n\n\u0000\u0013\n\n\u0000\u0015\u0000\u0013\n\n\u0000\u0017\u0000\u0013\n\n\u0000\u0019\u0000\u0013\n\n\u0000\u0015\u0000\u0013\n\n\u0000\u0013\n\n\u0000\u0015\u0000\u0013\n\n\u0000\u0017\u0000\u0013\n\nFigure 4: t-SNE visualization of embeddings from normal and abnormal samples in the RSNA dataset,\nextracted from the student network. Left: embeddings without teacher-student distillation. Right:\nembeddings with teacher-student distillation applied.\n\nE\n\nQ UALITATIVE R ESULTS\n\nFor qualitative analysis, we demonstrate our method’s anomaly localization capability using anomaly\nmaps shown in Figure 5. The figure displays results across five datasets: HIS, LAG, APTOS, RSNA,\nand Brain Tumor (from left to right). The top row shows original images from each dataset, while the\nbottom row shows the corresponding anomaly maps generated by our method. Despite promising\nqualitative localization, the absence of pixel-level annotations in our benchmark hinders quantitative\nevaluation, and this limitation could be addressed with fully annotated datasets in the future.\n\nF\n\nA LTERNATIVE I NSTANTIATIONS O F T HE L EARN - TO -W EIGHT M ECHANISM\n\nTo assess the flexibility of our weighting mechanism, we introduce three alternative similarity\nfunctions—Gaussian, embedded Gaussian, and concatenation—to compute query–support similarity,\nfollowed by softmax normalization:\n14\n\n\fPublished as a conference paper at ICLR 2026\n\nFigure 5: Visualization of exemplar anomaly maps generated by the proposed model.\nGaussian\n\ni\n\nT\n\ni\n\nwi = softmax(ezqry (zspt ) ) .\n(7)\nEuclidean distance, as in (Buades et al., 2005), is also applicable, but the dot product is more\nimplementation-friendly in modern deep-learning frameworks.\nEmbedded Gaussian\n\ni\n\ni\n\nT\n\nwi = softmax(eθ(zqry )ϕ(zspt ) ) ,\nwhere θ and ϕ are linear projections implemented with 1 × 1 convolutions.\nConcatenation\n\ni\ni\nwi = softmax(ReLU(wT [θ(zqry\n), ϕ(zspt\n)])) ,\n\n(8)\n\n(9)\n\ni\nwhere [·, ·] denotes concatenation, and w is a learnable weight vector. The query feature zqry\n∈\n1×Ci ×Hi ×Wi\nK×(Ci ×Hi ×Wi )\n\nR\n\nis broadcast to R\n\nfor this computation.\n\nTable 7: Performance comparison between different ways to instantiate Learn-To-Weight.\nHIS\nLAG\nAPTOS\nRSNA\nBrain Tumor\n2-shot 4-shot 8-shot 2-shot 4-shot 8-shot 2-shot 4-shot 8-shot 2-shot 4-shot 8-shot 2-shot 4-shot 8-shot\nGaussian\n95.7 97.4 98.0 95.6 96.9 97.0 99.9 99.2 100.0 97.0 98.1 98.8 94.1 95.3 95.8\nGaussian, embed 96.0 98.6 98.4 96.9 97.2 97.4 99.9 100.0 100.0 98.8 98.7 99.2 94.5 95.7 96.2\nConcatenation\n95.9 97.6 98.2 96.7 97.1 97.7 99.9 99.8 100.0 97.5 97.9 99.0 94.3 94.5 96.0\nOurs\n96.7 98.4 99.0 97.6 97.9 98.0 100.0 100.0 100.0 99.0 99.1 99.8 95.1 96.3 96.8\n\nThe remaining steps follow Section 2.3. As shown in Table 7, different weighting strategies produce\ncomparable but distinct results. The scaled dot-product formulation used in our main model shows\nslightly better performance, likely because it provides a more direct and effective measure of feature similarity. These variants demonstrate the flexibility of our learn-to-weight design, and other\nalternatives may further improve performance.\nWe also visualize the learned weights in Figure 6. Support images that are normal, anomalous, or\nsemantically irrelevant are marked in green, red, and yellow, respectively. Across multiple layers\n15\n\n\fPublished as a conference paper at ICLR 2026\n\n(weight 1/2/3), the model consistently assigns lower weights to anomalous or irrelevant support\nimages, highlighting the effectiveness of the proposed mechanism.\n\nQuery\n\nweight 1：0.5653\nweight 2：0.5324\nweight 3：0.5580\n\nweight 1：0.5824\nweight 2：0.6216\nweight 3：0.7095\n\nweight 1：0.8092\nweight 2：0.8225\nweight 3：0.8169\n\nweight 1：0.4347\nweight 2：0.4676\nweight 3：0.4420\n\nweight 1：0.4176\nweight 2：0.3784\nweight 3：0.2905\n\nweight 1：0.1908\nweight 2：0.1775\nweight 3：0.1831\n\nFigure 6: Visualization of learned weights in the learn-to-weight mechanism.\n\n16\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"