"<!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>Mixture Prototype Flow Matching for Open-Set Supervised Anomaly Detection\n\nFuyun Wang 1 Yuanzhi Wang 1 Xu Guo 2 Sujia Huang 1 Tong Zhang 1 Dan Wang 3 Hui Yan 1 Xin Liu 4\nZhen Cui 2\n(a) Existing Method\n\narXiv:2605.02438v3 [cs.CV] 14 May 2026\n\nAbstract\n\nNormal Samples\nFalse Positives\nTrue Anomalies\nPrototype Centers\n\nOpen-set supervised anomaly detection (OSAD)\naims to identify unseen anomalies using limited anomalous supervision. However, existing\nprototype-based methods typically model normal data via a unimodal Gaussian prior, failing to capture inherent multi-modality and resulting in blurred decision boundaries. To address\nthis, we propose Mixture Prototype Flow Matching (MPFM), a framework that learns a continuous transformation from normal feature distributions to a structured Gaussian mixture prototype space. Departing from traditional flow-based\napproaches that rely on a single velocity vector,\nMPFM explicitly models the velocity field as a\nGaussian mixture prior where each component\ncorresponds to a distinct normal class. This design facilitates mode-aware and semantically coherent distribution transport. Furthermore, we\nintroduce a Mutual Information Maximization\nRegularizer (MIMR) to prevent prototype collapse and maximize normal-anomaly separability.\nExtensive experiments demonstrate that MPFM\nachieves state-of-the-art performance across diverse benchmarks under both single- and multianomaly settings. Code is available at https:\n//github.com/fuyunwang/MPFM-OSAD.\n\n(b) Ours\nNormal Samples\nTrue Anomalies\nPrototype Centers\n\nFigure 1. (a) Existing method assumes a unimodal normal distribution, overlooking intrinsic multi-modality and causing false\npositives. (b) Our method learns a continuous multi-modal prototype space via flow, capturing intra-class diversity, concentrating\nnormal density, and enlarging the margin to true anomalies.\n\ncent advances in Unsupervised AD (Lu et al., 2023; Liu\net al., 2024) and few-shot AD (FSAD) (Pang et al., 2021;\nHu et al., 2024) focus on modeling normal distributions to\nflag irregularities, they often overlook the valuable prior information embedded in observed anomalies, resulting in\nimprecise decision boundaries. Conversely, Supervised\nAD (SAD) (Baitieva et al., 2024) explicitly incorporates\nknown anomalies for guidance; however, its reliance on\nseen classes risks overfitting, leading to poor generalization\nacross unseen anomaly types. To bridge this gap, Open-set\nSupervised AD (OSAD) (Ding et al., 2022; Wang et al.,\n2025a) aims to leverage limited anomalous examples with\nimage-level supervision, ensuring robust detection of both\nknown and previously unseen anomalies.\nExisting OSAD methods can be grouped into three categories. The first employs data augmentation and outlier\nexposure (e.g., DRA (Ding et al., 2022)), which increases\nanomaly coverage by disentangling seen, pseudo, and residual factors, while other methods inject synthetic defects or\nexternal outliers to refine decision boundaries. The second\ncategory relies on heterogeneous simulation, as exemplified by AHL (Zhu et al., 2024), to enhance generalization\nusing diverse simulated anomalies. The third leverages prototype learning and generative dynamics, constructing a\nstructured prototype space where normal samples are drawn\ntoward prototype centers and anomalies are repelled, often\nvia diffusion or flow-based mechanisms. However, these\nmethods face notable limitations: augmentation and exposure often cover only a limited anomaly spectrum and retain in-distribution bias, while simulation-based approaches\n\n1. Introduction\nAnomaly detection (AD) plays a pivotal role in identifying deviations from normal patterns, underpinning critical applications such as industrial inspection and medical\nimaging (Yao et al., 2024; Wang et al., 2026). While re1\nNanjing University of Science and Technology, Nanjing, China\nBeijing Normal University, Beijing, China 3 China Academy of\nSpace Technology, Beijing, China 4 Nanjing SeetaCloud Technology, Nanjing, China. Correspondence to: ZhenCui, DanWang\n&lt;\n&gt;.\n2\n\nProceedings of the 43 rd International Conference on Machine\nLearning, Seoul, South Korea. PMLR 306, 2026. Copyright 2026\nby the author(s).\n\n1\n\n\fMixture Prototype Flow Matching for Open-Set Supervised Anomaly Detection\n\n2. Related Work\n\nstruggle to capture the scale and structural diversity of\nreal-world anomalies. A recent prototype-based OSAD\napproach, DPDL (Wang et al., 2025a), models normal sample prototypes with a set of simple Gaussian distributions\nand identifies anomalies by constructing bridging flows that\nshift normal samples toward these prototypes. However,\nby assuming normal data is uni-modal and limited to observed categories, this method cannot represent the multimodal complexity of real-world industrial data. As shown\nin Fig. 1 (a), a uni-modal Gaussian prior oversimplifies the\nsub-patterns within the normal sample distribution and fails\nto capture rare normal instances, leading to their misclassification as anomalies (i.e., false positives) and blurring\nthe decision boundary of the normal samples. This raises\na critical question: How can we more precisely model the\ndistribution of normal samples to establish a compact, comprehensive decision boundary that remains robust against\nunseen anomalies?\n\n2.1. Open-set Supervised Anomaly Detection\nOpen-set supervised anomaly detection generalizes from\nlimited known anomalies to unseen types, leveraging anomalous priors to reduce false alarms. Existing approaches follow two main paradigms. The first paradigm employs data\naugmentation and simulation. DRA (Ding et al., 2022) disentangles seen, pseudo, and residual anomalies to expand\ncoverage, while AHL (Zhu et al., 2024) simulates heterogeneous distributions via collaborative training. However,\nthese methods typically cover limited anomaly subspaces\nand may inherit training biases, constraining generalization to truly novel anomalies. The second paradigm adopts\nprototype- or generative-based approaches, constructing\ncompact normal representations with transport dynamics.\nDPDL (Wang et al., 2025a) builds a prototype space using diffusion processes to attract normals and repel anomalies. Yet, its single-mode prototype fails to capture normal\ndata multimodality, causing false positives on rare normal\npatterns and ambiguous boundaries near subtle anomalies.\nAddressing these limitations, our approach is guided by a\nGaussian mixture prior for multi-modal normality, empowered by flow matching for stable alignment, and refined by\na center-aware regularizer to bolster component separation.\n\nTo address these challenges, we propose Mixture Prototype\nFlow Matching (MPFM), a novel framework integrating\nGaussian mixture modeling with continuous flow matching\nto explicitly capture the multi-modal nature of normal data.\nDeparting from conventional uni-modal prior paradigms,\nMPFM characterizes normality within a structured Gaussian mixture prototype space, where each component represents a semantically distinct normal mode. Technically,\nwe leverage flow matching to learn a mode-aware velocity\nfield that transports features into this mixture prior, enabling\nfine-grained and mode-aligned distribution transformation.\nThis yields a more expressive characterization of normality, enhancing both anomaly discrimination and generalization. Furthermore, to mitigate prototype collapse and ensure\nopen-set separability, we introduce a Mutual Information\nMaximization Regularizer (MIMR), which enforces confident prototype assignments and margin-based separation\nfrom anomalies. Our contributions are outlined as follows:\n\n2.2. Flow Matching\nFlow matching provides a simulation-free framework for\nlearning vector fields that transport data between complex\nand simple distributions (Lipman et al., 2022; Liu et al.,\n2022; Esser et al., 2024; Chen et al., 2025). Rectified\nFlow (Liu et al., 2022) substantially advanced the field by\nintroducing straight probability paths between distributions,\nsimplifying both training and sampling dynamics. Subsequent efforts further improved efficiency and generality:\nInstaFlow (Liu et al., 2023) achieved single-step generation\nvia rectified flow distillation, while Stable Diffusion 3 (Esser\net al., 2024) and Flux (Labs, 2024) emerged as state-of-theart text-to-image models by building upon flow matching\nfor robust and generalized synthesis (Wang et al., 2025b).\nThese advances establish flow matching as a scalable and\nstable alternative to diffusion models, particularly suited for\ntasks requiring efficient distribution alignment—a property\nwe leverage in this work to construct compact and discriminative normal feature distributions for anomaly detection.\n\n• We propose Mixture Prototype Flow Matching\n(MPFM) to integrate Gaussian mixture priors with flow\nmatching to capture multi-modal normality and produce sharper decision boundaries.\n\n• We introduce a Mutual Information Maximization Regularizer (MIMR) to prevent mode collapse and enhance\nfeature discriminability.\n\n3. Preliminaries\nWe adopt the standard additive–Gaussian perturbation view\nused by diffusion models and instantiate flow matching on\ntop of it. Let the clean feature be \\mathbf {z}_0 \\in \\mathbb {R}^D , Gaussian noise\n\\varepsilon \\sim \\mathcal {N}(\\0,\\I ) is injected along a time schedule (\\alpha _t, \\sigma _t):\n\n• Extensive experiments demonstrate that MPFM\nachieves state-of-the-art performance across diverse\nbenchmarks.\n\n  \\z _t = \\alpha _t \\z _0 + \\sigma _t \\varepsilon . \\label {eq:1} \n2\n\n(1)\n\n\fMixture Prototype Flow Matching for Open-Set Supervised Anomaly Detection\n\nAlgorithm 1 MPFM: Mixture Prototype Flow Matching\n\nIn the discrete-time setting, the process can be represented\nvia the transition from zt−∆t to zt as:\n  p(\\z _t|\\z _{t - \\Delta t}) = \\mathcal {N}\\left (\\z _t; \\frac {\\alpha _t}{\\alpha _{t - \\Delta t}} \\z _{t - \\Delta t}, \\beta _{t,\\Delta t} I\\right ), \n\nRequire: Training sets Ztrn , Ztra ; test set Zte\nEnsure: Anomaly scores {S(z)} for z ∈ Zte\n1: Hyperparameters: GMM components K, MIMR\nweight λ, Learning rate η\n2: Initialize f , ψ with θ, scoring modules {θa , θn , θr , θg }\n3: Extract features: Ftrn ← f (Ztrn ), Ftra ← f (Ztra )\n4: Initialize GMM prototype via K-means++ on Ftrn :\n5:\n{µk , πk }K\n← K-means++(Ftrn )\nk=1\nPK P\n1\n2\n2\n6:\ns ← dN k=1 i∈Ck ∥zn,i\n0 − µ k ∥2\n7: while not converged do\na,j\na\nn\n8:\nSample batch: {zn,i\n0 } ∼ Ftr , {z0 } ∼ Ftr\n9:\nSample timestep: t ∼ U (0, T )\n10:\nCompute interpolated features and velocities:\n\n(2)\n\nα2\n\n2\nwhere βt,∆t := σt2 − α2 t σt−∆t\n. During the reverse\nt−∆t\nprocess, marginalizing \\mathbf {z}_0 recovers the reverse kernel\np(\\z _{t-\\Delta t}|\\z _t) = \\int p(\\z _{t-\\Delta t}|\\z _t, \\z _0) p(\\z _0|\\z _t) \\, \\text {d}\\z _0 :\n\n  p(\\z _{t-\\Delta t} \\mid \\z _t, \\z _0) = \\mathcal {N}\\big (\\z _{t-\\Delta t};\\, c_1 \\z _t + c_2 \\z _0,\\, c_3 \\I \\big ), \\label {eq:2} \nα σ2\n\nt t−∆t\n,c =\nwhere c1 = αt−∆t\nσ2 2\nt\n\n(3)\n\n2\n\nσ\nβt,∆t\nαt−∆t βt,∆t\n, c3 = t−∆t\n.\nσt2\nσt2\n\nFlow Matching (FM) trains a neural network to directly\nt\npredict the ODE velocity field dz\ndt . By adopting a linear\nnoise schedule defined as T = 1, αt = 1 − t and σt = t,\nthe random velocity variable is defined as:\n  \\u = \\frac {\\z _t - \\z _{t-\\Delta t}}{\\Delta _t}, \\label {eq:3} \n\n11:\n12:\n13:\n14:\n15:\n16:\n17:\n\nCompute flow matching losses:\nLnflow ← E[− log qθ (un,i |zn,i\nt )]\nLaflow ← E[log qθ (ua,j |za,j\nt )]\nCompute MIMRP\nregularization:\nLmim ← E[ k p(c = k|ψ(zn,i\n0 )) log p(c =\nP\nk|ψ(zn,i\n))]\n−\nπ\nlog\nπ\nk\n0\nk k\nP\n18:\nCompute: Lscore ← m∈{a,n,r,g} LMm\n19:\nTotal loss: L ← Lnflow + Laflow + λLmim + Lscore\nUpdate Θ ← {θ, θa , θn , θr , θg }: Θ ← Θ − η · ∇Θ L\n20:\n21: end while\n22: Inference: For each z ∈ Zte :\n23:\nS(z) ← Sg + Sa + Sr − Sn\n24: return {S(z)}\n\n(4)\n\nDuring training, FM learns a time-dependent vector field\nby fitting a parametric conditional q_{\\theta }(\\u \\mid \\z _t) to the ground\ntruth p(\\u \\mid \\z _t) in Kullback-Leibler Divergence (KL):\n  \\mathcal {L}_{\\mathrm {FM}} &amp;= \\mathbb {E}_{t, \\z _0, \\z _t} \\big [ D_{\\mathrm {KL}} \\big ( p(\\u \\mid \\z _t) \\,\\|\\, q_{\\theta }(\\u \\mid \\z _t) \\big ) \\big ] \\nonumber \\\\ &amp;\\equiv \\mathbb {E}_{t, \\z _0, \\z _t} \\big [ -\\log q_{\\theta }(\\u \\mid \\z _t) \\big ]. \\label {eq:4}\n(5)\nTechnically, we obtain \\mathbf {z}_t by sampling \\mathbf {z}_0 , drawing \\varepsilon , and\ncomputing \\mathbf {u} via Eqn. (1). Minimizing Eqn. (5) is a supervised regression of velocities conditioned on \\mathbf {z}_t :\n  \\mcL _\\text {FM } = \\mathbb {E}_{t,\\z _0,\\z _t}[\\frac {1}{2}\\|\\u -\\boldsymbol {\\mu _\\theta }(\\z _t)\\|^2_2], \n\nn,i\nzn,i\nT −z0\nt\nza,j −za,j\na,j\na,j\nza,j\n← (1 − t)za,j\n← T t 0\nt\n0 + tzT , u\n\nn,i\nn,i\nn,i\n←\nzn,i\nt ← (1 − t)z0 + tzT , u\n\n(6)\n\nwhere µθ (zt ) denotes a flow velocity neural network with\nlearnable parameters θ.\n\nfragments the prototype space and disrupts semantic continuity in the data manifold. While typically formulated as\nlearning a set of independent Gaussians N (µk , σk2 I), this\nparadigm cannot establish semantic connections between\nmodes, ultimately limiting its capacity to model complex\nnormal distributions.\n\n4. Method\n4.1. Problem Definition\nLet Ztr = {(zi , yi )} be a weakly-supervised training\nset with zi denoting an image and yi ∈ {0, 1} denotes\nimage-level labels, where 0 indicates normal and 1 indicates anomaly. The training set typically divides as\nZtr = Ztrn ∪Ztra , with normal subset |Ztrn | = N , anomaly subset |Ztra | = M , and typically N ≫ M . Given a test set Zte ,\nthe goal is to predict whether z ∈ Zte is normal or anomaly.\nUnder OSAD, the anomaly distribution at test time differs\nsignificantly from that during training, i.e., pate (z) ̸= patr (z).\n\nOur core idea is to overcome the limitation of discrete multiGaussian prototypes by learning a continuous and structured\nprototype space through Mixture Prototype Flow Learning\n(MPFL). Rather than depending on a collection of isolated\ndistributions, we introduce a generative bridge in the form\nof a flow model ψ, which seamlessly maps the complex\nfeature distribution of normal data onto a Gaussian Mixture\nModel (GMM) prior. This formulation effectively captures\nthe multi-modal nature and smooth transitions inherent in\nthe normal data manifold, yielding a more coherent and\nexpressive density estimator that mitigates false positive\nanomalies. Formally, we jointly optimize the flow mapping\n\\psi  and the parameters of the Gaussian mixture prototype\n\nOSAD requires learning compact and discriminative representations of normality. However, methods based on discrete multi-Gaussian prototypes face a fundamental limitation: the lack of structured relationships among components\n3\n\n\fMixture Prototype Flow Matching for Open-Set Supervised Anomaly Detection\n\\protect \\mathcal  {P}_{\\text {GM}} under the following objective:\n\nwhich is defined as:\n\n  \\!\\!\\!\\underset {\\psi , \\mcP _\\text {GM},f}{\\min } &amp; \\!\\! D_\\text {flow}(\\psi (\\mcF _\\tr ^\\norm ), \\psi (\\mcF _\\tr ^\\anom ),\\mcP _\\text {GM})\\!+\\!\\lambda D_\\text {mim}(\\mcF _\\tr ^\\norm ),\\label {Eqn:abs-loss}\\\\ \\text {s.t.}, &amp;~\\psi : P(\\mcF )\\overset {\\text {flow}}{\\longrightarrow } \\mcP _\\text {GM}, \\label {Eqn:abs-bridge}\\\\ &amp;~ f: \\mcZ \\overset {\\text {feature}}{\\longrightarrow }\\mcF ,\\label {Eqn:abs-disp}\n\n  p_1(\\psi (\\z _0^{\\norm ,i})) = \\sum _{k=1}^K \\pi _k \\mcN (\\psi (\\z ^{\\norm ,i}_0); \\boldsymbol {\\mu }_k, s^2\\I ), \\label {eq:10} \n\n(10)\n\nd\nwhere ψ denotes the flow function and ψ(zn,i\n0 ) ∈ R denotes the latent features. K is the number of mixture components, πk is\nweight of the k-th component satisfying\nPthe\nK\nπk &gt; 0 and k=1 πk = 1, µk ∈ Rd is mean vector, and\ns ∈ R+ is a shared standard deviation to maintain numerical\nstability.\n\n(9)\nwhere \\protect \\mathcal  {P}_{\\text {GM}} denotes the Gaussian mixture prototype to be\nlearned, \\psi  is the flow function that performs probability\ndistribution transport, Ftrn and Ftra denote the feature space\nof normal and anomalous samples respectively, D_\\text {flow} represents the discriminative objective in the prototype space,\nf is the feature extractor, and D_\\text {mim} serves as a featurespace regularizer. In this formulation, we refer to the\nlearning of \\psi  and \\protect \\mathcal  {P}_{\\text {GM}} as MPFL. Concurrently, the objective D_\\text {mim}(\\mathcal {F}_{\\text {tr}}^{\\text {norm}}) is referred to as Mutual Information\nMaximization Regularizer (MIMR), which encourages confident yet balanced prototype usage and reinforces normal–anomalous separation, thereby mitigating prototype\ncollapse and enhancing overall discriminability. The complete algorithmic procedure is summarized in Algorithm 1.\n\nTraditional flow-matching methods typically regress a single\nvelocity vector, which limits their ability to capture the\ncomplex multimodal characteristics of normal data. To\nmitigate this limitation, we directly model the velocity field\np(u|zn,i\nt ) as a GMM:\n  q_{\\theta }(\\u |\\z _t^{\\norm ,i}) = \\sum _{k=1}^K \\pi _k(\\z _t^{\\norm ,i};\\theta ) \\mcN (\\u ; \\boldsymbol {\\mu }_k(\\z _t^{\\norm ,i};\\theta ), s^2\\I ), \\label {eq:11}  (11)\nwhere u ∈ Rd denotes the velocity vector, and zn,i\nt represents the feature representation at timestep t obtained by\nEqn. (4). Building on Eqn. (11), we directly regress the\nconditional velocity distribution with a Gaussian mixture.\nTraining minimizes the following negative log-likelihood:\n\n4.2. Mixture Prototype Flow Learning\nOur Mixture Prototype Flow Learning (MPFL) is performed\nin the feature space. To extract intermediate image features,\nwe employ a classic backbone network such as ResNet-18.\nFormally, the feature extraction process can be described\nby a function  f: \\mathcal {Z} \\to \\mathcal {F} , which maps an image  \\texttt {z}  to an\nintermediate feature representation  \\z = f(\\texttt {z}) \\in \\mathbb {R}^d  , where\n1\n \\mathbb {R}^d  denotes a  d -dimensional real space . We designate\nthe intermediate feature sets of normal and anomaly sama,j\na\nples as Ftrn = {zn,i\n0 |i = 1, · · · , N } and Ftr = {z0 |j =\n1, · · · , M }, respectively. Throughout the subsequent work,\nwe adopt a unified notation: subscripts denote timesteps\n(e.g., z0 ) and superscripts indicate both sample types and\nindices (e.g., zn,i\n0 for the i-th normal sample at timestep 0,\nza,j\nfor\nthe\nj-th\nanomalous sample at timestep 0).\n0\n\n  \\label {eq:nll} &amp;\\mathcal {L}_{\\mathrm {NLL}} = \\mathbb {E}_{\\u \\sim p(\\mathbf {u}|\\z _t^{\\norm ,i})} \\nonumber \\\\ &amp;\\left [ -\\log \\sum _{k=1}^{K} \\pi _k(\\mathbf {z}_t^{\\norm ,i};\\theta )\\, \\mathcal {N}\\!\\left ( \\mathbf {u};\\, \\boldsymbol {\\mu }_k(\\mathbf {z}_t^{\\norm ,i};\\theta ),\\, s^{2}\\mathbf {I} \\right ) \\right ].\n(12)\nWe introduce an explicit time parameterization that enables\nclosed-form reverse-time sampling while preserving the\nGaussian mixture structure. Under a standard linear noise\nschedule, the one-step transition admits an approximate\nreparameterization, yielding a conditional endpoint distribution consistent with the velocity field:\n\nExisting prototype-based OSAD methods rely on a simple unimodal Gaussian prior, which significantly underestimates the inherent multimodality of normal data. To\nmitigate this limitation, MPFL learns continuous flow transformations to map the features of normal samples to a structured Gaussian mixture prior, effectively capturing the complex and multi-modal characteristics of normal data. Specifically, owing to the scarcity of anomalous samples and the\nabundance and diversity of normal data, we consider learning a continuous distribution transformation from the source\ndistribution  p_\\text {source} = P(\\mathcal {F}^\\norm _\\text {tr})  of normal samples to the target\nGaussian mixture prototype distribution  p_\\text {target} = P(\\mcP _\\text {GM}) ,\n\n  q_{\\theta }(\\z _0^{\\norm ,i}|\\z _t^{\\norm ,i}) &amp;= \\sum _{k=1}^K\\pi _k(\\z _0^{\\norm ,i};\\boldsymbol {\\mu }_{z_k},s_z^2\\I ), \\nonumber \\\\ \\text {s.t.}, \\quad {\\boldsymbol {\\mu }}_{z_k} &amp;= \\z _t - \\sigma _t {\\boldsymbol {\\mu }}_k, \\quad s_z = \\sigma _t s,\n(13)\nBy the conditional–marginal closure of linear–Gaussian\nmodels, the one-step reverse transition that preserves the\nmixture structure is defined as follows:\n  &amp;q_{\\theta }(\\mathbf {z}_{t-\\Delta t}^{\\norm ,i}\\mid \\mathbf {z}_t^{\\norm ,i}) =\\sum _{k=1}^{K}\\pi _k(\\mathbf {z}_t^{\\norm ,i};\\theta ) \\nonumber \\\\ &amp;\\mathcal {N}\\Big (\\mathbf {z}_{t-\\Delta t}; c_1\\mathbf {z}_t^{\\norm ,i}+c_2\\boldsymbol {\\mu }_{z_k}, \\big (c_3+c_2^{2}s_z^{2}\\big )\\mathbf {I}\\Big ),\n(14)\n\n1\n\nz is obtained by flattening the spatial dimensions of the convolutional feature maps, transforming the 3D tensor into a 1D\nrepresentation.\n\nwhere the coefficients are fully determined by the noise\nschedule: c1 =\n4\n\n2\nσt−∆t\nαt\n,c\nσt2 αt−∆t 2\n\n=\n\nβt,∆t\nαt−∆t , c3\nσt2\n\n=\n\n\fMixture Prototype Flow Matching for Open-Set Supervised Anomaly Detection\nβt,∆t 2\nσt−∆t . The closed-form transition enables step-wise\nσt2\n\nwe introduce a Mutual Information Maximization Regularizer (MIMR) that complements our flow-based Gaussianmixture framework. The core insight is that optimal prototype learning should (i) encourage confident assignments of\nfeatures to specific prototypes and (ii) maintain balanced utilization across components. Formally, let c ∈ {1, ..., K} denote the prototype assignment variable, mutual information\nI(ψ(zn,i\n0 ); c) measures the reduction in uncertainty about c\ngiven ψ(zn,i\n0 ), which is defined as:\n\nsampling at inference without numerical integration, while\npreserving mixture closure throughout the reverse trajectory,\nyielding numerically stable inference.\nHowever, the interdependence between the Gaussian mixture parameters and the flow transformation network\npresents a significant optimization challenge. To address\nthis limitation, we introduce a data-driven initialization strategy for the target Gaussian mixture prototype distribution\nP (PGM ). Specifically, we perform K-means++ clustering\non Ftrn to partition it into K clusters {Ck }K\nk=1 , where Ck denotes the set of sample indices belonging to the k-th cluster,\nminimizing the within-cluster sum of squares:\n  \\min _{\\{C_k, \\boldsymbol {\\mu }_k\\}_{k=1}^K} \\sum _{k=1}^K \\sum _{i \\in C_k} \\| \\z _0^{\\norm ,i} - \\boldsymbol {\\mu }_k \\|_2^2. \n\n  I(\\psi (\\z _0^{\\norm ,i});c) = H(c) - H(c|\\psi (\\z _0^{\\norm ,i})), \n\nwhere H(c) is the marginal entropy of prototype assignments and H(c|ψ(zn,i\n0 )) is the conditional entropy.\nThanks to the Gaussian-mixture structure in Eqn. (10), both\nterms can be estimated without extra parameters. In particular, the posterior assignment follows directly from the\nprototype GMM:\n\n(15)\n\nThe resulting cluster centroids are used to initialize the\nmixture means µk . The mixture weights πk are initialized\nproportionally to cluster sizes as πk = |Ck |/N , while the\nshared variance s2 is set to the per-dimension average variance across all clusters:\n  s^2 = \\frac {1}{dN} \\sum _{k=1}^K \\sum _{i \\in C_k} \\| \\z _0^{\\norm ,i} - \\boldsymbol {\\mu }_k \\|_2^2. \n\n  p(c=k|\\psi (\\z _0^{\\norm ,i})) = \\frac {\\pi _k \\mathcal {N}(\\psi (\\z _0^{\\norm ,i}); \\boldsymbol {\\mu }_k, s^2\\mathbf {I})}{\\sum _{j=1}^K \\pi _j \\mathcal {N}(\\psi (\\z _0^{\\norm ,i}); \\boldsymbol {\\mu }_j, s^2\\mathbf {I})}.  (20)\nThis posterior distribution enables efficient computation of\nthe information-theoretic regularizer:\n  &amp;\\mathcal {L}_{\\text {mim}} = \\mathbb {E}_{\\z _0^{\\norm ,i} \\sim P(\\mathcal {F}^\\text {n}_\\text {tr})} \\nonumber \\\\ &amp;\\left [ \\sum _{k=1}^K p(c=k|\\psi (\\z _0^{\\norm ,i})) \\log p(c=k|\\psi (\\z _0^{\\norm ,i})) \\right ] \\nonumber \\\\ &amp; - \\sum _{k=1}^K \\pi _k \\log \\pi _k,\n\n(16)\n\nWe formulate the training objectives that enable effective\nlearning of MPFL. For normal samples, we employ a negative log-likelihood loss to align the predicted velocity distribution with the ground truth dynamics:\n  \\mathcal {L}_{\\text {flow}}^\\norm = \\mathbb {E}_{t, \\z _0^{\\norm ,i}, \\z ^{\\norm ,i}_t} \\left [ -\\log q_{\\theta }(\\mathbf {u}|\\z _t^{\\norm ,i}) \\right ], \n\n(21)\nwhere the first term reduces conditional entropy (promoting confident assignments), and the second term increases\nmarginal entropy (balancing component usage) via the mixture weights πk . We evaluate Lmim only on normal samples\nto prevent pulling anomalies toward the normal prototypes.\n\n(17)\n\nzn,i −zn,i\n\nwhere t ∼ U (0, T ), the true velocity u = T t 0 and the\nn,i\nn,i\ninterpolated feature zn,i\nt = (1−t)z0 +tzT . This objective\nencourages the model to learn velocity distributions that\nfaithfully capture the transformation dynamics of normal\nsamples toward P (PGM ). For anomalous samples, we adopt\nan opposite strategy that pushes their distributions away\nfrom the normal prototype space:\n  \\mathcal {L}_{\\text {flow}}^\\anom = \\mathbb {E}_{t, \\z _0^{\\anom ,i}, \\z _t^{\\anom ,i} } \\left [ \\log q_{\\theta } (\\mathbf {u}|\\z _t^{\\anom ,i}) \\right ]. \n\n(19)\n\n4.4. Anomaly Score Prediction\nBased on the MPFM framework, we design four complementary modules for estimating anomaly scores from dif′\n′\nferent perspectives. For the feature map F ∈ RH ×W ×C 2\nextracted from input images, we generate pixel-wise feature\n′\n×W ′\nvectors V = {vi }H\nwhere each \\protect \\mathbf  {v}_i \\in \\mathbb {R}^C represents\ni=1\nthe feature of a local image patch. We design the global\nanomaly scoring module \\protect \\text  {M}_\\texttt {g} that computes the negative\nlog-likelihood of transformed features under the Gaussian\nmixture prototype distribution:\n\n(18)\n\na\nwhere za,i\n0 ∼ P (Ftr ). The true velocity and the interpolated\nfeature were computed in the same way as above.\n\n4.3. Mutual Information Maximization Regularizer\nAlthough MPFL captures the multi-modal distribution of\nnormal data, the lack of explicit inter-prototype separation\ncan induce prototype collapse, where multiple components\nconverge to similar modes. This undermines discriminative power, making semantically distinct patterns indistinguishable in the latent space. To mitigate this challenge,\n\n  \\mathcal {L}_{\\text {M}_\\texttt {g}} = \\mathcal {L}_{\\text {binary}}(-\\log \\sum _{k=1}^{K}\\pi _k\\mathcal {N}(\\psi (\\mathbf {z});\\boldsymbol {\\mu }_k,s^2\\mathbf {I}), y), \n2\n\n(22)\n\nThe spatial feature map \\protect \\mathbf  {F}  is taken from the convolutional\nlayers of f by preserving the 3D tensor, while z is its flattened\nembedding.\n\n5\n\n\fMixture Prototype Flow Matching for Open-Set Supervised Anomaly Detection\n\nwhere Lbinary refers to a binary classification loss function.\nThe local anomaly scoring module \\protect \\text  {M}_\\texttt {a} focuses on the most\nsalient anomalous regions by aggregating top-O pixel-level\nanomaly scores:\n  \\mathcal {L}_{\\text {M}_\\texttt {a}} = \\mathcal {L}_{\\text {binary}}(\\frac {1}{O}\\sum \\text {Top}_O\\{S_\\texttt {a}(\\mathbf {v}_i;\\theta _\\texttt {a})\\}, y), \n\nsampling protocols: a general protocol that randomly draws\nanomaly examples from all anomaly categories, and a hard\nprotocol that samples from a single category to assess generalization to novel or unseen anomaly classes.\nEvaluation Metric. Performance is assessed using Area\nUnder the ROC Curve (AUC) across all methods and settings, with scores averaged over five independent runs.\n\n(23)\n\nThe normal feature scoring module \\protect \\text  {M}_\\texttt {n} learns prototypical\nnormal patterns through global feature pooling:\n  \\mathcal {L}_{\\text {M}_\\texttt {n}} = \\mathcal {L}_{\\text {binary}}(S_\\texttt {n}(\\frac {1}{H^\\prime \\times W^\\prime }\\sum _{i=1}^{H^\\prime \\times W^\\prime }\\mathbf {v}_i;\\theta _\\texttt {n}), y) \n\n5.2. Baselines\nWe evaluate MPFM against six baselines: SAOE (Markovitz\net al., 2020; Tack et al., 2020; Li et al., 2021), MLEP (Liu\net al., 2019), FLOS (Ross &amp; Dollár, 2017), DRA (Ding et al.,\n2022), AHL (Zhu et al., 2024), and the prior DPDL (Wang\net al., 2025a). Among these, MLEP, DRA, AHL, and DPDL\nare tailored for OSAD; SAOE is a supervised detector augmented with synthetic anomalies and anomaly exposure,\nwhereas FLOS handles class imbalance via focal loss.\n\n(24)\n\nThe residual anomaly scoring module \\protect \\text  {M}_\\texttt {r} measures the\ndeviation from the most probable prototype:\n  \\mathcal {L}_{\\text {M}_\\texttt {r}} = \\mathcal {L}_{\\text {binary}}(S_\\texttt {r}((\\psi (\\mathbf {z})-\\boldsymbol {\\mu }_{c^*})/s;\\theta _\\texttt {r}), y), \n\n(25)\n\nwhere c^* = \\arg \\max _c \\mathcal {N}(\\psi (\\mathbf {z});\\boldsymbol {\\mu }_c,s^2\\mathbf {I}) denotes the index\nof the most probable prototype.\n\n5.3. Implementation Details\n\nTraining. During the training phase, the flow matching model, Gaussian mixture prototype model, and four\nanomaly scoring modules are jointly trained. To this end,\nwe employ an objective function that encompasses three\ncomponents as follows:\n\nThe input image size is 448 × 448 × 3. We set O to 10%\nof the total scores in each score map. We optimize with\nAdamW (Loshchilov, 2017) using an initial learning rate of\n2 × 10−4 and weight decay of 1 × 10−5 . MPFM is trained\non a single NVIDIA GeForce RTX 5090 for 50 epochs with\n20 iterations per epoch. Following prior protocol(Ding et al.,\n2022), we evaluate under M = 10 and M = 1 anomaloussample settings. To enhance robustness to unseen anomalies,\nwe employ CutMix (Yun et al., 2019) to generate pseudoanomaly samples as augmentations of known anomalies.\nGMM components K is set to 32 and MIM weight λ is set\nto 0.1 in our experiments.\n\n  \\mathcal {L} = \\underbrace {\\mathcal {L}_{\\text {M}_\\texttt {a}} + \\mathcal {L}_{\\text {M}_\\texttt {n}} + \\mathcal {L}_{\\text {M}_\\texttt {r}} + \\mathcal {L}_{\\text {M}_\\texttt {g}}}_{\\text {Anomaly scoring modules}} + \\underbrace {\\mathcal {L}_{\\text {flow}}^\\norm + \\mathcal {L}_{\\text {flow}}^\\anom }_{\\text {Flow matching}} + \\lambda \\mathcal {L}_{\\text {mim}}. \n(26)\nwhere the coefficient \\lambda  modulates the relative importance of\nthe prototype regularization loss, and the learnable parameters include the flow model parameters \\theta  and the scoring\nmodule parameters \\ifmmode \\lbrace \\else \\textbraceleft \\fi \\theta _\\texttt {a}, \\theta _\\texttt {n}, \\theta _\\texttt {r}, \\theta _\\texttt {g}\\}.\n\n5.4. Results under General Setting\n\nInference. During the test phase, we compute the anomaly\nscore by adding the scores from S_\\texttt {g} , S_\\texttt {a} and S_\\texttt {r} , while subtracting the normal score obtained from S_\\texttt {n} .\n\nTab. 1 presents comprehensive AUC results under the general setting. MPFM achieves the best or tied-best mean\nAUC across all benchmarks, showing consistent advantages\nover the strongest baseline in each dataset. Under the oneshot setting, MPFM obtains the largest gains on BrainMRI,\nSDD, Hyper-Kvasir and ELPV, with improvements of 3.1,\n2.7, 2.6, and 1.7 percentage points, respectively. These results demonstrate its robustness in data-scarce scenarios,\nespecially for heterogeneous medical anomalies and subtle industrial defects. MPFM also improves AUC by 1.6\npoints on both Optical and AITEX, and by 1.4, 1.3, and 1.1\npoints on Mastcam, HeadCT, and MVTec AD, respectively,\nindicating stable generalization across diverse anomaly domains. Under the ten-shot setting, MPFM further shows\nnotable gains on Mastcam, Hyper-Kvasir, ELPV, and AITEX, improving the strongest baselines by 3.4, 2.6, 2.5, and\n1.7 percentage points, respectively. These improvements\nsuggest that the Gaussian mixture prototype space can ef-\n\nIn summary, we incorporate a shared standard deviation\nparameter  s  for training stability and provide complete\nderivations for this and other formulations in the appendix.\n\n5. Experiment\n5.1. Datasets and Evaluation Metric\nDatasets. We evaluate MPFM on nine real-world anomaly\ndetection benchmarks, covering six industrial defect datasets\n(MVTec AD (Bergmann et al., 2019), Optical (Wieler &amp;\nHahn, 2007), SDD (Tabernik et al., 2020), AITEX (SilvestreBlanes et al., 2019), ELPV (Deitsch et al., 2019), Mastcam (Kerner et al., 2020)) and three medical datasets (HyperKvasir (Borgli et al., 2020), Brain-MRI (Salehi et al., 2021),\nHeadCT (Salehi et al., 2021)). Following OSAD baselines (Ding et al., 2022; Zhu et al., 2024), we adopt two\n6\n\n\fMixture Prototype Flow Matching for Open-Set Supervised Anomaly Detection\nTable 1. AUC results (mean ± std) on nine real-world AD datasets under the general setting, with extended results in appendix. Best\nresults are highlighted in red and second-best in blue (per column). Baseline state-of-the-art numbers are taken from the original papers.\nDataset\n\nFLOS\n\nSAOE\n\nMVTec AD\nOptical\nSDD\nAITEX\nELPV\nMastcam\nHyper-Kvasir\nBrainMRI\nHeadCT\n\n0.939±0.007\n0.720±0.055\n0.967±0.018\n0.841±0.049\n0.818±0.032\n0.703±0.029\n0.773±0.029\n0.955±0.011\n0.971±0.004\n\nMVTec AD\nOptical\nSDD\nAITEX\nELPV\nMastcam\nHyper-Kvasir\nBrainMRI\nHeadCT\n\n0.755±0.136\n0.518±0.003\n0.840±0.043\n0.538±0.073\n0.457±0.056\n0.542±0.017\n0.668±0.004\n0.693±0.036\n0.698±0.092\n\nMLEP\nDRA\nTen Training Anomaly Examples\n0.926±0.010 0.907±0.005 0.959±0.003\n0.941±0.013 0.740±0.039 0.965±0.006\n0.955±0.020 0.983±0.013 0.991±0.005\n0.874±0.024 0.867±0.037 0.893±0.017\n0.793±0.047 0.794±0.047 0.845±0.013\n0.810±0.029 0.798±0.026 0.848±0.008\n0.666±0.050 0.600±0.069 0.834±0.004\n0.900±0.041 0.959±0.011 0.970±0.003\n0.935±0.021 0.972±0.014 0.972±0.002\nOne Training Anomaly Example\n0.834±0.007 0.744±0.019 0.883±0.008\n0.815±0.014 0.516±0.009 0.888±0.012\n0.781±0.009 0.811±0.045 0.859±0.014\n0.675±0.094 0.564±0.055 0.692±0.124\n0.635±0.092 0.578±0.062 0.675±0.024\n0.662±0.018 0.625±0.045 0.692±0.058\n0.498±0.100 0.445±0.040 0.690±0.017\n0.531±0.060 0.632±0.017 0.744±0.004\n0.597±0.022 0.758±0.038 0.796±0.105\n\nAHL\n\nDPDL\n\nMPFM (Ours)\n\n0.970±0.002\n0.976±0.004\n0.991±0.001\n0.925±0.013\n0.850±0.004\n0.855±0.005\n0.880±0.003\n0.977±0.001\n0.999±0.003\n\n0.977±0.002\n0.983±0.005\n0.996±0.001\n0.975±0.007\n0.937±0.003\n0.934±0.010\n0.939±0.005\n0.969±0.005\n0.981±0.003\n\n0.982±0.003\n0.992±0.002\n0.999±0.001\n0.992±0.004\n0.962±0.003\n0.968±0.007\n0.965±0.004\n0.984±0.004\n0.999±0.001\n\n0.901±0.003\n0.888±0.007\n0.909±0.001\n0.734±0.008\n0.828±0.005\n0.743±0.003\n0.768±0.015\n0.866±0.004\n0.825±0.014\n\n0.927±0.002\n0.915±0.002\n0.917±0.003\n0.838±0.008\n0.897±0.002\n0.838±0.011\n0.821±0.007\n0.893±0.004\n0.865±0.005\n\n0.938±0.004\n0.931±0.007\n0.944±0.004\n0.854±0.023\n0.914±0.016\n0.852±0.009\n0.847±0.005\n0.924±0.012\n0.878±0.025\n\nTable 2. AUC results (mean ± std) under the hard setting, with extended results in appendix. The best and second-best scores are\nhighlighted in red and blue, respectively. Carpet and Metal nut are subsets of MVTec AD. Following prior work (Ding et al., 2022; Zhu\net al., 2024), we use the same datasets, excluding those with only a single anomaly class to align with the hard setting.\nDataset\n\nFLOS\n\nCarpet (mean)\nMetal nut (mean)\nAITEX (mean)\nELPV (mean)\nMastcam (mean)\nHyper-Kvasir (mean)\n\n0.761±0.012\n0.922±0.014\n0.635±0.043\n0.642±0.032\n0.616±0.021\n0.786±0.021\n\nCarpet (mean)\nMetal nut (mean)\nAITEX (mean)\nELPV (mean)\nMastcam (mean)\nHyper-Kvasir (mean)\n\n0.678±0.040\n0.855±0.024\n0.624±0.024\n0.691±0.008\n0.524±0.013\n0.571±0.004\n\nSAOE\nMLEP\nDRA\nTen Training Anomaly Examples\n0.762±0.073 0.751±0.023 0.935±0.013\n0.855±0.016 0.878±0.058 0.945±0.017\n0.724±0.032 0.626±0.041 0.733±0.009\n0.683±0.047 0.745±0.020 0.766±0.029\n0.697±0.014 0.588±0.016 0.695±0.004\n0.698±0.021 0.571±0.014 0.844±0.009\nOne Training Anomaly Example\n0.753±0.055 0.679±0.029 0.901±0.006\n0.816±0.029 0.825±0.023 0.932±0.017\n0.674±0.034 0.466±0.030 0.684±0.033\n0.614±0.048 0.566±0.111 0.703±0.022\n0.689±0.037 0.541±0.007 0.667±0.012\n0.406±0.018 0.480±0.044 0.700±0.009\n\nfectively exploit additional anomaly examples to enhance\ndiscriminative capability while preserving generalization to\nunseen anomalies.\n\nAHL\n\nDPDL\n\nMPFM (Ours)\n\n0.949±0.002\n0.972±0.002\n0.747±0.002\n0.788±0.003\n0.721±0.003\n0.854±0.004\n\n0.956±0.004\n0.978±0.002\n0.798±0.005\n0.818±0.003\n0.778±0.007\n0.864±0.002\n\n0.966±0.003\n0.983±0.004\n0.816±0.006\n0.832±0.009\n0.815±0.005\n0.873±0.017\n\n0.932±0.003\n0.939±0.004\n0.707±0.007\n0.740±0.003\n0.673±0.010\n0.706±0.007\n\n0.941±0.006\n0.944±0.003\n0.753±0.005\n0.762±0.003\n0.733±0.004\n0.715±0.004\n\n0.949±0.003\n0.951±0.004\n0.772±0.011\n0.779±0.008\n0.760±0.013\n0.739±0.003\n\nterize multi-modal normal patterns, while conditional flow\nmatching helps preserve discriminative boundaries for diverse anomaly types. MPFM also improves the AUC by 0.5\npoint on Metal nut and 0.9 points on Hyper-Kvasir, indicating stable performance even when the baseline results are\nalready strong. Under the one-shot setting, MPFM maintains clear advantages, with gains of 3.9 points on AITEX,\n2.7 points on Mastcam, 1.3 points on Metal nut, 1.7 points\non ELPV, and 0.7 points on Carpet. These results confirm\nthat MPFM can effectively leverage limited anomaly supervision and reduce overfitting, leading to robust normal\nrepresentations that generalize to diverse unseen defects.\n\n5.5. Results under the Hard Setting\nTab. 2 reports the AUC results under the challenging hard\nsetting. MPFM achieves the highest mean AUC across\nall datasets in both one-shot and ten-shot configurations,\ndemonstrating strong robustness in more complex open-set\nscenarios. Under the ten-shot setting, MPFM obtains the\nmost notable gains on Mastcam, AITEX, ELPV, and Carpet, surpassing the strongest baselines by 1.9, 1.8, 1.4, and\n1.1 percentage points, respectively. These improvements\nsuggest that Gaussian mixture prototypes can better charac-\n\n7\n\n\fMixture Prototype Flow Matching for Open-Set Supervised Anomaly Detection\nTen Training Anomaly Examples Under General Settings\n\nAUC\n\nMPFM\n\nw/o MPFL\n\nw/o MIMR\n\nMPFM\n\nw/o MPFL\n\nTen Training Anomaly Examples Under Hard Settings\nw/o MIMR\n\nMPFM\n\nw/o MPFL\n\nw/o MIMR\n\nMPFM\n\n1.00\n\n1.00\n\n1.00\n\n1.00\n\n0.95\n\n0.95\n\n0.95\n\n0.95\n\n0.90\n\n0.90\n\n0.90\n\n0.90\n\n0.85\n\n0.85\n\n0.85\n\n0.85\n\n0.80\n\n0.80\n\n0.80\n\n0.80\n\n0.75\n\n0.75\n\n0.75\n\n0.75\n\n0.70\n\n0.70\n\n0.70\n\n0.70\n\n0.65\n\n0.65\n\n0.65\n\nMVTec AD\n\nOptical\n\nSDD\n\nAITEX\n\nELPV\n\nMastcam Hyper-KvasirBrainMRI HeadCT\n\nCarpet\n\nMetal_nut\n\nAITEX\n\n0.65\n\nELPV\n\nw/o MPFL\n\nMastcam\n\nw/o MIMR\n\nHyper-Kvasir\n\nFigure\nsettings.\nFigure2.2.Ablation\nAblationstudy\nstudyfor\nforMPFL\nMPFLand\nandMIMR\nMIMRunder\nunderthe\nthe general\ngeneral settings\nsettings and\nand hard\nhard settings.\nTable 3. Ablation study for scoring modules Mg , Ma , Mr and Mn .\n\nMg Ma Mr Mn\n\nAITEX\n\nHyper-Kvasir\n\nELPV\n\nOptical\n\nMastcam\n\nHeadCT\n\nBrainMRI\n\nTen Training Anomaly Examples Under General Settings\n0.945 ± 0.009 0.949 ± 0.010 0.946 ± 0.006 0.973 ± 0.008 0.948 ± 0.014 0.980 ± 0.008 0.962 ± 0.007\n0.968 ± 0.007 0.959 ± 0.005 0.958 ± 0.004 0.982 ± 0.005 0.962 ± 0.004 0.987 ± 0.006 0.971 ± 0.003\n0.932 ± 0.012 0.938 ± 0.011 0.929 ± 0.015 0.947 ± 0.009 0.937 ± 0.013 0.968 ± 0.011 0.934 ± 0.012\n0.992 ± 0.004 0.965 ± 0.004 0.962 ± 0.003 0.992 ± 0.002 0.968 ± 0.007 0.999 ± 0.001 0.984 ± 0.004\n\nTable 4. Parameter sensitivity analysis of GMM components K\nand MIMR weight λ on MVTec AD, AITEX, and Hyper-Kvasir\nunder the General Setting.\n\n5.6. Ablation Study\nThe ablation study in Fig. 2 systematically evaluates the\ncontributions of core components in MPFM. Removing\nMPFL leads to substantial performance degradation across\nall datasets, particularly on complex-texture benchmarks\nlike AITEX and Mastcam, underscoring its role in capturing multi-modal normality through Gaussian mixture\nprototypes. The MIMR removal results in moderate declines, especially in challenging settings, confirming its\nutility in preventing prototype collapse and enhancing feature discriminability. The synergistic combination of both\ncomponents is evidenced by the maximal performance drop\nwhen ablating them jointly, highlighting their complementary functions in establishing compact normal boundaries\nand generalizing to unseen anomalies.\n\nParam.\n\nValue\n\nMVTec AD\n\nComponents\n(K)\n\n8\n16\n32\n64\n\n0.975 ± 0.009 0.980 ± 0.006 0.954 ± 0.017\n0.979 ± 0.008 0.988 ± 0.004 0.960 ± 0.010\n0.982 ± 0.003 0.992 ± 0.002 0.965 ± 0.004\n0.978 ± 0.012 0.989 ± 0.008 0.958 ± 0.016\n\nAITEX\n\nHyper-Kvasir\n\n0.001 0.972 ± 0.008 0.987 ± 0.010 0.948 ± 0.011\nMIMR Weight 0.01 0.976 ± 0.006 0.989 ± 0.005 0.957 ± 0.010\n(λ)\n0.1 0.982 ± 0.003 0.992 ± 0.002 0.965 ± 0.004\n1.0 0.975 ± 0.009 0.981 ± 0.007 0.954 ± 0.014\n\nAUC on three representative datasets: MVTec AD (Object),\nAITEX (Texture), and Hyper-Kvasir (Medical).\n\nAs shown in Tab. 3, the scoring modules demonstrate distinct contributions to MPFM’s performance. The most substantial performance degradation occurs when removing the\nglobal likelihood scorer Mg , underscoring its fundamental\nrole in capturing normal patterns. The residual anomaly\nscorer Mr also proves essential, with its removal leading\nto noticeable performance drops, particularly in complex\ndetection scenarios. The most severe performance reduction\nemerges when both Mg and Mr are ablated simultaneously,\nhighlighting their synergistic effect in maintaining robust\nanomaly discrimination across diverse settings.\n\nImpact of Component Number K. Increasing the number\nof mixture components K initially yields consistent performance gains, with optimal results attained at K = 32.\nNotably, a small number of components (K = 8) struggles\nto encapsulate the rich multi-modal structures of complex\ndata, evident in the lower scores on texture-rich AITEX\nand medical Hyper-Kvasir. Increasing K to 32 provides the\nnecessary granularity to capture diverse semantic modes,\nachieving the best overall results (e.g., 0.992 on AITEX).\nHowever, excessive granularity (K = 64) leads to diminishing returns; this is likely due to the fragmentation of coherent semantic patterns into redundant mixture components,\nwhich unnecessarily complicates the decision boundary.\n\n5.7. Parameter Sensitivity Analysis\n\nImpact of MIMR Weight λ. The regularization coefficient\nλ governs the trade-off between flow matching fidelity and\ninter-prototype discriminability. Insufficient regularization\n\nWe analyze the sensitivity of the Gaussian components K\nand the MIMR regularization weight λ. Tab. 4 reports the\n\n8\n\n\fMixture Prototype Flow Matching for Open-Set Supervised Anomaly Detection\n\n(λ = 0.001) fails to enforce sharp separation, resulting in\nambiguous latent boundaries and degraded performance.\nConversely, aggressive regularization (λ = 1.0) imposes\nexcessive constraints on the flow field, hindering the model’s\nability to faithfully fit the data manifold. Setting λ = 0.1\nachieves the optimal equilibrium, ensuring that the learned\nprototypes are both discriminative against anomalies and\nrepresentative of the underlying normal distribution.\n\nChen, H., Zhang, K., Tan, H., Xu, Z., Luan, F., Guibas, L.,\nWetzstein, G., and Bi, S. Gaussian mixture flow matching\nmodels. arXiv preprint arXiv:2504.05304, 2025.\n\n6. Conclusion\n\nDing, C., Pang, G., and Shen, C. Catching both gray and\nblack swans: Open-set supervised anomaly detection. In\nProceedings of the IEEE/CVF conference on computer\nvision and pattern recognition, pp. 7388–7398, 2022.\n\nDeitsch, S., Christlein, V., Berger, S., Buerhop-Lutz, C.,\nMaier, A., Gallwitz, F., and Riess, C. Automatic classification of defective photovoltaic module cells in electroluminescence images. Solar Energy, 185:455–468,\n2019.\n\nWe have introduced Mixture Prototype Flow Matching\n(MPFM), a framework that bridges Gaussian mixture modeling with conditional flow matching for open-set anomaly\ndetection. By constructing a structured prototype space with\nmutual information regularization, our method effectively\ncaptures multi-modal normal patterns while maintaining\ndiscriminative power against anomalies. Across diverse\nbenchmarks, MPFM establishes tighter normal boundaries\nand exhibits improved generalization to unseen anomalies.\n\nEsser, P., Kulal, S., Blattmann, A., Entezari, R., Müller, J.,\nSaini, H., Levi, Y., Lorenz, D., Sauer, A., Boesel, F., et al.\nScaling rectified flow transformers for high-resolution\nimage synthesis. In Forty-first international conference\non machine learning, 2024.\nHu, T., Zhang, J., Yi, R., Du, Y., Chen, X., Liu, L., Wang,\nY., and Wang, C. Anomalydiffusion: Few-shot anomaly\nimage generation with diffusion model. In Proceedings\nof the AAAI Conference on Artificial Intelligence, volume 38, pp. 8526–8534, 2024.\n\nImpact Statement\nThis paper presents work whose goal is to advance the field\nof Machine Learning by introducing a robust framework\nfor Open-set Supervised Anomaly Detection. Our method,\nMPFM, is designed to improve the reliability of identifying irregularities in complex distributions, which has positive implications for safety-critical applications such as\nindustrial defect inspection and medical diagnosis. While\nanomaly detection techniques can theoretically be repurposed for surveillance, our work focuses on characterizing\nmulti-modal normality to reduce false positives in openworld settings. We do not foresee any specific negative\nsocietal consequences that must be highlighted here.\n\nKerner, H. R., Wagstaff, K. L., Bue, B. D., Wellington,\nD. F., Jacob, S., Horton, P., Bell, J. F., Kwan, C., and\nBen Amor, H. Comparison of novelty detection methods\nfor multispectral images in rover-based planetary exploration missions. Data Mining and Knowledge Discovery,\n34:1642–1675, 2020.\nLabs, B. F.\nFlux.\nhttps://github.com/\nblack-forest-labs/flux, 2024.\nLangley, P. Crafting papers on machine learning. In Langley,\nP. (ed.), Proceedings of the 17th International Conference\non Machine Learning (ICML 2000), pp. 1207–1216, Stanford, CA, 2000. Morgan Kaufmann.\n\nReferences\nBaitieva, A., Hurych, D., Besnier, V., and Bernard, O. Supervised anomaly detection for complex industrial images.\nIn Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 17754–17762,\n2024.\n\nLi, C.-L., Sohn, K., Yoon, J., and Pfister, T. Cutpaste:\nSelf-supervised learning for anomaly detection and localization. In Proceedings of the IEEE/CVF conference on\ncomputer vision and pattern recognition, pp. 9664–9674,\n2021.\n\nBergmann, P., Fauser, M., Sattlegger, D., and Steger, C.\nMvtec ad–a comprehensive real-world dataset for unsupervised anomaly detection. In Proceedings of the\nIEEE/CVF conference on computer vision and pattern\nrecognition, pp. 9592–9600, 2019.\n\nLipman, Y., Chen, R. T., Ben-Hamu, H., Nickel, M., and\nLe, M. Flow matching for generative modeling. arXiv\npreprint arXiv:2210.02747, 2022.\n\nBorgli, H., Thambawita, V., Smedsrud, P. H., Hicks, S., Jha,\nD., Eskeland, S. L., Randel, K. R., Pogorelov, K., Lux,\nM., Nguyen, D. T. D., et al. Hyperkvasir, a comprehensive\nmulti-class image and video dataset for gastrointestinal\nendoscopy. Scientific data, 7(1):283, 2020.\n\nLiu, J., Wu, K., Nie, Q., Chen, Y., Gao, B.-B., Liu, Y.,\nWang, J., Wang, C., and Zheng, F. Unsupervised continual anomaly detection with contrastively-learned prompt.\nIn Proceedings of the AAAI Conference on Artificial Intelligence, volume 38, pp. 3639–3647, 2024.\n9\n\n\fMixture Prototype Flow Matching for Open-Set Supervised Anomaly Detection\n\nLiu, W., Luo, W., Li, Z., Zhao, P., Gao, S., et al. Margin\nlearning embedded prediction for video anomaly detection with a few anomalies. In IJCAI, volume 3, pp. 023–3,\n2019.\n\nWang, F., Zhang, T., Wang, Y., Qiu, Y., Liu, X., Guo, X.,\nand Cui, Z. Distribution prototype diffusion learning for\nopen-set supervised anomaly detection. In Proceedings of\nthe Computer Vision and Pattern Recognition Conference,\npp. 20416–20426, 2025a.\n\nLiu, X., Gong, C., and Liu, Q. Flow straight and fast:\nLearning to generate and transfer data with rectified flow.\narXiv preprint arXiv:2209.03003, 2022.\n\nWang, F., Zhang, T., Wang, Y., Zhang, X., Liu, X., and Cui,\nZ. Scene graph-grounded image generation. In Proceedings of the AAAI Conference on Artificial Intelligence,\nvolume 39, pp. 7646–7654, 2025b.\n\nLiu, X., Zhang, X., Ma, J., Peng, J., et al. Instaflow: One\nstep is enough for high-quality diffusion-based text-toimage generation. In The Twelfth International Conference on Learning Representations, 2023.\n\nWang, F., Wang, Y., Guo, X., Huang, S., Zhang, T., Wang,\nD., Yan, H., Liu, X., and Cui, Z. Anomaly-preference image generation. arXiv preprint arXiv:2605.02439, 2026.\n\nLoshchilov, I. Decoupled weight decay regularization. arXiv\npreprint arXiv:1711.05101, 2017.\n\nWieler, M. and Hahn, T. Weakly supervised learning for\nindustrial optical inspection. In DAGM symposium in,\nvolume 6, pp. 11, 2007.\n\nLu, R., Wu, Y., Tian, L., Wang, D., Chen, B., Liu, X., and\nHu, R. Hierarchical vector quantized transformer for\nmulti-class unsupervised anomaly detection. Advances in\nNeural Information Processing Systems, 36:8487–8500,\n2023.\n\nYao, X., Li, R., Qian, Z., Wang, L., and Zhang, C. Hierarchical gaussian mixture normalizing flow modeling for unified anomaly detection. arXiv preprint arXiv:2403.13349,\n2024.\n\nMarkovitz, A., Sharir, G., Friedman, I., Zelnik-Manor, L.,\nand Avidan, S. Graph embedded pose clustering for\nanomaly detection. In Proceedings of the IEEE/CVF\nConference on Computer Vision and Pattern Recognition,\npp. 10539–10547, 2020.\n\nYun, S., Han, D., Oh, S. J., Chun, S., Choe, J., and Yoo,\nY. Cutmix: Regularization strategy to train strong classifiers with localizable features. In Proceedings of the\nIEEE/CVF international conference on computer vision,\npp. 6023–6032, 2019.\n\nPang, G., Ding, C., Shen, C., and Hengel, A. v. d. Explainable deep few-shot anomaly detection with deviation\nnetworks. arXiv preprint arXiv:2108.00462, 2021.\n\nZhu, J., Ding, C., Tian, Y., and Pang, G. Anomaly heterogeneity learning for open-set supervised anomaly detection. In Proceedings of the IEEE/CVF Conference on\nComputer Vision and Pattern Recognition, pp. 17616–\n17626, 2024.\n\nRoss, T.-Y. and Dollár, G. Focal loss for dense object\ndetection. In proceedings of the IEEE conference on\ncomputer vision and pattern recognition, pp. 2980–2988,\n2017.\nSalehi, M., Sadjadi, N., Baselizadeh, S., Rohban, M. H.,\nand Rabiee, H. R. Multiresolution knowledge distillation\nfor anomaly detection. In Proceedings of the IEEE/CVF\nconference on computer vision and pattern recognition,\npp. 14902–14912, 2021.\nSilvestre-Blanes, J., Albero-Albero, T., Miralles, I., PérezLlorens, R., and Moreno, J. A public fabric database\nfor defect detection methods and results. Autex Research\nJournal, 19(4):363–374, 2019.\nTabernik, D., Sela, S., Skvarc, J., and Skocaj, D.\nSegmentation-based deep-learning approach for surfacedefect detection. Journal of Intelligent Manufacturing,\n31(3):759–776, 2020.\nTack, J., Mo, S., Jeong, J., and Shin, J. Csi: Novelty detection via contrastive learning on distributionally shifted\ninstances. Advances in neural information processing\nsystems, 33:11839–11852, 2020.\n10\n\n\fMixture Prototype Flow Matching for Open-Set Supervised Anomaly Detection\n\nA. Dataset Statistics\nWe evaluate our approach through extensive experiments on nine real-world anomaly detection datasets. Key statistics of all\ndatasets are summarized in Tab. 5. Our experimental setup follows established protocols from prior open-set supervised\nanomaly detection (OSAD) literature. For MVTec AD, we adopt its original data split for normal samples. For the remaining\neight datasets, normal samples are randomly divided into training and testing sets with a ratio of 3:1.\nTable 5. Summary statistics of the nine real-world anomaly detection (AD) datasets, with the first 15 rows listing the subsets of the MVTec\nAD dataset.\nDataset\nOriginal Training Original Test\n|C| Type\nNormal\nNormal Anomaly\nCarpet\n5 Textture\n280\n28\n89\n5 Textture\n264\n21\n57\nGrid\nLeather\n5 Textture\n245\n32\n92\nTile\n5 Textture\n230\n33\n83\nWood\n5 Textture\n247\n19\n60\nBottle\n3 Object\n209\n20\n63\nCapsule\n5 Object\n219\n23\n109\nPill\n7 Object\n267\n26\n141\nTransistor\n4 Object\n213\n60\n40\n7 Object\n240\n32\n119\nZipper\nCable\n8 Object\n224\n58\n92\nHazelnut\n4 Object\n391\n40\n70\nMetal nut\n4 Object\n220\n22\n93\nScrew\n5 Object\n320\n41\n119\n1 Object\n60\n12\n30\nToothbrush\nMVTecAD 73\n3629\n467\n1258\n1 Object\n10500\n3500\n2100\nOptical\nSDD\n1 Textture\n594\n286\n54\nAITEX\n12 Textture\n1692\n564\n183\n2 Textture\n1131\n377\n715\nELPV\nMastcam\n11 Object\n9302\n426\n451\n2021\n674\n757\nHyper-Kvasir 4 Medical\n1 Medical\n73\n25\n155\nBrainMRI\nHeadCT\n1 Medical\n75\n25\n100\n\n• MVTec AD (Bergmann et al., 2019) is a standard benchmark for industrial defect inspection, comprising 15 object and\ntexture categories, each containing one or more defect types. In total, it provides 73 fine-grained anomaly classes at the\ntexture or object level.\n• Optical (Wieler &amp; Hahn, 2007) is a synthetically generated dataset for industrial optical inspection, where artificial\nimages are designed to closely mimic real-world defect detection scenarios.\n• SDD (Tabernik et al., 2020) is a product surface defect dataset with pixel-wise annotations. The original 500 × 1250\nimages are vertically split into three strips, and each strip is labeled at the pixel level.\n• AITEX (Silvestre-Blanes et al., 2019) is a fabric defect dataset with 12 defect categories and pixel-level labels. The\noriginal 4096 × 256 images are cropped into multiple 256 × 256 patches, which are then re-annotated at the pixel\nlevel.\n• ELPV (Deitsch et al., 2019) contains electroluminescence (EL) images of solar cells for defect detection. It covers two\nmain defect types associated with monocrystalline and polycrystalline solar cells, respectively.\n• Mastcam (Kerner et al., 2020) is a geological novelty detection dataset constructed from multispectral images captured\nby the Mastcam system on the Mars rover. It includes typical scenes and 11 novel geological classes. Each image\ncontains shorter-wavelength (color) and longer-wavelength (grayscale) channels, and we use only the shorter-wavelength\nchannels in this work.\n• Hyper-Kvasir (Borgli et al., 2020) is a large-scale, open-access gastrointestinal imaging dataset collected from real\nendoscopy and colonoscopy examinations. It consists of four main categories and 23 subclasses. We focus on\n11\n\n\fMixture Prototype Flow Matching for Open-Set Supervised Anomaly Detection\n\nendoscopic images, where anatomical landmark categories are treated as normal samples and pathological categories\nas anomalies.\n• BrainMRI (Salehi et al., 2021) is a brain tumor detection dataset composed of magnetic resonance (MR) images with\ncorresponding tumor labels.\n• HeadCT (Salehi et al., 2021) is an intracranial hemorrhage detection dataset based on head computed tomography (CT)\nscans.\nTable 6. AUC performance (mean ± std) across nine real-world AD datasets is reported under the general setting. red highlights the best\nresults, and blue indicates sub-optimal outcomes. All baseline SOTA results are sourced from the original papers (Ding et al., 2022; Zhu\net al., 2024).\nOne Training Anomaly Example\nTen Training Anomaly Examples\nFLOS\nSAOE\nMLEP\nDRA\nAHL\nDPDL\nOurs\nFLOS\nSAOE\nMLEP\nDRA\nAHL\nDPDL\nOurs\nCarpet\n0.755±0.026 0.766±0.098 0.701±0.091 0.859±0.023 0.877±0.004 0.914±0.006 0.916±0.014 0.780±0.009 0.755±0.136 0.781±0.049 0.940±0.027 0.953±0.001 0.988±0.002 0.990±0.003\nGrid\n0.871±0.076 0.921±0.032 0.839±0.028 0.972±0.011 0.975±0.005 0.999±0.001 1.000±0.005 0.966±0.005 0.952±0.011 0.980±0.009 0.987±0.009 0.992±0.002 0.999±0.001 1.000±0.000\n0.791±0.057 0.996±0.007 0.781±0.020 0.989±0.005 0.988±0.001 0.996±0.001 0.997±0.001 0.993±0.004 1.000±0.000 0.813±0.158 1.000±0.000 1.000±0.000 1.000±0.000 1.000±0.000\nLeather\nTile\n0.787±0.038 0.935±0.034 0.927±0.036 0.965±0.015 0.968±0.001 0.994±0.002 0.995±0.008 0.952±0.010 0.944±0.013 0.988±0.009 0.994±0.006 1.000±0.000 0.999±0.001 0.999±0.001\nWood\n0.927±0.065 0.948±0.009 0.660±0.142 0.985±0.011 0.987±0.003 0.998±0.002 0.998±0.004 1.000±0.000 0.976±0.031 0.999±0.002 0.998±0.001 0.998±0.000 0.998±0.001 0.999±0.001\n0.975±0.023 0.989±0.019 0.927±0.090 1.000±0.000 1.000±0.000 1.000±0.000 1.000±0.000 0.995±0.002 0.998±0.003 0.981±0.004 1.000±0.000 1.000±0.000 1.000±0.000 1.000±0.000\nBottle\nCapsule\n0.666±0.020 0.611±0.109 0.558±0.075 0.631±0.056 0.665±0.030 0.757±0.017 0.760±0.010 0.902±0.017 0.850±0.054 0.818±0.063 0.935±0.022 0.930±0.001 0.976±0.004 0.977±0.012\nPill\n0.745±0.064 0.652±0.078 0.656±0.061 0.832±0.034 0.840±0.003 0.842±0.002 0.845±0.004 0.929±0.012 0.872±0.049 0.845±0.048 0.904±0.024 0.918±0.001 0.923±0.001 0.940±0.026\nTransistor 0.709±0.041 0.680±0.182 0.695±0.124 0.668±0.068 0.796±0.003 0.748±0.002 0.800±0.005 0.862±0.037 0.860±0.053 0.927±0.043 0.915±0.025 0.926±0.009 0.928±0.001 0.945±0.015\nZipper\n0.885±0.033 0.970±0.033 0.865±0.086 0.984±0.016 0.986±0.000 0.989±0.001 0.990±0.001 0.990±0.008 0.995±0.004 0.965±0.002 1.000±0.000 1.000±0.000 1.000±0.000 1.000±0.000\nCable\n0.790±0.039 0.819±0.060 0.688±0.017 0.876±0.012 0.858±0.011 0.935±0.008 0.983±0.005 0.952±0.011 0.890±0.063 0.862±0.022 0.857±0.062 0.909±0.011 0.921±0.001 0.945±0.022\nHazelnut 0.976±0.021 0.961±0.042 0.704±0.090 0.977±0.030 0.984±0.004 0.997±0.002 0.998±0.002 1.000±0.000 1.000±0.000 1.000±0.000 1.000±0.000 1.000±0.000 1.000±0.000 1.000±0.000\nMetal nut 0.930±0.022 0.922±0.033 0.878±0.038 0.948±0.046 0.952±0.003 0.948±0.007 0.954±0.013 0.984±0.004 0.976±0.013 0.974±0.009 0.997±0.002 0.998±0.000 0.996±0.001 0.998±0.001\nScrew\n0.337±0.091 0.653±0.074 0.675±0.294 0.903±0.064 0.927±0.009 0.977±0.004 0.983±0.002 0.940±0.017 0.975±0.023 0.899±0.039 0.977±0.009 0.985±0.002 0.995±0.001 0.996±0.002\nToothbrush 0.731±0.028 0.686±0.110 0.617±0.058 0.650±0.029 0.794±0.016 0.807±0.001 0.845±0.004 0.900±0.008 0.865±0.062 0.783±0.048 0.826±0.021 0.921±0.007 0.929±0.000 0.941±0.013\nMVTec AD 0.755±0.136 0.834±0.007 0.744±0.019 0.883±0.008 0.901±0.003 0.927±0.002 0.938±0.004 0.939±0.007 0.926±0.010 0.907±0.005 0.959±0.003 0.970±0.002 0.977±0.002 0.982±0.003\nOptical\n0.518±0.003 0.815±0.014 0.516±0.009 0.888±0.012 0.888±0.007 0.915±0.002 0.931±0.007 0.720±0.055 0.941±0.013 0.740±0.039 0.965±0.006 0.976±0.004 0.983±0.002 0.992±0.002\nSDD\n0.840±0.043 0.781±0.009 0.811±0.045 0.859±0.014 0.909±0.001 0.917±0.003 0.944±0.004 0.967±0.018 0.955±0.020 0.983±0.013 0.991±0.005 0.991±0.001 0.996±0.001 0.999±0.001\n0.538±0.073 0.675±0.094 0.564±0.055 0.692±0.124 0.734±0.008 0.838±0.008 0.854±0.023 0.841±0.049 0.874±0.024 0.867±0.037 0.893±0.017 0.925±0.013 0.975±0.007 0.992±0.004\nAITEX\nELPV\n0.457±0.056 0.635±0.092 0.578±0.062 0.675±0.024 0.828±0.005 0.897±0.002 0.914±0.016 0.818±0.032 0.793±0.047 0.794±0.047 0.845±0.013 0.850±0.004 0.937±0.003 0.962±0.003\nMastcam 0.542±0.017 0.662±0.018 0.625±0.045 0.692±0.058 0.743±0.003 0.838±0.011 0.852±0.009 0.703±0.029 0.810±0.029 0.798±0.026 0.848±0.008 0.855±0.005 0.934±0.010 0.968±0.007\nHyper-Kvasir 0.668±0.004 0.498±0.100 0.445±0.040 0.690±0.017 0.768±0.015 0.821±0.007 0.847±0.005 0.773±0.029 0.666±0.050 0.600±0.069 0.834±0.004 0.880±0.003 0.939±0.005 0.965±0.004\nBrainMRI 0.693±0.036 0.531±0.060 0.632±0.017 0.744±0.004 0.866±0.004 0.893±0.004 0.924±0.012 0.955±0.011 0.900±0.041 0.959±0.011 0.970±0.003 0.977±0.001 0.969±0.005 0.984±0.004\nHeadCT 0.698±0.092 0.597±0.022 0.758±0.038 0.796±0.105 0.825±0.014 0.865±0.005 0.878±0.025 0.971±0.004 0.935±0.021 0.972±0.014 0.972±0.002 0.999±0.003 0.981±0.003 0.999±0.001\nDataset\n\nB. Full Results under General Setting\nTab. 6 provides extensive results across nine real-world datasets. MPFM achieves the highest average AUC on eight out\nof nine benchmarks in both one-shot and ten-shot settings, demonstrating exceptional generalization across industrial,\nmedical, and scientific domains. The method shows particular strength on complex object categories in MVTec AD.\nOn challenging classes like Screw and Capsule, MPFM achieves over 98% AUC, significantly outperforming unimodal\nprototype approaches. This validates the Gaussian mixture prior’s ability to capture diverse normal patterns that single-mode\nmethods miss. Performance improvements remain consistent when scaling from one to ten anomaly examples, confirming\nthat our mutual information regularization effectively leverages additional supervision while maintaining robustness to\nunseen anomalies.\n\nC. Detailed Class-level AUC Results under Hard Setting\nTab. 7 provides fine-grained, class-level results under the hard setting. MPFM demonstrates dominant performance across\nnearly all anomaly sub-types in both one-shot and ten-shot scenarios, validating its precision in modeling complex normality.\nThe framework excels particularly on subtle and structurally complex defects. For instance, on AITEX, it achieves\nsignificant gains on challenging Fuzzyball and Weft crack anomalies, where local texture deviations are difficult to\ndiscriminate. Similarly, on Metal nut, MPFM robustly handles Flip and Scratch types, outperforming methods reliant on\nunimodal priors. This consistent superiority across diverse defect morphologies—from global structural shifts to local\ntexture faults—highlights the advantage of the Gaussian mixture prototype in capturing nuanced feature distributions.\nNotably, MPFM maintains strong performance even on near-saturated categories like Carpet’s Thread, underscoring its\nability to refine decision boundaries without overfitting. The stable improvements across all six multi-subset datasets confirm\nthat our flow matching mechanism and mutual information regularization collectively enhance model discriminability and\nprototype utilization, leading to more reliable detection in open-set scenarios.\n12\n\n\fMixture Prototype Flow Matching for Open-Set Supervised Anomaly Detection\nTable 7. Detailed class-level AUC results (mean ± std) under the hard setting. The best and second-best results are highlighted in red and\nblue, respectively. Carpet and Metal nut are subsets of MvTec AD.\nOne Training Anomaly Example\nTen Training Anomaly Examples\nFLOS\nSAOE\nMLEP\nDRA\nAHL\nDPDL\nOurs\nFLOS\nSAOE\nMLEP\nDRA\nAHL\nDPDL\nOurs\nColor\n0.467±0.278 0.763±0.100 0.547±0.056 0.879±0.021 0.894±0.004 0.909±0.001 0.918±0.008 0.760±0.005 0.467±0.067 0.698±0.025 0.886±0.042 0.929±0.007 0.933±0.002 0.945±0.008\nCut\n0.685±0.007 0.664±0.165 0.658±0.056 0.902±0.033 0.934±0.003 0.941±0.003 0.950±0.013 0.688±0.059 0.793±0.175 0.653±0.120 0.922±0.038 0.943±0.002 0.951±0.004 0.963±0.012\nHole\n0.594±0.142 0.772±0.071 0.653±0.065 0.901±0.033 0.935±0.014 0.945±0.009 0.949±0.017 0.733±0.014 0.831±0.125 0.674±0.076 0.947±0.016 0.960±0.003 0.964±0.003 0.975±0.006\nCarpet\nMetal\n0.701±0.028 0.780±0.172 0.706±0.047 0.871±0.037 0.931±0.007 0.940±0.001 0.951±0.016 0.678±0.083 0.883±0.043 0.764±0.061 0.933±0.022 0.921±0.003 0.938±0.005 0.952±0.009\nThread\n0.941±0.005 0.787±0.204 0.831±0.117 0.950±0.029 0.966±0.005 0.970±0.002 0.978±0.011 0.946±0.005 0.831±0.297 0.967±0.006 0.989±0.004 0.991±0.001 0.993±0.000 0.997±0.001\nMean\n0.678±0.040 0.753±0.055 0.679±0.029 0.901±0.006 0.932±0.003 0.941±0.006 0.949±0.003 0.761±0.012 0.762±0.073 0.751±0.023 0.935±0.013 0.949±0.002 0.956±0.004 0.966±0.003\nBent\n0.851±0.046 0.864±0.032 0.743±0.013 0.952±0.020 0.954±0.003 0.958±0.001 0.965±0.013 0.827±0.075 0.901±0.023 0.956±0.013 0.990±0.003 0.989±0.000 0.991±0.002 0.995±0.006\nColor\n0.821±0.059 0.857±0.037 0.835±0.075 0.946±0.023 0.933±0.008 0.938±0.003 0.947±0.012 0.978±0.008 0.879±0.018 0.945±0.039 0.967±0.011 0.958±0.001 0.969±0.005 0.976±0.009\nMetal nut\nFlip\n0.799±0.058 0.751±0.090 0.813±0.031 0.921±0.029 0.931±0.002 0.940±0.004 0.948±0.018 0.942±0.009 0.795±0.062 0.805±0.057 0.913±0.021 0.937±0.003 0.955±0.003 0.964±0.014\nScratch\n0.947±0.027 0.792±0.075 0.907±0.085 0.909±0.023 0.934±0.005 0.936±0.002 0.945±0.007 0.845±0.041 0.805±0.153 0.911±0.034 0.999±0.000 0.992±0.002 0.994±0.002 0.997±0.001\nMean\n0.855±0.024 0.816±0.029 0.825±0.023 0.932±0.017 0.939±0.004 0.944±0.003 0.951±0.004 0.922±0.014 0.855±0.016 0.878±0.058 0.945±0.017 0.972±0.002 0.978±0.002 0.983±0.004\nBroken end\n0.645±0.030 0.778±0.068 0.441±0.111 0.708±0.094 0.704±0.005 0.761±0.010 0.783±0.013 0.585±0.037 0.712±0.068 0.732±0.065 0.693±0.099 0.735±0.010 0.796±0.001 0.814±0.026\nBroken pick 0.598±0.023 0.644±0.039 0.476±0.070 0.731±0.072 0.727±0.003 0.760±0.014 0.778±0.011 0.548±0.054 0.629±0.012 0.555±0.027 0.760±0.037 0.683±0.002 0.784±0.011 0.801±0.013\nCut selvage\n0.694±0.036 0.681±0.077 0.434±0.149 0.739±0.101 0.753±0.007 0.765±0.007 0.785±0.014 0.745±0.035 0.770±0.014 0.682±0.025 0.777±0.036 0.781±0.006 0.796±0.005 0.817±0.009\nAITEX\nFuzzyball\n0.525±0.043 0.650±0.064 0.525±0.157 0.538±0.092 0.647±0.007 0.715±0.013 0.739±0.009 0.550±0.082 0.842±0.026 0.677±0.223 0.701±0.093 0.775±0.024 0.808±0.003 0.824±0.005\nNep\n0.734±0.038 0.710±0.044 0.517±0.059 0.717±0.052 0.703±0.005 0.757±0.005 0.780±0.019 0.746±0.060 0.771±0.032 0.740±0.052 0.750±0.038 0.792±0.007 0.811±0.005 0.826±0.011\nWeft crack\n0.546±0.114 0.582±0.108 0.400±0.029 0.669±0.045 0.706±0.009 0.758±0.006 0.769±0.008 0.636±0.051 0.618±0.172 0.370±0.037 0.717±0.072 0.713±0.003 0.790±0.004 0.812±0.024\nMean\n0.624±0.024 0.674±0.034 0.466±0.030 0.684±0.033 0.707±0.007 0.753±0.005 0.772±0.011 0.635±0.043 0.724±0.032 0.626±0.041 0.733±0.009 0.747±0.002 0.798±0.005 0.816±0.006\nMono\n0.717±0.025 0.563±0.102 0.649±0.027 0.735±0.031 0.774±0.013 0.785±0.002 0.795±0.011 0.629±0.072 0.569±0.035 0.756±0.045 0.731±0.021 0.745±0.004 0.793±0.003 0.810±0.008\nELPV\nPoly\n0.665±0.021 0.665±0.173 0.483±0.247 0.671±0.051 0.705±0.006 0.738±0.008 0.762±0.009 0.662±0.042 0.796±0.084 0.734±0.078 0.800±0.064 0.831±0.011 0.843±0.004 0.854±0.015\nMean\n0.691±0.008 0.614±0.048 0.566±0.111 0.703±0.022 0.740±0.003 0.762±0.003 0.779±0.008 0.642±0.032 0.683±0.047 0.745±0.020 0.766±0.029 0.788±0.003 0.818±0.003 0.832±0.009\nBedrock\n0.499±0.056 0.636±0.072 0.532±0.036 0.668±0.012 0.679±0.012 0.732±0.003 0.757±0.017 0.499±0.098 0.636±0.068 0.512±0.062 0.658±0.021 0.673±0.006 0.757±0.004 0.776±0.010\nBroken-rock 0.569±0.025 0.699±0.058 0.544±0.088 0.645±0.053 0.661±0.009 0.738±0.004 0.761±0.015 0.608±0.085 0.712±0.052 0.651±0.063 0.649±0.047 0.722±0.004 0.783±0.002 0.811±0.013\nDrill-hole\n0.539±0.077 0.697±0.074 0.636±0.066 0.657±0.070 0.654±0.004 0.738±0.011 0.764±0.016 0.601±0.009 0.682±0.042 0.660±0.002 0.725±0.005 0.760±0.003 0.797±0.004 0.823±0.026\nDrt\n0.591±0.042 0.735±0.020 0.624±0.042 0.713±0.053 0.724±0.006 0.745±0.005 0.772±0.024 0.652±0.024 0.761±0.062 0.616±0.048 0.760±0.033 0.772±0.004 0.818±0.002 0.837±0.025\nDump-pile\n0.508±0.021 0.682±0.022 0.545±0.127 0.767±0.043 0.756±0.011 0.764±0.003 0.782±0.005 0.700±0.070 0.750±0.037 0.696±0.047 0.748±0.066 0.802±0.005 0.830±0.005 0.854±0.012\nMastcam\nFloat\n0.551±0.030 0.711±0.041 0.530±0.075 0.670±0.065 0.702±0.005 0.739±0.007 0.760±0.009 0.736±0.041 0.718±0.064 0.671±0.032 0.744±0.073 0.765±0.002 0.816±0.012 0.847±0.008\nMeteorite\n0.462±0.077 0.669±0.037 0.476±0.014 0.637±0.015 0.616±0.013 0.704±0.004 0.732±0.017 0.568±0.053 0.647±0.030 0.473±0.047 0.716±0.004 0.691±0.001 0.785±0.017 0.808±0.010\nScuff\n0.508±0.070 0.679±0.048 0.492±0.037 0.549±0.027 0.581±0.020 0.714±0.002 0.741±0.021 0.575±0.042 0.676±0.019 0.504±0.052 0.636±0.086 0.656±0.009 0.777±0.003 0.802±0.021\nVeins\n0.493±0.052 0.688±0.069 0.489±0.028 0.699±0.045 0.687±0.017 0.789±0.003 0.814±0.018 0.608±0.044 0.686±0.053 0.510±0.090 0.620±0.036 0.650±0.003 0.766±0.008 0.792±0.006\nMean\n0.524±0.013 0.689±0.037 0.541±0.007 0.667±0.012 0.673±0.010 0.733±0.004 0.760±0.013 0.616±0.021 0.697±0.014 0.588±0.016 0.695±0.004 0.721±0.003 0.778±0.007 0.815±0.005\nBarretts\n0.703±0.040 0.382±0.117 0.438±0.111 0.772±0.019 0.792±0.007 0.793±0.000 0.812±0.015 0.764±0.066 0.698±0.037 0.540±0.014 0.824±0.006 0.829±0.002 0.832±0.004 0.839±0.015\nBarretts-short-seg 0.538±0.033 0.367±0.050 0.532±0.075 0.674±0.018 0.651±0.006 0.658±0.003 0.682±0.024 0.810±0.034 0.661±0.034 0.480±0.107 0.835±0.021 0.895±0.003 0.906±0.002 0.914±0.008\nHyper-Kvasir Esophagitis-a 0.536±0.040 0.518±0.063 0.491±0.084 0.778±0.020 0.760±0.006 0.758±0.001 0.785±0.014 0.815±0.022 0.820±0.034 0.646±0.036 0.881±0.035 0.878±0.021 0.878±0.003 0.887±0.012\nEsophagitis-b-d 0.505±0.039 0.358±0.039 0.457±0.086 0.577±0.025 0.622±0.014 0.652±0.002 0.678±0.022 0.754±0.073 0.611±0.017 0.621±0.042 0.837±0.009 0.815±0.010 0.841±0.002 0.851±0.007\nMean\n0.571±0.004 0.406±0.018 0.480±0.044 0.700±0.009 0.706±0.007 0.715±0.004 0.739±0.003 0.786±0.021 0.698±0.021 0.571±0.014 0.844±0.009 0.854±0.004 0.864±0.002 0.873±0.017\nDataset\n\nD. Additional Theoretical Analysis of Mixture Prototype Flow Matching\nIn this appendix, we provide the theoretical underpinnings of Mixture Prototype Flow Matching (MPFM) that are referenced\nbut not derived in the main text. We first justify the use of a shared standard deviation parameter s in the Gaussian mixture\nvelocity model and show that it preserves the correctness of the learned velocity field. We then derive the endpoint posterior\nq_\\theta (\\mathbf {z}_0\\mid \\mathbf {z}_t) with parameters \\protect \\bm  {\\mu }_{z_k} and s_z , and the closed-form reverse transition q_\\theta (\\mathbf {z}_{t-\\Delta t}\\mid \\mathbf {z}_t) with coefficients c_1,c_2,c_3 .\nFinally, we connect the Mutual Information Maximization Regularizer (MIMR) to an explicit estimate of the mutual\ninformation between transformed features and prototype indices.\nD.1. GM Velocity Parameterization and Shared Standard Deviation\nFollowing the diffusion/flow-matching formulation in GMFlow, we recall the standard forward noising process for latent\nfeatures:\n  \\mathbf {z}_t = \\alpha _t \\mathbf {z}_0 + \\sigma _t \\boldsymbol {\\varepsilon }, \\qquad \\boldsymbol {\\varepsilon }\\sim \\mathcal {N}(\\mathbf {0},\\mathbf {I}), \\label {eq:app_forward} \n(27)\nwhere \\alpha _t,\\sigma _t are a pre-defined noise schedule satisfying typical boundary conditions \\alpha _0=1,\\sigma _0=0 and \\alpha _T\\approx 0,\\sigma _T\\approx 1.\nThe corresponding random velocity is defined as:\n  \\mathbf {u} := \\frac {\\mathbf {z}_t - \\mathbf {z}_0}{\\sigma _t}, \\label {eq:app_def_u} \n\n(28)\n\nand the ground-truth velocity field at time t and state \\protect \\mathbf  {z}_t is the conditional expectation:\n  \\mathbf {v}_t(\\mathbf {z}_t) = \\mathbb {E}_{\\mathbf {z}_0\\sim p(\\mathbf {z}_0\\mid \\mathbf {z}_t)} [\\,\\mathbf {u}(\\mathbf {z}_0,\\boldsymbol {\\varepsilon })\\,], \\label {eq:app_flow_mean} \n\n(29)\n\nwhere p(\\mathbf {z}_0\\mid \\mathbf {z}_t) denotes the denoising distribution induced by normal training samples. In practice, we obtain empirical\npairs (\\mathbf {z}_t,\\mathbf {u}) using the interpolation rule in Eqn. (4) of the main text; for theoretical analysis, Eqn.(27)–Eqn.(28) provide an\nequivalent continuous-time parameterization.\nMPFM models the full conditional distribution p(\\mathbf {u}\\mid \\mathbf {z}_t) as a Gaussian mixture:\n  q_{\\theta }(\\mathbf {u}\\mid \\mathbf {z}_t) = \\sum _{k=1}^{K} \\pi _k(\\mathbf {z}_t;\\theta )\\, \\mathcal {N}\\!\\big (\\mathbf {u}; \\boldsymbol {\\mu }_k(\\mathbf {z}_t;\\theta ),\\,s^2\\mathbf {I}\\big ), \\label {eq:app_gm_u} \n13\n\n(30)\n\n\fMixture Prototype Flow Matching for Open-Set Supervised Anomaly Detection\n\nwhere\nall components share a scalar standard deviation s&gt;0, and the mixture weights \\pi _k(\\mathbf {z}_t;\\theta ) satisfy \\pi _k\\ge 0 and\n\\DOTSB \\sum@ \\slimits@ _k \\pi _k=1\nvia a softmax parameterization. The training loss:\n  \\mathcal {L}_{\\mathrm {NLL}} = \\mathbb {E}_{\\mathbf {u}\\sim p(\\mathbf {u}\\mid \\mathbf {z}_t)} \\Big [ -\\log q_{\\theta }(\\mathbf {u}\\mid \\mathbf {z}_t) \\Big ] \\label {eq:app_nll} \n\n(31)\n\nis equivalent to minimizing the conditional Kullback–Leibler divergence  \\mathrm {KL}\\big (p(\\mathbf {u}\\mid \\mathbf {z}_t)\\,\\|\\,q_\\theta (\\mathbf {u}\\mid \\mathbf {z}_t)\\big )  up to an additive\nconstant, and thus provides a consistent estimator for the velocity distribution.\nWe now show that the shared variance s^2 does not affect the correctness of the learned mean velocity. Let \\ifmmode \\lbrace \\else \\textbraceleft \\fi \\pi _k^{*},\\boldsymbol {\\mu }_k^{*}\\} denote\nthe optimal mixture parameters for a fixed \\protect \\mathbf  {z}_t and fixed s. Define:\n  q^{*}(\\mathbf {u}) := \\sum _{k=1}^K \\pi _k^{*} \\mathcal {N}(\\mathbf {u};\\boldsymbol {\\mu }_k^{*},s^2 \\mathbf {I}), q_k^{*}(\\mathbf {u}) := \\pi _k^{*} \\mathcal {N}(\\mathbf {u};\\boldsymbol {\\mu }_k^{*},s^2 \\mathbf {I}), \n\n(32)\n\nand use the shorthand \\protect \\mathbb  {E}[\\cdot ] := \\mathbb {E}_{\\mathbf {u}\\sim p(\\mathbf {u}\\mid \\mathbf {z}_t)}[\\cdot ]. Differentiating Eqn. (31) with respect to the mixture logits and component\nmeans yields the optimality conditions:\n  \\pi _k^{*} &amp;= \\mathbb {E}\\!\\left [\\frac {q_k^{*}(\\mathbf {u})}{q^{*}(\\mathbf {u})}\\right ], \\label {eq:app_opt_pi}\\\\ \\pi _k^{*} \\boldsymbol {\\mu }_k^{*} &amp;= \\mathbb {E}\\!\\left [\\frac {q_k^{*}(\\mathbf {u})}{q^{*}(\\mathbf {u})}\\,\\mathbf {u}\\right ]. \\label {eq:app_opt_mu}\n(34)\nSumming Eqn. (34) over k and using\n\n\\DOTSB \\sum@ \\slimits@ _{k=1}^{K} q_k^{*}(\\mathbf {u}) = q^{*}(\\mathbf {u})\n\ngives:\n\n  \\sum _{k=1}^K \\pi _k^{*} \\boldsymbol {\\mu }_k^{*} = \\mathbb {E}\\!\\left [ \\sum _{k=1}^K \\frac {q_k^{*}(\\mathbf {u})}{q^{*}(\\mathbf {u})}\\,\\mathbf {u} \\right ] = \\mathbb {E}[\\mathbf {u}]. \\label {eq:app_mean_alignment}\n(35)\nThus the mixture mean  \\bar {\\mathbf {u}}_\\theta (\\mathbf {z}_t) := \\sum _k \\pi _k^{*}(\\mathbf {z}_t)\\boldsymbol {\\mu }_k^{*}(\\mathbf {z}_t)  exactly matches the true conditional mean velocity \\protect \\mathbb  {E}[\\mathbf {u}], independently\nof the specific value of s. In the special case K=1, Eqn. (31) reduces to:\n  \\mathcal {L}_{\\mathrm {NLL}} = \\frac {1}{2s^2} \\mathbb {E}\\big [\\|\\mathbf {u}-\\boldsymbol {\\mu }_1(\\mathbf {z}_t;\\theta )\\|_2^2\\big ] + \\text {const}, \n\n(36)\n\nwhich is proportional to the standard L_2 flow-matching loss. Therefore, introducing a shared standard deviation parameter s\nimproves numerical stability without altering the learned flow field.\nD.2. From Velocity Mixtures to Endpoint Posterior\nThe Gaussian–mixture parameterization of the velocity field induces a Gaussian–mixture posterior over the initial feature \\protect \\mathbf  {z}_0\nat time t. From Eqn. (27)–Eqn. (28) we obtain the affine relation:\n  \\mathbf {z}_0 = \\mathbf {z}_t - \\sigma _t \\mathbf {u}. \\label {eq:app_z0_from_u} \n\n(37)\n\nIf \\protect \\mathbf  {u} follows the conditional mixture distribution Eqn. (30), the induced density of \\protect \\mathbf  {z}_0 given \\protect \\mathbf  {z}_t is:\n  q_\\theta (\\mathbf {z}_0\\mid \\mathbf {z}_t) = \\sum _{k=1}^K \\pi _k(\\mathbf {z}_t;\\theta )\\, \\mathcal {N}\\!\\big ( \\mathbf {z}_0; \\boldsymbol {\\mu }_{z_k},\\,s_z^2 \\mathbf {I} \\big ), \\label {eq:app_gm_z0} \n\n(38)\n\n  \\boldsymbol {\\mu }_{z_k} = \\mathbf {z}_t - \\sigma _t \\boldsymbol {\\mu }_k(\\mathbf {z}_t;\\theta ), \\qquad s_z = \\sigma _t s, \\label {eq:app_mu_zk_sz} \n\n(39)\n\nwith transformed parameters:\nexactly as stated in the main text. This follows from the closure of Gaussian distributions under affine transformations: for\neach component \\protect \\mathcal  {N}(\\mathbf {u};\\boldsymbol {\\mu }_k,s^2\\mathbf {I}) in Eqn. (30), the random variable \\protect \\mathbf  {z}_0=\\mathbf {z}_t-\\sigma _t\\mathbf {u} is Gaussian with mean and variance given\nby Eqn. (39), and summing over components preserves the mixture structure.\n14\n\n\fMixture Prototype Flow Matching for Open-Set Supervised Anomaly Detection\n\nD.3. Closed-Form Reverse-Time Transition\nWe now derive the reverse-time transition q_\\theta (\\mathbf {z}_{t-\\Delta t}\\mid \\mathbf {z}_t) and its coefficients c_1,c_2,c_3 . The forward diffusion process\nbetween adjacent timesteps is described by the Gaussian kernel:\n  p(\\mathbf {z}_t\\mid \\mathbf {z}_{t-\\Delta t}) = \\mathcal {N}\\big ( \\mathbf {z}_t; \\tfrac {\\alpha _t}{\\alpha _{t-\\Delta t}}\\mathbf {z}_{t-\\Delta t},\\, \\beta _{t,\\Delta t}\\mathbf {I} \\big ), \\label {eq:app_forward_transition} \n\n(40)\n\n  \\beta _{t,\\Delta t} = \\sigma _t^2 - \\frac {\\alpha _t^2}{\\alpha _{t-\\Delta t}^2}\\sigma _{t-\\Delta t}^2 \n\n(41)\n\nwhere:\n\nis the forward transition variance (cf. Eqn. (1) in GMFlow).\nGiven the endpoint posterior q_\\theta (\\mathbf {z}_0\\mid \\mathbf {z}_t) in Eqn. (38), the reverse transition density can be written, by Bayes’ rule and\nmarginalization over \\protect \\mathbf  {z}_0 , as:\n  q_\\theta (\\mathbf {z}_{t-\\Delta t}\\mid \\mathbf {z}_t) = \\int _{\\mathbb {R}^d} p(\\mathbf {z}_{t-\\Delta t}\\mid \\mathbf {z}_t,\\mathbf {z}_0)\\, q_\\theta (\\mathbf {z}_0\\mid \\mathbf {z}_t)\\,d\\mathbf {z}_0. \\label {eq:app_reverse_integral} \n\n(42)\n\nThe conditional kernel p(\\mathbf {z}_{t-\\Delta t}\\mid \\mathbf {z}_t,\\mathbf {z}_0) is obtained by “conflating” the three linear–Gaussian factors p(\\mathbf {z}_t\\mid \\mathbf {z}_{t-\\Delta t}),\np(\\mathbf {z}_{t-\\Delta t}\\mid \\mathbf {z}_0) and p(\\mathbf {z}_t\\mid \\mathbf {z}_0); their joint Gaussianity implies that:\n  p(\\mathbf {z}_{t-\\Delta t}\\mid \\mathbf {z}_t,\\mathbf {z}_0) = \\mathcal {N}\\!\\big ( \\mathbf {z}_{t-\\Delta t}; c_1 \\mathbf {z}_t + c_2 \\mathbf {z}_0,\\, c_3\\mathbf {I} \\big ), \\label {eq:app_conditional_gaussian} \n\n(43)\n\nwith coefficients determined by the schedule:\n  c_1 = \\frac {\\sigma _{t-\\Delta t}^2}{\\sigma _t^2} \\frac {\\alpha _t}{\\alpha _{t-\\Delta t}}, \\quad c_2 = \\frac {\\beta _{t,\\Delta t}}{\\sigma _t^2}\\alpha _{t-\\Delta t}, \\quad c_3 = \\frac {\\beta _{t,\\Delta t}}{\\sigma _t^2}\\sigma _{t-\\Delta t}^2. \\label {eq:app_c123} \n\n(44)\n\nSubstituting Eqn. (43) and the mixture posterior Eqn. (38) into Eqn. (42), and using the fact that the convolution of a\nGaussian and a Gaussian mixture remains a Gaussian mixture, we obtain:\n  q_\\theta (\\mathbf {z}_{t-\\Delta t}\\mid \\mathbf {z}_t) &amp;= \\sum _{k=1}^{K} \\pi _k(\\mathbf {z}_t;\\theta )\\, \\nonumber \\\\ &amp;\\mathcal {N}\\Big ( \\mathbf {z}_{t-\\Delta t}; c_1\\mathbf {z}_t + c_2 \\boldsymbol {\\mu }_{z_k},\\, \\big (c_3 + c_2^2 s_z^2\\big )\\mathbf {I} \\Big ), \\label {eq:app_gm_reverse}\n(45)\nwhich coincides with the reverse-time sampling formula given in the main text. Eqn. (45) shows that the mixture structure\nis preserved across reverse steps: each component mean and variance is updated analytically according to Eqn.(39) and\nEqn.(44), enabling numerically stable few-step sampling without numerical ODE integration.\nD.4. Mutual Information Maximization Regularizer\nWe finally make explicit the information-theoretic interpretation of the Mutual Information Maximization Regularizer\n(MIMR). Let  \\mathbf {y} = \\psi (\\mathbf {z}_0^{\\norm ,i})  denote the transformed feature of a normal sample and c\\in \\{1,\\dots ,K\\} denote the prototype\nindex. The mutual information between \\protect \\mathbf  {y} and c is:\n  I(\\mathbf {y};c) = H(c) - H(c\\mid \\mathbf {y}), \\label {eq:app_mi_def} \n\n(46)\n\nwhere H(c) is the marginal entropy of prototype usage, and H(c\\mid \\mathbf {y}) is the conditional entropy of prototype assignments\ngiven features.\nUnder the Gaussian-mixture prototype distribution in Eqn. (10) of the main text, Bayes’ rule gives the posterior assignment:\n  p(c=k\\mid \\mathbf {y}) = \\frac {\\pi _k \\,\\mathcal {N}(\\mathbf {y};\\boldsymbol {\\mu }_k,s^2\\mathbf {I})} {\\sum _{j=1}^{K}\\pi _j \\,\\mathcal {N}(\\mathbf {y};\\boldsymbol {\\mu }_j,s^2\\mathbf {I})}, \\label {eq:app_posterior_c} \n15\n\n(47)\n\n\fMixture Prototype Flow Matching for Open-Set Supervised Anomaly Detection\n\nwhich appears explicitly in the main text. Approximating the marginal p(c=k) by the mixture weights \\pi _k , we obtain:\n  &amp;I(\\mathbf {y};c) \\nonumber \\\\ &amp;\\approx -\\sum _{k=1}^{K} \\pi _k \\log \\pi _k - \\mathbb {E}_{\\mathbf {y}} \\Big [ -\\sum _{k=1}^{K} p(c=k\\mid \\mathbf {y}) \\log p(c=k\\mid \\mathbf {y}) \\Big ] \\nonumber \\\\ &amp;= -\\sum _{k=1}^{K} \\pi _k \\log \\pi _k + \\mathbb {E}_{\\mathbf {y}} \\Big [ \\sum _{k=1}^{K} p(c=k\\mid \\mathbf {y}) \\log p(c=k\\mid \\mathbf {y}) \\Big ]. \\label {eq:app_mi_est}\n\n(48)\nMaximizing this mutual information is equivalent to minimizing the loss:\n  &amp;\\mathcal {L}_{\\mathrm {mim}} \\nonumber \\\\ &amp;= \\mathbb {E}_{\\mathbf {z}_0^{\\norm ,i}\\sim P(\\mathcal {F}^\\norm _\\tr )} \\Big [ \\sum _{k=1}^{K} p(c=k\\mid \\psi (\\mathbf {z}_0^{\\norm ,i})) \\log p(c=k\\mid \\psi (\\mathbf {z}_0^{\\norm ,i})) \\Big ] \\nonumber \\\\ &amp;- \\sum _{k=1}^{K} \\pi _k \\log \\pi _k, \\label {eq:app_mim_loss}\n\n(49)\nwhich matches the MIMR objective used in the main text. The first term decreases the conditional entropy H(c\\mid \\mathbf {y}) by\nencouraging confident prototype assignments, while the second term increases the marginal entropy H(c) by discouraging\ndegenerate solutions in which only a few components are used. Evaluating \\protect \\mathcal  {L}_{\\mathrm {mim}} only on normal samples ensures that\nprototypes specialize to normal modes and remain well separated from anomalous regions.\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"