"<!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>Order within Chaos: Capturing Intrinsic Energy Anomalies for AI-Manipulated\nImage Forgery Localization\n\nYiming Wang 1 Baiqi Wu 1 Qingming Li * 1 Jiahao Chen 1 Tong Zhang 1 Shouling Ji 1\n\narXiv:2606.02178v1 [cs.CV] 1 Jun 2026\n\nAbstract\n\nmultaneously amplifies the risks of visual deception, ranging from the proliferation of misinformation to identity\nfraud (Times, 2024; News, 2024). This emerging threat necessitates the evolution of AI-Manipulated Image Forgery\nLocalization (AI-IFL), which advances beyond imagelevel classification to pixel-level localization that explicitly\ndelineates tampered regions for robust forensic verification\n(Kadha et al., 2025; Zou et al., 2025).\n\nRecent advancements in generative AI have led to\nimage editing models capable of producing realistic forgeries that evade traditional image forgery\nlocalization methods, as these approaches depend\non physical noise absent in synthetic data. To address this challenge, we theoretically demonstrate\nthat the diffusion process inherently suppresses local high-frequency variance, creating a statistical\nenergy gap that is distinguishable from the natural\nentropy of optical imaging. Guided by this insight,\nwe propose FLAME, a unified framework that utilizes a LAD map to capture these intrinsic anomalies, coupled with a parameter-efficient adapter\nfor SAM to achieve precise, pixel-level forgery\nlocalization. Furthermore, to bridge the lag between forensic benchmarks and evolving generative models, we introduce EditStream, an automated pipeline for continuous, instruction-based\ntraining data synthesis. Extensive experiments\ndemonstrate that FLAME establishes a new stateof-the-art, significantly outperforming previous\nmethods on AI-generated forgery datasets while\neffectively generalizing to unseen generative architectures. Our code is available at https:\n//github.com/phoenixnir/FLAME.\n\nThe primary objective of IFL is to localize manipulated\nregions within visual content. In the pre-AIGC era, IFL\nmethodologies relied on verifying the consistency of physical signals. These approaches operated on the premise that\nconventional manipulations (Zanardelli et al., 2023) such\nas splicing, disrupt the continuity of the physical imaging\npipeline, leaving discernible traces like sensor noise residuals and compression artifacts. However, the emergence of\nadvanced diffusion models (e.g., Stable Diffusion (Podell\net al., 2023), FLUX (Batifol et al., 2025), and DALL·E\n3 (Betker et al., 2023)) has precipitated a fundamental\nparadigm shift in the forensic landscape. The dominant\nforensic cues have transitioned from physical anomalies to\nsynthetic traces introduced by the generative process (Wang\net al., 2023; Cao et al., 2025). Consequently, traditional\nmethods often fail in this new context (Huang et al., 2025c).\nTo address the lack of physical signals, recent research (Xu\net al., 2025; Huang et al., 2025c) has pivoted towards\nsemantic-level scrutiny by leveraging MLLMs. These approaches treat forgery localization as a visual reasoning task,\nidentifying inconsistencies such as geometric contradictions.\nHowever, this direction faces a semantic illusion trap. Upto-date diffusion models possess such strong physical priors\nthat they generate semantically impeccable edits, leaving\nlittle semantic contradiction to exploit. Furthermore, the\ntokenization process inherent to MLLMs limits their visual\nperception to a coarse granularity (Naseer et al., 2021; Song\net al., 2024), rendering them blind to the subtle pixel-level\nimperfections that distinguish neural rendering from reality.\n\n1. Introduction\nRecent advancements in diffusion models have rendered synthetic images highly photorealistic and scalable (Rombach\net al., 2022; Kawar et al., 2023). Beyond text-to-image systems that generate high-fidelity content, instruction-based\nediting further enables the manipulation of real images,\nthereby streamlining creative workflows and facilitating\nartistic expression (Huang et al., 2025b). However, the\nwidespread availability of such powerful capabilities si-\n\nWe argue that for the AI-IFL task, the most reliable forensic evidence lies neither in missing physical sensors nor\nin semantic errors, but in the intrinsic statistical anomalies induced by the generative mechanism itself. From a\nstatistical mechanics perspective, diffusion models opti-\n\n1\nZhejiang University, Hangzhou, China. Correspondence to:\nQingming Li &lt;liqm@zju.edu.cn&gt;.\n\nProceedings of the 43 rd International Conference on Machine\nLearning, Seoul, South Korea. PMLR 306, 2026. Copyright 2026\nby the author(s).\n\n1\n\n\fOrder within Chaos\n\nFinally, to address the temporal obsolescence of static benchmarks, we introduce EditStream, a self-evolving data synthesis pipeline. By autonomously scouting and integrating\nemerging inpainting models, EditStream continuously updates the training distribution with novel artifact signatures.\nThis mechanism fosters a virtuous cycle, compelling the\nmodel to learn architecture-invariant representations and\nensuring robust generalization against unseen threats.\nIn summary, our contributions are as follows:\n\nFigure 1. The overall workflow of FLAME.\n\n1. We theoretically prove that the inherent spectral bias of\ndiffusion models inevitably induces distinct local energy\nanomalies, establishing a rigorous mathematical foundation\nfor forgery localization.\n\nmize an energy-based variational bound (Ho et al., 2020),\nwhich imposes a spectral bias: the denoising process tends\nto suppress high-frequency local variance to minimize energy (Rahaman et al., 2019). This creates a fundamental\ndistinguishability: while authentic regions retain the natural chaos of optical imaging with high entropy, generated\nregions collapse into a state of artificial order with low entropy. Motivated by this observation, we formulate AI-IFL\nthrough Gibbs energy modeling (Derin &amp; Elliott, 1987),\nwhich provides a principled way to characterize pixel-level\nlocal dependency structures. Here, pixel-level local dependency measures how each pixel statistically correlates with\nits neighborhood. Such local interactions can be expressed\nas spatial energy variations, allowing us to convert subtle\ndistributional differences into spatially coherent indicators\nthat facilitate precise localization.\n\n2. We propose FLAME, a unified framework for AI-IFL that\nleverages these intrinsic artifacts. By utilizing the LAD map\nfor feature extraction and a lightweight adapter-based SAM\nfor refinement, we achieve precise forgery localization.\n3. We develop EditStream, an automated pipeline for\ninstruction-based image editing, capable of integrating the\nlatest open-source models to generate diverse and challenging evaluation samples.\n4. Leveraging EditStream, we construct a new dataset based\non cutting-edge editing models. Comprehensive experiments validate that FLAME establishes a new state-of-theart in accuracy and robustness across multiple benchmarks.\n\n2. Related Work\n\nBased on this local dependency viewpoint, our theoretical\nanalysis identifies two diffusion-induced forensic signatures.\nFirst, generated regions often exhibit artificially regular local\nstatistics, forming low-energy basins compared to authentic content. Second, latent-space editing may disrupt local\ncorrelations near tampering boundaries, leading to a localized energy surge that highlights forgery. To quantify these\nsignatures, we introduce the Local Adjacency Discrepancy\n(LAD) map, which visualizes such statistical divergences\nand serves as a robust, content-agnostic forensic fingerprint.\n\nImage Forgery Localization. IFL addresses the challenge\nof verifying image integrity by locating tampered regions.\nTraditional methods target conventional manipulations such\nas splicing and copy-move, relying on low-level physical\nforensic cues (Liu et al., 2022; Guillaro et al., 2023; Bazyleva et al., 2025). These approaches can be broadly divided\ninto two categories. The first category focuses on detecting\nexplicit artifacts derived from reconstruction errors (Bazyleva et al., 2025) or JPEG compression traces. The second\ntargets implicit noise artifacts (Guillaro et al., 2023), where\ntrained networks like Noiseprint (Cozzolino &amp; Verdoliva,\n2019) extract specific sensor residuals. While effective\nfor physical manipulations, these methods suffer from significant performance degradation on AI-generated content\n(Huang et al., 2025c), as the generative process of diffusion models replaces camera sensor noise with synthetic\nsignatures, rendering traditional physical cues obsolete.\n\nBuilding upon the LAD map, we propose Fine-grained\nLocalization via Adjacency Map Energy (FLAME), a\nunified framework that implements a coarse-to-fine localization strategy. The architecture comprises two synergistic\nmodules. First, a lightweight LAD-Net extracts artifact\nfeatures from the LAD map to perform global image-level\nforgery detection and generate a preliminary coarse localization mask. Second, to achieve pixel-level precision, we\nincorporate a semantic refinement module based on SAM\n(Carion et al., 2025). By employing parameter-efficient\nadapters, this module aligns the low-level forensic cues with\nSAM’s powerful segmentation priors, utilizing the coarse\nprediction as a spatial prompt to accurately delineate complex forgery boundaries. The overall workflow is shown in\nFigure 1.\n\nTo adapt to this paradigm shift, current research has harnessed large foundation models. Some work (Li et al., 2024;\nZhu et al., 2025) utilizes the embedding space of vision\nencoders such as DINOv2 (Oquab et al., 2023) to detect\nsubtle synthetic distribution shifts. Concurrently, a new\nbranch employing MLLMs, such as SIDA (Huang et al.,\n2\n\n\fOrder within Chaos\nsource\n\n2025c) and FakeShield (Xu et al., 2025), exploits the textto-image alignment nature of diffusion models to localize\nforgeries while providing linguistic explanations (Huang\net al., 2025a). Despite these advancements, current methods\noften rely heavily on the generalizability of pre-trained encoders, potentially overlooking the intrinsic artifacts specific\nto the diffusion generation process (Cai et al., 2025).\nLocalized Image Generation. To benchmark IFL performance, the community has established several standard\ndatasets (Dong et al., 2013). Early contributions relied on\nmanually curated masks and prompts, limiting both scale\nand complexity (Zhang et al., 2023; Jia et al., 2023). Recent advancements introduce automated pipelines driven by\nMLLMs, which successfully enable large-scale data synthesis (Sun et al., 2024; Xu et al., 2025; Huang et al., 2025c).\nDespite this progress, existing generation protocols remain\nconstrained by two limitations: a temporal lag behind the\nrapidly iterating editing models and a scarcity of editing\ndiversity. These deficiencies compromise the alignment\nbetween benchmarks and real-world threats.\n\nmask\n\nEdited\n\nLAD map\n\nheatmap\n\nFigure 2. Visualization of the LAD map. From left to right, we\ndisplay the source, ground-truth mask, and edited images, followed\nby the LAD map and its energy heatmap.\n\n3.2. Artifact Separability via Gibbs Energy Modeling\n\n3. Theoretical Analysis\n\nTo quantify the statistical divergence between authentic and\nsynthetic patterns, we model the image lattice as a Gibbs\nRandom Field (GRF) (Derin &amp; Elliott, 1987). The probability distribution of an image x is governed by p(x) =\n1\nZ exp(−E(x)), where Z is the partition function and E(x)\nrepresents the total energy state. We focus on the local\npairwise potential V (p, q) between adjacent pixels p and q,\ndefined as a function of their intensity magnitude difference:\n\n3.1. Preliminaries\nLet x ∈ RH×W ×3 be an RGB image. The Latent Diffusion\nModel (LDM) consists of a pre-trained variational autoencoder (Kingma et al., 2013) with an encoder E, decoder D,\nand time-conditional denoising network ϵθ (Ho et al., 2020).\nThe image is first encoded into a reference latent represenh×w×c\ntation zref\n. The generative process is\n0 = E(x) ∈ R\nmodeled as a reverse Markov chain that progressively removes noise from a Gaussian prior zT ∼ N (0, I) to recover\nthe latent signal. The transition kernel pθ (zt−1 |zt ) is approximated by the denoiser ϵθ (zt , t), which minimizes the\nreweighted evidence lower bound:\n\u0002\n\u0003\nLLDM = Ez0 ,ϵ,t ∥ϵ − ϵθ (zt , t)∥22 ,\n(1)\n√\n√\nwhere zt = ᾱt z0 + 1 − ᾱt ϵ represents the forward\ndiffusion state at timestep t derived from sample z0 .\n\nV (p, q) = ρ (∥I(p) − I(q)∥2 ) .\n\nwhere I(p) and I(q) denote the RGB intensity vectors at\npixels p and q. This pairwise potential serves as a spatial\ndomain proxy for spectral energy. A high potential value\nimplies a large local gradient, which corresponds physically to the presence of high-frequency signal components.\nConversely, a low potential indicates local smoothness, dominated by low-frequency structures. Based on this formulation, we establish the following assumption regarding the\nseparability of authentic and generated distributions.\n\nLocalized editing aims to regenerate a specific region defined by a binary mask m (where m = 1 indicates the\nedited region) while preserving the authentic context. This\nis achieved via masked reverse sampling. At each reverse\nstep t → t − 1, the latent state is composited as follows:\nref\nzt−1 = m ⊙ ẑgen\nt−1 + (1 − m) ⊙ zt−1 ,\n{z\n}\n| {z } |\nGenerated\n\n(3)\n\nAssumption 3.1 (Spectral-Energy Inequality). Let U denote\nthe authentic region and M denote the diffusion-generated\nregion. We postulate that the expected local Gibbs energy in\nauthentic regions strictly exceeds that of generated regions\ndue to the disparity in high-frequency spectral density:\n\n(2)\n\nE(p,q)∈U [V (p, q)] ≥ ξnoise &gt; E(p,q)∈M [V (p, q)].\n\nAuthentic\n\n(4)\n\nHere, ξnoise represents the irreducible energy floor induced\nby physical sensor noise.\n\nwhere ẑgen\nt−1 is predicted by the denoiser ϵθ given the current\nref\nstate, and zref\nt−1 ∼ q(zt−1 |z0 ) is a sample from the forward\nprocess of the original authentic image. Finally, the edited\nimage is reconstructed via the decoder: x̂ = D(ẑ0 ), where\nẑ0 denotes the final state obtained from the reverse process.\n\nRemark 3.2. The theoretical grounding for Assumption 3.1\nstems from the fundamental difference between optical\nimaging physics and neural generative mechanisms:\n3\n\n\fOrder within Chaos\n\nModel Architecture\n\nLAD Map\n\nEditStream\n\nLAD-Net\n\nSAM\nRaw Image\n\nBinary Mask\n\nSegmentation Model\n\nLAD Map\n\nCoarse Mask\n\nBoundary\nSpike\n\nSemantic Planner\n\nEdit Prompt: “Replace the\nplane with a fighter jet”\nEdit Location: (𝑥𝑥, 𝑦𝑦)\n\nFake\nReal\n\nAdapter Module\n\nPrompt\nEncoder\n\n+\n\nDecoder\n\nTexture\nFeature\n\nVisual-Semantic Reasoning\n\nImage Edit API &amp; Model\n\nSAM Tracker\n\nSemantic\nFeature\n\nSelect\n\nModel Scouting Agent\n\nEdited Image\n\nPerception\nEncoder\n\nLocalization Result\n\nFigure 3. The overall flow of FLAME. (Left) EditStream functions as a self-evolving data engine, employing a Model Scouting Agent and\nSemantic Planner to generate diverse samples. (Middle) The LAD-Map Extraction module transforms the input image into an LAD map\nby capturing local dependency and energy potentials. (Right) The Model Architecture processes these inputs via LAD-Net to provide\ncoarse guidance, which is then refined by a parameter-efficient Adapter Module within SAM to achieve pixel-level forgery localization.\n\n1. Physical Entropy vs. Neural Order: Authentic images\n(U) are captured via optical sensors where photon shot noise\nand thermal noise introduce stochastic, pixel-independent\nperturbations (Foi et al., 2008). These perturbations manifest as high-frequency irregularities, resulting in a highentropy state with substantial local energy potentials.\n\n3.3. Local Adjacency Discrepancy Map\nBuilding upon the theoretical Energy Gap and Boundary\nSpike in Theorem 3.3, we propose the LAD map. This\nrepresentation is designed to quantify local Gibbs energy,\ntranslating theoretical spectral anomalies into a computable\nspatial fingerprint. Formally, the LAD map L ∈ RH×W\nis computed by aggregating pairwise potentials within a\nlocal neighborhood. Specifically, for a pixel p, its value is\ncalculated by the LAD operator:\n\n2. The Diffusion Spectral Bias: In contrast, diffusion\nmodels generally optimize a reconstruction objective (e.g.,\nMSE) constrained by a neural network architecture. As\nnoted in spectral bias literature (Rahaman et al., 2019; Wang\n&amp; Pehlevan, 2026), deep networks prioritize learning lowfrequency semantic structures while struggling to capture\nhigh-frequency noise. Furthermore, the Lipschitz continuity\nof the VAE decoder acts as a low-pass filter, truncating the\nhigh-frequency tail of the spectrum. Consequently, generated regions (M) collapse into a state of artificial order,\nstatistically over-smoothed textures that lack the requisite\nhigh-frequency energy to match natural sensor noise.\n\n1 X\nL(p) =\ntanh\n|Np |\nq∈Np\n\n\u0012\n\n∥I(p) − I(q)∥22\nτ2\n\n\u0013\n.\n\n(5)\n\nHere, Np denotes the set of pixels within a hollow n × n\nspatial window centered at p (where n = 2m + 1). We\nadopt m = 1 (i.e., n = 3) for efficient local estimation. The\nhyperbolic tangent tanh is employed to robustly saturate\nhigh-magnitude semantic gradients, strictly isolating the\nsubtle noise residuals, with the sensitivity threshold controlled by τ . Appendix G.9 provides a detailed discussion\nof the underlying mechanism of the LAD operator. By aggregating these robust pairwise potentials, the LAD map\ntransforms the input image into a Naturalness Response\nField. Authentic regions appear as high-energy areas due to\npreserved sensor noise, whereas manipulated regions manifest as low-energy voids, bounded by high-intensity spikes\nat the tampering trace, which aligns with our theoretical\nderivations. Figure 2 shows the visualization of the LAD\nmap, further validating our statements.\n\nTheorem 3.3 (Energy Gap &amp; Boundary Spike). Let\nEloc (p) = Eq∈Np [∥I(p) − I(q)∥2 ] be the expected local\nenergy. Under Assumption 3.1 and latent mixing mechanism (Eq. 2):\n1. Interior Gap: The energy in the authentic region is\ngreater than in the generated interior: Eloc (U) &gt; Eloc (M).\n2. Boundary Spike: At the mask boundary ∂M, the hard\nlatent composite disrupts the local covariance structure,\ncreating a manifold mismatch. This results in a localized\nsurge in energy: Eloc (∂M) ≫ Eloc (M).\nPlease refer to Appendix G.8 for full proof.\n4\n\n\fOrder within Chaos\n\n4. Model Architecture\n\n1×1 convolution. The adapter, consisting of residual blocks,\nlearns to modulate the semantic features with forensic cues,\nensuring the model focuses on manipulated objects.\n\nBuilding upon the extracted LAD map, we propose a coarseto-fine forensic framework designed to locate manipulated\nregions with high precision. As illustrated in Figure 3, our\narchitecture is composed of two synergistic modules: a\nlightweight LAD Analysis Network (LAD-Net) for initial\ntexture-based detection, and a SAM-based Semantic Refinement module that leverages pre-trained semantic priors\nto delineate precise forgery boundaries.\n\nPrompt-Guided Decoding. Leveraging SAM’s promptable\ndesign, we utilize the coarse mask Mcoarse as a dense spatial\nprompt. The mask is fed into SAM’s prompt encoder to generate dense positional embeddings Eprompt . Finally, SAM’s\nmask decoder takes the artifact-aware features Fadapted and\nthe prompt embeddings Eprompt as input. It attends to the relevant semantic regions highlighted by LAD-Net and outputs\nthe final, fine-grained forgery mask Mfinal .\n\n4.1. Localization Architecture\nLAD Analysis Network. The LAD map L highlights energy anomalies in the image. To further extract these cues,\nwe employ a lightweight CNN as the backbone, which we\ncall LAD-Net and denote as ftex . This network serves three\ndistinct purposes: extracting a texture-rich feature representation, predicting a global authenticity score, and generating\na preliminary coarse localization mask. Let Ftex = ftex (L)\nbe the multi-scale texture features extracted from the LAD\nmap. These features are forwarded to two parallel branches:\n\n4.2. Objective Function\nWe employ a hybrid objective function to jointly optimize\npixel-level localization precision and image-level detection\naccuracy. The total loss L is formulated as:\nL = LDice + λf ocal Lα,γ\nf ocal + λIoU LIoU + λdet Ldet . (7)\nHere, LDice and Lf ocal drive the segmentation process, ensuring precise boundary delineation while mitigating the\ninherent class imbalance between small forged regions and\nthe authentic background. Complementing these, LIoU\nsupervises the mask quality prediction via ℓ1 regression,\nand Ldet enforces global semantic consistency through binary cross-entropy for image-level forgery classification.\nFollowing SAM conventions (Carion et al., 2025), we set\nλf ocal = 20 and λIoU = 1. We set λdet = 1.\n\n1. Global Classification Head: This branch applies global\naverage pooling followed by a fully connected layer to predict a scalar score ycls ∈ [0, 1], indicating the probability\nthat the image has been manipulated.\n2. Coarse Localization Head: A lightweight decoder\nprojects Ftex back to the spatial resolution, outputting a\ncoarse mask Mcoarse ∈ [0, 1]H×W . This mask roughly localizes the tampered area through diffusion artifacts, serving\nas a spatial prior for the subsequent refinement stage.\n\n4.3. EditStream: Evolutionary Data Synthesis\n\nSAM-based Semantic Refinement. Although LAD-Net\ncan effectively identify statistical anomalies, it cannot be\ndirectly relied upon for precise localization. This is because authentic images inherently contain low-energy regions (e.g., uniformly colored backgrounds) that are not\nindicative of manipulation. Therefore, a semantic-level analysis of the image is required to distinguish and exclude\ngenuine low-energy regions. To address this, we integrate\nthe Segment Anything Model (SAM) architecture (Kirillov\net al., 2023). We adapt SAM (Carion et al., 2025) to the\nforgery localization task by conditioning it on both the texture anomalies and the coarse guidance from LAD-Net.\n\nA critical bottleneck in current AI forensics is the temporal\nlag where static training datasets fail to represent the artifacts of evolving generative models. To bridge this gap, we\nintroduce EditStream, a self-evolving data synthesis framework that dynamically adapts to the latest text-to-image\nadvancements. Unlike traditional static benchmarks, EditStream operates as a closed-loop adversarial generator to\ncompel the FLAME localizer to learn architecture-invariant\nrepresentations rather than overfitting to specific models.\nThe framework is driven by a collaborative multi-agent\nsystem that automates the entire lifecycle of training data\ngeneration (see Appendix C for implementation details):\n\nFeature Fusion and Adaptation. The target RGB image I\nis processed by SAM’s frozen image encoder (Bolya et al.,\n2025) to yield high-level semantic features, Fsem . Since\nFsem is optimized for natural object segmentation rather\nthan forensics, we introduce a lightweight Feature Adapter\nto align it with the forensic domain. We fuse the semantic\nfeatures with the texture features Ftex from LAD-Net:\n\n1. Semantic Planning &amp; Masking: To ensure high-quality,\nlogic-consistent edits, we employ a visual-semantic planner\nbased on Qwen-VL (Yang et al., 2025) that analyzes scene\nsemantics to generate editing instructions. These instructions are translated into precise pixel-level masks via SAM,\nguaranteeing that synthetic manipulations adhere to object\nboundaries without introducing background artifacts.\n\nFadapted = Adapter(Fsem ⊕ Ftex ),\n\n2. Autonomous Model Scouting: The core innovation of\nEditStream lies in its Autonomous Model Scouting Agent.\nPowered by Llama 3 (Grattafiori et al., 2024), this agent\n\n(6)\n\nwhere ⊕ denotes channel-wise concatenation followed by a\n5\n\n\fOrder within Chaos\n\nFigure 4. Overview of qualitative results across all models and datasets. Each row corresponds to a dataset sample and each column to the\noriginal and tampered images, the ground-truth mask, and each model’s predicted mask.\n\nactively monitors open-source repositories (e.g., Hugging\nFace) to identify trending inpainting models. It automatically parses model cards, synthesizes execution code, and\nintegrates new checkpoints into the generation pipeline without human intervention.\n\nnal training data (MagicBrush and SID) with the new finetuning samples.\nTesting Protocols. Our evaluation enforces a separation between distributions. For the Base FLAME, In-Distribution\n(ID) performance is assessed on the test splits of MagicBrush and SID. Conversely, CoCoGLIDE (Guillaro\net al., 2023), AutoSplice (Jia et al., 2023), and all three\nEditStream-generated datasets (Nano Banana (Comanici\net al., 2025), Qwen-Image-Edit, and Flux.1 Kontext (Batifol et al., 2025)) serve as Out-Of-Distribution (OOD)\nbenchmarks. For the Fine-tuned FLAME, the Qwen-ImageEdit dataset is reclassified as ID following its inclusion in\nthe adaptation phase, while the remaining datasets retain\ntheir OOD status to evaluate cross-domain generalization.\n\nBy continuously injecting samples from the latest generative\narchitectures, EditStream constructs a moving target for the\ndetector. This evolutionary mechanism fosters a virtuous\ncycle: as generative models improve in realism, FLAME\nis continuously exposed to harder, more diverse artifact\ndistributions, thereby sustaining its robustness in the wild.\n\n5. Experiments\n5.1. Experimental Settings\n\nBaselines and Metrics. We benchmark against a suite of\nstate-of-the-art methods: TruFor (Guillaro et al., 2023),\nSAFIRE (Kwon et al., 2025), Mesorch (Zhu et al., 2025),\nAdaIFL (Li et al., 2024), SparseViT (Su et al., 2025),\nSIDA (Huang et al., 2025c), and FakeShield (Xu et al.,\n2025). Performance is measured using pixel-level Mean\nIoU and F1 Score for localization, and image-level Accuracy (ACC) and Average Precision (AP) for detection\ncapabilities. Unless otherwise specified, aggregate comparisons are based on OOD scores to assess cross-domain\ngeneralization. See Appendix D for details. Since AI-IFL\n\nTraining Protocols. We adopt a two-stage training strategy. The Base FLAME model is trained exclusively on\nestablished datasets, MagicBrush (Zhang et al., 2023) and\na subset of SID (Huang et al., 2025c). To address emerging generative threats, the Fine-tuned FLAME adapts the\nbase model with 500 images generated by the EditStream\npipeline, specifically Qwen-Image-Edit (Wu et al., 2025).\nCrucially, to mitigate catastrophic forgetting during this\nadaptation, we implement a direct replay strategy (Zhou\net al., 2024): each training batch mixes 20% of the origi6\n\n\fOrder within Chaos\nTable 1. Quantitative comparison of pixel-level localization. FLAME refers to the base model, while FLAME-F denotes the version\nfine-tuned via our EditStream pipeline. Underlined values indicate ID evaluation. The Average column calculates the mean performance\nacross the last five datasets (from CoCoGLIDE to Flux Kontext) to assess generalization capabilities against OOD datasets.\nMagicBrush\n\nModel\nSAFIRE\nMesorch\nTruFor\nAdaIFL\nSIDA\nFakeShield\nSparseViT\nFLAME (ours)\nFLAME-F† (ours)\n\nCoCoGLIDE\n\nAutoSplice\n\nNanoBanana\n\nQwen-Image\n\nFlux Kontext\n\nIoU↑\n\nF1↑\n\nIoU↑\n\nSID\nF1↑\n\nIoU↑\n\nF1↑\n\nIoU↑\n\nF1↑\n\nIoU↑\n\nF1↑\n\nIoU↑\n\nF1↑\n\nIoU↑\n\nF1↑\n\nIoU↑\n\nAverage\nF1↑\n\n0.297\n0.150\n0.281\n0.122\n0.106\n0.091\n0.087\n0.538\n0.507\n\n0.485\n0.211\n0.391\n0.215\n0.180\n0.126\n0.154\n0.650\n0.632\n\n0.214\n0.124\n0.188\n0.128\n0.488\n0.117\n0.185\n0.580\n0.569\n\n0.274\n0.219\n0.243\n0.190\n0.565\n0.137\n0.227\n0.677\n0.650\n\n0.394\n0.382\n0.371\n0.209\n0.375\n0.138\n0.325\n0.469\n0.481↑\n\n0.467\n0.450\n0.457\n0.266\n0.465\n0.150\n0.386\n0.576\n0.602↑\n\n0.192\n0.210\n0.364\n0.227\n0.393\n0.238\n0.201\n0.501\n0.498\n\n0.251\n0.283\n0.483\n0.337\n0.483\n0.296\n0.279\n0.624\n0.618\n\n0.114\n0.102\n0.071\n0.091\n0.005\n0.086\n0.021\n0.216\n0.391↑\n\n0.153\n0.139\n0.092\n0.126\n0.012\n0.095\n0.049\n0.295\n0.454↑\n\n0.217\n0.216\n0.228\n0.066\n0.089\n0.098\n0.056\n0.321\n0.482↑\n\n0.269\n0.286\n0.312\n0.092\n0.143\n0.110\n0.073\n0.408\n0.603↑\n\n0.190\n0.124\n0.203\n0.073\n0.092\n0.096\n0.048\n0.285\n0.446↑\n\n0.225\n0.180\n0.276\n0.104\n0.149\n0.108\n0.061\n0.391\n0.548↑\n\n0.221\n0.207\n0.247\n0.133\n0.191\n0.131\n0.130\n0.358\n0.460↑\n\n0.273\n0.268\n0.324\n0.185\n0.250\n0.152\n0.170\n0.459\n0.565↑\n\nTable 2. Quantitative comparison of image-level forgery detection. The experimental setup is consistent with Table 1.\nModel\nSAFIRE\nMesorch\nTruFor\nAdaIFL\nSIDA\nFakeShield\nSparseViT\nFLAME (ours)\nFLAME-F† (ours)\n\nNanoBanana\n\nQwen-Image\n\nFlux Kontext\n\nACC↑\n\nMagicBrush\nAP↑\n\nACC↑\n\nSID\nAP↑\n\nACC↑\n\nCoCoGLIDE\nAP↑\n\nACC↑\n\nAutoSplice\nAP↑\n\nACC↑\n\nAP↑\n\nACC↑\n\nAP↑\n\nACC↑\n\nAP↑\n\nACC↑\n\nAP↑\n\n0.525\n0.630\n0.675\n0.526\n0.812\n0.664\n0.486\n0.901\n0.893\n\n0.640\n0.693\n0.776\n0.593\n0.824\n0.671\n0.487\n0.917\n0.905\n\n0.596\n0.625\n0.531\n0.546\n0.725\n0.632\n0.511\n0.916\n0.911\n\n0.570\n0.648\n0.558\n0.572\n0.768\n0.648\n0.555\n0.922\n0.925\n\n0.481\n0.606\n0.604\n0.519\n0.606\n0.532\n0.536\n0.732\n0.754↑\n\n0.481\n0.713\n0.650\n0.547\n0.710\n0.560\n0.508\n0.789\n0.801↑\n\n0.462\n0.558\n0.626\n0.546\n0.541\n0.574\n0.572\n0.714\n0.698\n\n0.623\n0.597\n0.693\n0.575\n0.743\n0.607\n0.478\n0.763\n0.756\n\n0.570\n0.468\n0.494\n0.474\n0.437\n0.470\n0.508\n0.715\n0.812↑\n\n0.592\n0.492\n0.498\n0.483\n0.350\n0.491\n0.523\n0.747\n0.805↑\n\n0.454\n0.598\n0.600\n0.547\n0.526\n0.582\n0.541\n0.781\n0.821↑\n\n0.644\n0.749\n0.679\n0.562\n0.543\n0.617\n0.607\n0.803\n0.845↑\n\n0.616\n0.547\n0.578\n0.523\n0.522\n0.493\n0.490\n0.754\n0.792↑\n\n0.492\n0.647\n0.656\n0.549\n0.537\n0.528\n0.553\n0.781\n0.828↑\n\n0.517\n0.555\n0.580\n0.522\n0.526\n0.530\n0.529\n0.639\n0.715↑\n\n0.566\n0.640\n0.635\n0.543\n0.577\n0.561\n0.534\n0.677\n0.755↑\n\nrequires localizing the edited subset within an otherwise authentic image, we evaluate methods that produce pixel-level\nmasks. Image-level synthetic-image detectors are therefore\noutside the primary localization comparison, while Table 2\nreports detection scores derived from localization outputs.\n\nAverage\n\ndelineating forgeries even in scenarios involving complex\nbackground interactions or varying object scales.\nDetection Results. Beyond localization, we evaluate the\nimage-level ability to distinguish between authentic and\nforged images. For baselines not explicitly designed for this\ntask, we adopt the maximum value of the localization map\nas the detection statistic, as we empirically observed that it\nyields superior discrimination compared to mean pooling.\nTable 2 presents the Accuracy and AP scores. Consistent\nwith the localization findings, FLAME achieves state-ofthe-art detection performance. The high AP scores indicate\nthat our model maintains a reliable ranking capability, effectively assigning higher anomaly scores to forged samples\nregardless of the specific generative architecture used.\n\n5.2. Evaluation Results of Base FLAME\nLocalization Results. We first evaluate the pixel-level localization performance of the Base FLAME model. As\npresented in Table 1, our method establishes a new state-ofthe-art, delivering the highest average performance across\nall OOD benchmarks in terms of both F1 and IoU scores.\nThis superiority is particularly pronounced in the zero-shot\ngeneralization setting against emerging generative models\n(Nano Banana, Qwen-Image, and Flux). Existing methodologies typically rely on traditional IFL cues or target the\nconspicuous artifacts characteristic of early-stage generators, leading to significant performance degradation under\nthis domain shift. In contrast, FLAME maintains robust\nlocalization capabilities. This empirical evidence validates\nour theoretical premise: the statistical energy anomalies\ncaptured by the LAD map are intrinsic to the diffusion process itself, rather than being specific to a particular model\narchitecture or dataset distribution.\n\n5.3. Adaptability of Fine-tuned FLAME\nWe analyze the performance of Fine-tuned FLAME\n(FLAME-F) based on the results in Tables 1 and 2. The\nperformance shifts reveal three critical capabilities:\nRapid Target Adaptation. FLAME-F exhibits a significant\nperformance leap on the target Qwen-Image dataset, which\nvalidates that the synthetic samples from EditStream successfully capture the distinct artifact signatures of modern\ngenerative models, enabling the network to effectively align\nits feature space with the evolving distribution.\n\nQualitatively, Figure 4 visualizes the predicted masks. Compared to baselines, which often produce fragmented regions\nor fail to detect subtle manipulations, FLAME generates\nprecise masks that align with the ground truth, accurately\n\nCross-Architecture Generalization. Improvements extend\nbeyond the target domain. Despite being fine-tuned exclu7\n\n\fOrder within Chaos\nTable 3. Quantitative comparison results under different perturbations.\nPerturbation\nJPEG\nGaussian Blur\nGaussian Noise\nNo Perturbation\n\nCoCoGLIDE\n\nAutoSplice\n\nNanoBanana\n\nQwen-Image-Edit\n\nFlux Kontext\n\nIoU↑\n\nMagicBrush\nF1↑\n\nIoU↑\n\nSID\nF1↑\n\nIoU↑\n\nF1↑\n\nIoU↑\n\nF1↑\n\nIoU↑\n\nF1↑\n\nIoU↑\n\nF1↑\n\nIoU↑\n\nF1↑\n\nIoU↑\n\nF1↑\n\n0.267\n0.374\n0.216\n0.538\n\n0.380\n0.498\n0.305\n0.650\n\n0.425\n0.568\n0.374\n0.580\n\n0.507\n0.653\n0.473\n0.677\n\n0.413\n0.420\n0.330\n0.469\n\n0.529\n0.535\n0.438\n0.576\n\n0.486\n0.498\n0.420\n0.501\n\n0.601\n0.622\n0.563\n0.624\n\n0.208\n0.202\n0.197\n0.216\n\n0.288\n0.285\n0.282\n0.295\n\n0.216\n0.319\n0.179\n0.321\n\n0.312\n0.405\n0.272\n0.408\n\n0.209\n0.275\n0.175\n0.285\n\n0.302\n0.381\n0.263\n0.391\n\n0.329\n0.379\n0.270\n0.416\n\n0.417\n0.483\n0.371\n0.517\n\nTable 4. Ablation study of different components.\nConfiguration\nw/o LAD Map\nw/o Adapter\nw/o SAM\nFLAME\n\nIoU↑\n0.294\n0.313\n0.379\n0.567\n\nAverage\n\nTable 5. Ablation study on different operators and kernel sizes.\n\nF1↑\n\nOperator\n\n0.380\n0.392\n0.458\n0.662\n\nMin\nMax\nAvg\nLAD\n\n3×3\n\n5×5\n\n7×7\n\nIoU↑\n\nF1↑\n\nIoU↑\n\nF1↑\n\nIoU↑\n\nF1↑\n\n0.439\n0.451\n0.502\n0.567\n\n0.525\n0.542\n0.596\n0.662\n\n0.477\n0.445\n0.478\n0.521\n\n0.568\n0.531\n0.572\n0.615\n\n0.289\n0.310\n0.458\n0.457\n\n0.355\n0.384\n0.545\n0.542\n\n5.5. Ablation Study\n\nsively on Qwen-generated data, FLAME-F demonstrates\nenhanced performance on other unseen contemporary models, such as Flux.1 and Nano Banana. This indicates that the\nmodel avoids overfitting to specific generator noise. Instead,\nit leverages the fresh data to learn a generalized representation of artifacts common to advanced diffusion architectures.\n\nEfficacy of Key Components. We assess the contribution\nof core modules by comparing the full model against three\nvariants: (1) w/o SAM Adapter, which removes the feature\nfusion module; (2) w/o LAD Map, which replaces the Local\nAdjacency Discrepancy map with the raw RGB input; and\n(3) w/o SAM, which bypasses the SAM refinement to use\nthe coarse difference mask directly. All ablations are trained\non the training sets of SID and MagicBrush and evaluated\non their validation splits. As shown in Table 4, performance\ndegrades in all ablated settings. The most significant drop\noccurs without the LAD map, confirming that explicit artifact modeling is crucial for detecting subtle diffusion traces.\nAdditionally, removing the SAM-related components leads\nto coarse, blocky predictions, underscoring their importance\nfor pixel-perfect boundary localization.\n\nMitigation of Forgetting. FLAME-F maintains high stability on historical benchmarks with negligible performance\ndegradation. This confirms that our framework successfully\nbalances plasticity, adapting to new domains, with stability,\nensuring that the integration of emerging threats does not\ncompromise defense capabilities.\n5.4. Robustness Evaluation\nIn real-world scenarios, images often undergo postprocessing operations that attenuate subtle forensic traces.\nWe therefore evaluate FLAME across all benchmarks under\nthree common perturbations: JPEG compression (quality\nlevel 75), Gaussian blur (kernel size 3), and Gaussian noise\n(variance 5), with results summarized in Table 3. Performance decreases under all perturbations, which is expected\nbecause LAD is derived from local high-frequency statistics. The degradation is larger under JPEG compression and\nGaussian noise: the former quantizes high-frequency coefficients, while the latter injects global variance, both of which\nobscure the energy contrast between authentic and generated\nregions. In contrast, Gaussian blur causes a smaller drop in\nour setting, suggesting that the region-level energy gap and\nboundary mismatch can remain informative even when the\nfinest texture residuals are attenuated. Overall, these results\nshow that the proposed statistical cue retains localization\nutility under common post-processing, while transformations that substantially rewrite local statistics remain more\nchallenging.\n\nImpact of Neighborhood Size and Operators. We further investigate the influence of the local aggregation operator and the neighborhood window size k ∈ {3, 5, 7}. As\ndetailed in Table 5, the proposed LAD operator consistently\noutperforms standard pooling mechanisms. While Min and\nMax suffer from sensitivity to outliers and Avg suppresses\nhigh-frequency forensic traces, LAD utilizes a robust potential function to capture the intrinsic energy anomalies.\nRegarding window size, we observe a monotonic performance decline as k increases, confirming that larger kernels\nover-smooth local pixel variances. Consequently, the 3 × 3\nLAD configuration proves optimal for preserving the subtle\nspectral signatures required for precise localization.\nFor ablation studies on individual parameters, please refer\nto the Appendix E.\n8\n\n\fOrder within Chaos\n\n6. Conclusion\n\nReferences\n\nIn this work, we propose FLAME, an AI-IFL framework\ngrounded in the theoretical discovery of diffusion-induced\nspectral bias. Our approach utilizes a lightweight LAD-Net\nto capture intrinsic energy anomalies from the LAD map\nfor preliminary localization. This coarse prediction serves\nas a spatial prompt for the SAM architecture, into which\nwe integrate a compact adapter to fuse forensic cues for\nprecise refinement. Furthermore, we introduce EditStream,\na self-evolving data synthesis pipeline that addresses the\nlimitations of static benchmarks by continuously integrating emerging generative models. Evaluations demonstrate\nthat FLAME establishes a new state-of-the-art, effectively\ngeneralizing across unseen generative architectures.\n\nBatifol, S., Blattmann, A., Boesel, F., Consul, S., Diagne, C.,\nDockhorn, T., English, J., English, Z., Esser, P., Kulal, S.,\net al. Flux. 1 kontext: Flow matching for in-context image\ngeneration and editing in latent space. arXiv e-prints, pp.\narXiv–2506, 2025.\nBazyleva, V., Bonettini, N., and Bharaj, G. X-edit: Detecting and localizing edits in images altered by text-guided\ndiffusion models. In Proceedings of the Computer Vision and Pattern Recognition Conference, pp. 2729–2739,\n2025.\nBetker, J., Goh, G., Jing, L., Brooks, T., Wang, J., Li, L.,\nOuyang, L., Zhuang, J., Lee, J., Guo, Y., et al. Improving\nimage generation with better captions. Computer Science.,\n2(3):8, 2023.\n\nAcknowledgements\nThis work was partly supported by the New Generation\nArtificial Intelligence-National Science and Technology Major Project under No. 2025ZD0123503, NSFC under No.\nU2441239 and U24A20336 and No. 62502433, the China\nPostdoctoral Science Foundation under No. 2024M762829,\n2025M781523 and 2025M781522, Zhejiang Key Laboratory of Decision Intelligence under No. 2025E10006, Zhejiang Provincial Natural Science Foundation Exploration\nof China under No. LMS26F020003, State Key Laboratory of Cryptography and Digital Economy Security under\nNo. KFYB2504, the Zhejiang Provincial Natural Science\nFoundation under No. LD24F020002, and the “Pioneer\nand Leading Goose” R&amp;D Program of Zhejiang under No.\n2025C02033 and 2025C01082.\n\nBolya, D., Huang, P.-Y., Sun, P., Cho, J. H., Madotto, A.,\nWei, C., Ma, T., Zhi, J., Rajasegaran, J., Rasheed, H.,\net al. Perception encoder: The best visual embeddings\nare not at the output of the network. arXiv preprint\narXiv:2504.13181, 2025.\nCai, L., Wang, H., Ji, J., ZhouMen, Y., Ma, Y., Sun, X.,\nCao, L., and Ji, R. Zooming in on fakes: A novel dataset\nfor localized ai-generated image detection with forgery\namplification approach. arXiv preprint arXiv:2504.11922,\n2025.\nCao, Y., Zhao, Z., Patras, I., and Gong, S. Temporal score\nanalysis for understanding and correcting diffusion artifacts. In Proceedings of the Computer Vision and Pattern\nRecognition Conference, pp. 7707–7716, 2025.\n\nImpact Statement\nThis paper aims to advance the field of AI forensics and digital media safety. As generative diffusion models become\nincreasingly accessible and capable of producing photorealistic edits, the risks associated with visual deception have\nescalated significantly. Our work, FLAME, contributes a\nrobust defense mechanism by theoretically identifying and\nlocalizing intrinsic statistical anomalies in AI-manipulated\ncontent, thereby restoring trust in digital media.\n\nCarion, N., Gustafson, L., Hu, Y.-T., Debnath, S., Hu, R.,\nSuris, D., Ryali, C., Alwala, K. V., Khedr, H., Huang, A.,\net al. Sam 3: Segment anything with concepts. arXiv\npreprint arXiv:2511.16719, 2025.\nComanici, G., Bieber, E., Schaekermann, M., Pasupat, I.,\nSachdeva, N., Dhillon, I., Blistein, M., Ram, O., Zhang,\nD., Rosen, E., et al. Gemini 2.5: Pushing the frontier\nwith advanced reasoning, multimodality, long context,\nand next generation agentic capabilities. arXiv preprint\narXiv:2507.06261, 2025.\n\nFurthermore, we introduce EditStream, an automated\npipeline for synthesizing training data. While we acknowledge that automated generation tools carry a potential dualuse risk, our deployment of EditStream is strictly intended\nfor adversarial robustness. It enables forensic models to\nevolve alongside rapid advancements in generative architectures. By establishing a virtuous cycle where defenses are\ncontinuously updated against emerging threats, our work\nseeks to mitigate the arms race in digital forgery and foster\na safer information ecosystem.\n\nCozzolino, D. and Verdoliva, L. Noiseprint: A cnn-based\ncamera model fingerprint. IEEE Transactions on Information Forensics and Security, 15:144–159, 2019.\nDerin, H. and Elliott, H. Modeling and segmentation of\nnoisy and textured images using gibbs random fields.\nIEEE Transactions on pattern analysis and machine intelligence, pp. 39–55, 1987.\n9\n\n\fOrder within Chaos\n\nDong, J., Wang, W., and Tan, T. Casia image tampering detection evaluation database. In 2013 IEEE China summit\nand international conference on signal and information\nprocessing, pp. 422–426. IEEE, 2013.\n\nKingma, D. P., Welling, M., et al. Auto-encoding variational\nbayes, 2013.\nKirillov, A., Mintun, E., Ravi, N., Mao, H., Rolland, C.,\nGustafson, L., Xiao, T., Whitehead, S., Berg, A. C., Lo,\nW.-Y., et al. Segment anything. In Proceedings of the\nIEEE/CVF international conference on computer vision,\npp. 4015–4026, 2023.\n\nFoi, A., Trimeche, M., Katkovnik, V., and Egiazarian, K.\nPractical poissonian-gaussian noise modeling and fitting\nfor single-image raw-data. IEEE transactions on image\nprocessing, 17(10):1737–1754, 2008.\n\nKwon, M.-J., Lee, W., Nam, S.-H., Son, M., and Kim, C.\nSafire: Segment any forged image region. In Proceedings of the AAAI Conference on Artificial Intelligence,\nvolume 39, pp. 4437–4445, 2025.\n\nGrattafiori, A., Dubey, A., Jauhri, A., Pandey, A., Kadian,\nA., Al-Dahle, A., Letman, A., Mathur, A., Schelten, A.,\nVaughan, A., et al. The llama 3 herd of models. arXiv\npreprint arXiv:2407.21783, 2024.\nGuillaro, F., Cozzolino, D., Sud, A., Dufour, N., and Verdoliva, L. Trufor: Leveraging all-round clues for trustworthy\nimage forgery detection and localization. In Proceedings\nof the IEEE/CVF conference on computer vision and pattern recognition, pp. 20606–20615, 2023.\n\nLi, Y., Cheng, F., Yu, W., Wang, G., Luo, G., and Zhu,\nY. Adaifl: Adaptive image forgery localization via a\ndynamic and importance-aware transformer network. In\nEuropean Conference on Computer Vision, pp. 477–493.\nSpringer, 2024.\n\nHo, J., Jain, A., and Abbeel, P. Denoising diffusion probabilistic models. Advances in neural information processing systems, 33:6840–6851, 2020.\n\nLin, T.-Y., Maire, M., Belongie, S., Hays, J., Perona, P., Ramanan, D., Dollár, P., and Zitnick, C. L. Microsoft coco:\nCommon objects in context. In European conference on\ncomputer vision, pp. 740–755. Springer, 2014.\n\nHuang, Q., Xu, Z., Zhang, X., and Zhang, J. Unishield: An adaptive multi-agent framework for unified\nforgery image detection and localization. arXiv preprint\narXiv:2510.03161, 2025a.\n\nLiu, X., Liu, Y., Chen, J., and Liu, X. Pscc-net: Progressive\nspatio-channel correlation network for image manipulation detection and localization. IEEE Transactions on\nCircuits and Systems for Video Technology, 32(11):7505–\n7517, 2022.\n\nHuang, Y., Huang, J., Liu, Y., Yan, M., Lv, J., Liu, J., Xiong,\nW., Zhang, H., Cao, L., and Chen, S. Diffusion modelbased image editing: A survey. IEEE Transactions on\nPattern Analysis and Machine Intelligence, 2025b.\n\nLugmayr, A., Danelljan, M., Romero, A., Yu, F., Timofte,\nR., and Van Gool, L. Repaint: Inpainting using denoising\ndiffusion probabilistic models. In Proceedings of the\nIEEE/CVF conference on computer vision and pattern\nrecognition, pp. 11461–11471, 2022.\n\nHuang, Z., Hu, J., Li, X., He, Y., Zhao, X., Peng, B., Wu,\nB., Huang, X., and Cheng, G. Sida: Social media image deepfake detection, localization and explanation with\nlarge multimodal model. In Proceedings of the Computer\nVision and Pattern Recognition Conference, pp. 28831–\n28841, 2025c.\n\nNaseer, M. M., Ranasinghe, K., Khan, S. H., Hayat, M.,\nShahbaz Khan, F., and Yang, M.-H. Intriguing properties\nof vision transformers. Advances in Neural Information\nProcessing Systems, 34:23296–23308, 2021.\n\nJia, S., Huang, M., Zhou, Z., Ju, Y., Cai, J., and Lyu, S.\nAutosplice: A text-prompt manipulated image dataset\nfor media forensics. In Proceedings of the IEEE/CVF\nconference on computer vision and pattern recognition,\npp. 893–903, 2023.\n\nNews, B. Inside the deepfake porn crisis engulfing korean\nschools. BBC News, 2024. URL https://www.bbc.\ncom/news/articles/cpdlpj9zn9go.\nOquab, M., Darcet, T., Moutakanni, T., Vo, H., Szafraniec,\nM., Khalidov, V., Fernandez, P., Haziza, D., Massa, F., ElNouby, A., et al. Dinov2: Learning robust visual features\nwithout supervision. arXiv preprint arXiv:2304.07193,\n2023.\n\nKadha, V., Bakshi, S., and Das, S. K. Unravelling digital\nforgeries: A systematic survey on image manipulation\ndetection and localization. ACM Computing Surveys, 57\n(12):1–36, 2025.\nKawar, B., Zada, S., Lang, O., Tov, O., Chang, H., Dekel,\nT., Mosseri, I., and Irani, M. Imagic: Text-based real\nimage editing with diffusion models. In Proceedings of\nthe IEEE/CVF conference on computer vision and pattern\nrecognition, pp. 6007–6017, 2023.\n\nPodell, D., English, Z., Lacey, K., Blattmann, A., Dockhorn,\nT., Müller, J., Penna, J., and Rombach, R. Sdxl: Improving latent diffusion models for high-resolution image\nsynthesis. arXiv preprint arXiv:2307.01952, 2023.\n10\n\n\fOrder within Chaos\n\nRahaman, N., Baratin, A., Arpit, D., Draxler, F., Lin, M.,\nHamprecht, F., Bengio, Y., and Courville, A. On the spectral bias of neural networks. In International conference\non machine learning, pp. 5301–5310. PMLR, 2019.\n\nXu, Z., Zhang, X., Li, R., Tang, Z., Huang, Q., and Zhang,\nJ. Fakeshield: Explainable image forgery detection and\nlocalization via multi-modal large language models. The\nThirteenth International Conference on Learning Representations, 2025.\n\nRamesh, A., Dhariwal, P., Nichol, A., Chu, C., and Chen, M.\nHierarchical text-conditional image generation with clip\nlatents. arXiv preprint arXiv:2204.06125, 1(2):3, 2022.\n\nYang, A., Li, A., Yang, B., Zhang, B., Hui, B., Zheng, B.,\nYu, B., Gao, C., Huang, C., Lv, C., et al. Qwen3 technical\nreport. arXiv preprint arXiv:2505.09388, 2025.\n\nRombach, R., Blattmann, A., Lorenz, D., Esser, P., and\nOmmer, B. High-resolution image synthesis with latent\ndiffusion models. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp.\n10684–10695, 2022.\n\nZanardelli, M., Guerrini, F., Leonardi, R., and Adami, N.\nImage forgery detection: a survey of recent deep-learning\napproaches. Multimedia Tools and Applications, 82(12):\n17521–17566, 2023.\n\nSchuhmann, C., Beaumont, R., Vencu, R., Gordon, C.,\nWightman, R., Cherti, M., Coombes, T., Katta, A., Mullis,\nC., Wortsman, M., et al. Laion-5b: An open large-scale\ndataset for training next generation image-text models.\nAdvances in neural information processing systems, 35:\n25278–25294, 2022.\n\nZhang, K., Mo, L., Chen, W., Sun, H., and Su, Y. Magicbrush: A manually annotated dataset for instructionguided image editing. Advances in Neural Information\nProcessing Systems, 36:31428–31449, 2023.\nZhou, D.-W., Wang, Q.-W., Qi, Z.-H., Ye, H.-J., Zhan, D.C., and Liu, Z. Class-incremental learning: A survey.\nIEEE Transactions on Pattern Analysis and Machine Intelligence, 2024.\n\nSong, X., Guo, X., Zhang, J., Li, Q., Bai, L., Liu, X., Zhai,\nG., and Liu, X. On learning multi-modal forgery representation for diffusion generated video detection. Advances\nin Neural Information Processing Systems, 37:122054–\n122077, 2024.\n\nZhu, X., Ma, X., Su, L., Jiang, Z., Du, B., Wang, X., Lei,\nZ., Feng, W., Pun, C.-M., and Zhou, J.-Z. Mesoscopic insights: orchestrating multi-scale &amp; hybrid architecture for\nimage manipulation localization. In Proceedings of the\nAAAI Conference on Artificial Intelligence, volume 39,\npp. 11022–11030, 2025.\n\nSu, L., Ma, X., Zhu, X., Niu, C., Lei, Z., and Zhou, J.-Z. Can\nwe get rid of handcrafted feature extractors? sparsevit:\nNonsemantics-centered, parameter-efficient image manipulation localization through spare-coding transformer.\nIn Proceedings of the AAAI Conference on Artificial Intelligence, volume 39, pp. 7024–7032, 2025.\n\nZou, Y., Li, P., Li, Z., Huang, H., Cui, X., Liu, X., Zhang, C.,\nand He, R. Survey on ai-generated media detection: From\nnon-mllm to mllm. arXiv preprint arXiv:2502.05240,\n2025.\n\nSun, Z., Fang, H., Cao, J., Zhao, X., and Wang, D. Rethinking image editing detection in the era of generative\nai revolution. In Proceedings of the 32nd ACM International Conference on Multimedia, pp. 3538–3547, 2024.\nTimes, T. N. Y. Taylor swift ai fake images controversy.\nThe New York Times, 2024. URL https://www.\nnytimes.com/2024/01/26/arts/music/\ntaylor-swift-ai-fake-images.html.\nWang, B. and Pehlevan, C. An analytical theory of spectral bias in the learning dynamics of diffusion models.\nAdvances in Neural Information Processing Systems, 38:\n95865–95963, 2026.\nWang, Z., Bao, J., Zhou, W., Wang, W., Hu, H., Chen, H.,\nand Li, H. Dire for diffusion-generated image detection.\nIn Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 22445–22455, 2023.\nWu, C., Li, J., Zhou, J., Lin, J., Gao, K., Yan, K., Yin, S.-m.,\nBai, S., Xu, X., Chen, Y., et al. Qwen-image technical\nreport. arXiv preprint arXiv:2508.02324, 2025.\n11\n\n\fOrder within Chaos\n\nA. Limitations\nFLAME is most effective when AI-edited regions leave detectable local statistical discrepancies and provide a usable\nboundary cue for refinement. Its performance can degrade in naturally smooth or repetitive authentic regions, where LAD\nresponses may be difficult to distinguish from generated content and can produce diffuse coarse proposals or false positives.\nVery small edits, weak object boundaries, and scenes containing many similar candidate objects may also limit SAM-based\nrefinement. Among editing operations, object removal is particularly challenging because inpainting often synthesizes\nbackground texture that is close to the surrounding authentic context and may not introduce a clear semantic transition.\nFinally, severe post-processing, extreme ISP denoising, or detector-aware anti-forensic perturbations can substantially\nalter the local statistics used by the LAD branch. Addressing these cases will require stronger context modeling and\nrobustness-aware training in future AI forgery localization systems.\n\nB. Additional Visualizations\nIn this section, we provide a comprehensive qualitative analysis to empirically validate the efficacy of the FLAME framework.\nFigure 5 visualizes the intermediate representations generated at each stage of the pipeline, tracking the transformation from\nraw statistical artifacts to precise semantic segmentation.\nColumns 4 and 5 corroborate our theoretical analysis presented in Theorem 3.3. As observed, authentic regions maintain\nhigh-frequency variations, appearing as high-energy noise, whereas diffusion-generated regions collapse into a state of\nartificial order and appear as low-energy voids.\nColumn 6 displays the Coarse Mask predicted by the LAD-Net. By processing the LAD map, the LAD-Net successfully\nidentifies the general location of the forgery, effectively acting as a global attention mechanism. However, relying solely\non statistical anomalies can yield blob-like predictions that lack boundary precision. Column 7 (Results) demonstrates\nthe contribution of our SAM-based refinement module. Using the coarse mask as a spatial prompt, the adapter leverages\nSAM’s powerful segmentation priors to snap the prediction to the object’s semantic boundaries. This coarse-to-fine strategy\nensures that FLAME achieves pixel-level accuracy even when the statistical traces at the boundary are faint or disrupted by\ncompression.\n\nFigure 5. Step-by-step visualization of the FLAME pipeline.\n\n12\n\n\fOrder within Chaos\n\nC. EditStream: Implementation and Data Generation Details\nThis section provides a comprehensive elucidation of the EditStream pipeline, complementing the high-level overview\npresented in Section 4.3. We detail its architectural mechanics and the rigorous protocols employed for dataset creation.\nC.1. Visual-Semantic Reasoning and Mask Generation\nThe first stage of the pipeline focuses on understanding the scene semantics to determine where and what to edit. We\nleverage the multimodal capabilities of Qwen3-VL-8B-Instruct (Yang et al., 2025) as the semantic planner. Given a raw\ninput image, the MLLM is prompted to analyze the scene layout and identify salient objects or background regions suitable\nfor manipulation. It outputs a structured description of the target region along with approximate spatial coordinates.\nTo translate these high-level semantic descriptions into precise pixel-level signals, we utilize SAM (Carion et al., 2025). By\ninjecting the text descriptions and spatial coordinates provided by the MLLM into SAM’s promptable interface, we obtain\nhigh-fidelity binary masks that strictly adhere to object boundaries, minimizing boundary artifacts during the subsequent\ninpainting phase.\nC.2. Autonomous Model Scouting Agent\nTo mitigate the temporal lag between the emergence of new generative models and their inclusion in forensic benchmarks,\nwe engineer the Autonomous Model Scouting Agent. This agent is not merely a static script but a dynamic system powered\nby Llama 3 (Grattafiori et al., 2024), capable of reasoning, tool usage, and code synthesis.\nTool-Augmented Search Mechanism. Unlike passive crawlers, our agent interacts directly with the ecosystem via the\nofficial Hugging Face API, which we encapsulate as a structured tool, search hf models().\n1. Query Formulation: The agent leverages the Hugging Face API, selecting the image-to-image task category to retrieve\nthe most recent and widely adopted open-source image editing models.\n2. Multi-Metric Filtering: The raw search results are filtered through a composite scoring function. This function\nweighs quantitative metrics, download counts, likes, and trending status, alongside qualitative indicators such as\n“recently updated” timestamps. This ensures that the selected models are not only popular but represent the current\nstate-of-the-art.\n3. Candidate Selection: Based on this analysis, the agent autonomously selects the top-3 most promising candidates that\nare architecturally distinct from the existing pool.\nDynamic Code Synthesis and Integration. Once a candidate model is selected, the agent must integrate it into the\nEditStream pipeline without human engineering.\n• Model Card Parsing: The agent retrieves and analyzes the unstructured text within the candidate’s Model Card\n(README). It extracts critical metadata: input constraints (e.g., resolution limits), dependency requirements, and the\nspecific input format.\n• Execution Logic Generation: Leveraging its code-generation capabilities, Llama 3 synthesizes a bespoke Python\nwrapper for the model. This wrapper standardizes the input-output interface, ensuring that diverse models, regardless\nof their internal implementation, conform to the EditStream pipeline’s expected protocols.\n• Sandboxed Verification: The synthesized code undergoes a dry-run verification in a sandboxed environment to ensure\nexecution stability before deployment.\nFor detailed prompts of different components, please refer to Appendix I.\nC.3. Dataset Creation Details\nTo construct a robust evaluation benchmark, we adhere to a strict data generation protocol that ensures diversity in semantic\ncontent, editing operations, and manipulation footprints.\n13\n\n\fOrder within Chaos\n\nComplexity-Aware Source Selection. We curate a pool of high-resolution authentic images sourced from open-domain\ndatasets (e.g., subsets of LAION-5B (Schuhmann et al., 2022) and COCO (Lin et al., 2014)). To avoid trivial cases, we\nimplement a multi-stage filtering protocol inspired by scene complexity heuristics:\n1. Aesthetic Filtering: We retain images with an aesthetic score &gt; 6.0 to ensure high visual fidelity.\n2. Semantic Density: We require the presence of at least three distinct object classes (detected via a pre-trained detector),\nensuring the scene offers rich semantic context for manipulation.\n3. Spatial Constraints: To prevent single-object dominance, we exclude images where the largest bounding box exceeds\n50% of the total canvas area. This ensures the resulting forgeries involve realistic multi-object interactions rather than\nsimple foreground replacements.\nBalancing Editing Operations. A core objective is to evaluate robustness across different manipulation types. We instruct\nthe Semantic Planner (Qwen-VL) to categorize its editing instructions into four distinct operations:\n1. Object Addition: Inserting new objects into the scene (e.g., “Add a red car in the driveway”).\n2. Object Removal: Erasing existing entities (e.g., “Remove the pedestrian”).\n3. Object Replacement: Swapping an object with a semantically different one (e.g., “Replace the dog with a cat”).\n4. Background Alteration: Modifying environmental textures or styles (e.g., “Change the grass to snow”).\nThe planner is prompted to sample these operations with a uniform probability distribution, ensuring balanced coverage\nacross all four categories. To address this, we implement a dynamic priority mechanism:\n1. Feasibility Analysis: For each source image, the Semantic Planner first identifies the subset of feasible operations that\nrespect the scene’s semantic and spatial constraints.\n2. Frequency-Inverse Sampling: From this feasible subset, the system selects the operation that is currently least\nrepresented in the generated dataset buffer. This active balancing strategy prevents the path of least resistance from\ndominating the distribution, ensuring approximately uniform coverage (∼25%) across all manipulation types.\nInpainting Area Distribution. To prevent the localizer from overfitting to specific mask sizes, we enforce a stratified\nsampling strategy for the manipulated region’s size. The generated masks vary from small-scale (occupying &lt; 5% of image\narea) to large-scale (&gt; 30%), challenging the model’s ability to detect both subtle and dominant forgeries.\nAdmission-Control Filtering. Before inserting generated samples into the dataset, EditStream applies a two-stage\nadmission-control filter to reduce low-quality or semantically inconsistent edits. First, a deterministic pre-check verifies\nmask validity, area ratio, and boundary alignment, discarding degenerate masks or edits with negligible visible changes.\nSecond, a VLM-based verifier evaluates instruction fidelity, semantic consistency, and edit quality. Samples that fail either\nstage are discarded or regenerated, complementing the planning-stage safeguards with explicit sample-level verification.\nDataset Composition and Model-Specific Handling. The final dataset consists of 6,500 images generated using three\ndistinct architectures:\n• Qwen-Image-Edit (Wu et al., 2025): We generated 3,000 samples. This model follows the standard inpainting\nparadigm, accepting a user-provided binary mask and text prompt. We fine-tune FLAME on 500 samples and test on\n2,500 samples.\n• Flux.1 Kontext (Batifol et al., 2025): We generated 3,000 samples. Similar to Qwen, this model utilizes the masks\ngenerated by our SAM-based Semantic Planner.\n• NanoBanana (Comanici et al., 2025): We generated 500 samples. A unique challenge with NanoBanana is that\nit operates as an instruction-to-image editor and does not support external mask injection. Instead, it autonomously\ndetermines the region to edit based on the textual prompt. To accommodate this, we inverted the workflow: we provide\nthe edit instruction, and the model returns both the manipulated image and the mask where the image changed. We\nutilize this returned mask as the ground truth for training and evaluation.\n14\n\n\fOrder within Chaos\n\nD. Detailed Experimental Settings\nIn this section, we provide a granular breakdown of the experimental setup to ensure reproducibility. We detail the dataset\ncompositions, the specific definitions of evaluation metrics, and the implementation hyperparameters used for the FLAME\nframework.\nD.1. Datasets\nTo comprehensively evaluate the robustness and generalizability of FLAME, we curate a diverse collection of benchmarks\nencompassing both manually annotated edits and large-scale synthetic manipulations. The datasets are categorized into ID\nsets used for training/validation, and OOD sets used exclusively for zero-shot testing.\n• MagicBrush (Zhang et al., 2023): This dataset represents high-quality, instruction-guided image editing. It contains\ndiffusion-based edits produced via DALL-E 2 (Ramesh et al., 2022), verified through rigorous human annotation. The\ndataset features multiple editing turns per image; we compute the ground-truth binary mask as the union of forged\npixels across all rounds. The final composition includes 8,807 samples. We strictly follow the official split, utilizing the\ntraining set for model training, 528 samples for validation, and 1,053 samples for ID testing.\n• SID (Huang et al., 2025c): A large-scale corpus comprising roughly 100,000 edits generated via Latent Diffusion\nModels (LDM) (Rombach et al., 2022). Given the sheer volume, we sample a subset to balance the training distribution.\nSpecifically, we utilize 10,000 tampered samples for training and 528 for validation. For evaluation, we employ the full\ntampered test set to assess performance on LDM-based forgeries.\n• AutoSplice (Jia et al., 2023): This dataset focuses on text-prompt manipulated images using DALL-E 2. We treat the\nentire dataset as an OOD benchmark, allocating all 3,621 images exclusively for testing.\n• CoCoGLIDE (Guillaro et al., 2023): A challenging evaluation set containing 512 images edited using the GLIDE\nmodel. We utilize all 512 samples for OOD testing to evaluate resilience against GLIDE-specific artifacts.\nFor datasets generated by EditStream, please refer to Appendix C.3 for details.\nD.2. Evaluation Metrics\nWe employ standard forensic metrics to quantify performance at both the pixel-level localization and image-level detection.\nD.2.1. P IXEL -L EVEL L OCALIZATION\nLocalization performance is measured by comparing the predicted binary mask Mpred (obtained by thresholding the\nprobability map at 0.5) with the ground-truth mask Mgt .\n• Intersection over Union (IoU): Measures the overlap between the predicted and ground-truth forged regions.\nIoU =\n\n|Mpred ∩ Mgt |\nTP\n=\n|Mpred ∪ Mgt |\nTP + FP + FN\n\n(8)\n\nwhere T P , F P , and F N denote True Positives, False Positives, and False Negatives, respectively.\n• F1 Score: The harmonic mean of precision and recall, providing a balanced view of localization accuracy, especially\nfor small forged regions.\n2 · P recision · Recall\n2T P\nF1 =\n=\n(9)\nP recision + Recall\n2T P + F P + F N\nD.2.2. I MAGE -L EVEL D ETECTION\nFor the binary classification task (Tampered vs. Authentic), we derive an image-level anomaly score yscore from the predicted\nmask. We empirically found that the maximum activation value yields the best separation: yscore = max(i,j) Mprob (i, j).\n15\n\n\fOrder within Chaos\n\n• Accuracy (ACC): The ratio of correctly classified images to the total number of images, using a decision threshold of\n0.5.\n• Average Precision (AP): The area under the Precision-Recall curve, providing a threshold-independent measure of the\ndetector’s discriminative ability.\n\nE. Additional Experimental Results\nIn this section, we provide a granular analysis of the hyperparameters, robustness, and generalization capabilities of FLAME,\nsupplementing the main experimental results.\nE.1. Sensitivity to Threshold τ\nThe temperature parameter τ in the LAD operator (Eq. 5) plays a pivotal role in regulating the sensitivity of the energy\nmapping. It controls the saturation point of the hyperbolic tangent function, effectively distinguishing between low-amplitude\nsensor noise and high-amplitude semantic edges. Figure 6 illustrates the impact of varying τ on localization performance on\nthe validation set.\nWe observe a convex performance trajectory. When τ is too small, the operator becomes over-sensitive to the natural\nthermal noise inherent in authentic regions, leading to a noisy LAD map and increased False Positives. Conversely, as τ\nincreases, the non-linearity suppresses the subtle spectral anomalies required to identify diffusion artifacts, causing a decline\nin recall. The performance peaks at τ = 0.004, striking an optimal balance between noise suppression and artifact retention.\nTheoretically, this value aligns with the pixel quantization limit (1/255 ≈ 0.0039), suggesting that this threshold effectively\nsuppresses quantization noise while preserving the structural reconstruction differences indicative of forgery. Consequently,\nwe fix τ = 0.004 for our experiments.\nE.2. Robustness on Image-level Detection\nTable 6. Quantitative comparison results of image-level detection under different perturbations.\nPerturbation\nJPEG\nGaussian Blur\nGaussian Noise\nNo Perturbation\n\nCoCoGLIDE\n\nAutoSplice\n\nNanoBanana\n\nQwen-Image-Edit\n\nFlux Kontext\n\nAcc↑\n\nMagicBrush\nAP↑\n\nAcc↑\n\nSID\nAP↑\n\nAcc↑\n\nAP↑\n\nAcc↑\n\nAP↑\n\nAcc↑\n\nAP↑\n\nAcc↑\n\nAP↑\n\nAcc↑\n\nAP↑\n\nAcc↑\n\nAP↑\n\n0.541\n0.893\n0.592\n0.921\n\n0.612\n0.906\n0.629\n0.937\n\n0.589\n0.920\n0.621\n0.946\n\n0.688\n0.938\n0.702\n0.952\n\n0.542\n0.715\n0.561\n0.732\n\n0.587\n0.770\n0.599\n0.789\n\n0.509\n0.699\n0.542\n0.714\n\n0.533\n0.737\n0.580\n0.763\n\n0.486\n0.682\n0.521\n0.715\n\n0.497\n0.724\n0.549\n0.747\n\n0.552\n0.743\n0.545\n0.781\n\n0.583\n0.771\n0.576\n0.803\n\n0.557\n0.715\n0.564\n0.754\n\n0.592\n0.740\n0.593\n0.781\n\n0.539\n0.767\n0.564\n0.795\n\n0.585\n0.798\n0.604\n0.825\n\nTable 6 details the image-level forgery detection performance under various perturbations. Consistent with the pixel-level localization results in\nthe main paper, the detection metrics exhibit specific sensitivities to signal\ndegradation types.\n\n0.7\nMetric Value\n\nHigh-Frequency Sensitivity. The model experiences the most notable\nperformance drop under JPEG compression and Gaussian Noise. This\naligns with our theoretical premise that the LAD map relies on highfrequency spectral discrepancies (Theorem 3.3). JPEG compression quantizes high-frequency DCT coefficients, and Gaussian Noise injects global\nvariance that masks the subtle energy gap between real and generated\nregions.\n\nAverage\n\n0.6\n0.5\n0.4\n\nIoU\n0.3\nF1-Score\n0.000 0.002 0.004 0.006 0.008 0.010 0.012\nParameter\n\nResilience to Blurring. Interestingly, FLAME demonstrates stronger\nFigure 6. Sensitivity to threshold τ .\nresilience to Gaussian Blur compared to noise injection. This suggests that\nwhile the finest spectral traces are attenuated by blurring, the structural\nboundary spike remains a sufficiently robust feature for the LAD-Net to discriminate between tampered and authentic\nimages. Even under these challenging conditions, FLAME maintains an average AP significantly better than random\nguessing, underscoring its practical utility.\n16\n\n\fOrder within Chaos\n\nE.3. Performance under Varying Mask Ratios\n\nTable 7. Quantitative results under different mask ratios.\n\nMask Ratio\n\nIoU↑\n\nF1↑\n\nSmall\nMedium\nLarge\n\n0.381\n0.612\n0.742\n\n0.458\n0.675\n0.794\n\nOverall\n\n0.567\n\n0.652\n\nTo evaluate the model’s sensitivity to the scale of manipulation, we stratify the test samples into three categories based\non the ratio of the forged area to the total image size: Small (&lt; 5%), Medium (5% − 30%), and Large (&gt; 30%). Table 7\nsummarizes the results.\nAs anticipated in semantic segmentation tasks, performance correlates positively with object size. Large manipulations\nyield the highest IoU due to the abundance of statistical evidence and stronger semantic guidance for the SAM module.\nHowever, FLAME maintains a commendable IoU of 0.381 even on Small forgeries. This indicates that the prompt-guided\ndecoding mechanism effectively leverages the coarse cues from the LAD map to localize minute alterations, mitigating the\nissue where small objects are often lost during downsampling in standard CNN architectures.\nE.4. Performance across Different Editing Types\n\nWe observe that Object Replacement and Addition consistently yield\nhigher detection scores compared to Object Removal. We hypothesize this\nstems from spectral disparity: inserting a foreign object or replacing an\nexisting one introduces a distinct latent representation that often clashes\nspectrally with the original scene. In contrast, Object Removal typically\ninvolves inpainting background textures (e.g., extending grass or walls).\nThe generated background texture tends to be spectrally more similar to\nthe surrounding authentic context, resulting in a subtler energy gap and\nmaking localization more challenging.\n\nIoU Score\n\nWe further dissect the model’s performance across the four editing operations defined in the EditStream pipeline: Object Addition, Removal,\nReplacement, and Background Alteration. Table 8 presents the comparative analysis on the Qwen and Flux benchmarks.\n\n0.7\n0.6\n0.5\n0.4\n0.3\n0.2\n0.1\n0.00\n\nID data\nOOD data\n1\n2\n3\n4\n5\nNumber of Training Epochs\n\nFigure 7. Ablation study on training epochs.\n\nE.5. Ablation Study on Training Epochs\nFinally, we investigate the impact of training duration on generalization. Figure 7 plots the IoU scores for ID and OOD\ndatasets across training epochs.\nThe results highlight a classic overfitting-to-distribution phenomenon. While performance on ID data (MagicBrush and\nSID) continues to improve monotonically with longer training, the zero-shot OOD performance (averaged across unseen\ngenerative models) peaks at Epoch 3 and subsequently degrades. This suggests that prolonged training causes the model to\noverfit to the specific artifact signatures of the training generators, reducing its ability to generalize to novel architectures\nlike Flux or Qwen. Based on this observation, we employ an early stopping strategy at Epoch 3 to maximize cross-model\nrobustness.\n\nF. Detailed Architecture of FLAME Components\nIn this section, we provide a granular description of the two core trainable components within the FLAME framework: the\nLAD-Net backbone and the Feature Adapter for SAM.\n17\n\n\fOrder within Chaos\nTable 8. Performance comparison across different editing types.\nDataset\nQwen\nFlux\n\nObject Addition\n\nObject Removal\n\nObject Replacement\n\nBackground Alteration\n\nIoU↑\n\nF1↑\n\nIoU↑\n\nF1↑\n\nIoU↑\n\nF1↑\n\nIoU↑\n\nF1↑\n\n0.367\n0.307\n\n0.429\n0.375\n\n0.187\n0.165\n\n0.263\n0.228\n\n0.405\n0.371\n\n0.463\n0.420\n\n0.258\n0.261\n\n0.317\n0.327\n\nF.1. LAD-Net\nThe LAD-Net is designed to act as a specialized forensic feature extractor. Based on the implementation, the architecture\nconsists of two key component: the Feature Encoder, and the Learnable Mask Compressor.\nDeep Separable Block (DSBlock). The core building block of the LAD-Net feature extractor is the DSBlock, designed to\nmaximize the receptive field while maintaining parameter efficiency. As shown in the code, the block is composed of a\nspecific sequence of layers:\n1. Dilated Convolution: A 3 × 3 dilated convolution (dilation rates increase with depth) is used to capture long-range\nstatistical dependencies without reducing resolution.\n2. Instance Normalization (IN): A critical design choice in our architecture is the replacement of standard Batch\nNormalization with Instance Normalization. Since forensic artifacts are often image-specific, Batch Normalization\ntends to overfit to the training domain’s statistics. IN operates on individual samples, significantly enhancing the\nmodel’s OOD robustness against unseen generative architectures.\n3. Squeeze-and-Excitation (SE): We incorporate SE blocks with a reduction ratio of 8. This mechanism adaptively\nrecalibrates channel-wise feature responses, allowing the network to suppress channels carrying irrelevant semantic\ninformation and emphasize those rich in forensic traces.\nLearnable Mask Compressor. To generate the coarse mask Mcoarse that serves as the spatial prompt for SAM 3, we avoid\nsimple mean pooling. Instead, we employ a lightweight sub-network consisting of a projection convolution (1 × 1), followed\nby Instance Normalization, ReLU activation, and a final prediction convolution. This allows the model to learn an optimal\nnon-linear projection from the high-dimensional forensic feature space to a single-channel probability map.\nF.2. Feature Adapter Module\nThe Feature Adapter bridges the gap between the forensic domain and the semantic domain. To preserve the powerful\nsegmentation priors of the pre-trained SAM, we design the adapter as a residual module that injects forensic cues without\ndisrupting the pre-trained semantic features.\nLet Fsem ∈ RC×H×W be the semantic features from the SAM encoder, and Ftex be the texture features from LAD-Net.\nThe adaptation process follows a bottleneck design:\n1. Feature Alignment: The forensic features Ftex are spatially interpolated to match the resolution of Fsem .\n2. Cross-Modal Fusion: We concatenate the unadapted semantic features with the aligned forensic features. A fusion\nMLP (1 × 1 Conv) compresses this concatenated representation into a hidden dimension Dhidden .\n3. Residual Injection: The fused features pass through a non-linear bottleneck before being projected back to the original\nsemantic channel dimension C. This produces a residual delta ∆F .\nThe final adapted feature map Fadapted is obtained via:\nFadapted = Fsem + Adapter([Fsem ∥ Resize(Ftex )])\n\n(10)\n\nWe initialize the adapter weights using a Xavier uniform distribution to ensure stability during the early stages of fine-tuning.\nThis residual formulation allows the gradient to flow directly through the semantic branch, ensuring that the forensic\ninjection refines rather than overrides the object segmentation capabilities of SAM.\n18\n\n\fOrder within Chaos\n\nG. Complete Theoretical Analysis for Artifact Separability\nThis appendix expands Section 3 in the main paper by (1) formalizing the full latent-diffusion inpainting pipeline with\nexplicit equations, and (2) providing a complete, step-wise theoretical justification for artifact separability and the design of\nthe LAD map.\nG.1. Preliminaries: Masked Latent Diffusion for Local Image Editing\nNotation. Let x ∈ RH×W ×3 be an RGB image defined on a pixel lattice Ω := {1, . . . , H} × {1, . . . , W }. Let\nm ∈ {0, 1}H×W be a binary mask, where m(p) = 1 indicates pixels to be edited (tampered region) and m(p) = 0 indicates\npixels to be preserved (authentic context). We denote the edited set by M := {p ∈ Ω : m(p) = 1} and the preserved set by\nU := Ω \\ M.\nWe consider a LDM (Ho et al., 2020; Rombach et al., 2022) consisting of: (i) a VAE encoder Eϕ and decoder Dψ , (ii) a\ntime-conditional denoiser εθ (·, t, c), optionally conditioned on text c.\nLet the latent resolution be h × w with channel dimension cz and downsampling factor f . We use ⊙ for element-wise\nproducts. We downsample the mask to the latent resolution by a deterministic operator Sf :\nm(z) := Sf (m) ∈ [0, 1]h×w .\n\n(11)\n\nFor clarity of analysis we treat m(z) as binary mask. Soft masks can be handled by the same derivations with minor\nmodifications.\nStep 1: VAE encoding. The VAE defines an approximate posterior qϕ (z|x); for most practical pipelines, the latent used for\nediting is the posterior mean:\nz0ref := Eϕ (x) ∈ Rh×w×cz .\n(12)\nThe mapping Eϕ compresses spatial information, which inevitably reduces high-frequency components.\nStep 2: Multi-step denoising with hard latent replacement. We use the standard Gaussian forward diffusion in latent\nspace:\n√\nq(zt |zt−1 ) = N ( αt zt−1 , (1 − αt )I) ,\nᾱt :=\n\nt\nY\n\n√\n\nq(zt |z0 ) = N\n\nαs ,\n\ns=1\n\n(13)\n\n√\n\n\u0001\nᾱt z0 , (1 − ᾱt )I ,\n\n(14)\n\nϵ ∼ N (0, I).\n\n(15)\n\nThe denoiser is trained with the simplified noise-prediction loss (Ho et al., 2020):\n\u0002\n\u0003\nLLDM := Ez0 ,t,ϵ ∥ϵ − εθ (zt , t, c)∥22 .\n\n(16)\n\nzt =\n\nᾱt z0 +\n\n1 − ᾱt ϵ,\n\n√\n\nDuring sampling, a common DDPM-style reverse update is:\n\u0011\n√\n1 \u0010\nẑ0 (zt ) := √\nzt − 1 − ᾱt εθ (zt , t, c) ,\nᾱt\n\u0011\n1 \u0010\n1 − αt\nµθ (zt , t, c) := √\nzt − √\nεθ (zt , t, c) ,\nαt\n1 − ᾱt\ngen\nzt−1\n:= µθ (zt , t, c) + σt η,\n\nη ∼ N (0, I),\n\n(17)\n(18)\n(19)\n\nwhere σt depends on the chosen sampler (DDPM/DDIM/PLMS) and can be set to 0 in deterministic sampling.\nMasked replacement (the key inpainting constraint). To preserve the authentic region, we force the unmasked latent to match\nthe original image latent at every reverse step. Specifically, we sample a reference latent at the same noise level from the\nforward process of the original image:\np\n√\nref\nref\nzt−1\n∼ q(zt−1 | z0ref ),\nequivalently\nzt−1\n= ᾱt−1 z0ref + 1 − ᾱt−1 ϵt−1 .\n(20)\n19\n\n\fOrder within Chaos\n\nThen we composite:\ngen\nref\nzt−1 := m(z) ⊙ zt−1\n+ (1 − m(z) ) ⊙ zt−1\n.\n\n(21)\n\nThis procedure is consistent with diffusion-based inpainting via conditioning on known pixels/regions (Lugmayr et al., 2022)\nand is widely adopted in latent inpainting pipelines.\nStep 3: VAE decoding. After T reverse steps, we obtain z0 and decode to the edited image:\nx̂ := Dψ (z0 ) ∈ RH×W ×3 .\n\n(22)\n\nNote that (21) is performed in latent space; because VAE latents are generally not pixel-local, latent compositing is not\nstrictly equivalent to pixel-space compositing and can introduce seam artifacts near ∂M (formalized later).\nAlgorithm (masked latent diffusion sampling).\n\nFor completeness, the full inpainting sampler is summarized below.\n\nAlgorithm 1 Masked Latent Diffusion Inpainting\nInput: image x, mask m, condition c, diffusion steps T\n1: z0ref ← Eϕ (x); m(z) ← Sf (m)\n2: Initialize zT ∼ N (0, I)\n3: for t = T, . . . , 1 do\ngen\n3.1: zt−1\n← reverse update using εθ (·, t, c)\nref\n3.2: zt−1\n← q(zt−1 | z0ref )\ngen\nref\n3.3: zt−1 ← m(z) ⊙ zt−1\n+ (1 − m(z) ) ⊙ zt−1\n4: x̂ ← Dψ (z0 )\nOutput: edited image x̂\nRemark. The subsequent theory is agnostic to the exact sampler (DDPM vs. DDIM) as long as (1) the reverse chain is\nimplemented with a learned denoiser and (2) hard replacement (21) is enforced.\nG.2. Artifact Separability via Gibbs Energy: Complete Analysis and Proofs\nWe now provide a rigorous justification for three claims:\n1. Inevitable artifacts: diffusion-based generative pipelines inevitably introduce statistical artifacts relative to physical\nimaging.\n2. Inpainting amplification: in masked inpainting, artifacts in the generated region M are significantly stronger than in\nthe preserved region U, and a sharp boundary spike emerges near ∂M.\n3. Local separability: these artifacts manifest as anomalies in adjacent-pixel relations; thus local neighbor differences\nyield discriminative features for real/fake separation, motivating LAD.\nG.2.1. E NERGY MODEL ON THE IMAGE LATTICE\nFollowing the main paper, we model the image lattice as a Gibbs Random Field (GRF) (Derin &amp; Elliott, 1987). Let\nI(p) ∈ R3 denote the RGB vector at pixel p ∈ Ω. Let Np be a fixed neighborhood system (e.g., 4-neighborhood). Define a\npairwise potential\nV (p, q) := ρ(∥I(p) − I(q)∥2 ) ,\n(p, q) ∈ Ω × Ω, q ∈ Np ,\n(23)\nwhere ρ : R≥0 → R≥0 is monotone increasing. A canonical choice for analysis is ρ(r) = r2 ; the LAD map later uses a\nrobust bounded surrogate via tanh(·).\nDefine the local energy at a pixel as\nEloc (p) :=\n\n1 X\n∥I(p) − I(q)∥22 .\n|Np |\n\n(24)\n\nq∈Np\n\nFor any set S ⊆ Ω, define the average local energy\n\u0002\n\u0003\nEloc (S) := Ep∼Unif(S) Eloc (p) .\n20\n\n(25)\n\n\fOrder within Chaos\n\nG.2.2. P HYSICAL IMAGING INDUCES AN IRREDUCIBLE LOCAL ENERGY FLOOR\nWe formalize the “physical entropy” argument by a standard sensor noise model.\nAssumption G.1 (Additive sensor noise floor). An authentic captured image x can be locally modeled as\nI(p) = S(p) + N (p),\n\n(26)\n\nwhere S(p) ∈ R3 is the clean irradiance-dependent signal, and N (p) is stochastic sensor noise with: (i) E[N (p)] = 0, (ii)\nCov(N (p)) = σ 2 I3 with σ 2 &gt; 0, (iii) N (p) and N (q) are independent for p ̸= q (pixel-wise temporal noise). This captures\nthe commonly used Poisson–Gaussian approximation of shot + read noise.\nLemma G.2 (Irreducible neighbor-difference energy). Under Assumption G.1, for any adjacent (p, q),\n\u0002\n\u0003\nE ∥I(p) − I(q)∥22 S = ∥S(p) − S(q)∥22 + 2 · 3σ 2 ≥ ξnoise ,\nξnoise := 6σ 2 .\n(27)\nConsequently, E[Eloc (p) | S] ≥ ξnoise for all p.\nProof. Write ∆S := S(p) − S(q) and ∆N := N (p) − N (q), so I(p) − I(q) = ∆S + ∆N . Then\n\u0002\n\u0003\n\u0002\n\u0003\nE ∥∆S + ∆N ∥22 | S = ∥∆S ∥22 + 2⟨∆S , E[∆N ]⟩ + E ∥∆N ∥22 .\nThe cross term vanishes since E[∆N ] = 0. Moreover, by independence and Cov(N (p)) = σ 2 I3 ,\n\u0002\n\u0003\n\u0002\n\u0003\n\u0002\n\u0003\nE ∥∆N ∥22 = E ∥N (p)∥22 + E ∥N (q)∥22 = tr(σ 2 I3 ) + tr(σ 2 I3 ) = 6σ 2 .\nAveraging over q ∈ Np yields the same lower bound for Eloc (p).\nLemma G.2 provides a concrete sufficient condition for a strictly positive energy floor in authentic regions, consistent with\nAssumption 3.1 in the main paper.\nG.2.3. W HERE DIFFUSION ARTIFACTS COME FROM : A THREE - STAGE MECHANISM\nWe now analyze how each of the three steps in Appendix G.1 contributes to artifacts. Throughout, we use the term artifact\nto mean a systematic deviation of local statistics (e.g., Eloc ) from those induced by physical imaging (Lemma G.2).\nStage A (VAE compression): high-frequency attenuation. A VAE encoder/decoder pair with spatial downsampling\nfactor f &gt; 1 cannot preserve all high-frequency components at the pixel scale. This is not merely an implementation detail:\nthe compression implies that fine-scale residuals are partially projected out.\nTo state this formally, we adopt a standard local linearization of the VAE reconstruction operator. Let P := Dψ ◦ Eϕ denote\nthe (deterministic) VAE round-trip reconstruction map in image space.\nAssumption G.3 (Local smoothing property of VAE reconstruction). For small perturbations δx (e.g., sensor noise), the\nVAE reconstruction satisfies\nP (x + δx) − P (x) ≈ H(δx),\n(28)\nwhere H is a non-trivial local smoothing operator (not the identity), i.e., it mixes information within a neighborhood and\nattenuates pixel-wise independent components. Concretely, in a linear filter model, H is a convolution with a kernel h\nhaving support size ≥ 2.\nLemma G.4 (VAE reduces the sensor-noise-induced neighbor energy). Under Assumption G.1 and Assumption G.3, there\nexists a constant κvae ∈ (0, 1) such that for any adjacent (p, q),\n\u0002\n\u0003\nE ∥P (I)(p) − P (I)(q)∥22 S ≤ ∥P (S)(p) − P (S)(q)∥22 + κvae · ξnoise .\n(29)\nIn particular, the noise contribution to local energy is strictly attenuated by VAE compression.\nProof. Under the linearized model, the noise component after reconstruction is H(N ). If H is a non-trivial local smoother\n(kernel support ≥ 2), then H(N ) becomes spatially correlated and its per-pixel variance decreases relative to i.i.d. noise\n(a standard property of averaging filters). For a convolutional H, the neighbor difference H(N )(p) − H(N )(q) is a linear\ncombination of i.i.d. terms with coefficients given by differences of shifted kernels; the resulting variance is strictly smaller\nthan that of N (p) − N (q) unless H is identity. Thus there exists κvae ∈ (0, 1) (depending on h and the neighbor offset)\nsuch that E∥H(N )(p) − H(N )(q)∥22 ≤ κvae E∥N (p) − N (q)∥22 = κvae ξnoise . Adding the deterministic signal term yields\n(29).\n21\n\n\fOrder within Chaos\n\nStage B (denoiser/sampler): variance shrinkage and spectral bias. Diffusion denoisers are trained under an ℓ2 objective\nin Eq. (main Eq. (1)). Even in classical estimation theory, the ℓ2 optimal predictor is a conditional mean (an L2 projection),\nwhich reduces variance relative to the raw stochastic signal. Moreover, neural networks are empirically and theoretically\nknown to prioritize low-frequency patterns, which implies slower/poorer fitting of high-frequency stochastic components.\nWe use the following formal abstraction:\nAssumption G.5 (High-frequency variance deficit of diffusion synthesis). Let x̂gen be a region generated by the diffusion\nsampler and decoded by Dψ . There exists κdiff ∈ (0, 1) such that for adjacent (p, q) inside the generated region,\n\u0002\n\u0003\n\u0002\n\u0003\nE ∥x̂gen (p) − x̂gen (q)∥22 ≤ E ∥P (I)(p) − P (I)(q)∥22 − (1 − κdiff )ξnoise .\n\n(30)\n\nIntuitively, the generated region has less fine-scale stochastic variation than even the VAE-reconstructed authentic content.\nAssumption G.5 is supported by: (i) ℓ2 -trained denoisers behaving like conditional mean estimators on weak-SNR\ncomponents, and (ii) spectral bias results showing that high-frequency modes are learned slower and remain underrepresented\nunder finite training/sampling.\nStage C (hard latent replacement): seam discontinuity and covariance mismatch.\n(21) stitches two latent random fields:\ngen\nzt−1\n\n(model sample)\n\nref\nzt−1\n\nand\n\nFinally, the key inpainting operation\n\n(noised reference latent).\n\nEven if both are plausible latents, they are not drawn from the same conditional distribution at the boundary, and hard\nreplacement creates a piece-wise latent manifold. This violates the smoothness/coherence prior of natural images and yields\nseam artifacts after decoding.\nWe formalize this via a boundary-crossing energy lower bound.\nLemma G.6 (Cross-boundary energy is strictly larger). Let p ∈ U and q ∈ M be adjacent across the boundary. Assume\nthat (conditionally on coarse content) the preserved pixel IU (p) and generated pixel IM (q) have different second-order\nstatistics:\nE[IU (p)] ̸= E[IM (q)]\n\nor\n\nCov(IU (p)) ̸= Cov(IM (q)).\n\n(31)\n\nThen the expected cross-boundary squared difference satisfies\n\u0002\n\u0003\n\u0002\n\u0003\nE ∥IU (p) − IM (q)∥22 ≥ E ∥IU (p) − IU (q ′ )∥22 + ∆∂ ,\n\n(32)\n\nfor some ∆∂ &gt; 0 and any q ′ ∈ Np ∩ U , provided the mismatch in (31) is non-degenerate.\nProof. Let X := IU (p) and Y := IM (q). Then\n\u0001\nE∥X − Y ∥22 = ∥EX − EY ∥22 + tr Cov(X) + Cov(Y ) − 2Cov(X, Y ) .\nAcross the boundary, the dependence between X and Y is weaker than within a single coherent field, so Cov(X, Y ) cannot\nfully cancel the sum of marginal covariances. Moreover, any mean mismatch contributes the nonnegative term ∥EX − EY ∥22 .\nIn contrast, within U, for Y ′ := IU (q ′ ), the pair (X, Y ′ ) shares matched statistics and stronger local correlation, yielding\nsmaller expected squared differences. Thus there exists ∆∂ &gt; 0 whenever the mismatch (31) is non-degenerate.\nLemma G.6 captures the boundary spike phenomenon; it is further amplified in latent pipelines because latent compositing\nis not pixel-equivalent.\nG.2.4. M AIN RESULTS : INEVITABILITY, INPAINTING AMPLIFICATION , AND LOCAL SEPARABILITY\nWe now prove the three target claims.\n22\n\n\fOrder within Chaos\n\n(1) Diffusion models inevitably introduce artifacts. We formalize this as an energy-statistic separation between physically\ncaptured images and LDM-generated images.\nTheorem G.7 (Unavoidable energy anomaly of latent diffusion synthesis). Assume the authentic imaging process satisfies\nAssumption G.1. Consider any edited image x̂ produced by the three-stage pipeline in Appendix G.1. If (i) the VAE\nreconstruction attenuates pixel-wise independent noise (Lemma G.4) and (ii) the diffusion synthesis exhibits a high-frequency\nvariance deficit (Assumption G.5), then there exists δ &gt; 0 such that\nEloc (M) ≤ Eloc (U) − δ.\n\n(33)\n\nEquivalently, the generated region necessarily differs from the preserved region in the local neighbor-difference energy,\nhence artifacts are unavoidable under this statistic.\nProof. Inside the preserved region U, the masked replacement (21) forces ztU to follow the forward noised reference latent\nat every step; thus the decoded output in U is effectively anchored to the VAE reconstruction of the original content, up\nto small decoding imperfections. Therefore, by Lemma G.4, adjacent differences in U retain a nontrivial fraction of the\nphysical noise-induced energy.\nInside the generated region M, the latent is produced by the learned reverse process and then decoded. By Assumption G.5,\nthe expected adjacent squared differences in M are strictly smaller than those in the VAE-reconstructed authentic content by\na margin proportional to ξnoise . Averaging over neighbors and over pixels in U and M yields the claimed strict gap with\nδ := (1 − κdiff )ξnoise (up to constant factors absorbed by averaging).\n(2) Inpainting causes larger artifacts in the edited region and a boundary spike. We now give a complete proof of\nthe energy gap and boundary spike stated as Theorem 3.3 in the main paper, with explicit dependence on the three-stage\nmechanism.\nTheorem G.8 (Energy Gap &amp; Boundary Spike (full proof)). Let x̂ be produced by masked latent diffusion inpainting\n(Algorithm 1). Assume Assumption G.1, Assumption G.3, and Assumption G.5. Then:\n1. Interior Gap: Eloc (U) &gt; Eloc (M).\n2. Boundary Spike: Let ∂M := {p ∈ Ω : ∃q ∈ Np s.t. m(p) ̸= m(q)}. Then Eloc (∂M) ≫ Eloc (M) in the sense that\nEloc (∂M) ≥ Eloc (U) + ∆∂ ,\n\n(34)\n\nfor some ∆∂ &gt; 0 determined by the cross-boundary statistical mismatch.\nref\nProof. (Interior gap). Fix an adjacent pair (p, q) fully inside U. Because zt−1 is replaced by zt−1\non U for every t, the\ndecoded output on U is anchored to P (I), where I is the authentic image content. Thus, for (p, q) ⊂ U,\n\nE∥x̂(p) − x̂(q)∥22 ≈ E∥P (I)(p) − P (I)(q)∥22 .\nNow fix an adjacent pair (p, q) fully inside M. By Assumption G.5,\nE∥x̂(p) − x̂(q)∥22 ≤ E∥P (I)(p) − P (I)(q)∥22 − (1 − κdiff )ξnoise .\nAveraging over neighbors and pixels yields Eloc (M) ≤ Eloc (U) − δ for δ &gt; 0, hence Eloc (U) &gt; Eloc (M).\n(Boundary spike). Consider a boundary pixel p ∈ ∂M. By definition, at least one neighbor q ∈ Np lies on the opposite\nside of the mask. Such neighbor pairs are cross-boundary pairs of the form treated in Lemma G.6. Under non-degenerate\nmismatch of statistics across the stitched fields (which is induced by the fact that one side is anchored to z ref and the other is\nsampled from z gen and then decoded), Lemma G.6 implies a strict increase in expected squared differences for at least one\nneighbor term in the sum (24). Therefore, Eloc (p) is larger than the within-U baseline by at least ∆∂ /|Np | in expectation,\nand averaging over p ∈ ∂M yields Eloc (∂M) ≥ Eloc (M) + ∆∂ (absorbing neighborhood constants into ∆∂ ).\n23\n\n\fOrder within Chaos\n\n(3) Local adjacency differences yield a separable artifact feature (LAD). Theorem G.8 states that inpainting creates a\ncharacteristic topology: a low-energy hole surrounded by a high-energy ring, against a higher-energy background. We now\nshow that comparing adjacent pixel differences is sufficient to expose this topology.\nRecall the LAD operator (Definition 3.4 in the main paper):\nL(p) :=\n\n\u0010 ∥I(p) − I(q)∥2 \u0011\n1 X\n2\n,\ntanh\n|Np |\nτ2\n\n(35)\n\nq∈Np\n\nwhere τ &gt; 0 is a temperature. Let Ψ(u) := tanh(u/τ 2 ) ∈ (0, 1).\nLemma G.9 (LAD is a robust monotone transform of local energy). For any p, L(p) is a bounded, monotone increasing\nfunctional of the set {∥I(p) − I(q)∥22 : q ∈ Np }. Moreover, for any nonnegative random variable X, Ψ is concave on\nX ≥ 0 and satisfies\nE[Ψ(X)] ≤ Ψ(E[X]).\n(36)\nProof. Monotonicity and boundedness are immediate from tanh being monotone and bounded in (0, 1) for positive inputs.\nConcavity of tanh on R≥0 is given by tanh′′ (u) = −2 tanh(u) sech2 (u) &lt; 0 for u &gt; 0. Jensen’s inequality yields\n(36).\nTheorem G.10 (Artifact separability in LAD space). Assume the conditions of Theorem G.8. Then there exist constants\n0 &lt; µM &lt; µU &lt; µ∂ such that\nE[L(p) | p ∈ M] ≤ µM ,\n\nE[L(p) | p ∈ U] ≥ µU ,\n\nE[L(p) | p ∈ ∂M] ≥ µ∂ .\n\nFurthermore, because L(p) averages bounded terms, it concentrates around its expectation: for any ϵ &gt; 0,\n\u0001\n\u0001\nP |L(p) − EL(p)| ≥ ϵ ≤ 2 exp − 2|Np |ϵ2 .\n\n(37)\n\n(38)\n\nHence, a simple threshold on L(p) can separate M and U with high probability, and pixels on ∂M saturate to high LAD\nresponses.\nProof. By Theorem G.8, the distribution of adjacent squared differences inside M is shifted to smaller values than inside U,\nwhile cross-boundary differences are shifted to larger values. Since Ψ is monotone increasing, these shifts imply an ordering\nof expectations of Ψ(∥I(p) − I(q)∥22 ) across regions, and averaging over neighbors preserves the ordering, yielding (37) for\nsome constants (µM , µU , µ∂ ).\nP\nFor concentration, define Yq := Ψ(∥I(p) − I(q)∥22 ) ∈ (0, 1) for each neighbor q ∈ Np . Then L(p) = |N1p | q Yq is\nan average of bounded random variables. Hoeffding’s inequality gives (38) (independence is not strictly required for a\nqualitative concentration statement; bounded-difference martingale variants yield similar bounds under mild dependence).\nThus LAD provides a robust, locally aggregated estimator that preserves the energy gap (interior) and emphasizes the\nboundary spike, enabling reliable discrimination of M vs. U.\nImplication for method design. Theorems G.7–G.10 establish a principled route from diffusion editing mechanics (VAE\ncompression + denoiser spectral bias + hard latent stitching) to a local adjacency statistic that is separable for authentic\nvs. generated regions. This directly motivates using the LAD map as an explicit artifact representation, upon which a\ndownstream segmentation/refinement model can operate.\n\nH. Hyperparameter Values\n\n24\n\n\fOrder within Chaos\nTable 9. Optimal hyperparameter values with sweep range.\n\nHyperparameter\n\nOptimal\n\nSweep Range\n\nLearning rate\nTemperature τ\nFocal α\nFocal γ\nAdam weight decay\nDropout rate\nBatch size\n\n0.001\n0.004\n0.6\n1.0\n0.0001\n0.2\n8\n\n{0.01, 0.001, 0.0001, 0.00001}\n{0.002, 0.004, 0.006, 0.008, 0.010}\n{0.5, 0.55, . . . , 0.75, 0.80}\n{1.0, 1.25, . . . , 1.75, 2.0}\n{0.0001, 0.00001, 0.0}\n{0.0, 0.1, 0.15, 0.2, 0.25, 0.3}\n{2, 4, 8, 16}\n\nI. Prompts for EditStream\nSemantic Planner Instruction\nYou are a highly intelligent Semantic Planner for an image editing dataset generation pipeline. Your task is to\nanalyze the provided image and generate a realistic, logic-consistent editing instruction.\nPlease follow these steps:\n1. Scene Analysis: Identify salient objects and the background environment.\n2. Feasibility Check: Determine which editing operations are visually and semantically feasible for this specific\nimage.\n3. Operation Selection: Select ONE operation from the following categories based on feasibility (aim for\ndiversity):\n• Object Addition: Insert a new object that fits the context (e.g., ”Add a red car in the driveway”).\n• Object Removal: Erase an existing entity (e.g., ”Remove the pedestrian”).\n• Object Replacement: Swap an object with a semantically different one.\n• Background Alteration: Modify environmental textures or styles (e.g., ”Change the grass to snow”).\n4. Output Generation: Provide the edit instruction and the approximate bounding box of the target region.\nOutput Format (JSON strictly):\n{\n\"scene description\": \"Brief description of the scene...\",\n\"selected operation\": \"Object Replacement\", // One of the 4 categories\n\"edit instruction\": \"Replace the brown dog with a white cat\",\n\"target object name\": \"brown dog\",\n\"target region box\": [x min, y min, x max, y max], // Normalized [0-1]\n\"reasoning\": \"The dog is clearly visible and replacing it creates a meaningful\nsemantic change.\"\n}\n\n25\n\n\fOrder within Chaos\n\nAutonomous Model Scouting Agent\nYou are an Autonomous Model Scouting Agent tasked with identifying the latest and most capable image inpainting\nmodels on Hugging Face.\nYou have access to a tool named search hf models. Your mission is:\n1. Search: Use the tool to find models with the tag image-to-image.\n2. Filter &amp; Rank: Analyze the search results based on the following multi-metric criteria:\n• Popularity: High download counts and likes.\n• Recency: Prioritize models updated within the last 3 months (trending status).\n• Architecture: Look for diverse architectures.\n3. Selection: Select the top-3 distinct candidates that are most promising for high-quality image editing.\nResponse Requirements:\n• Call the search tool first.\n• After receiving results, output a list of the 3 selected model ids.\n• Provide a brief justification for each selection based on the metrics.\n\n26\n\n\fOrder within Chaos\n\nSenior AI Software Engineer\nYou are a Senior AI Software Engineer specializing in ModelOps. I will provide you with the raw text content of a\nHugging Face Model Card (README) for a specific inpainting model.\nYour Task:\nSynthesize a standardized Python wrapper class named EditStreamWrapper for this model.\nRequirements:\n1. Interface Standardization: The class must implement a generate(self, image, mask, prompt)\nmethod.\n• image: Input PIL Image (RGB).\n• mask: Binary PIL Image (White=Edit, Black=Keep).\n• prompt: String describing the edit.\n2. Constraint Parsing: Analyze the README text to identify:\n• Resolution limits (e.g., if it requires 512x512, implement auto-resizing in the wrapper).\n• Specific input formatting (e.g., strictly masked inputs vs. original image + mask).\n3. Dependency Handling: Include a valid init method that loads the model using diffusers or the\nspecific library mentioned in the README. Use CUDA if available.\n4. Error Handling: Add basic error handling for dimension mismatches.\nInput Model Card Content:\n\"\"\"\n{{INSERT MODEL CARD CONTENT HERE}}\n\"\"\"\n\nOutput:\nReturn ONLY the executable Python code block containing the EditStreamWrapper class.\n\n27\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"