"<!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>Xiaofan Li1 , Xin Tan1 , Zhuo Chen3 , Zhizhong Zhang1†, Ruixin Zhang5 , Rizen Guo6 ,\nGuannan Jiang7 , Yulong Chen4 , Yanyun Qu3,8 , Lizhuang Ma1,4 , Yuan Xie1,2‡\n1\nEast China Normal University 2 Shanghai Innovation Institute\n3\nXiamen University 4 Shanghai Jiao Tong University\n5\nTencent YouTu Lab 6 Tencent WeChatPay Lab33 7 CATL\n8\nKey Laboratory of Multimedia Trusted Perception and Efficient Computing\nMinistry of Education of China\n\nAbstract\nWith the rise of generative models, there is a growing interest in unifying all tasks within a generative framework.\nAnomaly detection methods also fall into this scope and\nutilize diffusion models to generate or reconstruct normal\nsamples when given arbitrary anomaly images. However,\nour study found that the diffusion model suffers from severe\n“faithfulness hallucination” and “catastrophic forgetting”,\nwhich can’t meet the unpredictable pattern increments. To\nmitigate the above problems, we propose a continual diffusion model that uses gradient projection to achieve stable continual learning. Gradient projection deploys a regularization on the model updating by modifying the gradient towards the direction protecting the learned knowledge.\nBut as a double-edged sword, it also requires huge memory\ncosts brought by the Markov process. Hence, we propose\nan iterative singular value decomposition method based on\nthe transitive property of linear representation, which consumes tiny memory and incurs almost no performance loss.\nFinally, considering the risk of “over-fitting” to normal images of the diffusion model, we propose an anomaly-masked\nnetwork to enhance the condition mechanism of the diffusion model. For continual anomaly detection, ours achieves\nfirst place in 17/18 settings on MVTec and VisA. Code is\navailable at https://github.com/FuNz-0/One-for-More\n\n1. Introduction\nAnomaly detection (AD) [22, 42] has a wide array of applications in both medical and industrial fields. Traditional\nmethods typically operate on a one-to-one paradigm, where\na customized model is trained for a specific category or a\n† Corresponding author\n‡ Project leader\n\n98\n96\n94\n92\n90\n88\n86\n84\n\n\u0000$\u0000\u0010\u0000$\u00008\u00005\u00002\u0000&amp;\n\n{funzi}@stu.ecnu.edu.cn, {zzzhang, lzma, yxie}@cs.ecnu.edu.cn\n\n\u0000$\u0000\u0010\u0000$\u00008\u00005\u00002\u0000&amp;\n\narXiv:2502.19848v3 [cs.CV] 22 Jul 2025\n\nOne-for-More: Continual Diffusion Model for Anomaly Detection\n\nControlNet (Image)\nCDAD (Image)\nbase\n\nBase\ntrained on\nbottle\n\nContinually\ntrained on\ncable\n\ntask 1\n\ntask 2\n\ntask 3\n\n\u0000&amp;\u0000R\u0000Q\u0000W\u0000L\u0000Q\u0000X\u0000D\u0000O\u0000O\u0000\\\u0000\u0003\u0000W\u0000U\u0000D\u0000L\u0000Q\u0000H\u0000G\u0000\u0003\u0000W\u0000D\u0000V\u0000N\u0000V\n\ntask 4\n\ntask 5\n\n98\n96\n94\n92\n90\n88\n86\n84\n\nControlNet (Pixel)\nCDAD (Piexl)\nbase\n\ntask 1\n\ntask 2\n\ntask 3\n\n\u0000&amp;\u0000R\u0000Q\u0000W\u0000L\u0000Q\u0000X\u0000D\u0000O\u0000O\u0000\\\u0000\u0003\u0000W\u0000U\u0000D\u0000L\u0000Q\u0000H\u0000G\u0000\u0003\u0000W\u0000D\u0000V\u0000N\u0000V\n\nControlNet\n\nCDAD\n\nControlNet\n\nCDAD\n\nControlNet\n\nCDAD\n\ntask 4\n\ntask 5\n\nFigure 1. Top: Results of ControlNet and CDAD on image/pixellevel anomaly detection as the number of tasks on the MVTec continually increases. Bottom: “faithfulness hallucination” Problem\nin ControlNet for continuous anomaly detection.\n\nkind of industrial product. The one-for-one mode severely\nlimits the generalization of the model. Instead, the onefor-all paradigm proposes that training a single model can\nperform anomaly detection across all classes. However,\nin real-world scenarios, the pattern increments are unpredictable, necessitating the model’s ability to learn continuously, which we refer to as the on-for-more paradigm. This\npaper focuses on the task of continuous anomaly detection\nand proposes a Continual Diffusion model for Anomaly\nDetection (CDAD).\nThe diffusion model (DM) has been widely used in\nanomaly detection [9, 13, 43, 48]. Current DM-based methods generate the normal images conditioned on anomaly\nimages through the image-to-image mechanism. The difference between the input and output of the diffusion model is\nused as the score of anomaly detection, which requires the\ndiffusion model to reconstruct anomaly areas of the input\nimage. However, our study found that the image-to-image\n\n\fdiffusion model suffers from “catastrophic forgetting”[17]\nin continuously generating diverse samples. Taking ControlNet [47] as an example, as shown in Figure 1 (top), the\nperformance on the base task (10 classes in MVTec [3]) is\nexcellent but deteriorates seriously as the model continues\nto be trained on new tasks (new classes). Furthermore, as\nshown in Figure 1 (bottom), the ControlNet [47], after training in the latest class, suffers from “faithfulness hallucination” [16]. Specifically, the model’s output becomes inconsistent with previously trained samples, leading to a failure\nin detecting anomalies. In this paper, we mitigate the above\nproblem from two aspects: 1) use a stable parameter update strategy, and 2) strengthen the conditional mechanism\nof image-to-image generation.\nIn this paper, we propose a continual diffusion model\nframework that projects the updating gradient of new tasks\nonto a subspace orthogonal to the significant representation\nof previous tasks [29, 34], thus eliminating the effect of the\nupdate gradient on the previous feature space. Since the significant representation is calculated through singular value\ndecomposition (SVD) on the matrix unfolded by intermediate features, the gradient projection operation requires a\nlot of memory. However, the Markov-based diffusion process significantly increases the memory overhead. Taking\nU-Net of stable diffusion [30] as an example, computing the\nsignificant representation of 10 images consumes almost an\nadditional 157 GB of memory (see Table 1), and more images need more memory. To address this issue, we propose\nan iterative singular value decomposition (iSVD) method\nbased on linear transitivity theoretical property. Through\nthe online iterative operation, iSVD only needs about 17\nGB memory consumption to calculate the significant representation of any number of images. This paper demonstrates and validates the effectiveness of iSVD from both\ntheoretical and experimental perspectives.\nAnother issue of DM-based anomaly detection methods\n[13, 48] is that these methods tend to “over-fitting” normal\nsamples rather than focusing on “reconstructing” anomalous regions, which weakens the role of the image-to-image\nconditioning mechanism and aggravates the hallucination\nproblem in continuous learning. To this end, we propose\nthe anomaly-masked network. In it, we use a CNN to encode the input image and match its size with the input of\nU-Net, and we also design a non-local encoder using a\ntransformer [39] structure to perceive the global information. The neighbor-masked self-attention [44] and anomalymasked loss are used to mask out abnormal features, which\npreserves normal features output by the local encoder. As a\nresult, the diffusion model pays more attention to the reconstruction of abnormal regions while avoiding its overfitting\nto generate normal images. Figure 1 illustrates our great advantages, compared with ControlNet [47], CDAD can well\novercome the hallucination problem and effectively allevi-\n\nate the forgetting of continuous anomaly detection.\nTo summarize, the main contributions of this paper are:\n• We propose a continual diffusion framework by modifying the gradient to alleviate the issues of forgetting and\nhallucination caused by continual learning.\n• Iterative singular value decomposition is proposed, which\ncan greatly reduce the memory consumption of the gradient projection.\n• We propose the anomaly-masked network, which can enhance the condition mechanism of image-to-image generation to avoid the side effect of “over-fitting” in anomaly\ndetection.\n• For image-level and pixel-level anomaly detection, our\nmethod achieves first place in 17/18 continual anomaly\ndetection settings on MVTec [3] and VisA [49].\n\n2. Related Work\nDiffusion models have achieved significant advancements\nin the field of image generation [30, 33, 47],which aids other\nvisual tasks [18, 21, 23, 24]. They are also widely used in\nanomaly detection tasks, with some methods [13, 43, 48]\nutilizing diffusion models to reconstruct anomalous regions\nof an image. Additionally, some approaches [15] use diffusion models to generate various types of defects, which\nthen assist in training anomaly detection models.\nOne-for-One Anomaly Detection is the classical anomaly\ndetection framework, which trains a customized model for\neach class to detect anomalies. The feature embedding\nmethods [6, 7, 22, 31, 32] extract the patch features of\nthe normal image and store them as memory, then the distance between the test image features and the memory is\nused as anomaly scores. The knowledge distillation methods [2, 10, 35, 40] compute anomaly scores by the difference between the teacher network and the student network.\nThe reconstruction methods [8, 11] train the network to reconstruct abnormal regions into normal regions, and then\ncalculate the anomaly score by the difference. In addition, some methods Chen et al. [5], Liu et al. [26], Schlüter\net al. [36], Zavrtanik et al. [45] assist the model in identifying anomalies by generating anomalies. The one-for-one\nparadigm has achieved almost saturated performance, but\nthe above methods are unsuitable for multi-class tasks.\nOne-for-All Anomaly Detection is a recently emerging\nmulti-class anomaly detection paradigm, which aims to\ntrain a model that can detect multiple classes. UniAD [44]\nis the pioneer method, which uses transformer architecture\nto reconstruct features and proposes neighbor-masked attention to alleviate the “identical shortcut” problem. Subsequently, many multi-class anomaly detection methods\n[12, 14, 27] have been proposed, which are based on the\nparadigm of feature reconstruction. DiAD [13] introduces\nthe latent diffusion model [30] into multi-class anomaly detection, and proposes the semantic-guided network as the\n\n\fIterative Singular Value Decomposition (iSVD)\n\nContinual Diffusion Model\n\n*\n\n...\n\n*\n\nSplit\n\n...\n\nTransformer\n\niSVD\nText\nencoder\n\nl-th layer feature\n\nAMN\n\n...\n\niSVD\n\nc\n\nc\n\nl-th layer feature\n\nS&amp;K\n\nAnomaly Masked Network (AMN)\nL2 loss\n\nVAE Encoder\nDiffusion × T\n\nElement-wise substract\nElement-wise sum\n\nTask 2\n\nSignificant representation of previous tasks\nOriginal gradient of task i+1\nSpanned space by\n\nLocal\nEncoder\n\nTask 3\nGradient projection\n\nProjected gradient of task i+1\nInitial weight trained on task 1\n\nNon-local\nEncoder\n\nPatch perturbation\nQ\n\nConv\n\nc Concatenate\n\nTask 1\n\nS&amp;K\n\nl-th layer feature\n\n...\n\nlatent variable\n\nS&amp;K\n\nSiLU\n\niSVD\n\n...\n\nResnetBlock\n\nSVD&amp;k-rank\nappoximation (S&amp;K)\n\n×Lc\nConvolutional layer\n\nK\n\nV\n\nFeed\nforward\n\nTraining\n\nDenoising × T\n\nNMSA\n\nFrozen\n\nContinual updating of l-th layer\n\nTransformer layer\n\n×Lt\n\nFigure 2. Illustration of CDAD. Left is the overall framework of the continual diffusion model. Right is the proposed iterative singular\nvalue decomposition and anomaly-masked network.\n\ncondition mechanism for the generation process. The above\nmethods require all classes to be trained simultaneously,\nand their performance degrades as the number of classes\nincreases.\nOne-for-More Anomaly Detection is the focus of this paper, which enables models to continuously learn anomaly\ndetection for new categories without backtracking on previous tasks. DNE [20] and UCAD [25] propose using an additional memory bank to store the knowledge of old tasks.\nThe most direct issue is that as tasks increase, the memory\nbank gradually expands. IUF [38] introduces a semantic\ncompression loss to retain the knowledge of previous tasks,\nhowever, when one incremental step has many classes, it\nwill still cause a large forgetting of the previous tasks.\n\n3. Method\n\nso the iterative singular value decomposition (iSVD) is proposed. In addition, the anomaly-masked network is proposed masking out anomaly features while retaining normal\nfeatures to serve as conditions for the U-Net.\nDuring the inference phase, a testing image xtest with\nunknown categories is first encoded into latent space variable by VAE encoder z 0 = E(xtest ) and perform the diffusion process z T = Dif f usion(z 0 ). Then xtest is used\nas the input of AMN to control denoising processes ẑ =\nDenoise(z T , xtest ). Finally, the image is reconstructed by\nVAE decoder x̃test = D(ẑ). Besides, the original image\nalso reconstructed x̂test = D(E(xtest )). For anomaly localization and detection, we use pre-trained CNNs ϕ(·) to extract intermediate-layer feature maps, the distance of x̂test\nand x̃test in position (h, w) of l-th layer feature maps can\nbe calculated as:\n\n3.1. Overview\n\n  \\begin {aligned} \\mathcal {M}^l_{h,w}(\\hat {x}_{test}, \\Tilde {x}_{test})=\\left \\|\\phi ^l(\\hat {x}_{test})-\\phi ^l(\\Tilde {x}_{test})\\right \\|_2^2. \\end {aligned} \\label {eq:ad1} \n\nAn overview of our proposed CDAD is illustrated in Figure 2, our goal is to design a continuously updated diffusion\nmodel via task-by-task training to generate or reconstruct\nvarious kinds of normal images and then measure the difference between the generated normal image and the test\nimage, to determine whether there exists a defect. The\ncontinual diffusion model is based on a pre-trained variational auto-encoder (VAE) and controls the denoise process\nconditioned on input images. Note that the input of the\ntext encoder is a space character. The continuous update\nis achieved by modifying the gradient with the direction\nthat has less impact on previous tasks, such that we don’t\nrequire previous samples and there is no additional inference cost. However, this projection process requires huge\nmemory overhead of computing significant representation,\n\n(1)\n\nThen, the anomaly score map for anomaly localization is:\n  \\begin {aligned} \\mathcal {S}=\\sum _{l\\in \\mathbb {L}}Upsample(\\mathcal {M}^l(\\hat {x}_{test}, \\Tilde {x}_{test})) \\end {aligned} \\label {eq:ad2} \n\n(2)\n\nWhere L is the set of intermediate layers and U psample(·)\nis a bilinear interpolation that can upsample Ml from different layers to the same size. The anomaly score is the max\nvalue of S for image-level detection.\n\n3.2. Continual Diffusion Model\nThe proposed continual diffusion model (CDM) uses a pretrained VAE to project the image into the latent space for the\ndiffusion and denoising processes. Refer to latent diffusion\nmodel [30], the objective function is given by:\n  \\begin {aligned} \\mathcal {L}_{C D M}=\\mathbb {E}_{\\mathcal {E}(x), \\Tilde {x}, \\epsilon \\sim \\mathcal {N}(0,I), t}\\left \\|\\epsilon -\\epsilon _\\theta \\left (z_t, t, \\tau _\\theta (\\Tilde {x})\\right )\\right \\|_2^2, \\end {aligned} \\label {eq:ddpm}  (3)\n\n\fwhere ϵθ is U-net, τθ is the anomlay-masked network, E(·)\nis the encoder of VAE, zt is the encoded latent variable after\nt step diffusion, x̃ is the condition of U-net. Concretely, x̃\nis the original image perturbed by random patches.\nOur study found that the diffusion model suffers from\n“catastrophic forgetting” during continual learning. As\nshown in Figure 2, the U-Net is mainly composed of\nResnetBlock and Transformer, including the CNN and MLP\nlayers. Since MLP and CNN can be represented as matrix\nmultiplication, we can summarize the forgetting principle\nfrom the perspective of keeping the previous feature space\nunchanged after the gradient update. Taking layer l for example and omitting it, denote that X pre(i) ∈ Rn×d1 is the\ninput feature for l-th layer of previous i tasks, X i ∈ Rm×d1\nis the input feature of task i, W pre ∈ Rd1 ×d2 is previous\nnetwork parameters and O pre ∈ Rn×d2 is old output of\nprevious tasks, which is obtained as:\n  \\begin {aligned} \\boldsymbol {O}_{pre(i)} = \\boldsymbol {X}_{pre(i)} \\boldsymbol {W}_{pre(i)}, \\end {aligned} \\label {eq:gpm1} \n\n(4)\n\nAfter training on the i + 1 task, the network parameters are\nupdated, and the output of previous i tasks is as follows:\n  \\begin {aligned} \\hat {\\boldsymbol {O}}_{pre(i)} = \\boldsymbol {X}_{pre(i)} \\boldsymbol {W}_{i+1} = \\boldsymbol {O}_{pre(i)} - \\eta \\boldsymbol {X}_{pre(i)} \\nabla _{\\boldsymbol {W}_{i}}, \\end {aligned} \\label {eq:gpm3} \n(5)\nwhere η ̸= 0 is the learning rate, ∇W i ∈ Rd1 ×d2 is\nthe updating gradient of the task i + 1. After updating,\nÔ pre ̸= O pre which leads to the occurrence of forgetting. To solve this problem, as illustrated in Figure 2 the\ngradient projection is introduced to project ∇W i+1 into\nan orthogonal space of span(X pre(i) ). To obtain this orthogonal space, we first calculate the k-rank column basis\nÛ i ∈ Rd1 ×k of the previous i tasks is as follows:\n  \\begin {aligned} \\hat {\\boldsymbol {U}}_i = \\left \\{ \\begin {array}{ll} \\hat {\\mathbf {C}}((\\boldsymbol {X}_i)^T), &amp; i = 0, \\\\ \\hat {\\mathbf {C}}([\\hat {\\boldsymbol {U}}_{i-1}, (\\boldsymbol {X}_i)^T]), &amp; i &gt; 0, \\\\ \\end {array} \\right . \\end {aligned} \\label {eq:svd} \n\nAlgorithm 1 SVD followed by k-rank approximation\n# M: Feature matrix, d × m\n# th: Threshold\ndef S_and_K(M, th):\n# U: d × d, S: d, Vh: m × m\nU, S, Vh = torch.linalg.svd(M)\ntotal = (S ** 2).sum()\nratio = (S ** 2) / total\nk = (torch.cumsum(ratio) &lt; th).sum()\nU_hat = U[:, :k]\nreturn U_hat\n\n3.3. Iterative Singular Value Decomposition\nThe traditional SVD method used in Eq (6) needs the global\ncalculation to calculate the significant representation, thus\nit requires enough memory to store intermediate features.\nHowever, the Markov-based denoising process greatly increases the size of intermediate features, according to our\nstatistics, it requires almost 157 GB of memory to compute\nsignificant representation for only ten images (see Table 1),\nwhich is an unaffordable memory cost. Therefore, we propose an iterative SVD (iSVD) method, which can used to\ncalculate the significant representation of a large matrix and\nretain the original properties with a small memory overhead. Specifically, we denote the input matrix of Eq (6)\nas M ∈ Rd×Λ , where d and Λ denote the dimension and\nnumber of features and Λ ≫ d. As illustrated in Figure 2,\nM is split into {M 1 , M 2 , . . . , M n }, where M i ∈ Rd×m ,\nd×k\nm= Λ\nof M 1\nn . The significant representation Û 1 ∈ R\nis calculated by SVD followed by its k-rank approximation\naccording to the threshold, γth :\n  \\centering \\begin {aligned} \\boldsymbol {M}_1 = \\boldsymbol {U}_1 \\boldsymbol {\\Sigma }_1 \\boldsymbol {V}_1^T, \\boldsymbol {U}_1 &amp; \\in \\mathbb {R}^{d \\times d}, \\boldsymbol {\\Sigma }_1 \\in \\mathbb {R}^{d \\times m}, \\\\ (\\boldsymbol {M}_1)_{k} = \\hat {\\boldsymbol {U}}_1 \\hat {\\boldsymbol {\\Sigma }}_1 \\hat {\\boldsymbol {V}}_1^T, \\hat {\\boldsymbol {U}}_1 &amp; \\in \\mathbb {R}^{d \\times k}, \\hat {\\boldsymbol {\\Sigma }}_1 \\in \\mathbb {R}^{k \\times k}, \\\\ \\text {s.t.} \\quad \\left \\|\\left (\\boldsymbol {M}_1\\right )_{k}\\right \\|_F^2 &amp; \\geq \\gamma _{th}\\left \\|\\boldsymbol {M}_1\\right \\|_F^2 , \\end {aligned} \\label {eq:gpm4} \n(9)\n\n(6)\n2\n\nwhere [·] denotes concatenate operation, Ĉ(M ) denotes krank column basis of M , calculated by SVD followed krank approximation. As shown in Figure 2, for stable continual learning, CDM projects the original gradient of the\ntask i + 1 onto the orthogonal space of span(Û i ):\n  \\begin {aligned} \\nabla _{\\boldsymbol {W}_{i}}^{orth} = \\nabla _{\\boldsymbol {W}_{i}}-(\\hat {\\boldsymbol {U}}_i)(\\hat {\\boldsymbol {U}}_i)^T\\nabla _{\\boldsymbol {W}_{i}}, \\end {aligned} \\label {eq:gpm6} \n\n(7)\n\nwhere X pre(i) ∇orth\nW i ≈ 0. The initial task is updated with\nthe original gradient, and the incremental tasks are updated\nwith the projected gradient. Thus, we can deduce that:\n  \\begin {aligned} \\hat {\\boldsymbol {O}}_{pre(i)} =\\boldsymbol {X}_{pre(i)} \\boldsymbol {W}_{i} - \\eta \\boldsymbol {X}_{pre(i)} \\nabla _{\\boldsymbol {W}_{i}}^{orth} \\approx \\boldsymbol {O}_{pre(i)}, \\end {aligned} \\label {eq:gpm6}  (8)\nwhere the updated model on the new task does not perturb the output space of the previous task, thus ensuring the\nmodel retains the old knowledge.\n\nwhere ∥·∥F denotes F -norm, U 1 = [u1 , u2 , . . . , ud ], ui ∈\nRd , and the significant representation Û 1\n=\n[u1 , u2 , . . . , uk ], selected by the k vectors with highest singular values in U 1 , the pytorch implementation is\nshown in Algorithm 1. Then, Û 1 is concatenated with M 2\nto continue S&amp;K operation iteratively. Finally, the overall\nsignificant representation Û n is obtained to calculate\nthe orthogonal gradient of the new task. Next, we will\nprove that Û n obtained through iSVD is a significant\nrepresentation of M and give the memory saving rating.\nLemma 1 linear transitivity: Given matrices S 1 , S 2 , and\nS 3 , if S 1 can be linearly expressed by S 2 , and S 2 can be\nlinearly expressed by S 3 , then S 1 can be linearly expressed\nby S 3 .\nProof 1 For ease of understanding, we ignore the approximate information loss, assuming that the k-rank approxi-\n\n\fmation picks all vectors with nonzero singular values:\n  \\begin {aligned} \\boldsymbol {M}_1 = \\boldsymbol {U}_1 \\boldsymbol {\\Sigma }_1 \\boldsymbol {V}^T =[\\hat {\\boldsymbol {U}}_1 \\boldsymbol {U}_1^0] [ \\begin {array}{cc} \\hat {\\boldsymbol {\\Sigma }}_1 &amp; 0 \\\\ 0 &amp; 0 \\end {array} ]\\boldsymbol {V}_1^T, \\end {aligned} \n\n(10)\n\nwhere Û 1 ∈ Rd×k1 , Σ̂1 ∈ Rk1 ×k1 , rank(M 1 ) = k1 ,\nand Û 1 is an orthonormal basis of M 1 , thus M 1 can be\nlinearly expressed by Û 1 .\n  \\begin {aligned} [\\hat {\\boldsymbol {U}}_1 \\boldsymbol {M}_2] = \\boldsymbol {U}_2 \\boldsymbol {\\Sigma }_2 \\boldsymbol {V}_2^T =[\\hat {\\boldsymbol {U}}_2 \\boldsymbol {U}_2^0] [ \\begin {array}{cc} \\hat {\\boldsymbol {\\Sigma }}_2 &amp; 0 \\\\ 0 &amp; 0 \\end {array} ]\\boldsymbol {V}_2^T, \\end {aligned} \n\n(11)\n\nwhere Û 2 ∈ Rd×k2 , Σ̂2 ∈ Rk1 ×k1 , rank([Û 1 ; M 2 ]) =\nk2 , similarly, Û 1 and M 2 can be linearly expressed by Û 2 .\nAccording to Lemma 1, M 1 can also be linearly expressed\nby Û 2 .\nBy the same reasoning, it can be proved that M =\n[M 1 , M 2 , . . . , M n ] can be linearly expressed by Û n , thus\nÛ n is a significant representation of M .\nMemory saving rate. Theoretically, the memory saving\n2\n(see supplementary).\nrate of iSVD over SVD is about nn−1\n2\nConsidering memory sharing and other factors, there are\nsome changes in practice. Table 1 shows the actual memory usage of SVD and iSVD for computing the significant\nrepresentation of ten images. When n = 10 the memory\nis saved by 89.4%. In this paper, we set n to be the image\nnumber of the previous task. Therefore, the memory consumption of iSVD does not expand as the number of images\nincreases.\nSVD\nn\nMemory\nSaving rate\n\n1\n157.3GB\n0%\n\niSVD\n2\n69.9GB\n55.6%\n\n5\n30.3GB\n80.7%\n\n10\n16.7GB\n89.4%\n\nTable 1. Memory consumption and memory saving rate of iSVD\nwith different number of split blocks n.\n\n3.4. Anomaly-Masked Network\nThe image-to-image diffusion models in anomaly detection\nface the problems of ”identical shortcuts” and “overfitting”.\nTo address the above two issues, we propose the anomalymasked conditional network (AMN) to control anomalyto-normal generation. As shown in Figure 2, AMN comprises local and non-local encoders. The local encoder is\nCNNs with SiLU activation, which is used to encode the local features. Given an input image x ∈ RH×W ×3 , H and\nW denote its height and width, the image is initially enH\nW\ncoded by local encoder c̄ = Elo (x), where c̄ ∈ R f × f ×D ,\nwhich downsamples by a factor of f and the shape of c̄ is\nconsistent with the input shape of U-Net. The non-local\nencoder is composed of the transformer encoder layer and\nis used to mask out abnormal regions through the perception of non-local features. The self-attention module is\n\nreplaced by neighbor-masked self-attention (NMSA) [44],\nwhich aims to enhance the role of non-local features in feature encoding. Concretely, the locally encoded feature map\nc̄ is added with the sine positional embedding ep and then\nprocessed through the non-local encoder c = Eno (c̄ + ep ),\nW\nH\nwhere c ∈ R f × f ×D is the reprocessed c̄. Patch perturbation is introduced to make the non-local encoder mask\nout abnormal features and retain normal features. We perturb the original image x to obtain abnormal images x̃, both\nof which are input to AMN and constrained by anomalymasked loss:\n  \\begin {aligned} \\mathcal {L}_{amn} = \\mathbb {E}_{x, \\Tilde {x}}\\left \\| E_{no}(E_{lo}(\\Tilde {x})+e_p)-E_{lo}(x)\\right \\|_2^2, \\end {aligned} \\label {eq:amn} \n\n(12)\n\nwhich can mask out the anomaly region and retain normal\nregion features. So that the denoising process pays more\nattention to the reconstruction of anomaly regions.\n\n4. Experiments\nDataset. In this paper, the datasets we use are MVTec [3]\nand VisA [49]. Both datasets contain multiple classes. In\nparticular, MVTec contains 15 classes with 7002 − 9002\npixels per image, and VisA contains 12 classes with roughly\n1.5K × 1K pixels per image. The training set contains only\nnormal images, while the test set contains normal images\nand anomaly images with image-level and pixel-level annotations. These two datasets contain intricate instances that\nare widely acknowledged for their real-world applicability.\nProtocol. Referring to IUF[38], we conducted comparative experiments between our approach and the other methods under different continual anomaly detection settings.\nSpecifically, in MVTec-AD [3], we performed the subsequent four settings: 14 – 1 with 1 step, 10 – 5 with 1 step,\n3 × 5 with 5 steps, and 10 – 1 × 5 with 5 steps. In VisA\n[49], we established three settings: 11 – 1 with 1 step, 8 –\n4 with 1 step, and 8 – 1 × 4 with 4 steps, . In addition, we\ncompleted the cross-dataset continuous anomaly detection,\nincluding the MVTec to VisA increment and the VisA to\nMVTec increment.\nEvaluation metrics. We follow the literature [3] in reporting the Area Under the Receiver Operation Characteristic\n(AUROC) for both image-level and pixel-level anomaly detection. To measure the performance of the model in continuous learning, referring to DNE [20], we calculated the\naverage AUROC (A-AUROC) and the forgetting measure\n(FM) for N continual steps.\nImplementation details. CDAD is based on the pre-trained\nStable Diffusion with a pre-trained VAE, and the VAE does\nnot need further fine-tuning. The input images have all resized of 256 × 256, and the input to the text encoder is a\nspace character. For the Anomaly-Masked Network, the\ndepth of both the local encoder and the non-local encoder\nis 8. In the continuous learning process, the initial task is\n\n\f14 – 1 with 1 Step\n\nMethod\n\n10 – 5 with 1 Step\n\n3 × 5 with 5 Steps\n\n10 – 1 × 5 with 5 Steps\n\nUniAD[44]\nUniAD + EWC[17]\nUniAD + SI[46]\nUniAD + MAS[1]\nUniAD + LVT[41]\nUCAD∗[25]\nIUF[38]\n\nA-AUROC (↑)\n85.7 / 89.6\n92.8 / 95.4\n85.7 / 89.5\n85.8 / 89.6\n80.4 / 86.0\n93.8 / 95.7\n96.0 / 96.3\n\nFM (↓)\n18.3 / 13.3\n4.1 / 1.9\n18.4 / 13.4\n18.1 / 13.3\n29.1 / 20.6\n1.8 / 0.3\n1.0 / 0.6\n\nA-AUROC (↑)\n86.7 / 91.5\n90.5 / 93.6\n84.1 / 88.3\n86.8 / 91.0\n87.1 / 90.6\n88.7 / 93.1\n92.2 / 94.4\n\nFM (↓)\n14.9 / 10.6\n7.3 / 4.2\n20.2 / 17.0\n14.9 / 11.6\n14.1 / 12.3\n5.2 / 3.7\n9.3 / 4.3\n\nA-AUROC (↑)\n81.3 / 88.7\n79.6 / 89.0\n81.9 / 88.5\n81.5 / 89.0\n80.4 / 88.6\n84.8 / 90.1\n84.2 / 91.1\n\nFM (↓)\n7.4 / 10.6\n9.5 / 10.1\n7.0 / 10.8\n7.2 / 10.2\n8.6 / 10.6\n10.3 / 9.2\n10.0 / 8.4\n\nA-AUROC (↑)\n76.6 / 82.3\n89.6 / 93.8\n77.9 / 82.0\n77.9 / 82.0\n78.2 / 88.3\n91.2 / 94.0\n94.2 / 95.1\n\nFM (↓)\n21.1 / 17.3\n5.4 / 3.6\n19.5 / 17.7\n19.5 / 17.7\n19.1 / 16.1\n6.3 / 3.0\n3.2 / 1.0\n\nDiAD†[13]\nControlNet†[47]\n\n93.5 / 96.5\n92.6 / 96.4\n\n1.7 / 0.1\n3.6 / 0.1\n\n91.9 / 93.9\n92.7 / 93.8\n\n3.2 / 3.9\n2.9 / 4.0\n\n80.5 / 89.0\n79.2 / 89.6\n\n11.8 / 7.2\n13.9 / 7.3\n\n83.3 / 92.7\n82.6 / 91.8\n\n12.2 / 3.6\n13.5 / 4.5\n\nCDAD†\n\n96.4 / 96.6\n\n-0.57 / -0.04\n\n94.2 / 95.3\n\n2.05 / 2.40\n\n89.1 / 92.2\n\n3.69 / 4.65\n\n94.9 / 95.7\n\n1.01 / 0.74\n\nTable 2. Image-level/pixel-level results of our method on MVTec under 4 continual anomaly detection settings. The best and second-best\nresults are marked in blod and underline. † indicates DM-based methods, and ∗ indicates memory-limited.\n11 – 1 with 1 Step\n\nMethod\n\n8 – 4 with 1 Step\n\n8 – 1 × 4 with 4 Steps\n\nA-AUROC (↑)\n\nFM (↓)\n\nA-AUROC (↑)\n\nFM (↓)\n\nA-AUROC (↑)\n\nFM (↓)\n\nUniAD[44]\nUniAD + EWC[17]\nUniAD + SI[46]\nUniAD + MAS[1]\nUniAD + LVT[41]\nUCAD∗[25]\nIUF[38]\n\n75.0 / 92.1\n78.7 / 95.4\n78.1 / 92.0\n75.4 / 91.8\n77.5 / 92.3\n85.9 / 94.5\n87.3 / 97.6\n\n22.4 / 11.4\n14.9 / 4.8\n16.9 / 11.5\n21.5 / 11.9\n17.3 / 10.9\n2.7 / 0.6\n2.4 / 1.8\n\n78.1 / 94.0\n80.5 / 95.4\n69.8 / 88.5\n72.1 / 90.6\n70.8 / 91.4\n79.9 / 94.2\n80.1 / 95.4\n\n14.7 / 8.4\n10.0 / 5.3\n9.2 / 8.3\n14.1 / 8.4\n13.4 / 8.1\n8.9 / 4.8\n9.8 / 6.8\n\n72.2 / 90.8\n72.3 / 92.3\n69.8 / 88.5\n72.1 / 90.6\n70.8 / 94.4\n78.8 / 93.5\n79.8 / 95.0\n\n16.6 / 9.2\n16.5 / 7.3\n19.8 / 12.0\n16.7 / 9.4\n18.3 / 8.4\n10.4 / 5.4\n9.8 / 6.8\n\nDiAD†[13]\nControlNet†[47]\n\n70.2 / 91.1\n82.4 / 92.3\n\n5.6 / 2.2\n2.6 / 0.2\n\n67.4 / 91.7\n76.3 / 91.8\n\n7.7 / 1.6\n5.8 / 0.4\n\n65.0 / 84.9\n70.0 / 88.7\n\n11.2 / 8.8\n13.8 / 5.8\n\nCDAD†\n\n88.3 / 97.2\n\n-1.28 / -0.06\n\n85.3 / 97.1\n\n1.39 / 0.29\n\n83.4 / 95.8\n\n3.79 / 1.49\n\nTable 3. Image-level/pixel-level results of our method on VisA under 3 continual anomaly detection settings. The best and second-best\nresults are marked in blod and underline. † indicates DM-based methods, and ∗ indicates memory-limited.\nMethod\n\nMVTec–VisA\n\nVisA–MVTec\n\nA-AUROC (↑)\n\nFM (↓)\n\nA-AUROC (↑)\n\nFM (↓)\n\nIUF\nDiAD\nControlNet\n\n82.4 / 92.5\n85.5 / 93.0\n85.3 / 91.7\n\n11.09 / 4.88\n10.24 / 4.15\n10.35 / 4.73\n\n74.3 / 89.7\n78.1 / 92.2\n78.9 / 86.2\n\n16.74 / 5.54\n12.54 / 5.89\n12.07 / 10.68\n\nCDAD\n\n90.0 / 94.9\n\n4.71 / 1.78\n\n84.2 / 94.1\n\n6.90 / 3.45\n\nTable 4. Image-level/pixel-level results on cross-dataset continual\nanomaly detection.\n\ntrained for 500 epochs, and each incremental task is trained\nfor 100 epochs. During the inference phase, the Denoising Diffusion Implicit Model [37] (DDIM) is employed as\nthe sampler with a default of 10 steps, and the pre-trained\nCNN we used to extract features is a ResNet50 pre-trained\non ImageNet.\n\n4.1. Comparison Results\nThe image/pixel-level experimental results of CDAD and\ncurrent methods on continual anomaly detection are\nrecorded in Table 2 3, where UniAD[44] and DiAD[13] are\nmulti-class anomaly detection methods, EWC[17], SI[46],\nMAS[1] and LVT[41] are traditional continual learning\nmethod. IUF[38] and UCAD[25] are incremental frameworks for continual anomaly detection. We also replicate\nthe results of DiAD[13] and ControlNet[47] on continual\n\nanomaly detection. As illustrated in Table 2 3, after incorporating traditional continuous learning methods, the results of UniAD showed some improvement but were still\nbelow the SOTA level, the DM-based methods achieve good\nresults when the number of steps is small, while deteriorate and suffer “catastrophic forgetting” when the number\nof steps is larger. Compared with the above methods, IUF\nhas achieved better results overall, but in some tasks, such\nas setting 3 on MVTec and setting 6 on visa, it still suffers\nfrom forgetting problems. Regarding our method, CDAD\nachieved all the best results on MVTec, especially on setting 3, which increased by 4.3/1.1 compared to the second\nplace, and the forgetting rate was also significantly reduced\nby 6.31/3.75. On the VisA dataset, in addition to the pixel\nlevel result of setting 5, CDAD achieves the best results on\nother settings and improves 5.2/1.7 and 3.6/0.8 compared\nto the SOTA level of setting 6 and setting 7, respectively.\nThe recorded results indicate that CDAD exhibits excellent anomaly detection performance and a significant antiforgetting capability. Notably, in MVTec setting 1 and VisA\nsetting 5, CDAD not only mitigates the issue of forgetting\nbut also demonstrates enhanced performance on previous\ntasks, which suggests that CDAD can improve the overall\ngeneralization of the model with a limited number of incremental tasks.\n\n\f11\n\n12\n\n13\n\n14\n\n15\n\n1-10\n\nGT\n\nCDAD\n\nDiAD\n\nControlNet\n\nInput\n\nCDAD\n\nDiAD\n\nControlNet\n\n1-10\n\nFigure 3. Qualitative comparison results under setting 4 of MVTec, the numbers represent continual training steps. The top is the\nreconstruction result of the anomaly image, and the bottom is the heat map of the anomaly location.\n\n4.2. Cross-Dataset Continual Learning\n\n4.4. Ablation Study\n\nTable 4 shows the results of cross-dataset continual anomaly\ndetection, MVTec–VisA represents base training on MVTec\nfollowed by incremental training on VisA. Due to the\nmemory efficiency, CDAD enables continual learning on\nlarge-scale datasets. As recorded, CDAD outperforms the\nsecond-best method by 4.5/1.9 and 5.3/1.9 on two crossdataset settings, respectively. In addition, CDAD also\nachieves the optimal cross-dataset forgetting rate, which\nindicates its excellent stability for large-scale incremental\ntraining.\n\nWe verify the impact of different modules on the overall performance of CDAD under setting 4 on MVTec [3].\nThese include the continual diffusion model (CDM) and\nanomaly-masked network (AMN). To better verify the effectiveness of our method, we use ControlNet [47] as the\nbaseline for comparison. Results of the ablation study are\nrecorded in Table 5.\nContinual Diffusion Model. The continual diffusion\nmodel (CDM) is proposed to better retain the model’s\nknowledge of previous tasks during continual learning,\nthereby alleviating the problem of forgetting. As shown\nin Table 5, after removing CDM, the performance of the\nmodel in the new task gradually decreases with the increase of steps, and the final forgetting rate also increases\nby 4.35/1.81. However, compared with ControlNet, the\nforgetting rate of the model without CMD (only use AMN)\ndecreased by 8.1/1.9, which is a significant improvement.\nAnomaly-Masked Network. The anomaly-masked network (AMN) is proposed as a condition mechanism for the\ndenoising process. In image-to-image tasks, the anomalous\nregion in the input image is masked to retain the normal\nregion, allowing the diffusion model to focus more effectively on reconstructing the abnormal area. As illustrated in\nTable 5, without AMN, the model’s results have a 1.1/1.8\ndecrease on the initial step and a 0.6/1.7 decrease after 5\n\n4.3. Visualization Results\nFigure 3 shows the qualitative results. It can be seen that\non the last task, all methods can show excellent anomaly\nreconstruction and anomaly location effects, however, ControlNet [47] and DiAD [13] have serious illusion on the\nreconstruction results of the previous task, and the results\nof anomaly localization also collapse, especially on the object class. Our method shows strong stability in continuous learning, which shows excellent anomaly reconstruction and localization effects not only in the latest task but\nalso in previous tasks. This indicates that our method effectively mitigates the hallucination problem caused by continual learning in diffusion models.\n\n\fStep\n\n1-10\n\n11\n\n12\n\n13\n\n14\n\n15\n\nFM\n\nControlNet\nw/o AMN\nw/o CDM\n\n95.8 / 97.8\n94.7 / 96.3\n95.8 / 98.1\n\n92.4 / 95.8\n94.9 / 96.3\n93.2 / 96.6\n\n93.2 / 96.2\n94.7 / 96.3\n93.1 / 96.4\n\n87.4 / 91.0\n93.8 / 94.0\n87.9 / 92.4\n\n86.9 / 91.2\n94.0 / 93.6\n88.3 / 91.4\n\n82.6 / 91.8\n94.3 / 94.0\n90.6 / 93.5\n\n13.46 / 4.46\n1.69 / 1.55\n5.36 / 2.55\n\nCDAD\n\n95.8 / 98.1\n\n95.8 / 97.3\n\n95.3 / 97.4\n\n94.0 / 95.5\n\n94.3 / 95.1\n\n94.9 / 95.7\n\n1.01 / 0.74\n\nTable 5. Ablation study results (image-level/pixel-level A-AUROC (↑) and FM (↓) on setting 4 of MVTec.\n\nsteps of continuous learning. and finally. Interestingly, the\nuse of AMN reduces the forgetting rate of the Model by\n0.68/0.81, suggesting that AMN not only enhances the performance of diffusion models in anomaly detection but also\nbetter combats forgetting.\n\n0.8\n\n0.8\n\n0.8\n\n\u0000&amp;\u0000R\u0000X\u0000Q\u0000W\u0000\u0003\u0000\u000b\u0000\u0014\u0000H\u0000\u0019\u0000\f\n\n1.0 1e6\n\n\u0000&amp;\u0000R\u0000X\u0000Q\u0000W\u0000\u0003\u0000\u000b\u0000\u0014\u0000H\u0000\u0019\u0000\f\n\n1.0 1e6\n\n\u00006\u00009\u0000'\n\n\u0000&amp;\u0000R\u0000X\u0000Q\u0000W\u0000\u0003\u0000\u000b\u0000\u0014\u0000H\u0000\u0019\u0000\f\n\n1.0 1e6\n\n\u00002\u0000U\u0000L\u0000J\u0000L\u0000Q\u0000D\u0000O\n\n0.2\n\n0.2\n\n0.2\n\n0.0\n-0.05\n\n0.00\n\n\u00009\u0000D\u0000O\u0000X\u0000H\n\n0.05\n\n0.0\n-0.05\n\n0.00\n\n\u00009\u0000D\u0000O\u0000X\u0000H\n\n0.05\n\n0.0\n-0.05\n\nn=5\n\n\u0000S\u0000L\u0000[\u0000H\u0000O\u0000\u0003\u0000$\u0000\u0010\u0000$\u00008\u00005\u00002\u0000&amp;\n\n\u0000L\u0000P\u0000D\u0000J\u0000H\u0000\u0003\u0000)\u00000\n\n\u0000S\u0000L\u0000[\u0000H\u0000O\u0000\u0003\u0000)\u00000\n\n\u0000\u001c\u0000\u0017\u0000\u0011\u0000\u0018\n\u0000\u001c\u0000\u0016\u0000\u0011\u0000\u0018\n\u0000\u001c\u0000\u0015\u0000\u0011\u0000\u0018\n\u0000\u0013\u0000\u0011\u0000\u0013\n\u0000\u0014\u0000\u0011\u0000\u0013\n\u0000\u0015\u0000\u0011\u0000\u0013\n\n\u0000L\u00006\u00009\u0000'\nn=1\n\n\u0000L\u0000P\u0000D\u0000J\u0000H\u0000\u0003\u0000$\u0000\u0010\u0000$\u00008\u00005\u00002\u0000&amp;\n\u0000\u001c\u0000\u0018\u0000\u0011\u0000\u0018\n\nn=10\n\n\u0000\u0016\u0000\u0011\u0000\u0013\n\u0000\u0017\u0000\u0011\u0000\u0013\n\u0000\u0013\n\n\u0000\u0013\u0000\u0011\u0000\u0018\n\n\u0000\u0013\u0000\u0011\u0000\u001b\n\nγth\n\n\u0000\u0013\u0000\u0011\u0000\u001c\n\n\u0000\u0013\u0000\u0011\u0000\u001c\u0000\u001c\u0000\u001c\n\n\u0000\u0014\u0000\u0011\u0000\u0013\n\nFigure 5. Impact of γth on A-AUROC (↑) and FM (↓) under setting 2 of MVTec.\n\n0.00\n\n\u00009\u0000D\u0000O\u0000X\u0000H\n\n0.05\n\nFigure 4. Value distribution of original matrix. Value distribution\nafter projected by SVD and iSVD. n is the number of split blocks.\n\n4.5. Validation Experiments of iSVD\nWe complete the experiments to verify the effectiveness of\niSVD. Specifically, we expand an intermediate feature map\nof U-Net into a matrix, using SVD and iSVD to project this\nmatrix into its orthogonal space. Figure 4 illustrates the\nvalue distribution of the matrix before and after projection,\nthe matrix size is 1280 × 50000 and the threshold for k-rank\napproximate is 0.98. It can be seen that the distribution of\nfeatures is relatively uniform before projection, and after\nSVD projection, the distribution of values is concentrated\naround 0. iSVD shows almost the same performance as\nSVD, which verifies that the significant representation calculated by iSVD is effective. In addition, we also find that\nwith the increase of the number of split blocks, the effect\nof iSVD becomes worse, this is because the k-rank approximate is performed at each iteration, which loses part of the\ninformation. However, continuous learning can not project\ngradients 100% into the orthogonal space of the previous\ntask, which will harm the model’s plasticity to new tasks,\nso the information loss of iSVD is acceptable.\n\n4.6. Hyper-parameter Analysis\nWe complete the effect of the threshold γth of k-rank approximation. γth is the threshold for selecting the significant representation in the unitary matrix, used to control the\namount of information retained from previous tasks. Figure\n4 illustrates the effect of γth under setting 2 of MVTec. As\nshown, when γth = 0, the model experiences significant\nforgetting and performance degradation. As γth increases,\n\nboth the forgetting rate and performance improve. When\nγth = 1.0, although the forgetting rate is minimal, performance drops due to the model retaining all column bases\nfrom previous tasks, which interferes with learning new\ntasks. Even when γth = 0.999, the selected vectors are only\na small subset of the unitary matrix, preserving the core\nknowledge of previous tasks while maintaining the model’s\nplasticity to new tasks. Therefore, we set γ = 0.999.\n\n5. Conclusion\nIn this paper, we propose a continual diffusion model for\nanomaly detection termed CDAD, which continually learns\nanomaly detection for new tasks. First, we introduce a\ncontinual diffusion model framework that uses significant\nrepresentation to project the training gradient of the new\ntask to a direction having less influence on the previous\ntasks, to ensure the stability of the model. Second, we\npropose the iterative singular value decomposition, which\ngreatly alleviates the memory pressure of computing the\nsignificant representation for diffusion models. Finally, an\nanomaly-masked network is proposed as a control mechanism for the diffusion model. The experimental results\nshow that both the anomaly detection performance and\nanti-forgetting capability of our method are state-of-the-art.\nAcknowledgments This work is supported by the\nNational Natural Science Foundation of China\nNo.62222602, 62176092, U23A20343, 62106075,\n62302167, 62302296, 721928221, Shanghai Sailing\nProgram (23YF1410500), Natural Science Foundation of Shanghai (23ZR1420400), Natural Science\nFoundation of Chongqing, China (CSTB2023NSCQJQX0007, CSTB2023NSCQ-MSX0137), CCF-Tencent\nRAGR20240122, and Development Project of Ministry of\nIndustry and Information Technology (ZTZB.23-990-016).\n\n\fReferences\n[1] Rahaf Aljundi, Francesca Babiloni, Mohamed Elhoseiny,\nMarcus Rohrbach, and Tinne Tuytelaars. Memory aware\nsynapses: Learning what (not) to forget. In Proceedings\nof the European conference on computer vision, pages 139–\n154, 2018. 6\n[2] Kilian Batzner, Lars Heckler, and Rebecca König. Efficientad: Accurate visual anomaly detection at millisecond-level\nlatencies. arXiv preprint arXiv:2303.14535, 2023. 2\n[3] Paul Bergmann, Michael Fauser, David Sattlegger, and\nCarsten Steger. Mvtec ad–a comprehensive real-world\ndataset for unsupervised anomaly detection. In Proceedings\nof the IEEE/CVF conference on computer vision and pattern\nrecognition, pages 9592–9600, 2019. 2, 5, 7, 1\n[4] Paul Bergmann, Michael Fauser, David Sattlegger, and\nCarsten Steger. Uninformed students: Student-teacher\nanomaly detection with discriminative latent embeddings. In\nProceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 4183–4192, 2020. 1\n[5] Qiyu Chen, Huiyuan Luo, Chengkan Lv, and Zhengtao\nZhang. A unified anomaly synthesis strategy with gradient ascent for industrial anomaly detection and localization.\narXiv preprint arXiv:2407.09359, 2024. 2\n[6] Niv Cohen and Yedid Hoshen. Sub-image anomaly detection with deep pyramid correspondences. arXiv preprint\narXiv:2005.02357, 2020. 2\n[7] Thomas Defard, Aleksandr Setkov, Angelique Loesch, and\nRomaric Audigier. Padim: a patch distribution modeling\nframework for anomaly detection and localization. In International Conference on Pattern Recognition, pages 475–489.\nSpringer, 2021. 2\n[8] Zheng Fang, Xiaoyang Wang, Haocheng Li, Jiejie Liu, Qiugui Hu, and Jimin Xiao. Fastrecon: Few-shot industrial anomaly detection via fast feature reconstruction. In\nProceedings of the IEEE/CVF International Conference on\nComputer Vision, pages 17481–17490, 2023. 2\n[9] Matic Fučka, Vitjan Zavrtanik, and Danijel Skočaj.\nTransfusion–a transparency-based diffusion model for\nanomaly detection. In Proceedings of the European conference on computer vision, pages 91–108. Springer, 2025. 1\n[10] Zhihao Gu, Liang Liu, Xu Chen, Ran Yi, Jiangning Zhang,\nYabiao Wang, Chengjie Wang, Annan Shu, Guannan Jiang,\nand Lizhuang Ma. Remembering normality: Memoryguided knowledge distillation for unsupervised anomaly detection. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 16401–16409, 2023. 2\n[11] Hewei Guo, Liping Ren, Jingjing Fu, Yuwang Wang,\nZhizheng Zhang, Cuiling Lan, Haoqian Wang, and Xinwen\nHou. Template-guided hierarchical feature restoration for\nanomaly detection. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 6447–6458,\n2023. 2\n[12] Haoyang He, Yuhu Bai, Jiangning Zhang, Qingdong He,\nHongxu Chen, Zhenye Gan, Chengjie Wang, Xiangtai Li,\nGuanzhong Tian, and Lei Xie. Mambaad: Exploring state\n\nspace models for multi-class unsupervised anomaly detection. arXiv preprint arXiv:2404.06564, 2024. 2\n[13] Haoyang He, Jiangning Zhang, Hongxu Chen, Xuhai Chen,\nZhishan Li, Xu Chen, Yabiao Wang, Chengjie Wang, and Lei\nXie. A diffusion-based framework for multi-class anomaly\ndetection. In Proceedings of the AAAI Conference on Artificial Intelligence, pages 8472–8480, 2024. 1, 2, 6, 7, 3\n[14] Liren He, Zhengkai Jiang, Jinlong Peng, Liang Liu, Qiangang Du, Xiaobin Hu, Wenbing Zhu, Mingmin Chi, Yabiao\nWang, and Chengjie Wang. Learning unified reference representation for unsupervised multi-class anomaly detection.\narXiv preprint arXiv:2403.11561, 2024. 2\n[15] Teng Hu, Jiangning Zhang, Ran Yi, Yuzhen Du, Xu Chen,\nLiang Liu, Yabiao Wang, and Chengjie Wang. Anomalydiffusion: Few-shot anomaly image generation with diffusion\nmodel. In Proceedings of the AAAI Conference on Artificial\nIntelligence, pages 8526–8534, 2024. 2\n[16] Lei Huang, Weijiang Yu, Weitao Ma, Weihong Zhong,\nZhangyin Feng, Haotian Wang, Qianglong Chen, Weihua\nPeng, Xiaocheng Feng, Bing Qin, et al. A survey on\nhallucination in large language models: Principles, taxonomy, challenges, and open questions. arXiv preprint\narXiv:2311.05232, 2023. 2\n[17] James Kirkpatrick, Razvan Pascanu, Neil Rabinowitz, Joel\nVeness, Guillaume Desjardins, Andrei A Rusu, Kieran\nMilan, John Quan, Tiago Ramalho, Agnieszka GrabskaBarwinska, et al. Overcoming catastrophic forgetting in neural networks. Proceedings of the national academy of sciences, 114(13):3521–3526, 2017. 2, 6\n[18] Xia Kong, Zuodong Gao, Xiaofan Li, Ming Hong, Jun Liu,\nChengjie Wang, Yuan Xie, and Yanyun Qu. En-compactness:\nSelf-distillation embedding &amp; contrastive generation for generalized zero-shot learning. In Proceedings of the IEEE/CVF\nConference on Computer Vision and Pattern Recognition,\npages 9306–9315, 2022. 2\n[19] Chun-Liang Li, Kihyuk Sohn, Jinsung Yoon, and Tomas\nPfister. Cutpaste: Self-supervised learning for anomaly detection and localization. In IEEE Conference on Computer\nVision and Pattern Recognition, CVPR 2021, virtual, June\n19-25, 2021, pages 9664–9674. Computer Vision Foundation / IEEE, 2021. 1\n[20] Wujin Li, Jiawei Zhan, Jinbao Wang, Bizhong Xia, Bin-Bin\nGao, Jun Liu, Chengjie Wang, and Feng Zheng. Towards\ncontinual adaptation in industrial anomaly detection. In Proceedings of the 30th ACM International Conference on Multimedia, pages 2871–2880, 2022. 3, 5, 1\n[21] Xiaofan Li, Yachao Zhang, Shiran Bian, Yanyun Qu, Yuan\nXie, Zhongchao Shi, and Jianping Fan. Vs-boost: Boosting\nvisual-semantic association for generalized zero-shot learning. In Proceedings of the Thirty-Second International Joint\nConference on Artificial Intelligence, IJCAI 2023, 19th-25th\nAugust 2023, Macao, SAR, China, pages 1107–1115. ijcai.org, 2023. 2\n[22] Xiaofan Li, Zhizhong Zhang, Xin Tan, Chengwei Chen,\nYanyun Qu, Yuan Xie, and Lizhuang Ma. Promptad: Learning prompts with only normal samples for few-shot anomaly\ndetection. In Proceedings of the IEEE/CVF Conference on\n\n\fComputer Vision and Pattern Recognition, pages 16838–\n16848, 2024. 1, 2\n[23] Zechao Li, Jinhui Tang, and Tao Mei. Deep collaborative\nembedding for social image understanding. IEEE transactions on pattern analysis and machine intelligence, 41(9):\n2070–2083, 2018. 2\n[24] Zechao Li, Yanpeng Sun, Liyan Zhang, and Jinhui Tang. Ctnet: Context-based tandem network for semantic segmentation. IEEE Transactions on Pattern Analysis and Machine\nIntelligence, 44(12):9904–9917, 2021. 2\n[25] Jiaqi Liu, Kai Wu, Qiang Nie, Ying Chen, Bin-Bin\nGao, Yong Liu, Jinbao Wang, Chengjie Wang, and Feng\nZheng. Unsupervised continual anomaly detection with\ncontrastively-learned prompt. In Proceedings of the AAAI\nConference on Artificial Intelligence, pages 3639–3647,\n2024. 3, 6, 2\n[26] Zhikang Liu, Yiming Zhou, Yuansheng Xu, and Zilei Wang.\nSimplenet: A simple network for image anomaly detection\nand localization. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages\n20402–20411, 2023. 2\n[27] Ruiying Lu, YuJie Wu, Long Tian, Dongsheng Wang, Bo\nChen, Xiyang Liu, and Ruimin Hu. Hierarchical vector\nquantized transformer for multi-class unsupervised anomaly\ndetection. Advances in Neural Information Processing Systems, 36:8487–8500, 2023. 2\n[28] Patrick Pérez, Michel Gangnet, and Andrew Blake. Poisson\nimage editing. In Seminal Graphics Papers: Pushing the\nBoundaries, Volume 2, pages 577–582. 2023. 1\n[29] Jingyang Qiao, Xin Tan, Chengwei Chen, Yanyun Qu, Yong\nPeng, Yuan Xie, et al. Prompt gradient projection for continual learning. In The Twelfth International Conference on\nLearning Representations, 2023. 2\n[30] Robin Rombach, Andreas Blattmann, Dominik Lorenz,\nPatrick Esser, and Björn Ommer. High-resolution image\nsynthesis with latent diffusion models. In Proceedings of\nthe IEEE/CVF conference on computer vision and pattern\nrecognition, pages 10684–10695, 2022. 2, 3\n[31] Karsten Roth, Latha Pemula, Joaquin Zepeda, Bernhard\nSchölkopf, Thomas Brox, and Peter Gehler. Towards total recall in industrial anomaly detection. In Proceedings of\nthe IEEE/CVF Conference on Computer Vision and Pattern\nRecognition, pages 14318–14328, 2022. 2\n[32] Marco Rudolph, Bastian Wandt, and Bodo Rosenhahn. Same\nsame but differnet: Semi-supervised defect detection with\nnormalizing flows. In IEEE Winter Conference on Applications of Computer Vision, WACV 2021, Waikoloa, HI, USA,\nJanuary 3-8, 2021, pages 1906–1915. IEEE, 2021. 2\n[33] Nataniel Ruiz, Yuanzhen Li, Varun Jampani, Yael Pritch,\nMichael Rubinstein, and Kfir Aberman. Dreambooth: Fine\ntuning text-to-image diffusion models for subject-driven\ngeneration. In Proceedings of the IEEE/CVF conference\non computer vision and pattern recognition, pages 22500–\n22510, 2023. 2\n[34] Gobinda Saha, Isha Garg, and Kaushik Roy. Gradient\nprojection memory for continual learning. arXiv preprint\narXiv:2103.09762, 2021. 2\n\n[35] Mohammadreza Salehi, Niousha Sadjadi, Soroosh\nBaselizadeh, Mohammad H Rohban, and Hamid R Rabiee. Multiresolution knowledge distillation for anomaly\ndetection.\nIn Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages\n14902–14912, 2021. 2\n[36] Hannah M Schlüter, Jeremy Tan, Benjamin Hou, and Bernhard Kainz. Natural synthetic anomalies for self-supervised\nanomaly detection and localization. In Proceedings of the\nEuropean conference on computer vision, pages 474–489.\nSpringer, 2022. 2, 1\n[37] Jiaming Song, Chenlin Meng, and Stefano Ermon.\nDenoising diffusion implicit models.\narXiv preprint\narXiv:2010.02502, 2020. 6\n[38] Jiaqi Tang, Hao Lu, Xiaogang Xu, Ruizheng Wu, Sixing Hu,\nTong Zhang, Tsz Wa Cheng, Ming Ge, Ying-Cong Chen, and\nFugee Tsung. An incremental unified framework for small\ndefect inspection. In European Conference on Computer Vision, pages 307–324. Springer, 2025. 3, 5, 6, 2\n[39] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia\nPolosukhin. Attention is all you need. Advances in neural\ninformation processing systems, 30, 2017. 2\n[40] Guodong Wang, Shumin Han, Errui Ding, and Di Huang.\nStudent-teacher feature pyramid matching for anomaly detection. arXiv preprint arXiv:2103.04257, 2021. 2\n[41] Zhen Wang, Liu Liu, Yiqun Duan, Yajing Kong, and\nDacheng Tao. Continual learning with lifelong vision transformer. In Proceedings of the IEEE/CVF Conference on\nComputer Vision and Pattern Recognition, pages 171–181,\n2022. 6\n[42] Yao Wu, Mingwei Xing, Yachao Zhang, Yuan Xie, Zongze\nWu, and Yanyun Qu. Perturbed progressive learning for\nsemisupervised defect segmentation. IEEE Transactions on\nNeural Networks and Learning Systems, 35(5):6118–6132,\n2023. 1\n[43] Hang Yao, Ming Liu, Haolin Wang, Zhicun Yin, Zifei Yan,\nXiaopeng Hong, and Wangmeng Zuo. Glad: Towards better reconstruction with global and local adaptive diffusion\nmodels for unsupervised anomaly detection. arXiv preprint\narXiv:2406.07487, 2024. 1, 2\n[44] Zhiyuan You, Lei Cui, Yujun Shen, Kai Yang, Xin Lu,\nYu Zheng, and Xinyi Le. A unified model for multi-class\nanomaly detection. Advances in Neural Information Processing Systems, 35:4571–4584, 2022. 2, 5, 6\n[45] Vitjan Zavrtanik, Matej Kristan, and Danijel Skočaj. Draema discriminatively trained reconstruction embedding for surface anomaly detection. In Proceedings of the IEEE/CVF\nInternational Conference on Computer Vision, pages 8330–\n8339, 2021. 2\n[46] Friedemann Zenke, Ben Poole, and Surya Ganguli. Continual learning through synaptic intelligence. In International\nconference on machine learning, pages 3987–3995. PMLR,\n2017. 6\n[47] Lvmin Zhang, Anyi Rao, and Maneesh Agrawala. Adding\nconditional control to text-to-image diffusion models. In\nProceedings of the IEEE/CVF International Conference on\nComputer Vision, pages 3836–3847, 2023. 2, 6, 7, 3\n\n\f[48] Xinyi Zhang, Naiqi Li, Jiawei Li, Tao Dai, Yong Jiang,\nand Shu-Tao Xia. Unsupervised surface anomaly detection\nwith diffusion probabilistic model. In Proceedings of the\nIEEE/CVF International Conference on Computer Vision,\npages 6782–6791, 2023. 1, 2\n[49] Yang Zou, Jongheon Jeong, Latha Pemula, Dongqing Zhang,\nand Onkar Dabeer. Spot-the-difference self-supervised pretraining for anomaly detection and segmentation. In Proceedings of the European conference on computer vision,\npages 392–408. Springer, 2022. 2, 5, 1\n\n\fOne-for-More: Continual Diffusion Model for Anomaly Detection\nSupplementary Material\nA. Experimental details\n\nOriginal image\n\nData pre-processing. We employ the data pre-processing\npipeline specified in DiAD [13] for both the MVTec [3] and\nVisA [49] datasets to mitigate potential train-test discrepancies. This involves channel-wise standardization using\nprecomputed mean [0.485, 0.456, 0.406] and standard deviation [0.229, 0.224, 0.225] after normalizing each RGB image to [0, 1].\nPatch perturbation. We adopt the method proposed by\nNSA [36] for patch perturbation on the original images.\nThe NSA method builds upon the Cut-paste technique [19]\nand enhances it by incorporating the Poisson image editing method [28] to alleviate the discontinuities caused by\npasting image patches. The cut-paste method is commonly\nused in the anomaly detection domain to generate simulated anomalous images. It involves randomly cropping a\npatch from one image and pasting it onto a random location in another image, thus creating a simulated anomaly.\nThe Poisson-based pasting method seamlessly blends the\ncloned object from one image into another by solving Poisson partial differential equations, thereby better simulating\na realistic anomalous region. In this paper, the number of\npatches is set as a random value from 1 to 4, and the patch\nsize is a random value from 0.03 to 0.4 of the original image size. The visualization of patch perturbation is shown\nin Figure 6.\n\n(FM) for N continual steps. Specially, we define Apix\nN,i and\nimg\nAN,i as the test AUROC of task i after training on task N .\n  \\mathrm {A\\textbf {-}AUROC}=\\left \\{\\begin {array}{l} \\frac {1}{N} \\sum _{i=1}^{N-1} A_{N, i}^{\\mathrm {pix}} \\\\ \\frac {1}{N} \\sum _{i=1}^{N-1} A_{N, i}^{\\mathrm {img}} \\end {array},\\right . \\label {a-auroc} \n\n(13)\n\n  \\mathrm {FM}=\\left \\{\\begin {array}{l} \\frac {1}{N-1} \\sum _{i=1}^{N-1} \\max _{b \\in \\{1, \\cdots , N-1\\}}\\left (A_{b, i}^{\\mathrm {pix}}-A_{N, i}^{\\mathrm {pix}}\\right ) \\\\ \\frac {1}{N-1} \\sum _{i=1}^{N-1} \\max _{b \\in \\{1, \\cdots , N-1\\}}\\left (A_{b, i}^{\\mathrm {img}}-A_{N, i}^{\\mathrm {img}}\\right ) \\end {array}\\right . \\label {fm} \n(14)\nIn addition to the results for the AUROC documented in\nthe body of the paper, We also supplement the image-level\nPrecision-Recall (AUPR) results and pixel-level Per-regionoverlap (PRO) [3, 4] results. Referring to Equation (13) and\nEquation (14), we calculate A-AUPR, A-PRO, and their FM\nto evaluate our method. The results are shown in Table 6 7\n9 10. Our method still achieves an advanced level in the\nabove metrics.\n\nB. Memory Analysis of iSVD\nIn Section 3.2, considering the storage of the original matrix\nand U , Σ, V during SVD, the memory overhead of SVD is\ndΛ + d2 + Λ2 + min(d, Λ), while iSVD uses a memory\noverhead of d(m + k) + d2 + (m + k)2 + min(d, m + k).\nIt is known that Λ ≫ d, m &gt; d &gt; k and Λ = mn, thus, the\nmemory saving rate of iSVD is about:\n\nPatch perturbation\n\n  \\begin {aligned} &amp; \\frac {d\\Lambda + d^2+\\Lambda ^2+d - [d(m+k) + d^2 + (m+k)^2 + d]}{d\\Lambda + d^2+\\Lambda ^2+d} \\\\ = &amp; \\frac {d\\Lambda +\\Lambda ^2 - d(m+k) - (m+k)^2 }{\\Lambda ^2}/\\frac {d\\Lambda + d^2+\\Lambda ^2+d}{\\Lambda ^2} \\\\ = &amp; \\frac {d}{\\Lambda } + 1 - \\frac {d(m+k)}{\\Lambda ^2} - \\frac {(m+k)^2}{\\Lambda ^2} \\\\ \\approx &amp; 1-\\frac {m^2+2mk+k^2}{m^2n^2} \\\\ = &amp; 1 - \\frac {1}{n^2} - \\frac {2k}{m\\Lambda } - \\frac {k^2}{\\Lambda ^2} \\approx \\frac {n^2-1}{n^2}. \\end {aligned} \\label {eq:amn} \n\nFigure 6. Qualitative results of logical anomaly detection.\n\nEvaluation metrics. We follow the literature [3] in reporting the Area Under the Receiver Operation Characteristic\n(AUROC) for both image-level and pixel-level anomaly detection. To measure the performance of the model in continuous learning, referring to DNE [20], we calculated the\naverage AUROC (A-AUROC) and the forgetting measure\n\n(15)\nIn practice, the actual memory saving rate differs from the\ntheoretical value due to factors such as memory sharing.\nTaking the intermediate features of ten images as an example, Figure 7 shows the actual and theoretical memory\nsaving rate of splitting the feature matrix into n blocks for\niSVD. Although there are some differences between the theoretical value and the actual value, the general trend is consistent.\n\n\f14 – 1 with 1 Step\n\nMethod\n\n10 – 5 with 1 Step\n\n3 × 5 with 5 Steps\n\n10 – 1 × 5 with 5 Steps\n\nA-AUPR (↑)\n\nFM (↓)\n\nA-AUPR (↑)\n\nFM (↓)\n\nA-AUPR (↑)\n\nFM (↓)\n\nA-AUPR (↑)\n\nFM (↓)\n\nUCAD* [25]\nIUF [38]\nControlNet [47]\nDiAD [13]\n\n95.8\n97.8\n97.2\n97.4\n\n0.26\n0.25\n1.55\n0.71\n\n95.0\n95.4\n96.7\n96.4\n\n0.98\n1.92\n1.76\n1.85\n\n93.1\n91.1\n86.7\n89.1\n\n2.02\n2.86\n6.40\n4.31\n\n95.5\n95.3\n89.0\n91.4\n\n0.07\n0.16\n7.43\n4.83\n\nCDAD\n\n98.4\n\n0.08\n\n98.3\n\n0.55\n\n95.8\n\n1.88\n\n98.4\n\n0.02\n\nTable 6. Image-level A-AUPR of our method on MVTec under 4 continual anomaly detection settings. The best and second-best results\nare marked in blod and underline. ∗ indicates memory limited.\n\n14 – 1 with 1 Step\n\n10 – 5 with 1 Step\n\n3 × 5 with 5 Steps\n\n10 – 1 × 5 with 5 Steps\n\nA-PRO (↑)\n\nFM (↓)\n\nA-PRO (↑)\n\nFM (↓)\n\nA-PRO (↑)\n\nFM (↓)\n\nA-PRO (↑)\n\nFM (↓)\n\nUCAD [25]\nIUF [38]\nControlNet [47]\nDiAD [13]\n\n86.3\n88.6\n88.5\n88.9\n\n1.16\n0.62\n1.75\n0.85\n\n80.7\n85.0\n85.8\n87.4\n\n2.89\n3.22\n4.70\n3.91\n\n71.1\n72.9\n71.5\n72.1\n\n7.48\n5.79\n10.0\n9.23\n\n80.8\n84.3\n77.9\n83.1\n\n1.19\n2.41\n7.11\n2.93\n\nCDAD\n\n89.8\n\n0.47\n\n88.9\n\n2.57\n\n83.8\n\n4.05\n\n89.2\n\n1.16\n\nMethod\n\n\u00000\u0000H\u0000P\u0000R\u0000U\u0000\\\u0000\u0003\u0000V\u0000D\u0000Y\u0000L\u0000Q\u0000J\u0000\u0003\u0000U\u0000D\u0000W\u0000L\u0000Q\u0000J\u0000\u0003\u0000\u000b\u0000\b\u0000\f\n\nTable 7. Pixel-level A-PRO of our method on MVTec under 4 continual anomaly detection settings. The best and second-best results are\nmarked in blod and underline. ∗ indicates memory limited.\n\n100\ne=1\ne=2\ne=4\ne=6\n\n80\n60\n40\n20\n0 1\n\n2\n\n5\n\nTheoretical\nActual\n10\n\n\u00001\u0000X\u0000P\u0000E\u0000H\u0000U\u0000\u0003\u0000R\u0000I\u0000\u0003\u0000V\u0000S\u0000O\u0000L\u0000W\u0000\u0003\u0000E\u0000O\u0000R\u0000F\u0000N\u0000V\u0000\u0003\u0000\u000b\u0000Q\u0000\f\n\nFigure 7. The theoretical and actual values of the memory saving\nratio when the different number of split blocks is used.\n\nIn this paper, we determine the number of blocks n according to the number of images of the old task. Specifically, we first sample the old task dataset, randomly retain\n10% of the images, and then group according to the number of sampled images (denoted as Nimg ). The number of\nN\ngroups in iSVD is n = img\ne . In this paper, e is set to 1 by\ndefault, that is, the intermediate features of each image are\ndivided into a separate group for iSVD operation.\nIn addition, we analyze the impact of different e on the\nmodel and the time and memory overhead. Table 8 records,\nfor setting different e, the anomaly detection results of our\nmodel on MVTec setting 2, as well as the time and memory overhead for computing the significant representation of\nthe old task. When e is set to different values, the anomaly\n\nA-AUROC\n\nFM\n\nMemory\n\nTimes\n\n94.2 / 95.3\n94.1 / 95.4\n94.4 / 95.6\n94.5 / 95.7\n\n2.05 / 2.40\n2.10 / 2.32\n1.95 / 2.21\n1.91 / 2.23\n\n16.7GB\n30.3GB\n57.9GB\n85.9GB\n\n33.5h\n28.3h\n22.6h\n20.2h\n\nTable 8. The impact of different e on the model and the time and\nmemory overhead of iSVD under MVTec Setting 2.\n\ndetection results and forgetting rate of the model will not\nhave much influence. Although we discussed in Section 4.5\nthat the large number of split blocks will affect the performance of iSVD, it will not impair its representation ability of core information, so it can still ensure the continuous learning ability of the model. Table 8 also shows that\nwith the increase of e, the memory consumption increases,\nbut the time cost decreases, which indicates that although\niSVD can greatly alleviate the pressure of memory, it will\nbring extra time cost.\n\nC. Qualitative Results\nWe supplement the qualitative results on MVTec and VisA\ndatasets, which show the localization image reconstruction\nresults and anomaly localization results for the seven tasks,\nrespectively, as shown in Figure 8-14. Our method not only\novercomes the “faithfulness hallucination” problem of the\ndiffusion model but also shows excellent anomaly localization results.\n\n\fMethod\n\n11 – 1 with 1 Step\n\n8 – 4 with 1 Step\n\n8 – 1 × 4 with 4 Steps\n\nA-AUROC (↑)\n\nFM (↓)\n\nA-AUROC (↑)\n\nFM (↓)\n\nA-AUROC (↑)\n\nFM (↓)\n\nUCAD* [25]\nIUF [38]\nControlNet [47]\nDiAD [13]\n\n88.1\n91.6\n85.2\n74.9\n\n0.29\n-0.04\n2.38\n5.42\n\n83.2\n83.4\n78.8\n70.1\n\n5.17\n7.51\n6.25\n12.29\n\n82.9\n83.0\n72.4\n59.5\n\n2.16\n6.87\n4.56\n9.55\n\nCDAD\n\n89.4\n\n-0.77\n\n85.3\n\n3.1\n\n84.7\n\n1.83\n\nTable 9. Image-level A-AUPR of our method on VisA under 3 continual anomaly detection settings. The best and second-best results are\nmarked in blod and underline. ∗ indicates memory limited.\n\nMethod\n\n11 – 1 with 1 Step\n\n8 – 4 with 1 Step\n\n8 – 1 × 4 with 4 Steps\n\nA-PRO (↑)\n\nFM (↓)\n\nA-PRO (↑)\n\nFM (↓)\n\nA-PRO (↑)\n\nFM (↓)\n\nUCAD* [25]\nIUF [38]\nControlNet [47]\nDiAD [13]\n\n80.4\n82.0\n62.3\n69.9\n\n2.02\n1.04\n2.45\n4.33\n\n72.4\n63.9\n61.0\n67.7\n\n7.46\n20.8\n1.81\n8.29\n\n70.5\n57.0\n51.7\n55.0\n\n9.83\n23.95\n10.38\n11.74\n\nCDAD\n\n81.6\n\n-0.22\n\n78.9\n\n1.59\n\n77.7\n\n1.66\n\nTable 10. Pixel-level A-PRO of our method on VisA under 3 continual anomaly detection settings. The best and second-best results are\nmarked in blod and underline. ∗ indicates memory limited.\n1-14\n\n15\n\nInput\nOutput\nHeatmap\nGT\n\nFigure 8. Qualitative comparison results under setting 1 of MVTec, the numbers represent continual training classes.\n1-15\n\n14-15\n\nInput\nOutput\nHeatmap\nGT\n\nFigure 9. Qualitative comparison results under setting 2 of MVTec, the numbers represent continual training classes.\n\n\f1-3\n\n4-6\n\n7-9\n\n10-12\n\n13-15\n\nInput\nOutput\nHeatmap\nGT\n\nFigure 10. Qualitative comparison results under setting 3 of MVTec, the numbers represent continual training classes.\n1-10\n\n11\n\n12\n\n13\n\n14\n\n15\n\nInput\nOutput\nHeatmap\nGT\n\nFigure 11. Qualitative comparison results under setting 4 of MVTec, the numbers represent continual training classes.\n\n1-11\nInput\nOutput\nHeatmap\nGT\n\nFigure 12. Qualitative comparison results under setting 5 of VisA, the numbers represent continual training classes.\n\n12\n\n\f1-8\n\n9-12\n\nInput\nOutput\nHeatmap\nGT\n\nFigure 13. Qualitative comparison results under setting 6 of VisA, the numbers represent continual training classes.\n\n1-8\n\n9\n\n10\n\n11\n\nInput\nOutput\nHeatmap\nGT\n\nFigure 14. Qualitative comparison results under setting 7 of VisA, the numbers represent continual training classes.\n\n12\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"