"<!DOCTYPE html>\n<html lang=\"zh\" data-theme=\"light\">\n<head>\n<meta charset=\"utf-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<title>fulltext.txt — Vercel Design System</title>\n<link rel=\"preconnect\" href=\"https://fonts.googleapis.com\">\n<link rel=\"preconnect\" href=\"https://fonts.gstatic.com\" crossorigin>\n<link href=\"https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500;600&display=swap\" rel=\"stylesheet\">\n<link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/katex@0.16.8/dist/katex.min.css\">\n<style>\n\n:root {\n  /* Vercel Palette */\n  --geist-foreground: #171717;\n  --geist-background: #ffffff;\n  --geist-secondary: #4d4d4d;\n  --geist-tertiary: #666666;\n  --geist-quaternary: #808080;\n  --geist-border: #ebebeb;\n  --geist-surface-tint: #fafafa;\n  \n  /* Workflow Accents */\n  --develop-blue: #0a72ef;\n  --preview-pink: #de1d8d;\n  --ship-red: #ff5b4f;\n  \n  /* Interactive & Status */\n  --link-blue: #0072f5;\n  --ds-focus-color: hsla(212, 100%, 48%, 1);\n  --badge-blue-bg: #ebf5ff;\n  --badge-blue-text: #0068d6;\n  \n  /* Shadow-as-Border Philosophy */\n  --shadow-border: rgba(0, 0, 0, 0.08) 0px 0px 0px 1px;\n  --shadow-border-hover: rgba(0, 0, 0, 0.16) 0px 0px 0px 1px;\n  --shadow-card: rgba(0, 0, 0, 0.08) 0px 0px 0px 1px, rgba(0, 0, 0, 0.04) 0px 2px 2px, #fafafa 0px 0px 0px 1px;\n  --shadow-card-hover: rgba(0, 0, 0, 0.12) 0px 0px 0px 1px, rgba(0, 0, 0, 0.06) 0px 4px 6px, #fafafa 0px 0px 0px 1px;\n  --shadow-card-full: rgba(0, 0, 0, 0.08) 0px 0px 0px 1px, rgba(0, 0, 0, 0.04) 0px 2px 2px, rgba(0, 0, 0, 0.04) 0px 8px 8px -8px, #fafafa 0px 0px 0px 1px;\n  --shadow-ring: rgb(235, 235, 235) 0px 0px 0px 1px;\n  \n  /* Radius Scale */\n  --radius-xs: 2px;\n  --radius-sm: 4px;\n  --radius-md: 6px;\n  --radius-lg: 8px;\n  --radius-xl: 12px;\n  --radius-pill: 9999px;\n}\n\n[data-theme=\"dark\"] {\n  --geist-foreground: #ededed;\n  --geist-background: #000000;\n  --geist-secondary: #a1a1a1;\n  --geist-tertiary: #888888;\n  --geist-quaternary: #666666;\n  --geist-border: #222222;\n  --geist-surface-tint: #0a0a0a;\n  \n  --shadow-border: rgba(255, 255, 255, 0.14) 0px 0px 0px 1px;\n  --shadow-border-hover: rgba(255, 255, 255, 0.28) 0px 0px 0px 1px;\n  --shadow-card: rgba(255, 255, 255, 0.12) 0px 0px 0px 1px, rgba(0, 0, 0, 0.4) 0px 2px 4px, #111111 0px 0px 0px 1px;\n  --shadow-card-hover: rgba(255, 255, 255, 0.2) 0px 0px 0px 1px, rgba(0, 0, 0, 0.5) 0px 6px 12px, #111111 0px 0px 0px 1px;\n  --shadow-card-full: rgba(255, 255, 255, 0.12) 0px 0px 0px 1px, rgba(0, 0, 0, 0.5) 0px 8px 16px -4px, #111111 0px 0px 0px 1px;\n  --shadow-ring: rgb(40, 40, 40) 0px 0px 0px 1px;\n  \n  --badge-blue-bg: rgba(10, 114, 239, 0.15);\n  --badge-blue-text: #70b5ff;\n}\n\n* { box-sizing: border-box; }\nhtml { scroll-behavior: smooth; }\nbody {\n  margin: 0;\n  font-family: \"Geist\", Arial, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif;\n  background-color: var(--geist-background);\n  color: var(--geist-foreground);\n  font-feature-settings: \"liga\" 1;\n  -webkit-font-smoothing: antialiased;\n  min-height: 100vh;\n}\n\na {\n  color: inherit;\n  text-decoration: none;\n  transition: color 0.15s ease;\n}\n\n/* 导航栏 (Vercel Clean Sticky Nav) */\n.vercel-nav {\n  position: sticky;\n  top: 0;\n  background-color: var(--geist-background);\n  box-shadow: var(--shadow-border);\n  z-index: 100;\n  padding: 0 24px;\n  height: 64px;\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n}\n.nav-brand {\n  display: flex;\n  align-items: center;\n  gap: 12px;\n}\n.vercel-triangle {\n  width: 22px;\n  height: 19px;\n  fill: var(--geist-foreground);\n}\n.nav-title {\n  font-size: 16px;\n  font-weight: 600;\n  letter-spacing: -0.32px;\n  color: var(--geist-foreground);\n}\n.nav-badge-pill {\n  font-family: \"Geist Mono\", ui-monospace, monospace;\n  font-size: 11px;\n  font-weight: 500;\n  text-transform: uppercase;\n  background: var(--badge-blue-bg);\n  color: var(--badge-blue-text);\n  padding: 2px 8px;\n  border-radius: var(--radius-pill);\n}\n\n.nav-links {\n  display: flex;\n  align-items: center;\n  gap: 24px;\n}\n.nav-link {\n  font-size: 14px;\n  font-weight: 500;\n  color: var(--geist-secondary);\n  text-decoration: none;\n  transition: color 0.15s;\n}\n.nav-link:hover, .nav-link.active {\n  color: var(--geist-foreground);\n}\n.nav-link.active {\n  font-weight: 600;\n}\n\n.nav-actions {\n  display: flex;\n  align-items: center;\n  gap: 12px;\n}\n\n/* 按钮规范 */\n.btn-primary-dark {\n  background: var(--geist-foreground);\n  color: var(--geist-background);\n  border: none;\n  padding: 8px 16px;\n  border-radius: var(--radius-md);\n  font-size: 14px;\n  font-weight: 500;\n  cursor: pointer;\n  text-decoration: none;\n  display: inline-flex;\n  align-items: center;\n  gap: 6px;\n  transition: opacity 0.15s;\n}\n.btn-primary-dark:hover {\n  opacity: 0.9;\n}\n.btn-secondary-white {\n  background: var(--geist-background);\n  color: var(--geist-foreground);\n  box-shadow: var(--shadow-border);\n  border: none;\n  padding: 8px 16px;\n  border-radius: var(--radius-md);\n  font-size: 14px;\n  font-weight: 500;\n  cursor: pointer;\n  text-decoration: none;\n  display: inline-flex;\n  align-items: center;\n  gap: 6px;\n  transition: background 0.15s, box-shadow 0.15s;\n}\n.btn-secondary-white:hover {\n  background: var(--geist-surface-tint);\n  box-shadow: var(--shadow-border-hover);\n}\n.theme-toggle-btn {\n  background: transparent;\n  border: none;\n  box-shadow: var(--shadow-border);\n  border-radius: var(--radius-md);\n  width: 36px;\n  height: 36px;\n  cursor: pointer;\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  color: var(--geist-foreground);\n}\n\n/* 核心容器 */\n.vercel-container {\n  max-width: 1200px;\n  margin: 0 auto;\n  padding: 56px 24px 100px;\n}\n\n/* Hero Section (Gallery Emptiness + Negative Letter-spacing) */\n.vercel-hero {\n  text-align: center;\n  max-width: 860px;\n  margin: 0 auto 56px;\n}\n.hero-stage-badge {\n  display: inline-flex;\n  align-items: center;\n  gap: 8px;\n  background: var(--geist-surface-tint);\n  box-shadow: var(--shadow-border);\n  padding: 4px 14px;\n  border-radius: var(--radius-pill);\n  font-size: 13px;\n  font-weight: 500;\n  color: var(--geist-secondary);\n  margin-bottom: 24px;\n}\n.stage-dot {\n  width: 7px;\n  height: 7px;\n  border-radius: 50%;\n}\n.vercel-hero h1 {\n  font-size: 48px;\n  font-weight: 600;\n  line-height: 1.05;\n  letter-spacing: -2.4px;\n  color: var(--geist-foreground);\n  margin: 0 0 16px;\n}\n.vercel-hero p {\n  font-size: 20px;\n  font-weight: 400;\n  line-height: 1.80;\n  color: var(--geist-secondary);\n  margin: 0 auto 28px;\n}\n\n/* Workflow Pipeline (Develop -> Preview -> Ship) */\n.workflow-pipeline {\n  display: grid;\n  grid-template-columns: repeat(3, 1fr);\n  gap: 16px;\n  margin-bottom: 48px;\n}\n@media (max-width: 768px) {\n  .workflow-pipeline { grid-template-columns: 1fr; }\n}\n.workflow-step {\n  background: var(--geist-background);\n  box-shadow: var(--shadow-card);\n  border-radius: var(--radius-lg);\n  padding: 20px 22px;\n  transition: box-shadow 0.2s;\n}\n.workflow-step:hover {\n  box-shadow: var(--shadow-card-hover);\n}\n.step-mono-label {\n  font-family: \"Geist Mono\", monospace;\n  font-size: 12px;\n  font-weight: 500;\n  text-transform: uppercase;\n  letter-spacing: 0.5px;\n  margin-bottom: 8px;\n  display: flex;\n  align-items: center;\n  gap: 6px;\n}\n.step-title {\n  font-size: 20px;\n  font-weight: 600;\n  letter-spacing: -0.96px;\n  color: var(--geist-foreground);\n  margin-bottom: 6px;\n}\n.step-desc {\n  font-size: 14px;\n  color: var(--geist-secondary);\n  line-height: 1.5;\n}\n\n/* Metric Cards (Section 4 Spec) */\n.metric-grid {\n  display: grid;\n  grid-template-columns: repeat(4, 1fr);\n  gap: 16px;\n  margin-bottom: 48px;\n}\n@media (max-width: 900px) {\n  .metric-grid { grid-template-columns: repeat(2, 1fr); }\n}\n.metric-card {\n  background: var(--geist-background);\n  box-shadow: var(--shadow-card);\n  border-radius: var(--radius-lg);\n  padding: 20px;\n}\n.metric-number {\n  font-size: 40px;\n  font-weight: 600;\n  line-height: 1.0;\n  letter-spacing: -2.4px;\n  color: var(--geist-foreground);\n  margin-bottom: 8px;\n  font-feature-settings: \"tnum\" 1;\n}\n.metric-label {\n  font-size: 14px;\n  color: var(--geist-secondary);\n  line-height: 1.4;\n}\n\n/* VAD 专栏 Banner (Ship Red & Vercel Clean) */\n.vad-showcase {\n  background: var(--geist-background);\n  box-shadow: var(--shadow-card-full);\n  border-radius: var(--radius-xl);\n  padding: 32px;\n  margin-bottom: 48px;\n  position: relative;\n}\n.vad-header-row {\n  display: flex;\n  align-items: baseline;\n  justify-content: space-between;\n  flex-wrap: wrap;\n  gap: 12px;\n  margin-bottom: 12px;\n}\n.vad-header-row h2 {\n  font-size: 32px;\n  font-weight: 600;\n  letter-spacing: -1.28px;\n  color: var(--geist-foreground);\n  margin: 0;\n}\n.vad-pillars-grid {\n  display: grid;\n  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));\n  gap: 14px;\n  margin-top: 24px;\n}\n.vad-pillar-item {\n  background: var(--geist-surface-tint);\n  box-shadow: var(--shadow-border);\n  border-radius: var(--radius-md);\n  padding: 14px 16px;\n}\n.vad-pillar-title {\n  font-size: 14px;\n  font-weight: 600;\n  color: var(--ship-red);\n  margin-bottom: 4px;\n}\n.vad-pillar-text {\n  font-size: 13px;\n  color: var(--geist-secondary);\n  line-height: 1.5;\n}\n.vad-filter-bar {\n  display: flex;\n  flex-wrap: wrap;\n  align-items: center;\n  justify-content: space-between;\n  gap: 12px;\n  margin: 24px 0 16px;\n  padding: 12px 16px;\n  background: var(--geist-surface-tint);\n  border-radius: var(--radius-md);\n  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);\n}\n.vad-filter-btn {\n  font-family: 'Geist', sans-serif;\n  font-size: 13px;\n  font-weight: 500;\n  padding: 6px 14px;\n  border-radius: 9999px;\n  border: none;\n  background: transparent;\n  color: var(--geist-secondary);\n  cursor: pointer;\n  transition: all 0.15s ease;\n}\n.vad-filter-btn:hover {\n  color: var(--geist-foreground);\n  background: rgba(0,0,0,0.05);\n}\n.vad-filter-btn.active {\n  background: #171717;\n  color: #ffffff;\n}\n.vad-search-input {\n  font-family: 'Geist', sans-serif;\n  font-size: 13px;\n  padding: 7px 12px;\n  border-radius: 6px;\n  border: 1px solid var(--geist-border);\n  background: #ffffff;\n  color: var(--geist-foreground);\n  width: 280px;\n  outline: none;\n  transition: border-color 0.15s, box-shadow 0.15s;\n}\n.vad-search-input:focus {\n  border-color: #0a72ef;\n  box-shadow: 0 0 0 2px rgba(10, 114, 239, 0.2);\n}\n\n/* 控制栏：搜索、视图、筛选 */\n.control-bar {\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  gap: 16px;\n  margin-bottom: 24px;\n  flex-wrap: wrap;\n}\n.search-input-wrap {\n  position: relative;\n  flex: 1;\n  max-width: 480px;\n}\n.search-input {\n  width: 100%;\n  height: 40px;\n  padding: 0 38px 0 14px;\n  font-family: \"Geist\", sans-serif;\n  font-size: 14px;\n  color: var(--geist-foreground);\n  background: var(--geist-background);\n  box-shadow: var(--shadow-border);\n  border: none;\n  border-radius: var(--radius-md);\n  outline: none;\n  transition: box-shadow 0.15s;\n}\n.search-input:focus {\n  outline: 2px solid var(--ds-focus-color);\n  box-shadow: none;\n}\n.search-kbd {\n  position: absolute;\n  right: 12px;\n  top: 50%;\n  transform: translateY(-50%);\n  font-family: \"Geist Mono\", monospace;\n  font-size: 11px;\n  color: var(--geist-quaternary);\n  background: var(--geist-surface-tint);\n  box-shadow: var(--shadow-border);\n  padding: 2px 6px;\n  border-radius: var(--radius-sm);\n}\n\n.view-switcher {\n  display: flex;\n  box-shadow: var(--shadow-border);\n  border-radius: var(--radius-md);\n  background: var(--geist-background);\n  padding: 2px;\n}\n.view-btn {\n  background: transparent;\n  border: none;\n  font-size: 13px;\n  font-weight: 500;\n  color: var(--geist-tertiary);\n  padding: 6px 12px;\n  border-radius: var(--radius-sm);\n  cursor: pointer;\n  transition: color 0.15s, background 0.15s;\n}\n.view-btn.active {\n  background: var(--geist-surface-tint);\n  color: var(--geist-foreground);\n  font-weight: 600;\n}\n\n/* 筛选芯片行 (Filter Pill Strip) */\n.filter-group-strip {\n  display: flex;\n  flex-direction: column;\n  gap: 12px;\n  margin-bottom: 28px;\n  padding: 16px 20px;\n  background: var(--geist-surface-tint);\n  box-shadow: var(--shadow-border);\n  border-radius: var(--radius-lg);\n}\n.filter-row {\n  display: flex;\n  align-items: center;\n  gap: 8px;\n  flex-wrap: wrap;\n}\n.filter-label-mono {\n  font-family: \"Geist Mono\", monospace;\n  font-size: 11px;\n  font-weight: 500;\n  text-transform: uppercase;\n  color: var(--geist-quaternary);\n  min-width: 68px;\n}\n.pill-badge {\n  background: var(--geist-background);\n  color: var(--geist-secondary);\n  box-shadow: var(--shadow-border);\n  border: none;\n  padding: 3px 12px;\n  border-radius: var(--radius-pill);\n  font-size: 12px;\n  font-weight: 500;\n  cursor: pointer;\n  transition: all 0.15s;\n  display: inline-flex;\n  align-items: center;\n  gap: 6px;\n}\n.pill-badge:hover {\n  color: var(--geist-foreground);\n  box-shadow: var(--shadow-border-hover);\n}\n.pill-badge.active {\n  background: var(--geist-foreground);\n  color: var(--geist-background);\n  font-weight: 600;\n  box-shadow: none;\n}\n.pill-badge.active-blue {\n  background: var(--develop-blue);\n  color: #ffffff;\n  box-shadow: none;\n}\n.pill-badge.active-red {\n  background: var(--ship-red);\n  color: #ffffff;\n  box-shadow: none;\n}\n\n/* Bento Grid Cards (Section 4 & 6 Spec) */\n.card-grid-bento {\n  display: grid;\n  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));\n  gap: 16px;\n}\n.vercel-card {\n  background: var(--geist-background);\n  box-shadow: var(--shadow-card);\n  border-radius: var(--radius-lg);\n  padding: 20px;\n  display: flex;\n  flex-direction: column;\n  justify-content: space-between;\n  transition: box-shadow 0.2s, transform 0.2s;\n  text-decoration: none;\n  color: inherit;\n  overflow: hidden;\n  min-width: 0;\n  word-break: break-word;\n}\n.vercel-card:hover {\n  box-shadow: var(--shadow-card-hover);\n  transform: translateY(-2px);\n}\n.card-top {\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  margin-bottom: 12px;\n  gap: 8px;\n}\n.card-tag-mono {\n  font-family: \"Geist Mono\", monospace;\n  font-size: 11px;\n  font-weight: 500;\n  text-transform: uppercase;\n  color: var(--geist-quaternary);\n  letter-spacing: 0.5px;\n}\n.status-pill-badge {\n  padding: 2px 8px;\n  border-radius: var(--radius-pill);\n  font-size: 11px;\n  font-weight: 500;\n  flex-shrink: 0;\n}\n.pub-accepted { background: #ebfdf2; color: #027a48; }\n.pub-workshop { background: #eff8ff; color: #175cd3; }\n.pub-submitted { background: #fff8e6; color: #b54708; }\n.pub-preprint { background: #f2f4f7; color: #475467; }\n.pub-other { background: #f9f5ff; color: #6941c6; }\n\n[data-theme=\"dark\"] .pub-accepted { background: rgba(2, 122, 72, 0.2); color: #32d583; }\n[data-theme=\"dark\"] .pub-workshop { background: rgba(23, 92, 211, 0.2); color: #84caff; }\n[data-theme=\"dark\"] .pub-submitted { background: rgba(181, 71, 8, 0.2); color: #fec84b; }\n[data-theme=\"dark\"] .pub-preprint { background: rgba(71, 84, 103, 0.2); color: #98a2b3; }\n[data-theme=\"dark\"] .pub-other { background: rgba(105, 65, 198, 0.2); color: #d6bbfb; }\n\n/* 必读标杆徽章 (Vercel Amber Accent) */\n.milestone-badge {\n  display: inline-flex;\n  align-items: center;\n  gap: 3px;\n  padding: 2px 7px;\n  border-radius: var(--radius-pill);\n  font-size: 11px;\n  font-weight: 600;\n  white-space: nowrap;\n  flex-shrink: 0;\n  transition: all 0.15s ease;\n}\n.milestone-badge.ms-idea, .milestone-badge:not([class*=\"ms-\"]) {\n  color: #b54708;\n  background: #fff8e6;\n  border: 1px solid rgba(247, 144, 9, 0.35);\n  box-shadow: 0 1px 2px rgba(181, 71, 8, 0.05);\n}\n[data-theme=\"dark\"] .milestone-badge.ms-idea, [data-theme=\"dark\"] .milestone-badge:not([class*=\"ms-\"]) {\n  color: #fec84b;\n  background: rgba(181, 71, 8, 0.22);\n  border-color: rgba(254, 200, 75, 0.35);\n}\n.milestone-badge.ms-writing {\n  color: #6941c6;\n  background: #f9f5ff;\n  border: 1px solid rgba(105, 65, 198, 0.3);\n  box-shadow: 0 1px 2px rgba(105, 65, 198, 0.05);\n}\n[data-theme=\"dark\"] .milestone-badge.ms-writing {\n  color: #d6bbfb;\n  background: rgba(105, 65, 198, 0.22);\n  border-color: rgba(214, 187, 251, 0.35);\n}\n.milestone-badge.ms-value {\n  color: #027a48;\n  background: #ebfdf2;\n  border: 1px solid rgba(2, 122, 72, 0.3);\n  box-shadow: 0 1px 2px rgba(2, 122, 72, 0.05);\n}\n[data-theme=\"dark\"] .milestone-badge.ms-value {\n  color: #32d583;\n  background: rgba(2, 122, 72, 0.22);\n  border-color: rgba(50, 213, 131, 0.35);\n}\n\n/* 论文正文图表与插图卡片样式 (Geist Design) */\n.paper-figure, .article-body figure {\n  margin: 32px auto;\n  text-align: center;\n  max-width: 100%;\n}\n.paper-figure img, .article-body img {\n  max-width: 96%;\n  height: auto;\n  border-radius: var(--radius-md);\n  border: 1px solid var(--geist-border);\n  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);\n  background: #ffffff;\n  transition: transform 0.2s ease, box-shadow 0.2s ease;\n  display: block;\n  margin: 0 auto;\n}\n.paper-figure img:hover, .article-body img:hover {\n  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);\n}\n.paper-figure figcaption, .article-body figcaption {\n  font-size: 13px;\n  color: var(--geist-secondary);\n  margin-top: 10px;\n  line-height: 1.6;\n  font-style: italic;\n  max-width: 850px;\n  margin-left: auto;\n  margin-right: auto;\n}\n\n/* VAD 视图切换器 View Switcher */\n.vad-view-switcher {\n  display: inline-flex;\n  padding: 3px;\n  background: var(--geist-secondary-bg);\n  border: 1px solid var(--geist-border);\n  border-radius: 8px;\n  margin-bottom: 20px;\n  gap: 2px;\n}\n.view-switch-btn {\n  display: inline-flex;\n  align-items: center;\n  gap: 6px;\n  padding: 6px 14px;\n  font-size: 13px;\n  font-weight: 500;\n  color: var(--geist-secondary);\n  border-radius: 6px;\n  text-decoration: none;\n  transition: all 0.15s ease;\n}\n.view-switch-btn:hover {\n  color: var(--geist-foreground);\n  background: rgba(0, 0, 0, 0.04);\n}\n[data-theme=\"dark\"] .view-switch-btn:hover {\n  background: rgba(255, 255, 255, 0.06);\n}\n.view-switch-btn.active {\n  background: var(--geist-background);\n  color: var(--geist-foreground);\n  font-weight: 600;\n  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n}\n\n/* 关系图谱 Graph View Styles */\n.graph-container {\n  position: relative;\n  width: 100%;\n  height: 720px;\n  background: var(--geist-background);\n  border: 1px solid var(--geist-border);\n  border-radius: var(--radius-lg);\n  overflow: hidden;\n  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);\n  margin-bottom: 40px;\n}\n.graph-toolbar {\n  position: absolute;\n  top: 14px;\n  left: 14px;\n  right: 14px;\n  z-index: 10;\n  display: flex;\n  justify-content: space-between;\n  align-items: center;\n  background: var(--geist-background);\n  border: 1px solid var(--geist-border);\n  padding: 8px 14px;\n  border-radius: 8px;\n  box-shadow: 0 4px 16px rgba(0,0,0,0.06);\n  flex-wrap: wrap;\n  gap: 8px;\n}\n.graph-tool-title {\n  font-size: 13px;\n  font-weight: 700;\n  display: flex;\n  align-items: center;\n  gap: 6px;\n  color: var(--geist-foreground);\n}\n.graph-filter-group {\n  display: flex;\n  gap: 6px;\n  align-items: center;\n  flex-wrap: wrap;\n}\n.graph-chip {\n  font-size: 11px;\n  padding: 3px 8px;\n  border-radius: 4px;\n  border: 1px solid var(--geist-border);\n  background: var(--geist-background);\n  color: var(--geist-foreground);\n  cursor: pointer;\n  transition: all 0.15s ease;\n}\n.graph-chip:hover { background: var(--geist-secondary-bg); }\n.graph-chip.active {\n  background: var(--geist-foreground);\n  color: var(--geist-background);\n  border-color: var(--geist-foreground);\n}\n.graph-search-input {\n  padding: 3px 8px;\n  font-size: 11px;\n  border-radius: 4px;\n  border: 1px solid var(--geist-border);\n  background: var(--geist-background);\n  color: var(--geist-foreground);\n  outline: none;\n  width: 150px;\n}\n#vad-graph-svg {\n  width: 100%;\n  height: 100%;\n  cursor: grab;\n}\n#vad-graph-svg:active { cursor: grabbing; }\n.graph-legend {\n  position: absolute;\n  bottom: 14px;\n  left: 14px;\n  background: var(--geist-background);\n  border: 1px solid var(--geist-border);\n  border-radius: 8px;\n  padding: 10px 14px;\n  font-size: 11px;\n  box-shadow: 0 4px 16px rgba(0,0,0,0.06);\n  z-index: 10;\n  line-height: 1.6;\n  pointer-events: none;\n}\n.graph-legend-row { display: flex; align-items: center; gap: 8px; }\n.graph-legend-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }\n.graph-info-drawer {\n  position: absolute;\n  top: 66px;\n  right: 14px;\n  width: 310px;\n  max-height: 620px;\n  background: var(--geist-background);\n  border: 1px solid var(--geist-border);\n  border-radius: 8px;\n  box-shadow: 0 8px 30px rgba(0,0,0,0.12);\n  z-index: 10;\n  padding: 16px;\n  overflow-y: auto;\n  display: none;\n  backdrop-filter: blur(10px);\n  transition: transform 0.2s ease, opacity 0.2s ease;\n}\n.graph-drawer-close {\n  position: absolute;\n  top: 10px;\n  right: 12px;\n  cursor: pointer;\n  font-size: 16px;\n  color: var(--geist-tertiary);\n}\n.graph-drawer-badge {\n  display: inline-block;\n  padding: 2px 6px;\n  border-radius: 4px;\n  font-size: 10px;\n  font-weight: 600;\n  margin-bottom: 6px;\n}\n.graph-drawer-title {\n  font-size: 13px;\n  font-weight: 700;\n  line-height: 1.4;\n  margin-bottom: 8px;\n  color: var(--geist-foreground);\n}\n.graph-drawer-meta {\n  font-size: 11px;\n  color: var(--geist-secondary);\n  margin-bottom: 12px;\n}\n.graph-drawer-core {\n  font-size: 12px;\n  line-height: 1.6;\n  color: var(--geist-foreground);\n  background: var(--geist-secondary-bg);\n  padding: 8px 10px;\n  border-radius: 6px;\n  margin-bottom: 12px;\n  border: 1px solid var(--geist-border);\n}\n.graph-drawer-link {\n  display: block;\n  text-align: center;\n  padding: 7px 12px;\n  background: var(--geist-foreground);\n  color: var(--geist-background);\n  border-radius: 6px;\n  font-size: 12px;\n  font-weight: 600;\n  text-decoration: none;\n  transition: opacity 0.15s ease;\n  margin-bottom: 6px;\n}\n.graph-drawer-link:hover { opacity: 0.85; }\n.graph-drawer-pdf-link {\n  display: block;\n  text-align: center;\n  padding: 6px 12px;\n  background: var(--geist-secondary-bg);\n  color: var(--geist-foreground);\n  border: 1px solid var(--geist-border);\n  border-radius: 6px;\n  font-size: 11px;\n  font-weight: 500;\n  text-decoration: none;\n  transition: all 0.15s ease;\n}\n.graph-drawer-pdf-link:hover { background: var(--geist-border); }\n.node-circle {\n  cursor: pointer;\n  transition: r 0.2s, stroke-width 0.2s;\n}\n.node-label {\n  font-size: 10px;\n  font-weight: 600;\n  fill: var(--geist-foreground);\n  pointer-events: none;\n  text-shadow: 0 1px 2px var(--geist-background);\n}\n.link-line {\n  stroke: var(--geist-border);\n  stroke-opacity: 0.6;\n  stroke-width: 1.2;\n  transition: stroke 0.2s, stroke-width 0.2s, stroke-opacity 0.2s;\n}\n.link-label {\n  font-size: 9px;\n  fill: var(--geist-tertiary);\n  pointer-events: none;\n  text-anchor: middle;\n}\n\n/* 引用框与警示框 Alerts */\n.callout-alert {\n  margin: 20px 0;\n  padding: 14px 18px;\n  border-radius: var(--radius-md);\n  transition: all 0.15s ease;\n}\n.callout-important, .callout-idea {\n  border-left: 4px solid #b54708;\n  background: rgba(181, 71, 8, 0.06);\n  box-shadow: inset 0 0 0 1px rgba(247, 144, 9, 0.3);\n}\n[data-theme=\"dark\"] .callout-important, [data-theme=\"dark\"] .callout-idea {\n  border-left-color: #fec84b;\n  background: rgba(181, 71, 8, 0.18);\n  box-shadow: inset 0 0 0 1px rgba(254, 200, 75, 0.25);\n}\n.callout-writing {\n  border-left: 4px solid #6941c6;\n  background: rgba(105, 65, 198, 0.06);\n  box-shadow: inset 0 0 0 1px rgba(105, 65, 198, 0.3);\n}\n[data-theme=\"dark\"] .callout-writing {\n  border-left-color: #d6bbfb;\n  background: rgba(105, 65, 198, 0.18);\n  box-shadow: inset 0 0 0 1px rgba(214, 187, 251, 0.25);\n}\n.callout-value {\n  border-left: 4px solid #027a48;\n  background: rgba(2, 122, 72, 0.06);\n  box-shadow: inset 0 0 0 1px rgba(2, 122, 72, 0.3);\n}\n[data-theme=\"dark\"] .callout-value {\n  border-left-color: #32d583;\n  background: rgba(2, 122, 72, 0.18);\n  box-shadow: inset 0 0 0 1px rgba(50, 213, 131, 0.25);\n}\n\n.card-title {\n  font-size: 16.5px;\n  font-weight: 600;\n  line-height: 1.42;\n  letter-spacing: -0.4px;\n  color: var(--geist-foreground);\n  margin: 0 0 10px;\n  word-break: break-word;\n  overflow-wrap: anywhere;\n  hyphens: auto;\n}\n.card-title a {\n  color: var(--geist-foreground);\n  text-decoration: none;\n  display: inline;\n  transition: color 0.15s ease;\n}\n.card-title a:hover {\n  color: var(--develop-blue);\n  text-decoration: none;\n}\n.card-id-mono {\n  font-family: \"Geist Mono\", monospace;\n  font-size: 13px;\n  font-weight: 500;\n  color: var(--geist-quaternary);\n  margin-right: 5px;\n}\n.card-meta-row {\n  display: flex;\n  gap: 6px;\n  flex-wrap: wrap;\n  margin-bottom: 12px;\n}\n.meta-token {\n  font-size: 12px;\n  color: var(--geist-tertiary);\n  background: var(--geist-surface-tint);\n  box-shadow: var(--shadow-ring);\n  padding: 2px 7px;\n  border-radius: var(--radius-sm);\n  white-space: nowrap;\n}\n.card-body-text {\n  font-size: 13.5px;\n  color: var(--geist-secondary);\n  line-height: 1.6;\n  margin-bottom: 16px;\n  flex-grow: 1;\n  word-break: break-word;\n  overflow-wrap: anywhere;\n}\n.card-body-text strong {\n  color: var(--geist-foreground);\n  font-weight: 600;\n}\n\n.card-footer {\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  border-top: 1px solid var(--geist-border);\n  padding-top: 14px;\n}\n.card-link-action {\n  font-size: 13.5px;\n  font-weight: 500;\n  color: var(--link-blue);\n  display: inline-flex;\n  align-items: center;\n  gap: 4px;\n  text-decoration: none;\n  transition: all 0.15s ease;\n}\n.card-link-action:hover {\n  opacity: 0.85;\n  transform: translateX(2px);\n}\na.meta-token {\n  transition: all 0.15s ease;\n  cursor: pointer;\n  text-decoration: none;\n}\na.meta-token:hover {\n  background: var(--geist-selection);\n  color: var(--geist-foreground);\n  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);\n}\n\n/* 紧凑列表视图 (List View) */\n.card-list-view {\n  display: flex;\n  flex-direction: column;\n  gap: 8px;\n}\n.list-row-item {\n  background: var(--geist-background);\n  box-shadow: var(--shadow-card);\n  border-radius: var(--radius-md);\n  padding: 12px 18px;\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  gap: 16px;\n  transition: box-shadow 0.15s;\n}\n.list-row-item:hover {\n  box-shadow: var(--shadow-card-hover);\n}\n\n/* 阅读详情页 (Report Detail) */\n.reading-container {\n  display: grid;\n  grid-template-columns: minmax(0, 1fr) 260px;\n  gap: 40px;\n  align-items: start;\n}\n@media (max-width: 960px) {\n  .reading-container { grid-template-columns: 1fr; }\n  .reading-sidebar { display: none; }\n}\n\n.report-header-card {\n  background: var(--geist-background);\n  box-shadow: var(--shadow-card);\n  border-radius: var(--radius-lg);\n  padding: 28px 32px;\n  margin-bottom: 28px;\n}\n.crumb-bar {\n  font-size: 13px;\n  color: var(--geist-tertiary);\n  margin-bottom: 10px;\n}\n.report-title {\n  font-size: 32px;\n  font-weight: 600;\n  letter-spacing: -1.28px;\n  margin: 0 0 16px;\n  color: var(--geist-foreground);\n}\n.report-action-buttons {\n  display: flex;\n  align-items: center;\n  gap: 10px;\n  flex-wrap: wrap;\n  border-top: 1px solid var(--geist-border);\n  padding-top: 16px;\n  margin-top: 16px;\n}\n\n.article-body {\n  background: var(--geist-background);\n  box-shadow: var(--shadow-card-full);\n  border-radius: var(--radius-lg);\n  padding: 36px 42px 80px;\n  font-size: 16px;\n  line-height: 1.75;\n  color: var(--geist-foreground);\n}\n.article-body h1, .article-body h2, .article-body h3 {\n  color: var(--geist-foreground);\n  scroll-margin-top: 80px;\n}\n.article-body h1 { font-size: 28px; font-weight: 600; letter-spacing: -1.28px; border-bottom: 1px solid var(--geist-border); padding-bottom: 8px; margin-top: 32px; }\n.article-body h2 { font-size: 24px; font-weight: 600; letter-spacing: -0.96px; border-bottom: 1px solid var(--geist-border); padding-bottom: 6px; margin-top: 36px; }\n.article-body h3 { font-size: 18px; font-weight: 600; letter-spacing: -0.32px; margin-top: 26px; }\n.article-body table {\n  width: 100%;\n  border-collapse: collapse;\n  margin: 24px 0;\n  font-size: 14px;\n  box-shadow: var(--shadow-border);\n  border-radius: var(--radius-md);\n  overflow: hidden;\n}\n.article-body th, .article-body td {\n  padding: 10px 14px;\n  text-align: left;\n  border-bottom: 1px solid var(--geist-border);\n}\n.article-body th {\n  background: var(--geist-surface-tint);\n  font-weight: 600;\n  color: var(--geist-foreground);\n}\n.article-body blockquote {\n  border-left: 2px solid var(--geist-foreground);\n  margin: 20px 0;\n  padding: 8px 18px;\n  color: var(--geist-secondary);\n  font-style: normal;\n}\n.article-body code {\n  font-family: \"Geist Mono\", monospace;\n  font-size: 13.5px;\n  box-shadow: var(--shadow-ring);\n  background: var(--geist-surface-tint);\n  padding: 2px 6px;\n  border-radius: var(--radius-sm);\n}\n.article-body pre {\n  position: relative;\n  background: #000000;\n  color: #ededed;\n  box-shadow: var(--shadow-border);\n  border-radius: var(--radius-md);\n  padding: 18px;\n  margin: 24px 0;\n  overflow-x: auto;\n}\n.article-body pre code {\n  background: transparent;\n  box-shadow: none;\n  padding: 0;\n  color: inherit;\n  font-size: 13px;\n}\n.copy-code-btn {\n  position: absolute;\n  top: 8px;\n  right: 10px;\n  font-family: \"Geist Mono\", monospace;\n  font-size: 11px;\n  background: #171717;\n  color: #ffffff;\n  border: 1px solid #333333;\n  padding: 3px 8px;\n  border-radius: var(--radius-sm);\n  cursor: pointer;\n}\n\n/* 侧边大纲 (TOC) */\n.reading-sidebar {\n  position: sticky;\n  top: 80px;\n  background: var(--geist-background);\n  box-shadow: var(--shadow-card);\n  border-radius: var(--radius-lg);\n  padding: 20px;\n  max-height: calc(100vh - 100px);\n  overflow-y: auto;\n}\n.sidebar-toc-title {\n  font-family: \"Geist Mono\", monospace;\n  font-size: 12px;\n  font-weight: 500;\n  text-transform: uppercase;\n  letter-spacing: 0.5px;\n  color: var(--geist-quaternary);\n  margin-bottom: 12px;\n}\n.reading-sidebar ul {\n  list-style: none;\n  padding-left: 0;\n  margin: 0;\n  font-size: 13px;\n}\n.reading-sidebar li {\n  margin: 6px 0;\n}\n.reading-sidebar ul ul {\n  padding-left: 14px;\n}\n.reading-sidebar a {\n  color: var(--geist-secondary);\n  text-decoration: none;\n  transition: color 0.15s;\n}\n.reading-sidebar a:hover, .reading-sidebar a.active {\n  color: var(--geist-foreground);\n  font-weight: 600;\n}\n\n/* 后台管理 (/admin) */\n.admin-card-container {\n  background: var(--geist-background);\n  box-shadow: var(--shadow-card-full);\n  border-radius: var(--radius-lg);\n  padding: 32px;\n  margin-bottom: 32px;\n}\n.form-row-2 {\n  display: grid;\n  grid-template-columns: 1fr 1fr;\n  gap: 16px;\n  margin-bottom: 16px;\n}\n@media (max-width: 600px) {\n  .form-row-2 { grid-template-columns: 1fr; }\n}\n.form-field {\n  display: flex;\n  flex-direction: column;\n  gap: 6px;\n  margin-bottom: 16px;\n}\n.form-field label {\n  font-size: 13px;\n  font-weight: 500;\n  color: var(--geist-foreground);\n}\n.form-field input, .form-field select, .form-field textarea {\n  font-family: \"Geist\", sans-serif;\n  font-size: 14px;\n  padding: 9px 12px;\n  background: var(--geist-background);\n  box-shadow: var(--shadow-border);\n  border: none;\n  border-radius: var(--radius-md);\n  color: var(--geist-foreground);\n  outline: none;\n}\n.form-field input:focus, .form-field select:focus, .form-field textarea:focus {\n  outline: 2px solid var(--ds-focus-color);\n  box-shadow: none;\n}\n\n/* 语法高亮 (Console Blue / Purple / Pink) */\n.codehilite .k, .codehilite .kd, .codehilite .kn { color: #eb367f; font-weight: 500; }\n.codehilite .s, .codehilite .s1, .codehilite .s2 { color: #0070f3; }\n.codehilite .nf, .codehilite .na { color: #7928ca; font-weight: 500; }\n.codehilite .c, .codehilite .c1 { color: #666666; font-style: italic; }\n.codehilite .mi, .codehilite .mf { color: #ff5b4f; }\n\n</style>\n\n</head>\n<body>\n\n    <nav class=\"vercel-nav\">\n      <div class=\"nav-brand\">\n        <a href=\"/\" style=\"display:flex;align-items:center;gap:10px;text-decoration:none\">\n          <svg class=\"vercel-triangle\" viewBox=\"0 0 76 65\" fill=\"none\">\n            <path d=\"M37.5274 0L75.0548 65H0L37.5274 0Z\" fill=\"currentColor\"/>\n          </svg>\n          <span class=\"nav-title\">Agent Harness KB</span>\n        </a>\n        <span class=\"nav-badge-pill\">Geist 2.0</span>\n      </div>\n\n      <div class=\"nav-links\">\n        <a class=\"nav-link \" href=\"/\">全景总览</a>\n        <a class=\"nav-link \" href=\"/vad\" style=\"color:var(--ship-red)\">🎯 VAD 专栏 (144)</a>\n        <a class=\"nav-link\" href=\"https://m0rtzz.github.io/paper-notes/\" target=\"_blank\" rel=\"noopener\">顶会 669 篇 ↗</a>\n        <a class=\"nav-link\" href=\"/download/all\">整库打包</a>\n        \n      </div>\n\n      <div class=\"nav-actions\">\n        \n        <button class=\"theme-toggle-btn\" id=\"theme-toggle-btn\" onclick=\"toggleTheme()\" title=\"切换亮暗主题\">🌙</button>\n      </div>\n    </nav>\n    \n<main class=\"vercel-container\">\n\n        <div class=\"report-header-card\">\n          <div class=\"crumb-bar\"><a href=\"/\">Home</a> / <b>fulltext.txt</b></div>\n          <h1 class=\"report-title\">fulltext.txt</h1>\n          <div class=\"report-action-buttons\">\n            <a class=\"btn-primary-dark\" href=\"?dl=1\">Download Text</a>\n          </div>\n        </div>\n        <article class=\"article-body\"><pre><code>Published as a conference paper at ICLR 2026\n\nDARWIN G ÖDEL M ACHINE : O PEN -E NDED E VOLUTION\nOF S ELF -I MPROVING AGENTS\nJenny Zhang*,1,2 Shengran Hu*,1,2,3 Cong Lu1,2,3 Robert Lange†,3 Jeff Clune†,1,2,4\n1\nUniversity of British Columbia 2 Vector Institute 3 Sakana AI 4 Canada CIFAR AI Chair\n{jennyzzt,srhu,conglu}@cs.ubc.ca, robert@sakana.ai, jeff.clune@ubc.ca\n\narXiv:2505.22954v3 [cs.AI] 12 Mar 2026\n\nA BSTRACT\nMost of today’s AI systems are constrained by human-designed, fixed architectures\nand cannot autonomously and continuously improve themselves. The scientific\nmethod, on the other hand, is a cumulative and open-ended system, where each\ninnovation builds upon previous artifacts, enabling future discoveries. There is\ngrowing hope that the current manual process of advancing AI could itself be\nautomated. If done safely, such automation would accelerate AI development and\nallow us to reap its benefits much sooner. This prospect raises the question of\nhow AI systems can endlessly improve themselves while getting better at solving\nrelevant problems. Meta-learning can automate the discovery of novel algorithms,\nbut is limited by first-order improvements and the human design of a suitable search\nspace. The Gödel machine (Schmidhuber, 2007) proposed a theoretical alternative:\na self-improving AI that repeatedly modifies itself in a provably beneficial manner.\nUnfortunately, proving that most changes are net beneficial is impossible in practice.\nWe introduce the Darwin Gödel Machine (DGM), a novel self-improving system\nthat iteratively modifies its own code (thereby also improving its ability to modify\nits own codebase) and empirically validates each change using coding benchmarks.\nInspired by Darwinian evolution and open-endedness research, the DGM grows\nan archive of generated coding agents. It samples agents from this archive, which\nself-modify to create new, interesting versions of themselves. This open-ended\nexploration forms a growing tree of diverse, high-quality agents and allows the\nparallel exploration of many different paths through the search space. Empirically,\nthe DGM automatically improves its coding capabilities (e.g., better code editing\ntools, long-context window management, peer-review mechanisms), increasing\nperformance on SWE-bench from 20.0% to 50.0%, and on Polyglot from 14.2% to\n30.7%. Furthermore, the DGM significantly outperforms baselines without selfimprovement or open-ended exploration. All experiments were done with safety\nprecautions (e.g., sandboxing, human oversight). Overall, the DGM represents a\nsignificant step toward self-improving AI, capable of gathering its own stepping\nstones along a path that unfolds into endless innovation. All code is open-sourced\nat https://github.com/jennyzzt/dgm.\n\n1\n\nI NTRODUCTION\n\nScientific progress is cumulative and open-ended, with each breakthrough standing on the shoulders\nof countless prior insights. In the same way, our most advanced AI systems are built upon a long\nlineage of innovations. For instance, transformers (Vaswani et al., 2017), the backbone of current large\nlanguage models (LLMs) (Brown et al., 2020), did not emerge in isolation but were built upon years\nof past innovations, such as recurrent neural networks (Linnainmaa, 1970; Amari, 1972; Hopfield,\n1982; Rumelhart et al., 1985) and attention mechanisms (Schmidhuber &amp; Huber, 1990; Bahdanau\net al., 2015; Kim et al., 2017; Parikh et al., 2016). However, most of today’s AI systems remain bound\nby fixed, human-designed architectures that learn within predefined boundaries, without the capacity\nto autonomously rewrite their own source code to self-improve. As a result, each advancement in AI\ndevelopment still leans heavily on human interventions, tethering the pace of progress. This paper\n* co-first authors\n\n†\n\nco-senior authors\n\n1\n\n\fPublished as a conference paper at ICLR 2026\n\ninvestigates the intriguing possibility of safely automating the search for ever-better AI. One can\nimagine an AI system that, like scientific discovery itself, becomes an engine of its own advancement:\nbuilding upon its past, recursively improving, and propelling itself toward more advanced capabilities.\nArchive\n\nSelf-modify\nselect\n\nparent\n\nchild\n\nCoding agent’s\nown repo\n+\nSelf-improve\ninstruction\n\nCoding\nagent\n\nCode Diff:\nFeature to\nimprove itself\n\nTask repo\n(e.g., GitHub repo)\n+\nTask instruction\n(e.g., GitHub issue)\n\nNew\ncoding\nagent\n\nCode Diff:\nSolve task\n\nCoding\nagent\nNew\ncoding\nagent\n\nadd\n\nEvaluate on\nbenchmark\n\nFigure 1: Darwin Gödel Machine. The DGM iteratively builds a growing archive of agents by\ninterleaving self-modification with downstream task evaluation. Agents in the archive are selected for\nself-modification through open-ended exploration.\nSchmidhuber (2007) presented a class of mathematically rigorous, self-referential, self-improving\nproblem solvers. It relies on formal proofs to justify code rewrites, ensuring that any self-modification\nis provably beneficial. However, in practice and without restrictive assumptions about the system,\nit is impossible to formally prove whether a modification to an AI system will be beneficial. For\nexample, while it may seem that an LLM-based coding agent would benefit from access to more\ntools (e.g., code search, test runners), the actual impact depends heavily on the model’s training and\ntask context (e.g., a testing tool that is optimized for one setup may confuse the agent when working\nwith others). Instead of requiring formal proofs, we empirically validate self-modifications against a\nbenchmark, allowing the system to improve and explore based on observed results. This approach\nmirrors biological evolution, where mutations and adaptations are not verified in advance but are\nproduced, trialed, and then selected via natural selection. We also take inspiration from Darwinian\nevolution (Darwin, 2023) and investigate the effectiveness of maintaining a library of previously\ndiscovered agents to serve as stepping stones for future generations.\nWe propose the Darwin Gödel Machine (DGM), a self-referential, self-improving system that\nwrites and modifies its own code to become a better coding agent. Each self-modification requires\nthe DGM to edit its own codebase. We use Python, which is Turing-complete, giving the DGM\nthe potential to build any computable machine. Our framework envisions agents that can rewrite\ntheir own training scripts (including training a new foundation model (FM)). However, we do not\nshow that in this paper, as training FMs is computationally intensive and would introduce substantial\nadditional complexity, which we leave as future work. Instead, this paper focuses on improving the\ndesign of coding agents with frozen pretrained FMs (e.g., tool use, workflows). The DGM alternates\nbetween self-modification and evaluation phases. During the self-modification phase, selected coding\nagents from the archive generate modified versions of themselves. During the evaluation phase,\neach modified agent is tested on a coding benchmark, estimating the agent’s coding capabilities, and\nthen added to the archive. By improving its own capabilities through this loop, the DGM becomes\nbetter at both solving coding tasks and making future self-improvements. A key assumption is\nthat an increase in performance on coding benchmarks indicates better coding capabilities, and\nhence better ability to self-modify and self-improve. Furthermore, the DGM maintains an archive of\ngenerated coding agents, initialized with only one agent, and continuously accumulates all generated\nvariants over time. To support continual self-improvement, the DGM draws inspiration from openendedness research (Wang et al., 2019; Fernando et al., 2024; Faldor et al., 2025), accumulating\ndiverse stepping stones (i.e., interesting yet suboptimal solutions or features that may enable future\nbreakthroughs). This open-ended exploration encourages the discovery of novel and potentially\nuseful self-modifications beyond immediate performance gains.\nWe present results on two coding benchmarks: SWE-bench (Jimenez et al., 2024) and Polyglot (Paul\nGauthier, 2024). The DGM automatically improves itself from 20.0% to 50.0% on SWE-bench,\nand from 14.2% to 30.7% on Polyglot. We show that self-improvement enables continued progress,\nas the DGM outperforms the baseline where the same base agent is repeatedly used to modify and\n2\n\n\fPublished as a conference paper at ICLR 2026\n\ngenerate new agents without self-improvement. We also show that open-ended exploration and\nkeeping an archive of all previously generated agents lead to the discovery of better coding agents.\nThe DGM outperforms the baseline of not having open-ended exploration (i.e., a baseline without the\naccumulation of an archive of interestingly different stepping stones), where the coding agent always\nbuilds off the most recent version of itself. Overall, the DGM represents a step toward AI systems\nthat can build upon their own prior innovations and improve recursively. We consider and discuss\nsafety aspects extensively, including sandboxing and traceability of self-modifications, to ensure\nresponsible experimentation (Section 5). By advancing the possibility of safe, self-referential, selfimproving models, the DGM moves us closer to AI that not only learns but evolves in an open-ended,\nself-accelerating trajectory, much like science itself.\n\n2\n\nR ELATED W ORK\n\nOpen-Endedness. A grand challenge for driving unbounded innovation is designing open-ended AI\nsystems that continuously generate novel and learnable artifacts (Stanley et al., 2017). Hughes et al.\n(2024) characterized open-endedness as a system’s capacity to generate sequences of artifacts that are\nboth novel and learnable from an observer’s perspective. A central difficulty lies in structuring and\nexploring vast search spaces to consistently produce artifacts that are interesting to humans (Clune,\n2019; Jiang et al., 2023). Early progress drew on quality-diversity algorithms, goal-directed exploration, intrinsic motivation, and learning-progress frameworks (Pugh et al., 2016; Ecoffet et al.,\n2019; Lehman &amp; Stanley, 2011; Oudeyer et al., 2007), while recent advances leverage large-scale\nfoundation models (FMs) as proxies for human interestingness and versatile engines for generating\nand evaluating novel behaviors across diverse domains (Brown et al., 2020; Hu et al., 2025; Zhang\net al., 2024b). However, these approaches have yet to close the self-referential self-improvement\nloop, meaning improvements on downstream tasks do not translate into enhanced capabilities for\nself-modification or the acceleration of further innovations. We aim to mimic the acceleration of science and technology, where new tools and discoveries catalyze the creation of even more discoveries.\nHow can we emulate nature’s arc of evolution, which bends not only toward complexity but also an\never greater capacity to evolve (Dawkins, 2019; Gerhart &amp; Kirschner, 2007; Hendrikse et al., 2007)?\nMeta-Learning FM Agents. Many FM-based agents are handcrafted. Some building blocks include\nprompt engineering (Chen et al., 2023; Schulhoff et al., 2024), chain-of-thought (Wei et al., 2022;\nYao et al., 2023; Hu &amp; Clune, 2024; Guo et al., 2025; Lightman et al., 2023; Muennighoff et al., 2025;\nZelikman et al., 2024a), self-reflection (Shinn et al., 2023; Yao et al., 2023; Madaan et al., 2023),\nmulti-agent debate (Zhuge et al., 2023; Liang et al., 2023; Khan et al., 2024), memory (Liu et al., 2023;\nZhong et al., 2024; Modarressi et al., 2023), temperature sampling (Zhu et al., 2024), and retrieval\naugmented generation (Lewis et al., 2020). The manual composition of these components limits\nthe system’s abilities to the ingenuity of its human designer. More recently, several meta-learning\napproaches have emerged that leverage FM to automatically optimize prompts (Fernando et al., 2024;\n, FAIR; Khattab et al., 2023; Cheng et al., 2024; Yuksekgonul et al., 2024; Yuan et al., 2024) and\ndesign agentic modules (Zhang et al., 2024c; Zhou et al., 2024; Yin et al., 2024; Zhuge et al., 2024;\nRosser &amp; Foerster, 2025; Zhang et al., 2025a; Ye et al., 2025; Gao et al., 2025; Nie et al., 2025;\nSu et al., 2025; Zhang et al., 2025b; Niu et al., 2025). The Automated Design of Agentic Systems\n(ADAS, Hu et al., 2025) iteratively generates downstream agents with a fixed meta-agent, evaluates\nthem against a target benchmark, and incorporates feedback to refine subsequent generations. In\ncontrast, the DGM is a single system that both solves downstream tasks (i.e., coding problems)\nand refines its own implementation (i.e., its codebase), removing the need for a fixed, handcrafted\nmeta-agent and enabling self-referential improvements.\nSelf-Improving AI. Early on, various researchers outlined theoretical and conceptual approaches to\nself-improvement (Good, 1966; Schmidhuber, 1987; 2007). Some practical approaches to automated\nself-improvement include systems defined by neural network weight parameterizations (Schmidhuber,\n1993; Hall, 2007; Hobbhahn, 2025; Kirsch &amp; Schmidhuber, 2022; Irie et al., 2022; 2025; Lu et al.,\n2023; Havrilla et al., 2024b). Metz et al. (2021) developed a gradient-based optimizer that is selfreferentially meta-trained using a variant of population-based training (Jaderberg et al., 2017). Lange\net al. (2023) extended this approach to gradient-free learning. Silver et al. (2017) used self-play\nto continuously evolve agents, achieving superhuman performance in challenging domains such\nas chess and Go. More closely related to the DGM are recent approaches that leverage FM-based\nagents for self-improvement (Yin et al., 2024; Robeyns et al., 2025; Hu et al., 2024; Zelikman\n3\n\n\fPublished as a conference paper at ICLR 2026\n\net al., 2024b; Huang et al., 2022; Singh et al., 2023). Zelikman et al. (2024b) use a meta-agent\nto generate downstream agents, updating the meta-agent based on the meta-utility derived from\nthe generated solutions. Yin et al. (2024) use a single system to both solve downstream tasks and\nrecursively modify itself. However, the downstream tasks or the meta-utility do not always align\nwith the capabilities required for self-improvement. In the DGM, improvement in downstream tasks\ndirectly reflects an increase in self-improvement ability, enabling the potential for self-accelerating\nprogress. Most similar is concurrent work by Robeyns et al. (2025), which also has a single agent\nrecursively solving coding problems and modifying its own codebase. The main difference from\nRobeyns et al. (2025) (and also Zelikman et al. (2024b); Yin et al. (2024)) is that the DGM has an\nopen-ended exploration loop, encouraging self-modifications beyond immediate performance gains\nand thus avoiding stagnation in suboptimal states. Appendix B also discusses additional related work\non program synthesis and Darwinian evolution.\n\n3\n\nDARWIN G ÖDEL M ACHINE\n\nA Gödel Machine is a theoretical idea of an AI that searches for ways that provably improve\nitself (Schmidhuber, 2007). In this paper, we propose Darwin Gödel Machine (DGM), an attempt to\nrealize the long-held dream of creating a Gödel Machine. The DGM relaxes the Gödel Machine’s\nimpractical requirement of theoretically proving that a change will improve the system, instead\nrequiring empirical evidence from experiments to demonstrate that a proposed new version enhances\nperformance. Additionally, since the DGM relies on empirical evidence of improvement, it may\nget stuck in a local optimum within the vast search space of possible systems (i.e., all computable\nalgorithms). To address this, the DGM maintains an archive of discovered solutions during the\nsearch, facilitating open-ended exploration rather than relying on evolving a single solution. Since the\nprinciples echo Darwinian evolution (Darwin, 2023) (Appendix B), where new innovations emerge\nby selecting an entity from an archive of previously discovered solutions, modifying it, and keeping\nit if it is interestingly new (Zhang et al., 2024b; Faldor et al., 2025; Stanley &amp; Lehman, 2015), we\ncall our algorithm a Darwin Gödel Machine (Figure 1).\nSelf-referential Self-improvement of Coding Agents. The DGM is initialized with only one coding\nagent, and its progression is evaluated on coding benchmarks. A coding agent is defined as a single\nsystem, implemented with a code repository and powered by frozen pretrained foundation models\n(FMs), capable of reading, writing, and executing code. Code, when expressed in a general-purpose\nTuring-complete language (e.g., Python), is a powerful medium for building and improving intelligent\nsystems because it can represent any computable process. Recent works (Hu et al., 2025; Zhang et al.,\n2024c) demonstrate that such agents can be improved through meta-learning of their designs (e.g.,\nprompts, workflows, and tools), which are implemented in their code repository. Therefore, we define\nself-improvement as a coding task that involves modifying the design of an agent’s own components\n(i.e., its own code, which does not include the open-ended exploration process described in the next\nparagraph). The key motivation is that the empirical evidence must reflect the system’s ability to both\nself-improve and solve downstream tasks. By configuring the DGM as a coding agent and testing\nits coding capabilities, the observed improvements demonstrate not only enhanced performance\nin downstream tasks but also the capacity for further self-improvement, as self-improvement is\nfundamentally a coding task that modifies the coding agent’s own code repository.\nPopulation-based Open-ended Exploration. Starting from a single initial coding agent, the DGM\nbuilds an archive of all discovered agents. In each iteration, the DGM selects parent agents to selfmodify and branch off to produce new agents. Parent selection is roughly proportional to each agent’s\nperformance score and inversely proportional to the number of its children with codebase-editing\nfunctionality (Appendix C.2). This favors high-performing agents that have been underexplored\n(i.e., have fewer existing children), thereby promoting both exploitation of strong performers and\nexploration of promising but less-sampled lineages. All agents retain a non-zero selection probability,\nensuring that any path to improvement remains feasible given sufficient compute. Each selected\nparent analyzes its own benchmark evaluation logs, proposes the next feature to implement, and\nreceives this proposal as a problem statement to execute (Appendix C.3). The parent then implements\nthe suggested feature into its own codebase, generating a new coding agent. Each newly generated\nagent is quantitatively evaluated on a chosen coding benchmark to estimate its coding abilities. Only\nagents that compile successfully and retain the ability to edit a given codebase are added to the\nDGM archive, as only they can continue self-modification. All others are discarded. The cycle of\n4\n\n\fPublished as a conference paper at ICLR 2026\n\nparent selection, self-modification, and evaluation continues, progressively growing the archive of\nsolutions. Importantly, we note that archived solutions can serve as stepping stones that result in\nimprovements much later than their original discovery, making our approach substantially different\nfrom hill-climbing agentic design approaches (Robeyns et al., 2025). Currently, the open-ended\nexploration process (i.e., archive maintenance, parent selection) is fixed and not modifiable by the\nDGM, which we leave as an avenue for future work. Appendix C.4 shows the pseudocode for the\nDGM algorithm.\n\n4\n\nE XPERIMENTS\n\nSection 4.1 describes the experimental setup, including the initial coding agent that initializes the\nDGM. We conduct experiments on two coding benchmarks: SWE-bench (Jimenez et al., 2024) and\nPolyglot (Paul Gauthier, 2024) (Section 4.2). For each benchmark, we compare the DGM against\ntwo baselines: DGM without self-improving agents and DGM without open-ended exploration\n(Section 4.3). Across all experiments, we find that the DGM outperforms both baselines, showing that\nthe self-improvement mechanism and open-ended exploration are essential for sustained performance\ngains (Section 4.4). Furthermore, we show that the features discovered by the DGM transfer across\nmodels, benchmarks, and tasks (Section 4.4).\n4.1\n\nE XPERIMENT S ETUP\n\nThe DGM is initialized with a single coding agent. This base agent is built around a frozen FM and\naugmented with tool use capabilities (Schick et al., 2023; Anthropic, 2024b). The FM autonomously\ndetermines its action at each step, using whichever tool it deems appropriate. The base agent has\naccess to two tools: a Bash tool for executing bash commands, and an edit tool for viewing and\nediting directories and entire files (Appendix C.1). The agent receives a single input prompt that\nspecifies the location of the target repository, the problem statement, and the repository’s testing\nframework (Appendix C.1). The base agent is intentionally lightweight to provide a simple starting\npoint from which self-improvement can be clearly demonstrated. We run the DGM for 80 iterations\n(generating one new agent per iteration), with two iterations running in parallel for SWE-bench\nand four for Polyglot (Appendix C.2). During self-modifications, coding agents are powered by\nClaude 3.5 Sonnet (New) (Anthropic, 2024a) in both SWE-bench and Polyglot experiments. During\nbenchmark evaluation, coding agents are powered by Claude 3.5 Sonnet (New) for SWE-bench and\no3-mini (OpenAI, 2025) for Polyglot (Appendix D.1).\n4.2\n\nB ENCHMARKS\n\nWe evaluate the DGM on two popular benchmarks that assess different aspects of coding tasks\nto validate the algorithm’s effectiveness across various use cases. Both SWE-bench and Polyglot\nare benchmarks that evaluate how well AI agents solve coding tasks automatically. Given a code\nrepository and a task instruction, the agent is expected to make changes to the repository in order to\nfulfill the task. Both SWE-bench and Polyglot are widely used benchmarks (Zhang et al., 2024d;a;\nXia et al., 2024; Cao et al., 2024; Google DeepMind, 2025; Gauthier, 2024) that require the AI agent\nto navigate a code repository, understand the interplay between functions in different files, and spot\nsmall errors in convoluted code. SWE-bench only has Python tasks, while Polyglot has tasks in\nmultiple programming languages. Another difference is that each SWE-bench task may require edits\nto multiple files, whereas each Polyglot task primarily involves implementing a solution from scratch\nin a single file (although the agent still needs to examine other files to understand what changes are\nnecessary), resulting in fewer file edits overall.\nSWE-bench. To avoid wasting compute on unsolvable tasks, we use SWE-bench Verified (OpenAI,\n2024), a human-filtered subset of SWE-bench (Jimenez et al., 2024) where all tasks are solvable.\nThroughout this paper, the term SWE-bench refers by default to to the SWE-bench Verified subset.\nPolyglot. Polyglot includes tasks in multiple programming languages (C++, Rust, Python, etc.) (Paul\nGauthier, 2024). Compared to SWE-bench, one of the most widely used coding benchmarks and\nlikely included in the training sets of FMs, Polyglot is more niche and less likely to be included\nin FMs’ post-training data. Additionally, Polyglot is primarily used by its developer to evaluate\nAider (Gauthier, 2024). This provides an opportunity to compare automatically designed agents with\n5\n\n\fPublished as a conference paper at ICLR 2026\n\na representative coding agent in the community, which has been continuously developed and tested\nagainst the Polyglot benchmark over a year by human developers. Finally, Polyglot enables testing of\nthe DGM’s ability to generalize across multiple programming languages beyond just Python. We\nfollow the Polyglot leaderboard setup (Paul Gauthier, 2024), with one key difference: the leaderboard\nreports pass@2, where the agent can view feedback from ground-truth tests once, whereas we report\npass@1, where the agent never sees ground-truth test results.\nSince it is expensive to evaluate on the full benchmarks (Appendix E.1), we use a staged evaluation\nstrategy to estimate the coding agent’s performance. In general, we evaluate the coding agent on\nmore tasks when we are more confident that it is a relatively strong performer. We first evaluate\neach coding agent on a set of 10 tasks to verify basic codebase-editing functionality. Only agents\nthat retain the ability to edit code can solve downstream coding tasks or perform further selfmodifications. Agents that pass this initial stage are then evaluated on an expanded set of 50 tasks.\nFor SWE-bench, tasks are selected based on SWE-bench-verified-mini (Hobbhahn, 2025), which is\ndesigned to be a representative sample of the full benchmark (Appendix E.2). For Polyglot, tasks\nare chosen as a random subset of the full benchmark (Appendix E.3). Because the LLMs we use\nare inherently stochastic, performance can be noisy. We use smaller subset evaluations to estimate\ngeneral effectiveness and identify top candidates. For SWE-bench, if a coding agent achieves over\n40% success (a heuristic chosen based on the noise observed in preliminary runs) on the 60-task\nsubset and ranks among the top two performers in the archive, it is then evaluated on 200 tasks\n(140 plus the previous 60) to more accurately assess its true coding capability (Appendix E.2). For\nPolyglot, if a coding agent achieves over 40% success on the 10-task subset, it is evaluated on an\nexpanded 50-task subset (Appendix E.3).\n4.3\n\nBASELINES\n\nTo isolate and evaluate the contribution of the DGM’s core components, we compare the DGM against\ntwo baselines: DGM without self-improving agents (DGM w/o self-improve) and DGM without\nopen-ended exploration (DGM w/o open-ended exploration). DGM w/o self-improve replicates the\napproach of ADAS (Hu et al., 2025) in this setting, wherein the meta agent responsible for modifying\nthe coding agents remains fixed as the base agent throughout the experiment (Algorithm 2). This\nbaseline allows us to assess the role of iterative self-improvement in accelerating the evolution of\nbetter coding agents. DGM w/o open-ended exploration eliminates the use of an archive and always\nself-modifies the latest stored version of itself (Algorithm 3). If a coding agent self-modifies to the\npoint where it loses the basic functionality required to edit a codebase, it can no longer modify itself\nor solve any coding task. Therefore, DGM w/o open-ended exploration retains the latest version\nof itself that still maintains the basic functionality for codebase editing. This baseline allows us to\nevaluate the impact of having an archive and the well-documented beneficial principles of open-ended\nexploration (Clune, 2019; Stanley &amp; Lehman, 2015; Zhang et al., 2024b; Fernando et al., 2024; Lee\net al., 2020; Samvelyan et al., 2024; Colas et al., 2022b) in guiding the agent’s evolution.\nIn addition to the learned baselines, we compare the DGM against handcrafted, open-source solutions.\nFor SWE-bench, we take the state-of-the-art (SoTA) open-source solution that has been checked\n(i.e., the SWE-bench team was able to reproduce the results) (Appendix E.4). For Polyglot, we take\nthe representative agent (Aider) (Gauthier, 2024), which is open-sourced and designed to support\nmultiple programming languages and large codebase editing (Appendix E.5). For a fair comparison,\nwe measure the percentage of solved tasks on the same benchmark subsets used to evaluate the DGM\n(Appendix E.2, Appendix E.3). These values are shown as dotted horizontal lines in Figure 2.\n4.4\n\nR ESULTS\n\nAfter 80 iterations of the DGM, the coding agent’s performance increases from 20.0% to 50.0% on\nSWE-bench, and from 14.0% to 38.0% on Polyglot (Figure 2). Since the DGM is evaluated on only\n50 tasks in the Polyglot experiment setup (Section 4.2), we additionally evaluate both the base agent\nand the best DGM-discovered agent on the full Polyglot benchmark to more accurately estimate the\nimprovement. On the full Polyglot benchmark, the DGM improves the coding agent from 14.2% to\n30.7%. This shows that the DGM can automatically self-improve to create a better coding agent.\nMoreover, the performance of the best DGM-discovered agent is comparable to that of the checked,\nopen-source, human-designed SoTA on SWE-bench (Figure 2). On Polyglot, although the DGM\n6\n\n\fChecked Open-sourced SoTA\nDGM w/o Open-ended exploration\nDGM w/o Self-improve\nDGM\n\n0.50\n0.45\n\nRepresentative Agent Baseline (Aider)\n\nPolyglot Score of Best Agent\n\nSWE-bench Score of Best Agent\n\nPublished as a conference paper at ICLR 2026\n\n0.40\n0.35\n0.30\n0.25\n0.20\n0\n\n10\n\n20\n\n30\n\n40\n\nIterations\n\n50\n\n60\n\n70\n\n80\n\n0.35\n0.30\n0.25\n0.20\n0.15\n0\n\n10\n\n20\n\n30\n\n40\n\nIterations\n\n50\n\n60\n\n70\n\n80\n\nFigure 2: Self-improvement and open-ended exploration enable the DGM to continue making\nprogress and improve its performance. The DGM automatically discovers increasingly better\ncoding agents and performs better on both (Left) SWE-bench and (Right) Polyglot. It outperforms\nbaselines that lack either self-improvement or open-ended exploration, showing that both components\nare essential for continual self-improvement. These scores are obtained from evaluating on the\nbenchmark subsets detailed in Section 4.2.\nDGM Progress\n\nDGM Archive Tree\nSWE-bench\nScore\n\nHistory-aware\npatch generations\nand ranking\n\nMore granular file\nediting via string\nreplacement\n\n10 tasks (no basic functionality)\n\nNon-empty patch\nvalidation and retry\n\n60 tasks\n\nAuto-summarize\non context limit\n\nMultiple patch\ngenerations and\nranking\n\n200 tasks (score ≥ 0.4 and\ntop two of archive then)\nMore granular file\nviewing via lines\n\nFinal best agent\n\nFigure 3: The DGM automatically self-improves to become a better coding agent. (Left) Archive\nof coding agents generated during the DGM run on SWE-bench. Each node represents a coding\nagent, with node 0 corresponding to the base agent. Node color indicates performance on SWE-bench\n(percentage of solved tasks), while border color reflects the number of tasks for which the agent\nwas evaluated. Edges show which agents self-modified to produce the offsprings. Many paths to\ninnovation traverse lower-performing nodes, and key innovations (like node 24) lead to an explosion\nof innovations built on top of them. Both properties underscore the benefits of open-ended search.\n(Right) Progress plot of the DGM on SWE-bench. The light blue line shows the average score of all\nagents possessing basic codebase-editing functionality. The blue line tracks the best score achieved by\nany agent in the archive at each iteration. The dark line shows the lineage of the final best-discovered\nagent and its precursor nodes, which includes two performance dips. This illustrates the benefits of\nopen-ended search, which explores a diverse set of interesting stepping stones instead of focusing\nonly on branching off the best solution found so far.\n\nstarts with a base agent whose performance is lower than that of Aider, it discovers an agent that far\nsurpasses Aider (Figure 2). The DGM-discovered agents are comparable to or outperform handcrafted\nagents on both benchmarks. While the SoTA SWE-bench agent and Aider were painstakingly shaped\nby human efforts, the DGM hints at a future in which such ingenuity is automated, evolving through\nself-referential cycles of continuous self-improvements.\nThe DGM automatically improves both the tools and the workflow of how FMs are utilized (Figure 3).\nFor example, the DGM enhanced the edit tool to allow more granular file viewing (by lines) and\n7\n\n\fPublished as a conference paper at ICLR 2026\n\nmore precise file editing (by string replacement), instead of always viewing or replacing the entire\nfile. Workflow improvements include making multiple attempts to solve a task and using another FM\nto evaluate and select the best solution. Other workflow improvements include considering previous\nattempts when generating subsequent ones. Appendix F.1 and Appendix F.2 show all modifications\nleading up to the final best-discovered agents on SWE-bench and Polyglot respectively.\nBecause open-ended exploration allows branching from any agent in the archive with non-zero\nprobability, the DGM can get out of deceptive dips or peaks in performance. For example, at\niterations 4 and 56 of the experiment on SWE-bench, although the agent’s score temporarily fell\nbelow that of its parent, the DGM was still able to explore innovations along that path and create a\nnew agent that outperformed all of its predecessors (Figure 3). Furthermore, open-ended exploration\nallows different implementations of the same target functionality to be attempted. For example, while\nthe goal is to provide finer-grained editing tools, the specific implementation of this feature can vary\ngreatly and hence lead to very different performance (Appendix G). The DGM can explore multiple\nimplementations to find the most suitable one and avoid getting trapped in a suboptimal one.\nThe DGM outperforms the baselines of DGM w/o self-improve and DGM w/o open-ended exploration\non both benchmarks (Figure 2). Without updating the meta agent that modifies coding agents, DGM\nw/o self-improve improves the agents in early iterations, but its gains taper off quickly (Appendix A.1).\nIn DGM w/o open-ended exploration, only the most recent agent is retained, so a poorly performing\nself-modification makes subsequent improvements harder to achieve (Appendix A.1).\n\n33.0%\n23.0%\n\n20.0%\n\n19.0%\n\n10\n0\n\n50.0%\n\n50\n40\n30\n20\n\n20.0%\n\n28.9% 30.7%\n\n24.5%\n14.2%\n\n10\no3-mini\nClaude 3.5 Sonnet Claude 3.7 Sonnet\nBase agent\nBest agent searched with Claude 3.5 Sonnet\nBest agent transfer to other FMs\n\n0\n\nSWE-bench\nPolyglot\nBase agent\nBest agent searched on SWE-bench\nBest agent searched on Polyglot\n\nSuccess Rate on Polyglot (%)\n\n40\n20\n\n60\n\n50.0%\n\n50\n30\n\nZero-shot Transfer Between Benchmarks\n\n59.0%\n\nSuccess Rate (%)\n\nSuccess Rate on SWE-bench (%)\n\nModel Transfer on SWE-bench\n60\n\n40\n35\n30\n25\n20\n15\n10\n5\n0\n\nTask Transfer on Polyglot\n33.0%\n30.8%\n20.6%\n17.6%\n8.8%\n\n11.8%\n\n17.3%\n15.2%\n\npython task\nnon-python task\nBase agent\nAider\nDGM search on all language\nDGM search only on python\n\nFigure 4: Transfer between Models, Benchmarks, and Tasks. The superior performance of\nDGM-discovered agents can be transferred across (Left) different models, (Middle) benchmarks, and\n(Right) different programming language tasks in Polyglot, such as from Python tasks to C++ tasks.\nTo evaluate the generality of the improvements from the DGM, we tested the base agent (Section 4.1)\nand the best agent discovered during the DGM run (Figure 2) with different FMs than those used\nduring optimization. For SWE-bench, where the DGM was run using Claude 3.5 Sonnet (New),\nwe replaced the FM with Claude 3.7 Sonnet (Anthropic, 2025) or o3-mini, and evaluated on 200\ntasks (Figure 4, Left). With o3-mini, the base agent achieved 23.0% and the DGM-discovered agent\n33.0%. With Claude 3.7 Sonnet, the base agent achieved 19.0% and the DGM-discovered agent\n59.5%. These results suggest that the DGM yields improvements that generalize across FMs, rather\nthan being tightly coupled to the specific FM used during its run (Figure 4). Model transfer results on\nPolyglot are presented in Appendix A.2.\nFurthermore, we investigate the transferability of the DGM-discovered agent across different benchmarks and programming languages. First, we evaluate the best DGM-discovered agent from one\nbenchmark (e.g., SWE-bench) on a completely held-out benchmark (e.g., Polyglot), and vice versa\n(Figure 4, Middle). The best agent evolved on SWE-bench achieves 28.9% on Polyglot, compared\nto the initial agent’s baseline of 14.2%. Conversely, the best agent evolved on Polyglot achieves\n24.5% on SWE-bench, outperforming the original baseline of 20.0%. Since each agent was optimized\nwithout ever accessing the alternate benchmark, these evaluations represent truly held-out tests. The\nconsistent performance gains across benchmarks support our claim that DGM’s improvements reflect\ngeneral skill acquisition rather than overfitting or exploitation of benchmark-specific artifacts. Second,\nwe experiment with a version of the DGM trained exclusively on Python tasks from Polyglot and then\ntransfer the discovered agent to tasks in other languages. Focusing primarily on Python tasks slightly\nimproves performance on Python tasks but reduces performance on non-Python tasks compared to\nthe DGM trained on all languages (Figure 4, Right). However, after being transferred from Python to\nother unseen languages during the search, the agent still achieves performance comparable to that\n8\n\n\fPublished as a conference paper at ICLR 2026\n\nof the DGM trained on all languages and substantially outperforms both the base agent and Aider.\nThese results demonstrate the robustness of the discovered improvements, showing that they do not\noverfit to a specific programming language. We also present additional results in Appendix A.\n\n5\n\nS AFETY D ISCUSSION\n\nSystems capable of self-improvement, such as the DGM, represent a step toward more autonomous\nAI development, aligning with long-standing goals in the field of making capable AI that can benefit\nhumanity (Schmidhuber, 1987; Clune, 2019; Markoff, 2016; Lehman, 2023). However, this capability\nintroduces unique safety considerations stemming from the system’s ability to autonomously modify\nits own code. Modifications optimized solely for benchmark performance might inadvertently\nintroduce vulnerabilities or behaviors misaligned with human intentions, even if they improve the\ntarget metric (Bostrom, 2020). In particular, if evaluation benchmarks do not fully capture all desired\nagent properties (e.g., safety and robustness), the self-improvement loop could amplify misalignment\nover successive generations. Iterative self-modification could also lead to increasingly complex and\nuninterpretable internal logic, hindering human understanding, oversight, and control (Sheth et al.,\n2025; Anwar et al., 2024; Greenblatt et al., 2024; Ganguli et al., 2022).\nRecognizing these challenges, the current implementation and experimental setup of the DGM\nincorporates several safeguards. All agent execution and self-modification processes are conducted\nwithin isolated sandboxed environments, limiting their ability to affect the host system, and thereby\nmitigating the risk of unintended actions. Each execution within the sandbox is subjected to a strict\ntime limit, reducing the risk of resource exhaustion or unbounded behavior. The self-improvement\nprocess is currently confined to the well-defined domain of enhancing performance on specific coding\nbenchmarks by modifying the agent’s own Python codebase, thus limiting the scope of potential\nmodifications. Additionally, we actively monitor agent performance and code changes, with the\nDGM archive providing a traceable lineage of modifications for review. At this stage, we have found\nno evidence of harmful or malicious behavior in the generated agents, and the self-modifications have\nbeen primarily focused on improving coding capabilities.\nConversely, a significant potential benefit of the self-improvement paradigm is that it could, in principle, be directed toward enhancing safety and interpretability themselves. We conduct a preliminary\ninvestigation into how the DGM can be deployed in AI safety settings to develop countermeasures for\nFM hallucination (Appendix H). Just as the DGM learns to improve its coding capabilities, it could\npotentially discover and integrate better internal safeguards or modify itself for greater transparency\n(e.g., incorporating principles akin to Constitutional AI (Bai et al., 2022)), if such properties were\nincluded in its evaluation criteria (Rosser &amp; Foerster, 2025). This suggests a promising, albeit\nchallenging, pathway in which self-improvement becomes a tool for building more trustworthy AI\nsystems. Additional research could also explore weaving Constitutional AI in from the start, though\nthe challenge would be incentivizing the system to retain these directives (an option worth exploring\nis to create an unmodifiable part of the system to be able to evaluate at halt the rest).\nThe DGM demonstrates the potential of self-improving AI while still operating within safe research\nboundaries due to the current limitations of frontier FMs and effective mitigations like sandboxing.\nAppendix I presents additional discussion on broader safety uncertainties. We include this safety\ndiscussion proactively to raise awareness about the emerging prospect of self-improving AI systems\nand their associated safety implications, particularly as these systems inevitably become more\ncapable (Yudkowsky et al., 2008; Bostrom, 2002; Ecoffet et al., 2020; Bengio et al., 2024; Clune,\n2019). Accordingly, we advocate for continued investigation into the safe and beneficial evolution of\nAI-Generating Algorithms (Clune, 2019) and self-improving systems.\n\n6\n\nC ONCLUSION AND L IMITATIONS\n\nWe introduce the Darwin Gödel Machine (DGM), the first self-improving system powered by FMs\nwith open-ended exploration, where progress on its evaluation benchmarks can directly translate\ninto better self-improvement capabilities. We demonstrate the automatic discovery of better tools\nand FM systems, resulting in better performance on two benchmarks: SWE-bench and Polyglot.\nThrough self-improvement and open-ended exploration, the DGM shows a continuous increase in\nperformance, bringing us one step closer to self-accelerating, self-improving AI systems.\n9\n\n\fPublished as a conference paper at ICLR 2026\n\nWe demonstrate that the DGM can autonomously achieve performance on par with openly available\nsolutions. However, it still falls short of closed-source SoTA SWE-bench solutions. An open question\nis whether running the DGM for longer would continue to yield performance gains and eventually\nsurpass closed-source solutions. These closed-source solutions often rely on elaborately handcrafted\ntechniques developed by teams of highly skilled experts. Since FMs have yet to match the capabilities\nof such experts (e.g., in reasoning), the DGM currently requires extensive compute to discover\nimprovements. A single run of the DGM on SWE-bench, as presented in Section 4, takes about 2\nweeks and incurs significant API costs (Appendix E.1). We hypothesize that further progress will\nrequire more efficient use of computational resources and the development of better reasoning skills.\nSince this version of the DGM is mainly powered by FMs, it is inherently limited by the capabilities\nof the underlying FM. Hence, an exciting future direction is to extend self-modification beyond just\nprompts or FM workflows, to include more computationally intensive methods, such as rewriting\nits own training script to update the FM itself. While this version of the DGM focuses on coding,\nAI systems are increasingly applied across a wide range of domains (e.g., computer vision, creative\nwriting). Another promising extension is to develop self-improving AI systems capable of enhancing\nthemselves beyond just the coding domain. A key assumption in this work is that coding benchmarks\nare a good reflection of the agent’s ability to self-improve, since the self-modification task requires\nthe agent to modify its own codebase. However, one could envision an alternative approach that\nco-evolves the target task distribution (Faldor et al., 2025; Wang et al., 2023c), thereby removing\nthe constraint of self-improvement being tied to a single objective, as in true open-ended processes.\nAppendix J presents additional potential directions for future work. As we continue to explore this\npowerful technology, we must also keep safety front and center, as discussed in Section 5.\nIn conclusion, the DGM represents a significant step toward the automation of AI development\nthrough self-improving systems capable of editing their own codebase. While current limitations in\ncompute and reasoning constrain its full potential, continued advances in FMs and infrastructure may\nunlock more powerful and general-purpose self-improvements. Provided that the safety concerns\nare carefully navigated (Section 5), the future of self-improving AI systems and AI-Generating\nAlgorithms (Clune, 2019) holds immense promise to open-endedly evolve AI, continually rewriting\nor retraining itself in pursuit of greater capabilities aligned with human values.\n\n10\n\n\fPublished as a conference paper at ICLR 2026\n\nE THICS S TATEMENT\nWe affirm compliance with the ICLR Code of Ethics. This work studies self-improving AI systems\nin the limited context of code-editing agents evaluated on standard programming benchmarks. No\nhuman subjects were involved and no personally identifiable information (PII) was collected or\nprocessed; IRB approval was therefore not required.\nSafety and misuse. Self-modifying systems can pose safety risks if allowed to act without constraints\nor if optimizations inadvertently introduce unsafe behaviors. To mitigate this, all agents in our\nexperiments ran inside isolated sandboxes with strict resource and time limits; agents had limited\nnetwork access and no ability to modify the host environment. The self-improvement scope was\nrestricted to the agent’s own Python codebase and evaluation harnesses. We maintained a complete,\nauditable lineage (archive) of code changes and evaluations, enabling rollback and post-hoc analysis.\nWe did not deploy discovered agents in real development environments. Our release plan (code,\nprompts, and evaluation artifacts) will exclude any components that grant elevated system access and\nwill include default sandboxing, guardrails, and clear documentation of intended use.\nDual-use, downstream impact, and limitations. Stronger autonomous coding agents could be\ndual-use (e.g., aiding software maintenance, but also potentially facilitating creation of harmful code\nif misapplied). We believe the research benefits (e.g., advancing methods for controlled, auditable\nself-improvement and demonstrating practical safeguards) outweigh the risks. Nevertheless, we\nexplicitly discourage security-sensitive or unsandboxed deployment and provide concrete safety\nrecommendations (Section 5). Our empirical focus on benchmark optimization may not capture\nall desirable properties (robustness, interpretability, or broader social values). We therefore treat\nbenchmark gains as necessary but insufficient indicators of general AI development, and discuss\navenues to integrate other objectives (e.g., safety, reasoning) into the optimization loop.\nData governance, IP, and licensing. We evaluate on SWE-bench Verified and Polyglot, which are\ncomposed of open-source repositories and tasks. We complied with dataset licenses and usage terms\nto the best of our knowledge. We did not introduce or distribute proprietary code. Foundation models\n(FMs) were accessed via provider APIs under their terms of service; we did not submit sensitive data,\nnor attempt to circumvent usage policies. Logs released with this work will be scrubbed of API keys\nand any incidental sensitive strings.\nBias, fairness, and equity. Although our domain is software code rather than human-centered text,\nFM behavior can still reflect biases (e.g., language or ecosystem preferences) and may unevenly\nbenefit communities whose tooling is better represented in training data. We partially address this by\nevaluating across multiple languages (Polyglot) and reporting cross-benchmark transfer. Future work\nshould add diagnostics for biased failure modes and include broader, community-driven task sets.\nConflicts of interest and funding. No author has a financial interest in products whose performance\nis evaluated here. Sponsors and employers did not influence experimental design, analysis, or the\ndecision to publish, beyond providing salary or standard research support. Any external compute or\nAPI credits are acknowledged in the appendix.\n\nR EPRODUCIBILITY S TATEMENT\nWe will open-source all code and full agent logs, including the complete archive lineage of selfmodifications (diffs, prompts, and configs) as well as the evaluation harness. To support exact replication, we reference the following: algorithmic details and pseudocode (Section 3, Appendix C.4);\nparent selection and open-ended exploration settings (Appendix C.2); foundation model choices\nand hyperparameters (Appendix D.1); benchmark task subsets for SWE-bench and Polyglot (Appendix E.2, Appendix E.3); staged evaluation protocols and scripts (Section 4.2); implementations\nand diffs for the best discovered agents (Appendix F.1, Appendix F.2); and compute and cost estimates\n(Appendix E.1). The released code repository will include environment specifications and scripts to\nreproduce all results, figures, and tables.\n\n11\n\n\fPublished as a conference paper at ICLR 2026\n\nACKNOWLEDGMENTS\nThis research was supported by the Vector Institute, the Canada CIFAR AI Chairs program, a\ngrant from Schmidt Futures, an NSERC Discovery Grant, and a generous donation from Rafael\nCosman. Resources used in preparing this research were provided, in part, by the Province of\nOntario, the Government of Canada through CIFAR, and companies sponsoring the Vector Institute\n(https://vectorinstitute.ai/partnerships/current-partners/). Any opinions, findings, and conclusions or\nrecommendations expressed in this material are those of the authors and do not necessarily reflect the\nviews of the sponsors. We also thank Aaron Dharna, Ben Norman, Cédric Colas, Sam Devlin, and\nShyam Sudhakaran for insightful discussions and feedback.\n\nR EFERENCES\nFuma Aki, Riku Ikeda, Takumi Saito, Ciaran Regan, and Mizuki Oka. Llm-poet: Evolving complex\nenvironments using large language models. In Proceedings of the Genetic and Evolutionary\nComputation Conference Companion, pp. 243–246, 2024.\nRajeev Alur, Rishabh Singh, Dana Fisman, and Armando Solar-Lezama. Search-based program\nsynthesis. Communications of the ACM, 61(12):84–93, 2018.\nS-I Amari. Learning patterns and pattern sequences by self-organizing nets of threshold elements.\nIEEE Transactions on computers, 100(11):1197–1206, 1972.\nMarcin Andrychowicz, Filip Wolski, Alex Ray, Jonas Schneider, Rachel Fong, Peter Welinder, Bob\nMcGrew, Josh Tobin, OpenAI Pieter Abbeel, and Wojciech Zaremba. Hindsight experience replay.\nAdvances in neural information processing systems, 30, 2017.\nAnthropic.\nClaude 3.5 Sonnet.\nhttps://www.anthropic.com/news/\nclaude-3-5-sonnet, June 2024a. [Accessed 17 April 2025].\nAnthropic. Claude can now use tools, May 2024b. URL https://www.anthropic.com/\nnews/tool-use-ga. Accessed: 2025-05-03.\nAnthropic. Claude 3.7 sonnet and claude code, February 2025. URL https://www.anthropic.\ncom/news/claude-3-7-sonnet. Accessed: 2025-05-06.\nUsman Anwar, Abulhair Saparov, Javier Rando, Daniel Paleka, Miles Turpin, Peter Hase,\nEkdeep Singh Lubana, Erik Jenner, Stephen Casper, Oliver Sourbut, et al. Foundational challenges\nin assuring alignment and safety of large language models. arXiv preprint arXiv:2404.09932,\n2024.\nDzmitry Bahdanau, Kyung Hyun Cho, and Yoshua Bengio. Neural machine translation by jointly\nlearning to align and translate. In International Conference on Learning Representations, 2015.\nYuntao Bai, Saurav Kadavath, Sandipan Kundu, Amanda Askell, Jackson Kernion, Andy Jones,\nAnna Chen, Anna Goldie, Azalia Mirhoseini, Cameron McKinnon, et al. Constitutional AI:\nHarmlessness from AI feedback. arXiv preprint arXiv:2212.08073, 2022.\nAdrien Baranes and Pierre-Yves Oudeyer. Active learning of inverse models with intrinsically\nmotivated goal exploration in robots. Robotics and Autonomous Systems, 61(1):49–73, 2013.\nShraddha Barke, Emmanuel Anaya Gonzalez, Saketh Ram Kasibatla, Taylor Berg-Kirkpatrick, and\nNadia Polikarpova. Hysynth: Context-free llm approximation for guiding program synthesis.\nAdvances in Neural Information Processing Systems, 37:15612–15645, 2024.\nYoshua Bengio, Geoffrey Hinton, Andrew Yao, Dawn Song, Pieter Abbeel, Trevor Darrell, Yuval Noah Harari, Ya-Qin Zhang, Lan Xue, Shai Shalev-Shwartz, et al. Managing extreme AI risks\namid rapid progress. Science, 384(6698):842–845, 2024.\nN Bostrom. Existential Risks: analyzing human extinction scenarios and related hazards. Journal of\nEvolution and Technology, 9, 2002.\nNick Bostrom. Ethical issues in advanced artificial intelligence. Machine Ethics and Robot Ethics,\npp. 69–75, 2020.\n12\n\n\fPublished as a conference paper at ICLR 2026\n\nHerbie Bradley, Andrew Dai, Hannah Benita Teufel, Jenny Zhang, Koen Oostermeijer, Marco\nBellagente, Jeff Clune, Kenneth Stanley, Gregory Schott, and Joel Lehman. Quality-diversity\nthrough ai feedback. In The Twelfth International Conference on Learning Representations, 2024.\nTom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal,\nArvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are\nfew-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020.\nJake Bruce, Michael D Dennis, Ashley Edwards, Jack Parker-Holder, Yuge Shi, Edward Hughes,\nMatthew Lai, Aditi Mavalankar, Richie Steigerwald, Chris Apps, et al. Genie: Generative\ninteractive environments. In Forty-first International Conference on Machine Learning, 2024.\nJ Richard Buchi and Lawrence H Landweber. Solving sequential conditions by finite-state strategies.\nIn The collected works of J. Richard Büchi, pp. 525–541. Springer, 1990.\nRuisheng Cao, Fangyu Lei, Haoyuan Wu, Jixuan Chen, Yeqiao Fu, Hongcheng Gao, Xinzhuang\nXiong, Hanchong Zhang, Wenjing Hu, Yuchen Mao, et al. Spider2-v: How far are multimodal\nagents from automating data science and engineering workflows? Advances in Neural Information\nProcessing Systems, 37:107703–107744, 2024.\nKonstantinos Chatzilygeroudis, Antoine Cully, Vassilis Vassiliades, and Jean-Baptiste Mouret.\nQuality-diversity optimization: a novel branch of stochastic optimization. In Black Box Optimization, Machine Learning, and No-Free Lunch Theorems, pp. 109–135. Springer, 2021.\nBanghao Chen, Zhaofeng Zhang, Nicolas Langrené, and Shengxin Zhu. Unleashing the potential of prompt engineering in large language models: a comprehensive review. arXiv preprint\narXiv:2310.14735, 2023.\nChing-An Cheng, Allen Nie, and Adith Swaminathan. Trace is the next autodiff: Generative\noptimization with rich feedback, execution traces, and llms. Advances in Neural Information\nProcessing Systems, 37:71596–71642, 2024.\nJeff Clune. AI-GAs: AI-generating algorithms, an alternate paradigm for producing general artificial\nintelligence. arXiv preprint arXiv:1905.10985, 2019.\nCédric Colas, Pierre Fournier, Mohamed Chetouani, Olivier Sigaud, and Pierre-Yves Oudeyer.\nCurious: intrinsically motivated modular multi-goal reinforcement learning. In International\nconference on machine learning, pp. 1331–1340. PMLR, 2019.\nCédric Colas, Tristan Karch, Clément Moulin-Frier, and Pierre-Yves Oudeyer. Language and culture\ninternalization for human-like autotelic AI. Nature Machine Intelligence, 4(12):1068–1076, 2022a.\nCédric Colas, Tristan Karch, Olivier Sigaud, and Pierre-Yves Oudeyer. Autotelic agents with\nintrinsically motivated goal-conditioned reinforcement learning: a short survey. Journal of\nArtificial Intelligence Research, 74:1159–1199, 2022b.\nCédric Colas, Laetitia Teodorescu, Pierre-Yves Oudeyer, Xingdi Yuan, and Marc-Alexandre Côté.\nAugmenting autotelic agents with large language models. In Conference on Lifelong Learning\nAgents, pp. 205–226. PMLR, 2023.\nRémi Coulom. Efficient selectivity and backup operators in monte-carlo tree search. In International\nconference on computers and games, pp. 72–83. Springer, 2006.\nCharles Darwin. Origin of the species. In British Politics and the environment in the long nineteenth\ncentury, pp. 47–55. Routledge, 2023.\nRichard Dawkins. The evolution of evolvability. In Artificial life, pp. 201–220. Routledge, 2019.\nMichael Dennis, Natasha Jaques, Eugene Vinitsky, Alexandre Bayen, Stuart Russell, Andrew Critch,\nand Sergey Levine. Emergent complexity and zero-shot transfer via unsupervised environment\ndesign. Advances in neural information processing systems, 33:13049–13061, 2020.\nAaron Dharna, Cong Lu, and Jeff Clune. Quality-Diversity Self-Play: Open-Ended Strategy Innovation via Foundation Models. In NeurIPS 2024 Workshop on Open-World Agents, 2024.\n13\n\n\fPublished as a conference paper at ICLR 2026\n\nLi Ding, Jenny Zhang, Jeff Clune, Lee Spector, and Joel Lehman. Quality diversity through\nhuman feedback: towards open-ended diversity-driven optimization. In Proceedings of the 41st\nInternational Conference on Machine Learning, pp. 11072–11090, 2024.\nTheodosius Dobzhansky. Genetics of the evolutionary process, volume 139. Columbia University\nPress, 1970.\nAdrien Ecoffet, Joost Huizinga, Joel Lehman, Kenneth O Stanley, and Jeff Clune. Go-explore: a new\napproach for hard-exploration problems. arXiv preprint arXiv:1901.10995, 2019.\nAdrien Ecoffet, Jeff Clune, and Joel Lehman. Open questions in creating safe open-ended AI: tensions\nbetween control and creativity. In Artificial Life Conference Proceedings 32, pp. 27–35. MIT Press\nOne Rogers Street, Cambridge, MA 02142-1209, USA journals-info . . . , 2020.\nAdrien Ecoffet, Joost Huizinga, Joel Lehman, Kenneth O Stanley, and Jeff Clune. First return, then\nexplore. Nature, 590(7847):580–586, 2021.\nAnthony W Fisher Edwards. The genetical theory of natural selection. Genetics, 154(4):1419–1426,\n2000.\nKevin Ellis, Catherine Wong, Maxwell Nye, Mathias Sablé-Meyer, Lucas Morales, Luke Hewitt, Luc\nCary, Armando Solar-Lezama, and Joshua B Tenenbaum. Dreamcoder: Bootstrapping inductive\nprogram synthesis with wake-sleep library learning. In Proceedings of the 42nd acm sigplan\ninternational conference on programming language design and implementation, pp. 835–850,\n2021.\nBenjamin Eysenbach, Abhishek Gupta, Julian Ibarz, and Sergey Levine. Diversity is all you need:\nLearning skills without a reward function. arXiv preprint arXiv:1802.06070, 2018.\nMeta Fundamental AI Research Diplomacy Team (FAIR)†, Anton Bakhtin, Noam Brown, Emily\nDinan, Gabriele Farina, Colin Flaherty, Daniel Fried, Andrew Goff, Jonathan Gray, Hengyuan Hu,\net al. Human-level play in the game of Diplomacy by combining language models with strategic\nreasoning. Science, 378(6624):1067–1074, 2022.\nMaxence Faldor, Jenny Zhang, Antoine Cully, and Jeff Clune. OMNI-EPIC: Open-endedness\nvia Models of human Notions of Interestingness with Environments Programmed in Code. In\nThe Thirteenth International Conference on Learning Representations, 2025. URL https:\n//openreview.net/forum?id=Y1XkzMJpPd.\nChrisantha Fernando, Dylan Sunil Banarse, Henryk Michalewski, Simon Osindero, and Tim Rocktäschel. Promptbreeder: Self-Referential Self-Improvement via Prompt Evolution. In Forty-first\nInternational Conference on Machine Learning, 2024.\nDeep Ganguli, Liane Lovitt, Jackson Kernion, Amanda Askell, Yuntao Bai, Saurav Kadavath, Ben\nMann, Ethan Perez, Nicholas Schiefer, Kamal Ndousse, et al. Red teaming language models to\nreduce harms: Methods, scaling behaviors, and lessons learned. arXiv preprint arXiv:2209.07858,\n2022.\nHongcheng Gao, Yue Liu, Yufei He, Longxu Dou, Chao Du, Zhijie Deng, Bryan Hooi, Min\nLin, and Tianyu Pang. Flowreasoner: Reinforcing query-level meta-agents. arXiv preprint\narXiv:2504.15257, 2025.\nPaul Gauthier. Aider: Ai pair programming in your terminal.\nAider-AI/aider, 2024. Accessed: 2025-05-14.\n\nhttps://github.com/\n\nLoris Gaven, Thomas Carta, Clément Romac, Cédric Colas, Sylvain Lamprier, Olivier Sigaud, and\nPierre-Yves Oudeyer. MAGELLAN: Metacognitive predictions of learning progress guide autotelic\nLLM agents in large goal spaces. arXiv preprint arXiv:2502.07709, 2025.\nJohn Gerhart and Marc Kirschner. The theory of facilitated variation. Proceedings of the National\nAcademy of Sciences, 104(suppl_1):8582–8589, 2007.\nIrving John Good. Speculations concerning the first ultraintelligent machine. In Advances in\ncomputers, volume 6, pp. 31–88. Elsevier, 1966.\n14\n\n\fPublished as a conference paper at ICLR 2026\n\nGoogle\nDeepMind.\nGemini\nmodel\n“thinking”\nupdates\n—\nmarch\n2025.\nhttps://blog.google/technology/google-deepmind/\ngemini-model-thinking-updates-march-2025/#gemini-2-5-thinking,\nMarch 2025. Accessed: 2025-05-11.\nRyan Greenblatt, Carson Denison, Benjamin Wright, Fabien Roger, Monte MacDiarmid, Sam Marks,\nJohannes Treutlein, Tim Belonax, Jack Chen, David Duvenaud, et al. Alignment faking in large\nlanguage models. arXiv preprint arXiv:2412.14093, 2024.\nSumit Gulwani. Automating string processing in spreadsheets using input-output examples. ACM\nSigplan Notices, 46(1):317–330, 2011.\nDaya Guo, Dejian Yang, Haowei Zhang, Junxiao Song, Ruoyu Zhang, Runxin Xu, Qihao Zhu,\nShirong Ma, Peiyi Wang, Xiao Bi, et al. Deepseek-r1: Incentivizing reasoning capability in llms\nvia reinforcement learning. arXiv preprint arXiv:2501.12948, 2025.\nJohn Storrs Hall. Self-improving AI: An analysis. Minds and Machines, 17(3):249–259, 2007.\nAlex Havrilla, Andrew Dai, Laura O’Mahony, Koen Oostermeijer, Vera Zisler, Alon Albalak, Fabrizio\nMilo, Sharath Chandra Raparthy, Kanishk Gandhi, Baber Abbasi, et al. Surveying the effects of\nquality, diversity, and complexity in synthetic data from large language models. arXiv preprint\narXiv:2412.02980, 2024a.\nAlex Havrilla, Sharath Raparthy, Christoforus Nalmpantis, Jane Dwivedi-Yu, Maksym Zhuravinskyi,\nEric Hambro, and Roberta Raileanu. Glore: When, where, and how to improve llm reasoning via\nglobal and local refinements. arXiv preprint arXiv:2402.10963, 2024b.\nJesse Love Hendrikse, Trish Elizabeth Parsons, and Benedikt Hallgrímsson. Evolvability as the\nproper focus of evolutionary developmental biology. Evolution &amp; development, 9(4):393–401,\n2007.\nNathan Herr, Tim Rocktäschel, and Roberta Raileanu. Llm-first search: Self-guided exploration of\nthe solution space. arXiv preprint arXiv:2506.05213, 2025.\nMarius Hobbhahn. Swe-bench verified mini. https://github.com/mariushobbhahn/\nSWEBench-verified-mini, April 2025. Accessed: 2025-04-16.\nJohn J Hopfield. Neural networks and physical systems with emergent collective computational\nabilities. Proceedings of the national academy of sciences, 79(8):2554–2558, 1982.\nShengran Hu and Jeff Clune. Thought Cloning: Learning to think while acting by imitating human\nthinking. Advances in Neural Information Processing Systems, 36, 2024.\nShengran Hu, Cong Lu, and Jeff Clune. Automated Design of Agentic Systems. In The Thirteenth\nInternational Conference on Learning Representations, 2025. URL https://openreview.\nnet/forum?id=t9U3LW7JVX.\nYue Hu, Yuzhu Cai, Yaxin Du, Xinyu Zhu, Xiangrui Liu, Zijie Yu, Yuchen Hou, Shuo Tang, and\nSiheng Chen. Self-evolving multi-agent collaboration networks for software development. arXiv\npreprint arXiv:2410.16946, 2024.\nJiaxin Huang, Shixiang Shane Gu, Le Hou, Yuexin Wu, Xuezhi Wang, Hongkun Yu, and Jiawei Han.\nLarge language models can self-improve. arXiv preprint arXiv:2210.11610, 2022.\nEdward Hughes, Michael Dennis, Jack Parker-Holder, Feryal Behbahani, Aditi Mavalankar, Yuge\nShi, Tom Schaul, and Tim Rocktaschel. Open-endedness is essential for artificial superhuman\nintelligence. arXiv preprint arXiv:2406.04268, 2024.\nKazuki Irie, Imanol Schlag, Róbert Csordás, and Jürgen Schmidhuber. A modern self-referential\nweight matrix that learns to modify itself. In International Conference on Machine Learning, pp.\n9660–9677. PMLR, 2022.\nKazuki Irie, Róbert Csordás, and Jürgen Schmidhuber. Metalearning continual learning algorithms.\nTransactions on Machine Learning Research, 2025.\n15\n\n\fPublished as a conference paper at ICLR 2026\n\nMax Jaderberg, Valentin Dalibard, Simon Osindero, Wojciech M Czarnecki, Jeff Donahue, Ali\nRazavi, Oriol Vinyals, Tim Green, Iain Dunning, Karen Simonyan, et al. Population based training\nof neural networks. arXiv preprint arXiv:1711.09846, 2017.\nMinqi Jiang, Edward Grefenstette, and Tim Rocktäschel. Prioritized level replay. In International\nConference on Machine Learning, pp. 4940–4950. PMLR, 2021.\nMinqi Jiang, Tim Rocktäschel, and Edward Grefenstette. General intelligence requires rethinking\nexploration. Royal Society Open Science, 10(6):230539, 2023.\nCarlos E Jimenez, John Yang, Alexander Wettig, Shunyu Yao, Kexin Pei, Ofir Press, and\nKarthik R Narasimhan. SWE-bench: Can Language Models Resolve Real-world Github Issues? In The Twelfth International Conference on Learning Representations, 2024. URL\nhttps://openreview.net/forum?id=VTF8yNQM66.\nIngmar Kanitscheider, Joost Huizinga, David Farhi, William Hebgen Guss, Brandon Houghton, Raul\nSampedro, Peter Zhokhov, Bowen Baker, Adrien Ecoffet, Jie Tang, Oleg Klimov, and Jeff Clune.\nMulti-task curriculum learning in a complex, visual, hard-exploration domain: Minecraft. arXiv\npreprint arXiv:2106.14876, 2021.\nAkbir Khan, John Hughes, Dan Valentine, Laura Ruis, Kshitij Sachan, Ansh Radhakrishnan, Edward\nGrefenstette, Samuel R Bowman, Tim Rocktäschel, and Ethan Perez. Debating with more\npersuasive llms leads to more truthful answers. arXiv preprint arXiv:2402.06782, 2024.\nOmar Khattab, Arnav Singhvi, Paridhi Maheshwari, Zhiyuan Zhang, Keshav Santhanam, Sri Vardhamanan, Saiful Haq, Ashutosh Sharma, Thomas T Joshi, Hanna Moazam, et al. Dspy: Compiling\ndeclarative language model calls into self-improving pipelines. arXiv preprint arXiv:2310.03714,\n2023.\nYoon Kim, Carl Denton, Luong Hoang, and Alexander M Rush. Structured Attention Networks. In\nInternational Conference on Learning Representations, 2017.\nMotoo Kimura. The neutral theory of molecular evolution. Scientific American, 241(5):98–129,\n1979.\nLouis Kirsch and Jürgen Schmidhuber. Self-referential meta learning. In First Conference on\nAutomated Machine Learning (Late-Breaking Workshop), 2022.\nMartin Klissarov, Pierluca D’Oro, Shagun Sodhani, Roberta Raileanu, Pierre-Luc Bacon, Pascal\nVincent, Amy Zhang, and Mikael Henaff. Motif: Intrinsic motivation from artificial intelligence\nfeedback. arXiv preprint arXiv:2310.00166, 2023.\nMartin Klissarov, Mikael Henaff, Roberta Raileanu, Shagun Sodhani, Pascal Vincent, Amy Zhang,\nPierre-Luc Bacon, Doina Precup, Marlos C Machado, and Pierluca D’Oro. MaestroMotif: Skill\nDesign from Artificial Intelligence Feedback. arXiv preprint arXiv:2412.08542, 2024.\nVarun Raj Kompella, Marijn Stollenga, Matthew Luciw, and Juergen Schmidhuber. Continual\ncuriosity-driven skill acquisition from high-dimensional video inputs for humanoid robots. Artificial\nIntelligence, 247:313–335, 2017.\nRobert Lange, Tom Schaul, Yutian Chen, Tom Zahavy, Valentin Dalibard, Chris Lu, Satinder Singh,\nand Sebastian Flennerhag. Discovering evolution strategies via meta-black-box optimization. In\nProceedings of the Companion Conference on Genetic and Evolutionary Computation, pp. 29–30,\n2023.\nRobert Lange, Yingtao Tian, and Yujin Tang. Large language models as evolution strategies. In\nProceedings of the Genetic and Evolutionary Computation Conference Companion, pp. 579–582,\n2024.\nJoonho Lee, Jemin Hwangbo, Lorenz Wellhausen, Vladlen Koltun, and Marco Hutter. Learning\nquadrupedal locomotion over challenging terrain. Science robotics, 5(47):eabc5986, 2020.\nJoel Lehman. Machine love. arXiv preprint arXiv:2302.09248, 2023.\n16\n\n\fPublished as a conference paper at ICLR 2026\n\nJoel Lehman and Kenneth O Stanley. Novelty search and the problem with objectives. Genetic\nprogramming theory and practice IX, pp. 37–56, 2011.\nJoel Lehman, Jonathan Gordon, Shawn Jain, Kamal Ndousse, Cathy Yeh, and Kenneth O Stanley.\nEvolution through large models. In Handbook of Evolutionary Machine Learning, pp. 331–366.\nSpringer, 2023.\nPatrick Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal,\nHeinrich Küttler, Mike Lewis, Wen-tau Yih, Tim Rocktäschel, et al. Retrieval-augmented generation for knowledge-intensive nlp tasks. Advances in neural information processing systems, 33:\n9459–9474, 2020.\nJ. Li, Storie J., and J. Clune. Encouraging creative thinking in robots improves their ability to solve\nchallenging problems. In Proceedings of the Genetic and Evolutionary Computation Conference,\npp. 193–200, 2014.\nYixuan Li, Julian Parsert, and Elizabeth Polgreen. Guiding enumerative program synthesis with\nlarge language models. In International Conference on Computer Aided Verification, pp. 280–301.\nSpringer, 2024.\nTian Liang, Zhiwei He, Wenxiang Jiao, Xing Wang, Yan Wang, Rui Wang, Yujiu Yang, Shuming Shi,\nand Zhaopeng Tu. Encouraging divergent thinking in large language models through multi-agent\ndebate. arXiv preprint arXiv:2305.19118, 2023.\nHunter Lightman, Vineet Kosaraju, Yuri Burda, Harrison Edwards, Bowen Baker, Teddy Lee, Jan\nLeike, John Schulman, Ilya Sutskever, and Karl Cobbe. Let’s verify step by step. In The Twelfth\nInternational Conference on Learning Representations, 2023.\nBryan Lim, Manon Flageat, and Antoine Cully. Large language models as in-context ai generators\nfor quality-diversity. In ALIFE 2024: Proceedings of the 2024 Artificial Life Conference. MIT\nPress, 2024.\nSeppo Linnainmaa. The representation of the cumulative rounding error of an algorithm as a Taylor\nexpansion of the local rounding errors. PhD thesis, Master’s Thesis (in Finnish), Univ. Helsinki,\n1970.\nFei Liu, Xialiang Tong, Mingxuan Yuan, Xi Lin, Fu Luo, Zhenkun Wang, Zhichao Lu, and Qingfu\nZhang. Evolution of heuristics: Towards efficient automatic algorithm design using large language\nmodel. arXiv preprint arXiv:2401.02051, 2024.\nLei Liu, Xiaoyan Yang, Yue Shen, Binbin Hu, Zhiqiang Zhang, Jinjie Gu, and Guannan Zhang.\nThink-in-memory: Recalling and post-thinking enable llms with long-term memory. arXiv preprint\narXiv:2311.08719, 2023.\nChris Lu, Sebastian Towers, and Jakob Foerster. Arbitrary order meta-learning with simple populationbased evolution. In Artificial Life Conference Proceedings 35, volume 2023, pp. 67. MIT Press\nOne Rogers Street, Cambridge, MA 02142-1209, USA journals-info . . . , 2023.\nChris Lu, Cong Lu, Robert Tjarko Lange, Jakob Foerster, Jeff Clune, and David Ha. The ai scientist:\nTowards fully automated open-ended scientific discovery. arXiv preprint arXiv:2408.06292, 2024a.\nCong Lu, Shengran Hu, and Jeff Clune. Intelligent go-explore: Standing on the shoulders of giant\nfoundation models. arXiv preprint arXiv:2405.15143, 2024b.\nCong Lu, Shengran Hu, and Jeff Clune. Automated capability discovery via model self-exploration.\narXiv preprint arXiv:2502.0757, 2025.\nYecheng Jason Ma, William Liang, Guanzhi Wang, De-An Huang, Osbert Bastani, Dinesh Jayaraman,\nYuke Zhu, Linxi Fan, and Anima Anandkumar. Eureka: Human-level reward design via coding\nlarge language models. arXiv preprint arXiv:2310.12931, 2023.\nAman Madaan, Niket Tandon, Prakhar Gupta, Skyler Hallinan, Luyu Gao, Sarah Wiegreffe, Uri\nAlon, Nouha Dziri, Shrimai Prabhumoye, Yiming Yang, et al. Self-refine: Iterative refinement\nwith self-feedback, 2023. URL https://arxiv. org/abs/2303.17651, 2023.\n17\n\n\fPublished as a conference paper at ICLR 2026\n\nJohn Markoff. Machines of loving grace: The quest for common ground between humans and robots.\nHarperCollins Publishers, 2016.\nErnst Mayr. The growth of biological thought: Diversity, evolution, and inheritance. Harvard\nUniversity Press, 1982.\nLuke Metz, C Daniel Freeman, Niru Maheswaranathan, and Jascha Sohl-Dickstein. Training learned\noptimizers with randomly initialized learned optimizers. arXiv preprint arXiv:2101.07367, 2021.\nAli Modarressi, Ayyoob Imani, Mohsen Fayyaz, and Hinrich Schütze. Ret-llm: Towards a general\nread-write memory for large language models. arXiv preprint arXiv:2305.14322, 2023.\nJean-Baptiste Mouret and Jeff Clune. Illuminating search spaces by mapping elites. arXiv preprint\narXiv:1504.04909, 2015.\nNiklas Muennighoff, Zitong Yang, Weijia Shi, Xiang Lisa Li, Li Fei-Fei, Hannaneh Hajishirzi, Luke\nZettlemoyer, Percy Liang, Emmanuel Candès, and Tatsunori Hashimoto. s1: Simple test-time\nscaling. arXiv preprint arXiv:2501.19393, 2025.\nMuhammad U Nasir and Julian Togelius. Practical PCG through large language models. In 2023\nIEEE Conference on Games (CoG), pp. 1–4. IEEE, 2023.\nMuhammad U Nasir, Steven James, and Julian Togelius. Word2world: Generating stories and worlds\nthrough large language models. arXiv preprint arXiv:2405.06686, 2024.\nAnh Mai Nguyen, Jason Yosinski, and Jeff Clune. Innovation engines: Automated creativity and\nimproved stochastic optimization via deep learning. In Proceedings of the 2015 annual conference\non genetic and evolutionary computation, pp. 959–966, 2015.\nFan Nie, Lan Feng, Haotian Ye, Weixin Liang, Pan Lu, Huaxiu Yao, Alexandre Alahi, and James\nZou. Weak-for-strong: Training weak meta-agent to harness strong executors. arXiv preprint\narXiv:2504.04785, 2025.\nBoye Niu, Yiliao Song, Kai Lian, Yifan Shen, Yu Yao, Kun Zhang, and Tongliang Liu. Flow: Modularized agentic workflow automation. In The Thirteenth International Conference on Learning\nRepresentations, 2025.\nAlexander Novikov, Ngân Vũ, Marvin Eisenberger, Emilien Dupont, Po-Sen Huang, Adam Zsolt Wagner, Sergey Shirobokov, Borislav Kozlovskii, Francisco J. R. Ruiz, Abbas Mehrabian, M. Pawan\nKumar, Abigail See, Swarat Chaudhuri, George Holland, Alex Davies, Sebastian Nowozin, Pushmeet Kohli, and Matej Balog. Alphaevolve: A coding agent for scientific and algorithmic discovery.\nTechnical report, Google DeepMind, 2025.\nOpenAI.\nIntroducing swe-bench verified.\nhttps://openai.com/index/\nintroducing-swe-bench-verified/, August 2024. Accessed: 2025-04-16.\nOpenAI. OpenAI o3-mini. https://openai.com/index/openai-o3-mini/, January\n2025. Accessed: 2025-05-01.\nPierre-Yves Oudeyer, Frdric Kaplan, and Verena V Hafner. Intrinsic motivation systems for autonomous mental development. IEEE transactions on evolutionary computation, 11(2):265–286,\n2007.\nLong Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong\nZhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. Training language models to follow\ninstructions with human feedback. Advances in neural information processing systems, 35:27730–\n27744, 2022.\nAnkur Parikh, Oscar Täckström, Dipanjan Das, and Jakob Uszkoreit. A Decomposable Attention\nModel for Natural Language Inference. In Proceedings of the 2016 Conference on Empirical\nMethods in Natural Language Processing, pp. 2249–2255, 2016.\n18\n\n\fPublished as a conference paper at ICLR 2026\n\nJack Parker-Holder, Philip Ball, Jake Bruce, Vibhavari Dasagi, Kristian Holsheimer, Christos Kaplanis, Alexandre Moufarek, Guy Scully, Jeremy Shar, Jimmy Shi, Stephen Spencer,\nJessica Yung, Michael Dennis, Sultan Kenjeyev, Shangbang Long, Vlad Mnih, Harris\nChan, Maxime Gazeau, Bonnie Li, Fabio Pardo, Luyu Wang, Lei Zhang, Frederic Besse,\nTim Harley, Anna Mitenkova, Jane Wang, Jeff Clune, Demis Hassabis, Raia Hadsell,\nAdrian Bolton, Satinder Singh, and Tim Rocktäschel. Genie 2: A large-scale foundation world model, 2024. URL https://deepmind.google/discover/blog/\ngenie-2-a-large-scale-foundation-world-model/.\nDeepak Pathak, Pulkit Agrawal, Alexei A Efros, and Trevor Darrell. Curiosity-driven exploration\nby self-supervised prediction. In International conference on machine learning, pp. 2778–2787.\nPMLR, 2017.\nPaul Gauthier. o1 tops aider’s new polyglot leaderboard. https://aider.chat/2024/12/\n21/polyglot.html, December 2024. Accessed: 2025-04-16.\nOleksandr Polozov and Sumit Gulwani. Flashmeta: A framework for inductive program synthesis. In Proceedings of the 2015 ACM SIGPLAN International Conference on Object-Oriented\nProgramming, Systems, Languages, and Applications, pp. 107–126, 2015.\nJustin K Pugh, Lisa B Soros, and Kenneth O Stanley. Quality diversity: A new frontier for evolutionary\ncomputation. Frontiers in Robotics and AI, 3:40, 2016.\nAlec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, Ilya Sutskever, et al. Language\nmodels are unsupervised multitask learners. OpenAI blog, 1(8):9, 2019.\nMaxime Robeyns, Martin Szummer, and Laurence Aitchison. A Self-Improving Coding Agent. arXiv\npreprint arXiv:2504.15228, 2025.\nBernardino Romera-Paredes, Mohammadamin Barekatain, Alexander Novikov, Matej Balog,\nM Pawan Kumar, Emilien Dupont, Francisco JR Ruiz, Jordan S Ellenberg, Pengming Wang,\nOmar Fawzi, et al. Mathematical discoveries from program search with large language models.\nNature, 625(7995):468–475, 2024.\nJ Rosser and Jakob Nicolaus Foerster. Agentbreeder: Mitigating the AI safety impact of multi-agent\nscaffolds via self-improvement. In Scaling Self-Improving Foundation Models without Human\nSupervision, 2025. URL https://openreview.net/forum?id=j0n3BJJTcT.\nDavid E Rumelhart, Geoffrey E Hinton, Ronald J Williams, et al. Learning internal representations\nby error propagation, 1985.\nMikayel Samvelyan, Sharath Chandra Raparthy, Andrei Lupu, Eric Hambro, Aram Markosyan,\nManish Bhatt, Yuning Mao, Minqi Jiang, Jack Parker-Holder, Jakob Foerster, et al. Rainbow\nteaming: Open-ended generation of diverse adversarial prompts. Advances in Neural Information\nProcessing Systems, 37:69747–69786, 2024.\nCansu Sancaktar, Christian Gumbsch, Andrii Zadaianchuk, Pavel Kolev, and Georg Martius. SENSEI:\nSemantic Exploration Guided by Foundation Models to Learn Versatile World Models. arXiv\npreprint arXiv:2503.01584, 2025.\nTom Schaul, Daniel Horgan, Karol Gregor, and David Silver. Universal value function approximators.\nIn International conference on machine learning, pp. 1312–1320. PMLR, 2015.\nTimo Schick, Jane Dwivedi-Yu, Roberto Dessì, Roberta Raileanu, Maria Lomeli, Eric Hambro, Luke\nZettlemoyer, Nicola Cancedda, and Thomas Scialom. Toolformer: Language models can teach\nthemselves to use tools. Advances in Neural Information Processing Systems, 36:68539–68551,\n2023.\nJürgen Schmidhuber. Evolutionary principles in self-referential learning, or on learning how to learn:\nthe meta-meta-... hook. PhD thesis, Technische Universität München, 1987.\nJürgen Schmidhuber. A ‘self-referential’weight matrix. In International conference on artificial\nneural networks, pp. 446–450. Springer, 1993.\n19\n\n\fPublished as a conference paper at ICLR 2026\n\nJürgen Schmidhuber. Gödel machines: Fully self-referential optimal universal self-improvers. In\nArtificial general intelligence, pp. 199–226. Springer, 2007.\nJürgen Schmidhuber. Driven by compression progress: A simple principle explains essential aspects\nof subjective beauty, novelty, surprise, interestingness, attention, curiosity, creativity, art, science,\nmusic, jokes. In Workshop on anticipatory behavior in adaptive learning systems, pp. 48–76.\nSpringer, 2008.\nJürgen Schmidhuber. Powerplay: Training an increasingly general problem solver by continually\nsearching for the simplest still unsolvable problem. Frontiers in psychology, 4:313, 2013.\nJürgen Schmidhuber and Rudolf Huber. Learning to generate focus trajectories for attentive vision.\nInstitut für Informatik, 1990.\nSander Schulhoff, Michael Ilie, Nishant Balepur, Konstantine Kahadze, Amanda Liu, Chenglei\nSi, Yinheng Li, Aayush Gupta, HyoJung Han, Sevien Schulhoff, et al. The prompt report: A\nsystematic survey of prompting techniques. arXiv preprint arXiv:2406.06608, 2024.\nIvaxi Sheth, Jan Wehner, Sahar Abdelnabi, Ruta Binkyte, and Mario Fritz. Safety is Essential for\nResponsible Open-Ended Systems. arXiv preprint arXiv:2502.04512, 2025.\nKensen Shi, Hanjun Dai, Wen-Ding Li, Kevin Ellis, and Charles Sutton. Lambdabeam: Neural program search with higher-order functions and lambdas. Advances in Neural Information Processing\nSystems, 36:51327–51346, 2023.\nNoah Shinn, Federico Cassano, Ashwin Gopinath, Karthik Narasimhan, and Shunyu Yao. Reflexion:\nLanguage agents with verbal reinforcement learning. Advances in Neural Information Processing\nSystems, 36:8634–8652, 2023.\nDavid Silver, Aja Huang, Chris J Maddison, Arthur Guez, Laurent Sifre, George Van Den Driessche,\nJulian Schrittwieser, Ioannis Antonoglou, Veda Panneershelvam, Marc Lanctot, et al. Mastering\nthe game of go with deep neural networks and tree search. nature, 529(7587):484–489, 2016.\nDavid Silver, Thomas Hubert, Julian Schrittwieser, Ioannis Antonoglou, Matthew Lai, Arthur Guez,\nMarc Lanctot, Laurent Sifre, Dharshan Kumaran, Thore Graepel, et al. Mastering chess and shogi\nby self-play with a general reinforcement learning algorithm. arXiv preprint arXiv:1712.01815,\n2017.\nAvi Singh, John D Co-Reyes, Rishabh Agarwal, Ankesh Anand, Piyush Patil, Xavier Garcia, Peter J\nLiu, James Harrison, Jaehoon Lee, Kelvin Xu, et al. Beyond human data: Scaling self-training for\nproblem-solving with language models. arXiv preprint arXiv:2312.06585, 2023.\nJoar Skalse, Nikolaus Howe, Dmitrii Krasheninnikov, and David Krueger. Defining and characterizing\nreward gaming. Advances in Neural Information Processing Systems, 35:9460–9471, 2022.\nKenneth O Stanley and Joel Lehman. Why greatness cannot be planned: The myth of the objective.\nSpringer, 2015.\nKenneth O Stanley, Joel Lehman, and Lisa Soros. Open-endedness: The last grand challenge you’ve\nnever heard of. While open-endedness could be a force for discovering intelligence, it could also\nbe a component of AI itself, 2017.\nMarilyn Strathern. ‘Improving ratings’: audit in the British University system. European review, 5\n(3):305–321, 1997.\nJinwei Su, Yinghui Xia, Ronghua Shi, Jianhui Wang, Jianuo Huang, Yijin Wang, Tianyu Shi, Yang\nJingsong, and Lewei He. Debflow: Automating agent creation via agent debate. arXiv preprint\narXiv:2503.23781, 2025.\nShyam Sudhakaran, Miguel González-Duque, Matthias Freiberger, Claire Glanois, Elias Najarro,\nand Sebastian Risi. Mariogpt: Open-ended text2level generation through large language models.\nAdvances in Neural Information Processing Systems, 36:54213–54227, 2023.\n20\n\n\fPublished as a conference paper at ICLR 2026\n\nOpenAI Team, Aaron Jaech, Adam Kalai, Adam Lerer, Adam Richardson, Ahmed El-Kishky, Aiden\nLow, Alec Helyar, Aleksander Madry, Alex Beutel, Alex Carney, et al. Openai o1 system card.\narXiv preprint arXiv:2412.16720, 2024.\nAshish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz\nKaiser, and Illia Polosukhin. Attention is all you need. Advances in neural information processing\nsystems, 30, 2017.\nGuanzhi Wang, Yuqi Xie, Yunfan Jiang, Ajay Mandlekar, Chaowei Xiao, Yuke Zhu, Linxi Fan, and\nAnima Anandkumar. Voyager: An open-ended embodied agent with large language models. arXiv\npreprint arXiv:2305.16291, 2023a.\nRen-Jian Wang, Ke Xue, Yutong Wang, Peng Yang, Haobo Fu, Qiang Fu, and Chao Qian. Diversity\nfrom human feedback. arXiv preprint arXiv:2310.06648, 2023b.\nRui Wang, Joel Lehman, Jeff Clune, and Kenneth O Stanley. Paired open-ended trailblazer (poet):\nEndlessly generating increasingly complex and diverse learning environments and their solutions.\narXiv preprint arXiv:1901.01753, 2019.\nXingyao Wang, Boxuan Li, Yufan Song, Frank F Xu, Xiangru Tang, Mingchen Zhuge, Jiayi Pan,\nYueqi Song, Bowen Li, Jaskirat Singh, et al. Openhands: An open platform for ai software developers as generalist agents. In The Thirteenth International Conference on Learning Representations,\n2024.\nYufei Wang, Zhou Xian, Feng Chen, Tsun-Hsuan Wang, Yian Wang, Katerina Fragkiadaki, Zackory\nErickson, David Held, and Chuang Gan. Robogen: Towards unleashing infinite data for automated\nrobot learning via generative simulation. arXiv preprint arXiv:2311.01455, 2023c.\nJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Fei Xia, Ed Chi, Quoc V Le, Denny\nZhou, et al. Chain-of-thought prompting elicits reasoning in large language models. Advances in\nneural information processing systems, 35:24824–24837, 2022.\nMarco Wiering and Jürgen Schmidhuber. Hq-learning. Adaptive behavior, 6(2):219–246, 1997.\nS Wright. The roles of mutation, inbreeding, crossbreeding and selection in evolution, proceedings of\nthe sixth international congress of genetics. proc sixth int congr genet [internet]. New York356366,\n1932.\nChunqiu Steven Xia, Yinlin Deng, Soren Dunn, and Lingming Zhang. Agentless: Demystifying\nllm-based software engineering agents. arXiv preprint arXiv:2407.01489, 2024.\nJohn Yang, Carlos E Jimenez, Alexander Wettig, Kilian Lieret, Shunyu Yao, Karthik R Narasimhan,\nand Ofir Press. SWE-agent: Agent-computer interfaces enable automated software engineering.\nIn The Thirty-eighth Annual Conference on Neural Information Processing Systems, 2024. URL\nhttps://arxiv.org/abs/2405.15793.\nShunyu Yao, Jeffrey Zhao, Dian Yu, Nan Du, Izhak Shafran, Karthik Narasimhan, and Yuan Cao.\nReact: Synergizing reasoning and acting in language models. In International Conference on\nLearning Representations (ICLR), 2023.\nRui Ye, Shuo Tang, Rui Ge, Yaxin Du, Zhenfei Yin, Siheng Chen, and Jing Shao. Mas-gpt: Training\nllms to build llm-based multi-agent systems. arXiv preprint arXiv:2503.03686, 2025.\nXunjian Yin, Xinyi Wang, Liangming Pan, Xiaojun Wan, and William Yang Wang. G\\\" odel\nAgent: A Self-Referential Agent Framework for Recursive Self-Improvement. arXiv preprint\narXiv:2410.04444, 2024.\nSiyu Yuan, Kaitao Song, Jiangjie Chen, Xu Tan, Dongsheng Li, and Deqing Yang. Evoagent: Towards\nautomatic multi-agent generation via evolutionary algorithms. arXiv preprint arXiv:2406.14228,\n2024.\nEliezer Yudkowsky et al. Artificial Intelligence as a positive and negative factor in global risk. Global\ncatastrophic risks, 1(303):184, 2008.\n21\n\n\fPublished as a conference paper at ICLR 2026\n\nMert Yuksekgonul, Federico Bianchi, Joseph Boen, Sheng Liu, Zhi Huang, Carlos Guestrin, and\nJames Zou. Textgrad: Automatic\" differentiation\" via text. arXiv preprint arXiv:2406.07496,\n2024.\nEric Zelikman, Georges Harik, Yijia Shao, Varuna Jayasiri, Nick Haber, and Noah D Goodman.\nQuiet-star: Language models can teach themselves to think before speaking. arXiv preprint\narXiv:2403.09629, 2024a.\nEric Zelikman, Eliana Lorch, Lester Mackey, and Adam Tauman Kalai. Self-taught optimizer (stop):\nRecursively self-improving code generation. In First Conference on Language Modeling, 2024b.\nDan Zhang, Sining Zhoubian, Ziniu Hu, Yisong Yue, Yuxiao Dong, and Jie Tang. Rest-mcts*: Llm\nself-training via process reward guided tree search. Advances in Neural Information Processing\nSystems, 37:64735–64772, 2024a.\nGuibin Zhang, Luyang Niu, Junfeng Fang, Kun Wang, Lei Bai, and Xiang Wang. Multi-agent\narchitecture search via agentic supernet. arXiv preprint arXiv:2502.04180, 2025a.\nJenny Zhang, Joel Lehman, Kenneth Stanley, and Jeff Clune. OMNI: Open-endedness via Models\nof human Notions of Interestingness. In The Twelfth International Conference on Learning\nRepresentations, 2024b. URL https://openreview.net/forum?id=AgM3MzT99c.\nJiayi Zhang, Jinyu Xiang, Zhaoyang Yu, Fengwei Teng, Xionghui Chen, Jiaqi Chen, Mingchen Zhuge,\nXin Cheng, Sirui Hong, Jinlin Wang, et al. Aflow: Automating agentic workflow generation. arXiv\npreprint arXiv:2410.10762, 2024c.\nYuanshuo Zhang, Yuchen Hou, Bohan Tang, Shuo Chen, Muhan Zhang, Xiaowen Dong, and Siheng\nChen. Gnns as predictors of agentic workflow performances. arXiv preprint arXiv:2503.11301,\n2025b.\nYuntong Zhang, Haifeng Ruan, Zhiyu Fan, and Abhik Roychoudhury. Autocoderover: Autonomous\nprogram improvement. In Proceedings of the 33rd ACM SIGSOFT International Symposium on\nSoftware Testing and Analysis, pp. 1592–1604, 2024d.\nWanjun Zhong, Lianghong Guo, Qiqi Gao, He Ye, and Yanlin Wang. Memorybank: Enhancing large\nlanguage models with long-term memory. In Proceedings of the AAAI Conference on Artificial\nIntelligence, volume 38, pp. 19724–19731, 2024.\nAndy Zhou, Kevin Wu, Francesco Pinto, Zhaorun Chen, Yi Zeng, Yu Yang, Shuang Yang, Sanmi\nKoyejo, James Zou, and Bo Li. AutoRedTeamer: Autonomous Red Teaming with Lifelong Attack\nIntegration. arXiv preprint arXiv:2503.15754, 2025.\nWangchunshu Zhou, Yixin Ou, Shengwei Ding, Long Li, Jialong Wu, Tiannan Wang, Jiamin Chen,\nShuai Wang, Xiaohua Xu, Ningyu Zhang, et al. Symbolic learning enables self-evolving agents.\narXiv preprint arXiv:2406.18532, 2024.\nYuqi Zhu, Jia Li, Ge Li, YunFei Zhao, Zhi Jin, and Hong Mei. Hot or cold? adaptive temperature\nsampling for code generation with large language models. In Proceedings of the AAAI Conference\non Artificial Intelligence, volume 38, pp. 437–445, 2024.\nMingchen Zhuge, Haozhe Liu, Francesco Faccio, Dylan R. Ashley, Róbert Csordás, Anand Gopalakrishnan, Abdullah Hamdi, Hasan Abed Al Kader Hammoud, Vincent Herrmann, Kazuki Irie, Louis\nKirsch, Bing Li, Guohao Li, Shuming Liu, Jinjie Mai, Piotr Piékos, Aditya Ramesh, Imanol\nSchlag, Weimin Shi, Aleksandar Stanic, Wenyi Wang, Yuhui Wang, Mengmeng Xu, Deng-Ping\nFan, Bernard Ghanem, and Jürgen Schmidhuber. Mindstorms in natural language-based societies\nof mind. arXiv preprint arXiv:2305.17066, 2023.\nMingchen Zhuge, Wenyi Wang, Louis Kirsch, Francesco Faccio, Dmitrii Khizbullin, and Jürgen\nSchmidhuber. Gptswarm: Language agents as optimizable graphs. In Forty-first International\nConference on Machine Learning, 2024.\n\n22\n\n\fPublished as a conference paper at ICLR 2026\n\nA PPENDIX\nTABLE OF C ONTENTS\nA Additional Results\n\n24\n\nA.1 Baselines on SWE-bench . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .\n\n24\n\nA.2 Generality across models on Polyglot . . . . . . . . . . . . . . . . . . . . . . . .\n\n25\n\nA.3 Ablation of Parent Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . .\n\n25\n\nA.4 Additional Statistics of DGM runs . . . . . . . . . . . . . . . . . . . . . . . . . .\n\n25\n\nB Additional Related Work\n\n26\n\nC Algorithmic Details\n\n27\n\nC.1 Initial Coding Agent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .\n\n27\n\nC.2 Parent Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .\n\n28\n\nC.3 Self-Improve Prompts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .\n\n28\n\nC.4 Pseudocode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .\n\n31\n\nD Experiment Details\n\n32\n\nD.1 Hyperparameters for Foundation Models . . . . . . . . . . . . . . . . . . . . . . .\nE Benchmark Details\n\n32\n32\n\nE.1 Cost Estimate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .\n\n32\n\nE.2 SWE-bench Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .\n\n33\n\nE.3 Polyglot Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .\n\n35\n\nE.4 SWE-bench State-of-The-Art . . . . . . . . . . . . . . . . . . . . . . . . . . . . .\n\n36\n\nE.5 Polyglot Representative Agent . . . . . . . . . . . . . . . . . . . . . . . . . . . .\n\n36\n\nF Best-Discovered Agents\n\n36\n\nF.1\n\nDGM on SWE-bench . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .\n\n36\n\nF.2\n\nDGM on Polyglot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .\n\n50\n\nG Similar Target Functionality, Different Implementations\n\n60\n\nH Case Study: Solving Hallucination\n\n69\n\nI\n\nAdditional Safety Discussion\n\n71\n\nJ Additional Future Work Directions\n\n72\n\n23\n\n\fPublished as a conference paper at ICLR 2026\n\nA\n\nA DDITIONAL R ESULTS\n\nA.1\n\nBASELINES ON SWE- BENCH\nDGM w/o Self-improve\nArchive Tree\n\nDGM w/o Self-improve\nProgress\nSWE-bench\nScore\n\n10 tasks (no basic functionality)\n60 tasks\n200 tasks (score ≥ 0.4 and\ntop two of archive then)\nFinal best agent\n\nFigure 5: DGM without self-improving agents. Keeping the meta-agent that is modifying and\nproducing the next coding agents the same, DGM w/o self-improve is unable to continuously improve\nover time. (Left) Archive of coding agents generated during the DGM w/o self-improve run on\nSWE-bench. Each node represents a coding agent, with node 0 corresponding to the base agent. Node\ncolor indicates performance on SWE-bench (percentage of solved tasks), while border color reflects\nthe number of tasks for which the agent was evaluated. Edges show which agents self-modified to\nproduce the offsprings. (Right) Progress plot of the DGM w/o self-improve on SWE-bench. The light\ngreen line shows the average score of all agents possessing basic codebase-editing functionality. The\ngreen line tracks the best score achieved by any agent in the archive at each iteration. The dark line\nshows the lineage of the final best-discovered agent and its precursor nodes.\n\nDGM w/o Open-ended exploration\nArchive Tree\n\nDGM w/o Open-ended exploration\nProgress\nSWE-bench\nScore\n\n10 tasks (no basic functionality)\n60 tasks\n200 tasks (score ≥ 0.4 and\ntop two of archive then)\nFinal best agent\n\nFigure 6: DGM without open-ended exploration. Removing the archive, DGM w/o open-ended\nexploration always uses the most recent agent to self-modify and makes very little progress on\nSWE-bench. (Left) Archive of coding agents generated during the DGM w/o open-ended exploration\nrun on SWE-bench. Each node represents a coding agent, with node 0 corresponding to the base\nagent. Node color indicates performance on SWE-bench (percentage of solved tasks), while border\ncolor reflects the number of tasks for which the agent was evaluated. Edges show which agents\nself-modified to produce the offsprings. (Right) Progress plot of the DGM w/o open-ended on\nSWE-bench. The orange line shows the average score of all agents possessing basic codebase-editing\nfunctionality. The light orange line tracks the best score achieved by any agent in the archive at each\niteration. The dark line shows the lineage of the final best-discovered agent and its precursor nodes.\n24\n\n\fPublished as a conference paper at ICLR 2026\n\nA.2\n\nG ENERALITY ACROSS MODELS ON P OLYGLOT\n\nSuccess Rate on Polyglot (%)\n\nModel Transfer on Polyglot\n40\n30.7%\n\n30\n20\n\n35.6% 36.8%\n\n32.0% 33.3%\n\n14.2%\n\n10\n0\n\nBase Agent\n\no3-mini\n\nClaude 3.5 Sonnet Claude 3.7 Sonnet\n\nBest Agent transfer to other FMs\n\nBest Agent from DGM\n\nFigure 7: Transfer between Models on Polyglot\n\nIn addition to testing the transfer models on SWE-bench (see Section 4.4, Figure 2), we also\npresent the transfer results on Polyglot in this section. On Polyglot (Figure 7), where the DGM was\nrun with o3-mini, we replaced the FM with Claude 3.5 Sonnet (New) or Claude 3.7 Sonnet, and\nevaluated on the full benchmark (Figure 4, Middle). With Claude 3.5 Sonnet (New), the initial agent\nachieved 32.0% and the DGM-discovered agent 33.3%. With Claude 3.7 Sonnet, the initial agent\nachieved 35.6% and the DGM-discovered agent 36.8%. These results suggest that the DGM yields\nimprovements that generalize across FMs, rather than being tightly coupled to the specific FM used\nduring its run (Figure 4).\nA.3\n\nA BLATION OF PARENT S ELECTION\n\nTo further study the impact of the parent selection mechanism in DGM, we introduce DGM Greedy.\nDGM Greedy always selects the best-performing node as the parent to branch from, rather than giving\nevery node a non-zero probability of being branched off (roughly proportional to their performance\nscore and number of children) as in this implementation of the DGM (Appendix C.2). This ablation\nreplicates the approach of Robeyns et al. (2025) in this setting. As shown in Table 1, DGM Greedy\nachieves 39.7% and 30.0% on SWE-bench and Polyglot, respectively, compared to 50.0% and 38.0%\nby this implementation of DGM. These results demonstrate that allowing all solutions in the archive\nto serve as potential stepping stones can lead to greater improvements over time, underscoring the\nimportance of open-ended exploration.\nTable 1: Comparison of DGM, its ablations, and baselines on SWE-bench and Polyglot benchmarks.\nMethod\nDGM\nDGM w/o Open-ended exploration\nDGM w/o Self-improve\nDGM Greedy\n\nA.4\n\nSWE-bench\n\nPolyglot\n\n50.0%\n23.0%\n39.0%\n39.7%\n\n38.0%\n14.0%\n28.0%\n30.0%\n\nA DDITIONAL S TATISTICS OF DGM RUNS\n\nPercentage of Generated Agents with Basic Code-Editing Functionality. To gain deeper insights\ninto the DGM process, we analyze the percentage of generated agents that possess basic code-editing\nfunctionality on the SWE-bench benchmark. As shown in Table 2, DGM exhibits the highest\npercentage of producing agents with basic codebase-editing functionality. These results highlight the\neffectiveness of both open-ended exploration and self-improvement components in the DGM, where\nopen-ended exploration enables the search to escape local optima, while self-improvement enhances\nthe ability to generate better agents.\n25\n\n\fPublished as a conference paper at ICLR 2026\n\nTable 2: Percentage of generated agents with basic code-editing functionality on SWE-bench.\nMethod\n\nPercentage with Basic Code-Editing Functionality\n\nDGM\nDGM w/o Open-ended exploration\nDGM w/o Self-improve\n\n51.3%\n32.5%\n32.5%\n\nStability of DGM Runs. To evaluate the stability of DGM, we run the DGM algorithm three times\non the Polyglot benchmark and analyze the variance in performance. The DGM achieved a mean\naccuracy of 40.7% with a standard deviation of 2.3%, indicating that the DGM can achieve consistent\nand reproducible results across runs.\n\nB\n\nA DDITIONAL R ELATED W ORK\n\nOpen-Endedness (part 2). Early approaches to open-endedness explored different mechanisms\nto balance learnability and interestingness. Quality-diversity algorithms sought to illuminate vast\nsolution spaces with diverse, high-performing behaviors (Pugh et al., 2016; Chatzilygeroudis et al.,\n2021; Mouret &amp; Clune, 2015; Nguyen et al., 2015). Other methods emphasized goal-directed\nexploration (Ecoffet et al., 2019; 2021; Schaul et al., 2015; Andrychowicz et al., 2017; Eysenbach\net al., 2018), intrinsic motivation (Lehman &amp; Stanley, 2011; Oudeyer et al., 2007; Li et al., 2014;\nPathak et al., 2017), or learning progress frameworks (Kanitscheider et al., 2021; Gaven et al.,\n2025; Baranes &amp; Oudeyer, 2013; Colas et al., 2019; 2022b; Jiang et al., 2021; Dennis et al., 2020;\nSchmidhuber, 2008; 2013; Kompella et al., 2017). More recently, large-scale foundation models\n(FMs) (Brown et al., 2020; Radford et al., 2019) have emerged as powerful proxies for human notions\nof interestingness (Zhang et al., 2024b; Faldor et al., 2025; Sancaktar et al., 2025) and effective\nmutation operators to propose novel solutions in code (Romera-Paredes et al., 2024; Novikov et al.,\n2025; Lehman et al., 2023; Faldor et al., 2025; Hu et al., 2025). FMs can guide autotelic agents (Colas\net al., 2022b; 2023; 2022a), model human preferences for quality and diversity (Bradley et al., 2024;\nDing et al., 2024; Wang et al., 2023b; Klissarov et al., 2023; 2024; Samvelyan et al., 2024; Lim\net al., 2024; Havrilla et al., 2024a), design reward functions (Wiering &amp; Schmidhuber, 1997; Wang\net al., 2023a; Ma et al., 2023; Faldor et al., 2025), create simulated environments (Sudhakaran et al.,\n2023; Nasir &amp; Togelius, 2023; Aki et al., 2024; Nasir et al., 2024; Bruce et al., 2024; Parker-Holder\net al., 2024; Schmidhuber, 2013), drive ever-evolving multi-agent dynamics (Dharna et al., 2024;\nZhou et al., 2025), search diverse ambulating robot morphologies (Lehman et al., 2023), and search\nexpansive solution spaces for benchmark or objective optimization (Lange et al., 2024; Zhang et al.,\n2024b; Faldor et al., 2025; Hu et al., 2025; Lu et al., 2024b; Romera-Paredes et al., 2024; Fernando\net al., 2024; Lu et al., 2024a; Khan et al., 2024; Lu et al., 2025; Liu et al., 2024; Novikov et al., 2025).\nProgram Synthesis. Program synthesis (Alur et al., 2018; Polozov &amp; Gulwani, 2015; Buchi\n&amp; Landweber, 1990; Gulwani, 2011; Ellis et al., 2021) seeks to generate code meeting external\nspecifications such as input-output examples or logical formulas. Hybrid approaches combine\nsymbolic methods with neural or FM guidance: for instance, Li et al. (2024) uses LLM suggestions\nto steer symbolic search in SyGuS settings, improving over pure enumeration. Barke et al. (2024)\nblends LLM completions with a learned surrogate model to guide synthesis in DSLs. Shi et al. (2023)\nuses neural policies to build higher-order and lambda abstractions during search, outperforming both\nLLM-only and symbolic baselines on list manipulation tasks. The DGM differs in focusing not\njust on producing programs for external tasks, but also on agent self-modification, rewriting its own\nimplementation to improve its capacity for future self-improvement.\nInspiration from Darwinian Evolution. This work is heavily inspired by the mechanisms of\nDarwinian evolution (Darwin, 2023), notably variation (mutation), selection, and the preservation\nof lineages (stepping stones), and brings them into the realm of self-modifying coding agents. In\nDGM, an archive of past agent versions is maintained, from which parent agents are sampled; then\nmutations (i.e., code edits) generate new offspring agents, which are empirically evaluated on coding\nbenchmarks; successful ones are added to the archive, enabling parallel exploration of multiple\nevolutionary trajectories (Section 3). This mirrors how biological evolution (Edwards, 2000; Wright,\n26\n\n\fPublished as a conference paper at ICLR 2026\n\n1932) preserves genetic diversity (Mayr, 1982), leverages variation (Kimura, 1979), and uses natural\nselection to retain beneficial mutations (Dobzhansky, 1970).\n\nC\n\nA LGORITHMIC D ETAILS\n\nC.1\n\nI NITIAL C ODING AGENT\n\nIn this section, we present the details of the tools available to the initial coding agent (Section 4.1)\nand its task prompt.\nInformation of the given Bash tool:\ndef tool_info():\nreturn {\n\"name\": \"bash\",\n\"description\": \"\"\"Run commands in a bash shell\\n\n* When invoking this tool, the contents of the \"command\" parameter does NOT need to be\n,→ XML-escaped.\\n\n* You don't have access to the internet via this tool.\\n\n* You do have access to a mirror of common linux and python packages via apt and pip.\\n\n* State is persistent across command calls and discussions with the user.\\n\n* To inspect a particular line range of a file, e.g. lines 10-25, try 'sed -n 10,25p\n,→ /path/to/the/file'.\\n\n* Please avoid commands that may produce a very large amount of output.\\n\n* Please run long lived commands in the background, e.g. 'sleep 10 &amp;' or start a server in\n,→ the background.\"\"\",\n\"input_schema\": {\n\"type\": \"object\",\n\"properties\": {\n\"command\": {\n\"type\": \"string\",\n\"description\": \"The bash command to run.\"\n}\n},\n\"required\": [\"command\"]\n}\n}\n\nInformation of the given Edit tool:\ndef tool_info():\nreturn {\n\"name\": \"editor\",\n\"description\": \"\"\"Custom editing tool for viewing, creating, and editing files\\n\n* State is persistent across command calls and discussions with the user.\\n\n* If `path` is a file, `view` displays the entire file with line numbers. If `path` is a\n,→ directory, `view` lists non-hidden files and directories up to 2 levels deep.\\n\n* The `create` command cannot be used if the specified `path` already exists as a file.\\n\n* If a `command` generates a long output, it will be truncated and marked with `&lt;response\n,→ clipped&gt;`.\\n\n* The `edit` command overwrites the entire file with the provided `file_text`.\\n\n* No partial/line-range edits or partial viewing are supported.\"\"\",\n\"input_schema\": {\n\"type\": \"object\",\n\"properties\": {\n\"command\": {\n\"type\": \"string\",\n\"enum\": [\"view\", \"create\", \"edit\"],\n\"description\": \"The command to run: `view`, `create`, or `edit`.\"\n},\n\"path\": {\n\"description\": \"Absolute path to file or directory, e.g. `/repo/file.py` or\n,→ `/repo`.\",\n\"type\": \"string\"\n},\n\"file_text\": {\n\"description\": \"Required parameter of `create` or `edit` command,\n,→ containing the content for the entire file.\",\n\"type\": \"string\"\n}\n},\n\"required\": [\"command\", \"path\"]\n}\n}\n\n27\n\n\fPublished as a conference paper at ICLR 2026\n\nTask prompt:\nI have uploaded a Python code repository in the directory {self.git_tempdir}. Help solve\n,→ the following problem.\n&lt;problem_description&gt;\n{self.problem_statement}\n&lt;/problem_description&gt;\n&lt;test_description&gt;\n{self.test_description}\n&lt;/test_description&gt;\nYour task is to make changes to the files in the {self.git_tempdir} directory to address\n,→ the &lt;problem_description&gt;. I have already taken care of the required dependencies.\n\nC.2\n\nPARENT S ELECTION\n\nAt each DGM iteration, we select a subset of agents from the archive as parents to self-modify\nand produce new child agents (Section 3). The details of the parent selection process, inspired by\nEcoffet et al. (2019), are outlined below. Future work could explore alternative search and exploration\nmethods (Coulom, 2006; Silver et al., 2016; Herr et al., 2025).\nAt each iteration t of the DGM run, let\nAt = {at1 , at2 , . . . , atN }\nbe the archive of candidate agents. We first define the eligible set\n\b\nE t = ati ∈ At : αi &lt; 1 ,\ni.e. only those agents whose performance score is not yet perfect. We then sample k parents (with\nreplacement) from E t in proportion to a combined measure of performance and number of children\nwith codebase-editing functionality. Concretely, for each agent ati ∈ E t :\n(performance)\n\nαi = performance(ati ),\n\n(1)\n\n(children count)\n\nni =\n\nfunctioning_children_count(ati ),\n\n(sigmoid-scaled performance)\n\nsi =\n\n1\n\u0001,\n1 + exp −λ (αi − α0 )\n\n(3)\n\n(novelty bonus)\n\nhi =\n\n1\n,\n1 + ni\n\n(4)\n\n(unnormalized weight)\n\nwi = si hi ,\n\n(selection probability)\n\nwi\npi = PN\n\n(sampling)\n\n(2)\n\n(5)\n\nj=1 wj\n\n,\n\n{ parents } ∼ Categorical {pi }ati ∈E t\n\n(6)\n\u0001\n\n(draw k samples). (7)\n\nHere, λ &gt; 0 controls the sharpness of the sigmoid, and α0 is the midpoint accuracy. We set λ = 10\nand α0 = 0.5. k determines how many self-improvements are done in parallel during each iteration\nof the DGM run. We set k = 2 in SWE-bench experiments, and k = 4 in Polyglot experiments.\nC.3\n\nS ELF -I MPROVE P ROMPTS\n\nIn every iteration, an agent is chosen to self-modify. For this step, the current implementation of\nDGM leverages a separate FM to diagnose improvement opportunities, which are then passed to\nthe coding agent for implementation. To identify the next potential improvement, the evaluation\nlogs from the chosen agent’s performance on the coding benchmark are fed into the FM. While the\ncurrent implementation relies on an additional diagnostic step, there are no fundamental limitations\npreventing the DGM from autonomously analyzing its own performance, generating improvement\n28\n\n\fPublished as a conference paper at ICLR 2026\n\nhypotheses, and implementing subsequent modifications. We chose to use OpenAI’s o1 model (Team\net al., 2024) for this purpose, as we found it had better reasoning capabilities than other FMs available\nat the time of our experiments. The prompts used for this diagnosis are provided below. From\nthe diagnostic output, the implementation_suggestion and problem_description are\nextracted and passed to the coding agent as its self-modification task.\nSelf-improve diagnosis prompt for SWE-bench experiments:\nSelf-Improve Prompt\n# Coding Agent Summary\n- **Main File**: `coding_agent.py`\n- Primary Class: `AgenticSystem`\n- The `forward()` function is the central entry point.\n- Prompts are located either within the `forward()` function or in the `prompts/`\n,→ directory.\n- **Tools**: `tools/`\n- The `tools/` directory contains various tools that LLMs can use to perform specific\n,→ tasks.\n- Each tool must have a `tool_info()` function that returns a JSON object containing\n,→ 'name', 'description', and 'input_schema'. The 'input_schema' should be a JSON\n,→ object containing 'type', 'properties', and 'required'.\n- Each tool must have a `tool_function()` function that takes the arguments defined\n,→ in input_schema, performs the tool's task, and returns a string.\n- See other tools for reference.\n- **Utilities**: `utils/`\n- The `utils/` directory contains utility functions used across the codebase.\n- **Additional Details**:\n- The agent is very good at automatically utilizing the right available tools at the\n,→ right time. So do not have an agentic flow that explicitly forces a tool's usage.\n- Common tools, such as file editing and bash commands, are easy for the agent to\n,→ recognize and use appropriately. However, more complex and niche tools may\n,→ require explicit instructions in the prompt.\n- Tools should be designed to be as general as possible, ensuring they work across\n,→ any GitHub repository. Avoid hardcoding repository-specific details or behaviors\n,→ (e.g., paths).\n- Do not use 'while True' loops in the agent's code. This can cause the agent to get\n,→ stuck and not respond.\n- Verify the implementation details of helper functions prior to usage to ensure\n,→ proper integration and expected behavior.\n- Do not install additional packages or dependencies directly. Update\n,→ `requirements.txt` if new dependencies are required and install them using `pip\n,→ install -r requirements.txt`.\nHere is the implementation of the coding agent.\n# Coding Agent Implementation\n----- Coding Agent Implementation Start ----{code}\n----- Coding Agent Implementation End ----Your task is to identify ONE detailed plan that would improve the agent's coding\n,→ ability. The improvement should not be specific to any particular GitHub issue or\n,→ repository.\nHere is the log for the coding agent trying to solve the GitHub issues but failed.\n# Agent Running Log\n----- Agent Running Log Start ----{md_log}\n----- Agent Running Log End ----# GitHub Issue\nThe GitHub issue that the agent is trying to solve.\n----- GitHub Issue Start ----{github_issue}\n----- GitHub Issue End ----# Predicted Patch\nThe agent's predicted patch to solve the issue.\n----- Predicted Patch Start ----{predicted_patch}\n----- Predicted Patch End ----# Private Test Patch\n\n29\n\n\fPublished as a conference paper at ICLR 2026\n\nSWE-bench's official private tests to detect whether the issue is solved. This is not\n,→ available to the agent during evaluation. The agent should try to implement its own\n,→ tests.\n----- Private Test Patch Start ----{test_patch}\n----- Private Test Patch End ----# Issue Test Results\nThe test results from SWE-bench using the above official private tests.\n----- Issue Test Results Start ----{eval_log}\n----- Issue Test Results End ----Respond precisely in the following format including the JSON start and end markers:\n```json\n&lt;JSON&gt;\n```\nIn &lt;JSON&gt;, provide a JSON response with the following fields:\n- \"log_summarization\": Analyze the above logs and summarize how the agent tried to\n,→ solve the GitHub issue. Note which tools and how they are used, the agent's\n,→ problem-solving approach, and any issues encountered.\n- \"potential_improvements\": Identify potential improvements to the coding agent that\n,→ could enhance its coding capabilities. Focus on the agent's general coding\n,→ abilities (e.g., better or new tools usable across any repository) rather than\n,→ issue-specific fixes (e.g., tools only usable in one framework). All necessary\n,→ dependencies and environment setup have already been handled, so do not focus on\n,→ these aspects.\n- \"improvement_proposal\": Choose ONE high-impact improvement from the identified\n,→ potential improvements and describe it in detail. This should be a focused and\n,→ comprehensive plan to enhance the agent's overall coding ability.\n- \"implementation_suggestion\": Referring to the coding agent's summary and\n,→ implementation, think critically about what feature or tool could be added or\n,→ improved to best implement the proposed improvement. If the proposed feature can be\n,→ implemented by modifying the existing tools, describe the modifications needed,\n,→ instead of suggesting a new tool.\n- \"problem_description\": Phrase the improvement proposal and implementation suggestion\n,→ as a GitHub issue description. It should clearly describe the feature so that a\n,→ software engineer viewing the issue and the repository can implement it.\nYour response will be automatically parsed, so ensure that the string response is\n,→ precisely in the correct format. Do NOT include the `&lt;JSON&gt;` tag in your output.\n\nWhile the private test patch is included in the diagnosis prompt, one could imagine that an easy\nway for the agent to score well on the task would be to hard code the solutions. However, from\nmanual inspection of the logs and agent modifications, we have not observed any problematic logic\nor behavior indicative of memorization or overfitting to specific private test cases. Furthermore,\nimprovements discovered on one task or LLM model often generalize well to others (Figure 4),\nshowing that these improvements are not task-specific but instead reflect general changes that enhance\noverall performance.\nAdditional prompt for Polyglot experiments:\nAdditional Prompt for o3-mini Tool Use and Polyglot\n### DOC: tool function schema\nCarefully consider whether to add/enhance the current tool or edit the workflow in\n,→ forward()\nPay special attention to making sure that \"required\" and \"type\" are always at the\n,→ correct level of nesting. For example, \"required\" should be at the same level as\n,→ \"properties\", not inside it.\nMake sure that every property, no matter how short, has a type and description\n,→ correctly nested inside it.\nOther arguments than you have seen are not permitted. For example, in\n,→ \"edit_line_ranges\" with \"type\": \"array\", arguments like \"minItems\" and \"maxItems\"\n,→ are not permitted.\n...\nHere is the log for the coding agent trying to solve a programming task.\nA task is in one programming language, but the coding agent needs to deal with\n,→ different languages including C++, Go, Java, JavaScript, Python, and Rust.\n\n30\n\n\fPublished as a conference paper at ICLR 2026\n\nC.4\n\nP SEUDOCODE\n\nThis is the pseudocode of the DGM algorithm, described in Section 3:\nAlgorithm 1: Darwin Gödel Machine\nInput: Initial coding agent g0 , benchmark suite B, maximum iterations T\nOutput: Archive of agents A\ns0 ← evaluate(g0 , B)\ninitialize A ← {(g0 , s0 )}\nfor t ← 1 to T do\nP ← SelectParents(A)\nforeach p ∈ P do\nc ← p.modify(p)\ns ← evaluate(c, B)\nif c.is_valid() then\nA ← A ∪ {(c, s)}\nend\nend\nend\nreturn A\n\n// Evaluate the base agent\n// Start with the base agent\n// Select parent agents\n// Self-modification\n// Evaluate on benchmark\n// Keep children capable of code editing\n\nThis is the pseudocode of the baseline DGM without self-improving agents, described in Section 4.3:\nAlgorithm 2: Darwin Gödel Machine without Self-improving agents\nInput: Initial coding agent g0 , benchmark suite B, maximum iterations T\nOutput: Archive of agents A\ns0 ← evaluate(g0 , B)\ninitialize A ← {(g0 , s0 )}\nfor t ← 1 to T do\nP ← SelectParents(A)\nforeach p ∈ P do\nc ← g0 .modify(p)\ns ← evaluate(c, B)\nif c.is_valid() then\nA ← A ∪ {(c, s)}\nend\nend\nend\nreturn A\n\n// Evaluate the base agent\n// Start with the base agent\n// Select parent agents\n// Modify with base agent\n// Evaluate on benchmark\n// Keep children capable of code editing\n\nThis is the pseudocode of the baseline DGM without open-ended exploration, described in Section 4.3:\n31\n\n\fPublished as a conference paper at ICLR 2026\n\nAlgorithm 3: Darwin Gödel Machine without Open-ended exploration\nInput: Initial coding agent g0 , benchmark suite B, maximum iterations T\nOutput: Archive of agents A\ns0 ← evaluate(g0 , B)\ninitialize A ← {(g0 , s0 )}\nfor t ← 1 to T do\nP ← SelectParents(A)\nforeach p ∈ P do\nc ← p.modify(p)\ns ← evaluate(c, B)\nif c.is_valid() then\nA ← {(c, s)}\nend\nend\nend\nreturn A\n\n// Evaluate the base agent\n// Start with the base agent\n// Select parent agents\n// Self-modification\n// Evaluate on benchmark\n// Only keep the latest agent\n\nD\n\nE XPERIMENT D ETAILS\n\nD.1\n\nH YPERPARAMETERS FOR F OUNDATION M ODELS\n\nTable 3 shows the foundation model used in each experiment setting, as described in Section 4.1.\nSince SWE-bench is a more challenging coding benchmark, we use a stronger coding model, Claude\n3.5 Sonnet (New) (based on our preliminary testing). To enable faster iterations and avoid the same\nrate limits as Claude, we use o3-mini for Polyglot experiments. The temperature for all FMs in every\nsetting is set to 1.0.\nTable 3: Foundation models used in each experiment setting.\nBenchmark\n\nSWE-bench\n\nPolyglot\n\nSelf-modification\nEvaluation\n\nClaude 3.5 Sonnet (New)\nClaude 3.5 Sonnet (New)\n\nClaude 3.5 Sonnet (New)\no3-mini\n\nE\n\nB ENCHMARK D ETAILS\n\nE.1\n\nC OST E STIMATE\n\nThe estimated cost of completing a single run of the DGM on SWE-bench, as presented in Section 4,\nis about USD 22,000. In comparison, the estimated cost of completing a single run of either baseline\n(DGM w/o self-improve or DGM w/o open-ended exploration) on SWE-bench is about USD 10,000.\nAlthough the DGM is considerably more costly than the baselines, a method that can continuously\nimprove, even at a higher cost, is preferable to one that fails to improve or stagnates at a level of\nperformance that may never match that of the DGM. A more granular break down is:\nLLM\n\nBenchmark\n\nNumber of Tasks\n\nCost Estimate (USD)\n\nClaude 3.5 Sonnet (New)\no3-mini\n\nSWE-bench\nPolyglot\n\n60\n60\n\n$350\n$5\n\nWe acknowledge that the current experiments on SWE-bench require considerable compute. Hence,\nwe also include experiments on another benchmark, Polyglot, with significantly lower costs. This\nsuggests that expenses vary greatly by task complexity, with SWE-bench being among the more\ncomplex and resource-intensive coding benchmarks. Moreover, several impactful methods (e.g., LLM\ntraining at its inception) were characterized substantial computational demands initially. Similar to\n32\n\n\fPublished as a conference paper at ICLR 2026\n\nthese pioneering works, we hope to open the door to future research on improving the efficiency and\nscalability of our approach. In addition, many leading coding agents on the SWE-bench leaderboard\nare backed by industrial companies employing expert full-time researchers and engineers, which\nincurs substantial human labor costs. In contrast, our approach achieves SoTA-level performance\nthrough fully autonomous self-improvement without human intervention, potentially offering greater\nefficiency when considering the comparative costs of specialized AI development talent versus API\nusage. Finally, as FMs continue to improve and compute costs continue to decline, methods like the\nDGM will become increasingly efficient and accessible.\nAlso, higher-performing agents discovered by the DGM do indeed incur greater inference costs than\nthe initial agent, but cost and performance are not strictly correlated, where some expensive agents\nunderperform cheaper ones.\nE.2\n\nSWE- BENCH TASKS\n\nInitial 10 tasks for verifying basic functionality of a coding agent:\n• django__django-10973\n\n• django__django-16661\n\n• django__django-11066\n\n• django__django-13346\n\n• django__django-12754\n\n• django__django-10880\n\n• django__django-15930\n\n• django__django-10999\n\n• django__django-13279\n\n• django__django-11087\n\nAdditional 50 tasks for estimating general effectiveness of a coding agent:\n• sphinx-doc__sphinx-7454\n• sphinx-doc__sphinx-7590\n• sphinx-doc__sphinx-7748\n• sphinx-doc__sphinx-7757\n• sphinx-doc__sphinx-7985\n• sphinx-doc__sphinx-8035\n• sphinx-doc__sphinx-8056\n• sphinx-doc__sphinx-8265\n• sphinx-doc__sphinx-8269\n• sphinx-doc__sphinx-8475\n• sphinx-doc__sphinx-8548\n• sphinx-doc__sphinx-8551\n• sphinx-doc__sphinx-8638\n• sphinx-doc__sphinx-8721\n• sphinx-doc__sphinx-9229\n• sphinx-doc__sphinx-9230\n• sphinx-doc__sphinx-9281\n• sphinx-doc__sphinx-9320\n• sphinx-doc__sphinx-9367\n• sphinx-doc__sphinx-9461\n• sphinx-doc__sphinx-9698\n• sphinx-doc__sphinx-10449\n• sphinx-doc__sphinx-10466\n• sphinx-doc__sphinx-10673\n• sphinx-doc__sphinx-11510\n\n• django__django-9296\n• django__django-11790\n• django__django-11815\n• django__django-11848\n• django__django-11880\n• django__django-11885\n• django__django-11951\n• django__django-11964\n• django__django-11999\n• django__django-12039\n• django__django-12050\n• django__django-12143\n• django__django-12155\n• django__django-12193\n• django__django-12209\n• django__django-12262\n• django__django-12273\n• django__django-12276\n• django__django-12304\n• django__django-12308\n• django__django-12325\n• django__django-12406\n• django__django-12708\n• django__django-12713\n• django__django-12774\n33\n\n\fPublished as a conference paper at ICLR 2026\n\nAdditional 140 tasks for more accurate assessment of a coding agent’s performance:\n• astropy__astropy-12907\n\n• django__django-11400\n• django__django-11433\n• django__django-11451\n• django__django-11477\n• django__django-11490\n• django__django-11532\n• django__django-11551\n• django__django-11555\n• django__django-11603\n• django__django-11728\n• django__django-11734\n• django__django-11740\n• django__django-11749\n• django__django-11820\n• django__django-12125\n• django__django-12419\n• django__django-12663\n• django__django-12741\n• django__django-12858\n• django__django-12965\n• django__django-13012\n• django__django-13023\n• django__django-13028\n• django__django-13033\n• django__django-13089\n• django__django-13109\n• django__django-13112\n• django__django-13121\n• django__django-13128\n• django__django-13158\n• django__django-13195\n• django__django-13212\n• django__django-13297\n• django__django-13315\n• django__django-13343\n• django__django-13344\n• django__django-13363\n• django__django-13401\n• django__django-13406\n• django__django-13410\n• django__django-13417\n• django__django-13449\n• django__django-13512\n• django__django-13513\n\n• astropy__astropy-13033\n• astropy__astropy-13236\n• astropy__astropy-13398\n• astropy__astropy-13453\n• astropy__astropy-13579\n• astropy__astropy-13977\n• astropy__astropy-14096\n• astropy__astropy-14182\n• astropy__astropy-14309\n• astropy__astropy-14365\n• astropy__astropy-14369\n• astropy__astropy-14508\n• astropy__astropy-14539\n• astropy__astropy-14598\n• astropy__astropy-14995\n• astropy__astropy-7166\n• astropy__astropy-7336\n• astropy__astropy-7606\n• astropy__astropy-7671\n• astropy__astropy-8707\n• astropy__astropy-8872\n• django__django-10097\n• django__django-10554\n• django__django-10914\n• django__django-11095\n• django__django-11099\n• django__django-11119\n• django__django-11133\n• django__django-11138\n• django__django-11141\n• django__django-11149\n• django__django-11163\n• django__django-11179\n• django__django-11206\n• django__django-11211\n• django__django-11239\n• django__django-11265\n• django__django-11276\n• django__django-11292\n• django__django-11299\n• django__django-11333\n34\n\n\fPublished as a conference paper at ICLR 2026\n\n• django__django-13516\n\nE.3\n\n• django__django-13551\n\n• django__django-14155\n• django__django-14170\n\n• django__django-13568\n\n• django__django-14238\n\n• django__django-13569\n\n• django__django-14311\n\n• django__django-13590\n\n• django__django-14315\n\n• django__django-13658\n\n• django__django-14349\n\n• django__django-13670\n\n• django__django-14351\n\n• django__django-13741\n\n• django__django-14373\n\n• django__django-13786\n\n• django__django-14376\n\n• django__django-13794\n\n• django__django-14404\n\n• django__django-13807\n\n• django__django-14434\n\n• django__django-13809\n\n• django__django-14493\n\n• django__django-13810\n\n• django__django-14500\n\n• django__django-13820\n\n• django__django-14534\n\n• django__django-13821\n\n• django__django-14539\n\n• django__django-13837\n\n• django__django-14559\n\n• django__django-13925\n\n• django__django-14580\n\n• django__django-13933\n\n• django__django-14608\n\n• django__django-13964\n\n• django__django-14631\n\n• django__django-14007\n\n• django__django-14672\n\n• django__django-14011\n\n• django__django-14725\n\n• django__django-14017\n\n• django__django-14752\n\n• django__django-14034\n\n• django__django-14765\n\n• django__django-14053\n\n• django__django-14771\n\n• django__django-14089\n\n• django__django-14787\n\n• django__django-14122\n• django__django-14140\n\n• django__django-14792\n• django__django-14855\n\nP OLYGLOT TASKS\n\nInitial 10 tasks for verifying basic functionality of a coding agent:\n• go__dominoes\n\n• rust__variable-length-quantity\n\n• cpp__all-your-base\n\n• python__beer-song\n\n• python__dominoes\n\n• go__book-store\n\n• java__sgf-parsing\n\n• javascript__bottle-song\n\n• javascript__robot-name\n\n• rust__bowling\n\nAdditional 50 tasks for estimating general effectiveness of a coding agent:\n• javascript__queen-attack\n\n• rust__accumulate\n\n• rust__wordy\n\n• go__error-handling\n\n• python__dot-dsl\n\n• cpp__queen-attack\n\n• java__satellite\n\n• rust__poker\n\n• cpp__diamond\n\n• python__sgf-parsing\n35\n\n\fPublished as a conference paper at ICLR 2026\n\nE.4\n\n• rust__react\n\n• java__react\n\n• java__ledger\n\n• javascript__ocr-numbers\n\n• go__connect\n\n• python__scale-generator\n\n• rust__macros\n\n• java__go-counting\n\n• javascript__triangle\n\n• rust__doubly-linked-list\n\n• java__zipper\n\n• python__grade-school\n\n• java__bowling\n\n• javascript__forth\n\n• python__tree-building\n\n• python__wordy\n\n• javascript__say\n\n• java__mazy-mice\n\n• java__wordy\n\n• cpp__bank-account\n\n• python__food-chain\n\n• python__zipper\n\n• javascript__wordy\n\n• java__custom-set\n\n• python__poker\n\n• java__rest-api\n\n• javascript__grade-school\n\n• go__transpose\n\n• cpp__gigasecond\n\n• rust__gigasecond\n\n• java__forth\n\n• rust__say\n\n• python__dominoes\n\n• go__food-chain\n\n• go__word-search\n\n• rust__pig-latin\n\n• javascript__simple-linked-list\n\n• go__markdown\n\n• go__counter\n\n• go__crypto-square\n\nSWE- BENCH S TATE - OF -T HE -A RT\n\nAt the time of writing this paper (16 April 2025), the highest performing, checked (i.e., the SWE-bench\nteam received access to the system and were able to reproduce the patch generations), open-source\nentry on SWE-bench Verified is OpenHands + CodeAct v2.1 (claude-3-5-sonnet-20241022) (Wang\net al., 2024), achieving 53.0%. Only considering the same subset of 200 tasks used by the DGM\n(Appendix E.2), OpenHands + CodeAct v2.1 (claude-3-5-sonnet-20241022) achieves 51.0%.\nE.5\n\nP OLYGLOT R EPRESENTATIVE AGENT\n\nAider (Gauthier, 2024), a popular coding agent in the community, was published in Spring 2024. It\nhas garnered over 33,000 stars on GitHub and has been continuously developed and tested against\nthe Polyglot benchmark for over a year by human developers, primarily to evaluate its performance.\nAider has also become a standard baseline for assessing the performance of different models, with\nthe current top performers on the Polyglot benchmark being a mix of o3 (high) and GPT-4.1. We\nadopt a setup similar to that of the Polyglot leaderboard, with one key difference: the leaderboard\nreports pass@2 performance, where the agent can view feedback from ground-truth tests once. In\ncontrast, we use a pass@1 setting, where the agent never sees the results of ground-truth tests, as we\nbelieve this more closely reflects realistic coding applications.\n\nF\n\nB EST-D ISCOVERED AGENTS\n\nF.1\n\nDGM ON SWE- BENCH\n\nDiff patches contributing to the best agent discovered by the DGM on SWE-bench:\ndiff --git a/coding_agent.py b/coding_agent.py\nindex 2cd395a..9a2cc2f 100644\n--- a/coding_agent.py\n+++ b/coding_agent.py\n@@ -4,6 +4,7 @@ import logging\nfrom logging.handlers import RotatingFileHandler\n\n36\n\n\fPublished as a conference paper at ICLR 2026\n\nimport os\nimport threading\n+import re\nfrom llm_withtools import CLAUDE_MODEL, OPENAI_MODEL, chat_with_agent\nfrom utils.eval_utils import get_report_score, msg_history_to_report, score_tie_breaker\n@@ -63,6 +64,42 @@ def safe_log(message, level=logging.INFO):\nelse:\nprint(f\"Warning: No logger found for thread {threading.get_ident()}\")\n+def is_patch_valid(patch_str):\n+ \"\"\"\n+ Parse the patch to check if any non-test source files are modified.\n+ Returns (bool, str) tuple: (is_valid, reason)\n+ \"\"\"\n+ if not patch_str or patch_str.isspace():\n+ return False, \"Empty patch\"\n+\n+ # Parse the patch to find modified files\n+ modified_files = []\n+ diff_header_pattern = re.compile(r'^\\+\\+\\+ b/(.+)$', re.MULTILINE)\n+ for match in diff_header_pattern.finditer(patch_str):\n+ filepath = match.group(1)\n+ if filepath != '/dev/null': # Skip deleted files\n+ modified_files.append(filepath)\n+\n+ if not modified_files:\n+ return False, \"No files modified\"\n+\n+ # Check if any non-test files are modified\n+ test_patterns = (\n+ lambda f: f.startswith('tests/'),\n+ lambda f: f.startswith('test_'),\n+ lambda f: f.endswith('_test.py')\n+ )\n+\n+ source_files = [\n+ f for f in modified_files\n+ if not any(pattern(f) for pattern in test_patterns)\n+ ]\n+\n+ if not source_files:\n+ return False, \"Only test files were modified\"\n+\n+ return True, \"Valid patch with source file modifications\"\n+\nclass AgenticSystem:\ndef __init__(\nself,\n@@ -73,6 +110,7 @@ class AgenticSystem:\ntest_description=None,\nself_improve=False,\ninstance_id=None,\n+ max_retries=3,\n):\nself.problem_statement = problem_statement\nself.git_tempdir = git_tempdir\n@@ -82,6 +120,7 @@ class AgenticSystem:\nself.self_improve = self_improve\nself.instance_id = instance_id if not self_improve else 'dgm'\nself.code_model = CLAUDE_MODEL\n+ self.max_retries = max_retries\n# Initialize logger and store it in thread-local storage\nself.logger = setup_logger(chat_history_file)\n@@ -153,7 +192,7 @@ Your task is to run the regression tests in the {self.git_tempdir}\n,→ directory to\n\"\"\"\nThe forward function for the AgenticSystem.\n\"\"\"\n- instruction = f\"\"\"I have uploaded a Python code repository in the directory\n,→ {self.git_tempdir}. Help solve the following problem.\n+ base_instruction = f\"\"\"I have uploaded a Python code repository in the directory\n,→ {self.git_tempdir}. Help solve the following problem.\n&lt;problem_description&gt;\n{self.problem_statement}\n@@ -165,7 +204,39 @@ Your task is to run the regression tests in the {self.git_tempdir}\n,→ directory to\n\n37\n\n\fPublished as a conference paper at ICLR 2026\n\nYour task is to make changes to the files in the {self.git_tempdir} directory to address\n,→ the &lt;problem_description&gt;. I have already taken care of the required dependencies.\n\"\"\"\n- new_msg_history = chat_with_agent(instruction, model=self.code_model, msg_history=[],\n,→ logging=safe_log)\n+\n+ retry_count = 0\n+ while retry_count &lt; self.max_retries:\n+ safe_log(f\"\\n=== Attempt {retry_count + 1} of {self.max_retries} ===\")\n+\n+ # Reset to base commit before each attempt\n+ if retry_count &gt; 0:\n+ reset_to_commit(self.git_tempdir, self.base_commit)\n+\n+ # Add retry context to instruction if this is a retry attempt\n+ instruction = base_instruction\n+ if retry_count &gt; 0:\n+ instruction += f\"\"\"\\nNOTE: Previous attempt(s) failed because they either produced empty\n,→ patches or only modified test files.\n+Please ensure your solution includes changes to the main source code files, not just test\n,→ files.\"\"\"\n+\n+ # Run the agent\n+ new_msg_history = chat_with_agent(instruction, model=self.code_model, msg_history=[],\n,→ logging=safe_log)\n+\n+ # Check the patch\n+ patch = self.get_current_edits()\n+ is_valid, reason = is_patch_valid(patch)\n+\n+ if is_valid:\n+ safe_log(f\"Valid patch generated: {reason}\")\n+ break\n+ else:\n+ safe_log(f\"Invalid patch: {reason}\")\n+ if retry_count &lt; self.max_retries - 1:\n+ safe_log(\"Retrying with a new attempt...\")\n+ else:\n+ safe_log(\"Maximum retries reached. Unable to generate a valid patch.\")\n+\n+ retry_count += 1\ndef main():\nparser = argparse.ArgumentParser(description='Process repository with an agentic\n,→ system.')\n@@ -177,6 +248,7 @@ def main():\nparser.add_argument('--test_description', default=None, required=False,\n,→ help='Description of how to test the repository')\nparser.add_argument('--self_improve', default=False, action='store_true',\n,→ help='Whether to self-improve the repository or solving swe')\nparser.add_argument('--instance_id', default=None, help='Instance ID for SWE issue')\n+ parser.add_argument('--max_retries', type=int, default=3, help='Maximum number of patch\n,→ generation attempts')\nargs = parser.parse_args()\n# Process the repository\n@@ -188,6 +260,7 @@ def main():\ntest_description=args.test_description,\nself_improve=args.self_improve,\ninstance_id=args.instance_id,\n+ max_retries=args.max_retries,\n)\n# Run the agentic system to try to solve the problem\n@@ -200,4 +273,4 @@ def main():\nf.write(model_patch)\nif __name__ == \"__main__\":\n- main()\n+ main()\n\\ No newline at end of file\ndiff --git a/tests/test_patch_validator.py b/tests/test_patch_validator.py\nnew file mode 100644\nindex 0000000..5689f7d\n--- /dev/null\n+++ b/tests/test_patch_validator.py\n@@ -0,0 +1,77 @@\n+import pytest\n+from coding_agent import is_patch_valid\n+\n+def test_empty_patch():\n\n38\n\n\fPublished as a conference paper at ICLR 2026\n\n+ # Test empty patch\n+ is_valid, reason = is_patch_valid(\"\")\n+ assert not is_valid\n+ assert reason == \"Empty patch\"\n+\n+ # Test whitespace-only patch\n+ is_valid, reason = is_patch_valid(\" \\n \")\n+ assert not is_valid\n+ assert reason == \"Empty patch\"\n+\n+def test_test_only_patch():\n+ patch = \"\"\"\n+diff --git a/tests/test_edit_tool.py b/tests/test_edit_tool.py\n+index abc123..def456 100644\n+--- a/tests/test_edit_tool.py\n++++ b/tests/test_edit_tool.py\n+@@ -10,6 +10,8 @@ def test_something():\n+ assert True\n++ assert 1 == 1\n+\"\"\"\n+ is_valid, reason = is_patch_valid(patch)\n+ assert not is_valid\n+ assert reason == \"Only test files were modified\"\n+\n+def test_source_file_patch():\n+ patch = \"\"\"\n+diff --git a/tools/edit.py b/tools/edit.py\n+index abc123..def456 100644\n+--- a/tools/edit.py\n++++ b/tools/edit.py\n+@@ -10,6 +10,8 @@ class Editor:\n+ def edit(self):\n+ pass\n++ return True\n+\"\"\"\n+ is_valid, reason = is_patch_valid(patch)\n+ assert is_valid\n+ assert reason == \"Valid patch with source file modifications\"\n+\n+def test_mixed_files_patch():\n+ patch = \"\"\"\n+diff --git a/tools/edit.py b/tools/edit.py\n+index abc123..def456 100644\n+--- a/tools/edit.py\n++++ b/tools/edit.py\n+@@ -10,6 +10,8 @@ class Editor:\n+ def edit(self):\n+ pass\n++ return True\n+\n+diff --git a/tests/test_edit.py b/tests/test_edit.py\n+index abc123..def456 100644\n+--- a/tests/test_edit.py\n++++ b/tests/test_edit.py\n+@@ -10,6 +10,8 @@ def test_something():\n+ assert True\n++ assert 1 == 1\n+\"\"\"\n+ is_valid, reason = is_patch_valid(patch)\n+ assert is_valid\n+ assert reason == \"Valid patch with source file modifications\"\n+\n+def test_no_files_modified():\n+ patch = \"\"\"\n+diff --git a/nonexistent.py b/nonexistent.py\n+deleted file mode 100644\n+index abc123..0000000\n+--- a/nonexistent.py\n++++ /dev/null\n+\"\"\"\n+ is_valid, reason = is_patch_valid(patch)\n+ assert not is_valid\n+ assert reason == \"No files modified\"\n\\ No newline at end of file\ndiff --git a/tools/edit.py b/tools/edit.py\nindex 59137ee..16ae521 100644\n--- a/tools/edit.py\n+++ b/tools/edit.py\n@@ -1,16 +1,17 @@\n\n39\n\n\fPublished as a conference paper at ICLR 2026\n\nfrom pathlib import Path\nimport subprocess\n+from typing import Optional, List, Tuple, Union\ndef tool_info():\nreturn {\n\"name\": \"editor\",\n\"description\": \"\"\"Custom editing tool for viewing, creating, and editing files\\n\n* State is persistent across command calls and discussions with the user.\\n\n-* If `path` is a file, `view` displays the entire file with line numbers. If `path` is a\n,→ directory, `view` lists non-hidden files and directories up to 2 levels deep.\\n\n+* If `path` is a file, `view` displays the file with line numbers. With optional\n,→ `view_range` [start, end], it displays only specified lines. Use -1 in `end` for\n,→ all remaining lines.\\n\n+* If `path` is a directory, `view` lists non-hidden files and directories up to 2 levels\n,→ deep.\\n\n* The `create` command cannot be used if the specified `path` already exists as a file.\\n\n* If a `command` generates a long output, it will be truncated and marked with `&lt;response\n,→ clipped&gt;`.\\n\n-* The `edit` command overwrites the entire file with the provided `file_text`.\\n\n-* No partial/line-range edits or partial viewing are supported.\"\"\",\n+* The `edit` command overwrites the entire file with the provided `file_text`.\"\"\",\n\"input_schema\": {\n\"type\": \"object\",\n\"properties\": {\n@@ -26,6 +27,13 @@ def tool_info():\n\"file_text\": {\n\"description\": \"Required parameter of `create` or `edit` command,\n,→ containing the content for the entire file.\",\n\"type\": \"string\"\n+ },\n+ \"view_range\": {\n+ \"description\": \"Optional parameter for `view` command. Array of [start_line, end_line]\n,→ (1-based). Use -1 for end_line to read until end of file.\",\n+ \"type\": \"array\",\n+ \"items\": {\"type\": \"integer\"},\n+ \"minItems\": 2,\n+ \"maxItems\": 2\n}\n},\n\"required\": [\"command\", \"path\"]\n@@ -89,6 +97,46 @@ def read_file(path: Path) -&gt; str:\nexcept Exception as e:\nraise ValueError(f\"Failed to read file: {e}\")\n+def read_file_range(path: Path, line_range: Optional[List[int]] = None) -&gt; Tuple[str,\n,→ int]:\n+ \"\"\"\n+ Read and return file contents within specified line range.\n+ Returns tuple of (content, start_line).\n+\n+ Args:\n+ path: Path object for the file\n+ line_range: Optional [start, end] line numbers (1-based). Use -1 for end to read until\n,→ EOF.\n+ \"\"\"\n+ try:\n+ if line_range is None:\n+ return read_file(path), 1\n+\n+ start, end = line_range\n+ if start &lt; 1:\n+ raise ValueError(\"Start line must be &gt;= 1\")\n+ if end != -1 and end &lt; start:\n+ raise ValueError(\"End line must be &gt;= start line or -1\")\n+\n+ with path.open() as f:\n+ # Skip lines before start\n+ for _ in range(start - 1):\n+ next(f, None)\n+\n+ lines = []\n+ current_line = start\n+ while True:\n+ line = next(f, None)\n+ if line is None: # EOF\n+ break\n+ if end != -1 and current_line &gt; end:\n+ break\n+ lines.append(line.rstrip('\\n'))\n+ current_line += 1\n\n40\n\n\fPublished as a conference paper at ICLR 2026\n\n+\n+ return '\\n'.join(lines), start\n+\n+ except Exception as e:\n+ raise ValueError(f\"Failed to read file range: {e}\")\n+\ndef write_file(path: Path, content: str):\n\"\"\"Write (overwrite) entire file contents.\"\"\"\ntry:\n@@ -96,9 +144,18 @@ def write_file(path: Path, content: str):\nexcept Exception as e:\nraise ValueError(f\"Failed to write file: {e}\")\n-def view_path(path_obj: Path) -&gt; str:\n- \"\"\"View the entire file contents or directory listing.\"\"\"\n+def view_path(path_obj: Path, view_range: Optional[List[int]] = None) -&gt; str:\n+ \"\"\"\n+ View the file contents (optionally within a range) or directory listing.\n+\n+ Args:\n+ path_obj: Path object for the file or directory\n+ view_range: Optional [start, end] line numbers for file viewing\n+ \"\"\"\nif path_obj.is_dir():\n+ if view_range is not None:\n+ raise ValueError(\"view_range is not supported for directory listings\")\n+\n# For directories: list non-hidden files up to 2 levels deep\ntry:\nresult = subprocess.run(\n@@ -115,14 +172,14 @@ def view_path(path_obj: Path) -&gt; str:\nexcept Exception as e:\nraise ValueError(f\"Failed to list directory: {e}\")\n- # If it's a file, show the entire file with line numbers\n- content = read_file(path_obj)\n- return format_output(content, str(path_obj))\n+ # If it's a file, show the file content (with optional line range)\n+ content, start_line = read_file_range(path_obj, view_range)\n+ return format_output(content, str(path_obj), start_line)\n-def tool_function(command: str, path: str, file_text: str = None) -&gt; str:\n+def tool_function(command: str, path: str, file_text: str = None, view_range:\n,→ Optional[List[int]] = None) -&gt; str:\n\"\"\"\nMain tool function that handles:\n- - 'view' : View the entire file or directory listing\n+ - 'view' : View file or directory listing, optionally within line range for files\n- 'create': Create a new file with the given file_text\n- 'edit' : Overwrite an existing file with file_text\n\"\"\"\n@@ -130,7 +187,7 @@ def tool_function(command: str, path: str, file_text: str = None) -&gt;\n,→ str:\npath_obj = validate_path(path, command)\nif command == \"view\":\n- return view_path(path_obj)\n+ return view_path(path_obj, view_range)\nelif command == \"create\":\nif file_text is None:\n@@ -152,4 +209,4 @@ def tool_function(command: str, path: str, file_text: str = None) -&gt;\n,→ str:\nif __name__ == \"__main__\":\n# Example usage\n- print(tool_function(\"view\", \"/home/ubuntu/xx/dgm/coding_agent.py\"))\n+ print(tool_function(\"view\", \"/home/ubuntu/xx/dgm/coding_agent.py\"))\n\\ No newline at end of file\ndiff --git a/tests/test_tools/test_edit.py b/tests/test_tools/test_edit.py\nnew file mode 100644\nindex 0000000..04f535b\n--- /dev/null\n+++ b/tests/test_tools/test_edit.py\n@@ -0,0 +1,54 @@\n+import pytest\n+from pathlib import Path\n+from tools.edit import tool_function\n+\n+def test_view_line_range(tmp_path):\n+ # Create a test file\n\n41\n\n\fPublished as a conference paper at ICLR 2026\n\n+ test_file = tmp_path / \"test.txt\"\n+ test_content = \"line1\\nline2\\nline3\\nline4\\nline5\\n\"\n+ test_file.write_text(test_content)\n+\n+ # Test viewing specific line range\n+ result = tool_function(\"view\", str(test_file), view_range=[2, 4])\n+ assert \"line2\" in result\n+ assert \"line3\" in result\n+ assert \"line4\" in result\n+ assert \"line1\" not in result\n+ assert \"line5\" not in result\n+ assert \" 2\\t\" in result # Correct line numbering\n+\n+ # Test viewing from start to middle\n+ result = tool_function(\"view\", str(test_file), view_range=[1, 3])\n+ assert \"line1\" in result\n+ assert \"line2\" in result\n+ assert \"line3\" in result\n+ assert \"line4\" not in result\n+ assert \" 1\\t\" in result\n+\n+ # Test viewing from middle to end with -1\n+ result = tool_function(\"view\", str(test_file), view_range=[3, -1])\n+ assert \"line1\" not in result\n+ assert \"line2\" not in result\n+ assert \"line3\" in result\n+ assert \"line4\" in result\n+ assert \"line5\" in result\n+ assert \" 3\\t\" in result\n+\n+def test_view_range_validation(tmp_path):\n+ # Create a test file\n+ test_file = tmp_path / \"test.txt\"\n+ test_content = \"line1\\nline2\\nline3\\n\"\n+ test_file.write_text(test_content)\n+\n+ # Test invalid start line\n+ result = tool_function(\"view\", str(test_file), view_range=[0, 2])\n+ assert \"Failed to read file range: Start line must be &gt;= 1\" in result\n+\n+ # Test invalid range (end &lt; start)\n+ result = tool_function(\"view\", str(test_file), view_range=[2, 1])\n+ assert \"Failed to read file range: End line must be &gt;= start line or -1\" in result\n+\n+def test_view_range_with_directory(tmp_path):\n+ # Test that view_range is rejected for directories\n+ result = tool_function(\"view\", str(tmp_path), view_range=[1, 10])\n+ assert \"Error: view_range is not supported for directory listings\" in result\n\\ No newline at end of file\ndiff --git a/tools/edit.py b/tools/edit.py\nindex 16ae521..757f5c2 100644\n--- a/tools/edit.py\n+++ b/tools/edit.py\n@@ -11,21 +11,21 @@ def tool_info():\n* If `path` is a directory, `view` lists non-hidden files and directories up to 2 levels\n,→ deep.\\n\n* The `create` command cannot be used if the specified `path` already exists as a file.\\n\n* If a `command` generates a long output, it will be truncated and marked with `&lt;response\n,→ clipped&gt;`.\\n\n-* The `edit` command overwrites the entire file with the provided `file_text`.\"\"\",\n+* The `str_replace` command replaces a unique occurrence of old_str with new_str, failing\n,→ if old_str is not found or appears multiple times.\"\"\",\n\"input_schema\": {\n\"type\": \"object\",\n\"properties\": {\n\"command\": {\n\"type\": \"string\",\n- \"enum\": [\"view\", \"create\", \"edit\"],\n- \"description\": \"The command to run: `view`, `create`, or `edit`.\"\n+ \"enum\": [\"view\", \"create\", \"str_replace\"],\n+ \"description\": \"The command to run: `view`, `create`, or `str_replace`.\"\n},\n\"path\": {\n\"description\": \"Absolute path to file or directory, e.g. `/repo/file.py`\n,→ or `/repo`.\",\n\"type\": \"string\"\n},\n\"file_text\": {\n\n42\n\n\fPublished as a conference paper at ICLR 2026\n\n- \"description\": \"Required parameter of `create` or `edit` command, containing the content\n,→ for the entire file.\",\n+ \"description\": \"Required parameter of `create` command, containing the content for the\n,→ entire file.\",\n\"type\": \"string\"\n},\n\"view_range\": {\n@@ -34,6 +34,14 @@ def tool_info():\n\"items\": {\"type\": \"integer\"},\n\"minItems\": 2,\n\"maxItems\": 2\n+ },\n+ \"old_str\": {\n+ \"description\": \"Required parameter of `str_replace` command, containing the exact text\n,→ to find and replace.\",\n+ \"type\": \"string\"\n+ },\n+ \"new_str\": {\n+ \"description\": \"Required parameter of `str_replace` command, containing the new text to\n,→ replace old_str with.\",\n+ \"type\": \"string\"\n}\n},\n\"required\": [\"command\", \"path\"]\n@@ -51,7 +59,7 @@ def validate_path(path: str, command: str) -&gt; Path:\nValidate the file path for each command:\n- 'view': path may be a file or directory; must exist.\n- 'create': path must not exist (for new file creation).\n- - 'edit': path must exist (for overwriting).\n+ - 'str_replace': path must exist and be a file.\n\"\"\"\npath_obj = Path(path)\n@@ -69,7 +77,7 @@ def validate_path(path: str, command: str) -&gt; Path:\n# Path must not exist\nif path_obj.exists():\nraise ValueError(f\"Cannot create new file; {path} already exists.\")\n- elif command == \"edit\":\n+ elif command == \"str_replace\":\n# Path must exist and must be a file\nif not path_obj.exists():\nraise ValueError(f\"The file {path} does not exist.\")\n@@ -144,6 +152,28 @@ def write_file(path: Path, content: str):\nexcept Exception as e:\nraise ValueError(f\"Failed to write file: {e}\")\n+def str_replace_in_file(path: Path, old_str: str, new_str: str) -&gt; str:\n+ \"\"\"\n+ Replace an exact occurrence of old_str with new_str in the file.\n+ Only performs the replacement if old_str occurs exactly once.\n+ Returns a message indicating success or failure.\n+ \"\"\"\n+ try:\n+ content = read_file(path)\n+ occurrences = content.count(old_str)\n+\n+ if occurrences == 0:\n+ return f\"Error: Could not find the exact text to replace in {path}\"\n+ elif occurrences &gt; 1:\n+ return f\"Error: Found multiple ({occurrences}) occurrences of the text in {path}. Must\n,→ be unique.\"\n+ else:\n+ new_content = content.replace(old_str, new_str)\n+ write_file(path, new_content)\n+ return f\"Successfully replaced text in {path}\"\n+\n+ except Exception as e:\n+ return f\"Error during string replacement: {e}\"\n+\ndef view_path(path_obj: Path, view_range: Optional[List[int]] = None) -&gt; str:\n\"\"\"\nView the file contents (optionally within a range) or directory listing.\n@@ -176,12 +206,13 @@ def view_path(path_obj: Path, view_range: Optional[List[int]] =\n,→ None) -&gt; str:\ncontent, start_line = read_file_range(path_obj, view_range)\nreturn format_output(content, str(path_obj), start_line)\n-def tool_function(command: str, path: str, file_text: str = None, view_range:\n,→ Optional[List[int]] = None) -&gt; str:\n+def tool_function(command: str, path: str, file_text: str = None, view_range:\n,→ Optional[List[int]] = None,\n\n43\n\n\fPublished as a conference paper at ICLR 2026\n\n+ old_str: str = None, new_str: str = None) -&gt; str:\n\"\"\"\nMain tool function that handles:\n- - 'view' : View file or directory listing, optionally within line range for files\n- - 'create': Create a new file with the given file_text\n- - 'edit' : Overwrite an existing file with file_text\n+ - 'view' : View file or directory listing, optionally within line range for files\n+ - 'create' : Create a new file with the given file_text\n+ - 'str_replace': Replace exact occurrence of old_str with new_str in the file\n\"\"\"\ntry:\npath_obj = validate_path(path, command)\n@@ -195,11 +226,10 @@ def tool_function(command: str, path: str, file_text: str = None,\n,→ view_range: Op\nwrite_file(path_obj, file_text)\nreturn f\"File created successfully at: {path}\"\n- elif command == \"edit\":\n- if file_text is None:\n- raise ValueError(\"Missing required `file_text` for 'edit' command.\")\n- write_file(path_obj, file_text)\n- return f\"File at {path} has been overwritten with new content.\"\n+ elif command == \"str_replace\":\n+ if old_str is None or new_str is None:\n+ raise ValueError(\"Missing required `old_str` and/or `new_str` for 'str_replace'\n,→ command.\")\n+ return str_replace_in_file(path_obj, old_str, new_str)\nelse:\nraise ValueError(f\"Unknown command: {command}\")\ndiff --git a/tests/__init__.py b/tests/__init__.py\nnew file mode 100644\nindex 0000000..e69de29\ndiff --git a/tests/test_tools.py b/tests/test_tools.py\nnew file mode 100644\nindex 0000000..c7f242f\n--- /dev/null\n+++ b/tests/test_tools.py\n@@ -0,0 +1,65 @@\n+import pytest\n+from pathlib import Path\n+from tools.edit import tool_function\n+\n+# Test fixtures\n+@pytest.fixture\n+def temp_file(tmp_path):\n+ file_path = tmp_path / \"test.txt\"\n+ content = \"line 1\\nline 2\\nline 3\\n\"\n+ file_path.write_text(content)\n+ return str(file_path)\n+\n+def test_str_replace_success(temp_file):\n+ # Test successful replacement\n+ result = tool_function(\n+ command=\"str_replace\",\n+ path=temp_file,\n+ old_str=\"line 2\\n\",\n+ new_str=\"replaced line\\n\"\n+ )\n+ assert \"Successfully replaced\" in result\n+ assert Path(temp_file).read_text() == \"line 1\\nreplaced line\\nline 3\\n\"\n+\n+def test_str_replace_not_found(temp_file):\n+ # Test when old_str is not found\n+ result = tool_function(\n+ command=\"str_replace\",\n+ path=temp_file,\n+ old_str=\"nonexistent\",\n+ new_str=\"something\"\n+ )\n+ assert \"Could not find\" in result\n+ # Original file should be unchanged\n+ assert Path(temp_file).read_text() == \"line 1\\nline 2\\nline 3\\n\"\n+\n+def test_str_replace_multiple_occurrences(temp_file):\n+ # First create a file with multiple occurrences\n+ Path(temp_file).write_text(\"same\\nsame\\nsame\\n\")\n+ result = tool_function(\n+ command=\"str_replace\",\n+ path=temp_file,\n+ old_str=\"same\\n\",\n\n44\n\n\fPublished as a conference paper at ICLR 2026\n\n+ new_str=\"different\\n\"\n+ )\n+ assert \"multiple\" in result\n+ # Original file should be unchanged\n+ assert Path(temp_file).read_text() == \"same\\nsame\\nsame\\n\"\n+\n+def test_str_replace_missing_params(temp_file):\n+ # Test missing parameters\n+ result = tool_function(\n+ command=\"str_replace\",\n+ path=temp_file,\n+ )\n+ assert \"Missing required\" in result\n+\n+def test_str_replace_invalid_path():\n+ # Test with non-existent file\n+ result = tool_function(\n+ command=\"str_replace\",\n+ path=\"/nonexistent/path\",\n+ old_str=\"old\",\n+ new_str=\"new\"\n+ )\n+ assert \"does not exist\" in result\n\\ No newline at end of file\ndiff --git a/llm_withtools.py b/llm_withtools.py\nindex d1394bb..6cc3604 100644\n--- a/llm_withtools.py\n+++ b/llm_withtools.py\n@@ -29,7 +29,7 @@ def process_tool_call(tools_dict, tool_name, tool_input):\n)\ndef get_response_withtools(\nclient, model, messages, tools, tool_choice,\n- logging=None,\n+ logging=None, system_message=None,\n):\ntry:\nif 'claude' in model:\n@@ -52,13 +52,32 @@ def get_response_withtools(\nraise ValueError(f\"Unsupported model: {model}\")\nreturn response\nexcept Exception as e:\n- logging(f\"Error in get_response_withtools: {str(e)}\")\n+ error_msg = str(e)\n+ logging(f\"Error in get_response_withtools: {error_msg}\")\n# Hitting the context window limit\n- if 'Input is too long for requested model' in str(e):\n- pass\n+ if 'Input is too long for requested model' in error_msg or 'maximum context length' in\n,→ error_msg:\n+ if not system_message:\n+ # Extract system message from the first message if available\n+ system_message = messages[0].get('content', '') if messages else ''\n+ if isinstance(system_message, list):\n+ system_message = ' '.join(block['text'] for block in system_message if block['type'] ==\n,→ 'text')\n+\n+ # Summarize the conversation history\n+ summarized_messages = summarize_messages(client, model, messages, system_message)\n+\n+ # Retry with summarized messages\n+ return get_response_withtools(\n+ client=client,\n+ model=model,\n+ messages=summarized_messages,\n+ tools=tools,\n+ tool_choice=tool_choice,\n+ logging=logging,\n+ system_message=system_message\n+ )\n- raise # Re-raise the exception after logging\n+ raise # Re-raise other exceptions\ndef check_for_tool_use(response, model=''):\n\"\"\"\n@@ -247,6 +266,57 @@ def convert_msg_history_openai(msg_history):\nreturn new_msg_history\n\n45\n\n\fPublished as a conference paper at ICLR 2026\n\n+def summarize_messages(client, model, messages, system_message):\n+ \"\"\"\n+ Creates a condensed summary of older messages while preserving recent context.\n+ Only summarizes assistant and user messages, keeps tool results as is for accuracy.\n+ \"\"\"\n+ # Keep the most recent messages intact\n+ recent_msgs = messages[-2:] if len(messages) &gt; 2 else messages\n+ if len(messages) &lt;= 2:\n+ return messages\n+\n+ # Prepare messages to be summarized\n+ msgs_to_summarize = messages[:-2]\n+\n+ # Create a prompt to summarize the conversation\n+ summary_request = \"Please create a concise summary of this conversation that preserves\n,→ the key context and important details:\"\n+ for msg in msgs_to_summarize:\n+ if isinstance(msg.get('content', ''), list):\n+ content = ' '.join(block['text'] for block in msg['content'] if block['type'] == 'text')\n+ else:\n+ content = str(msg.get('content', ''))\n+ if msg.get('role') in ['assistant', 'user']:\n+ summary_request += f\"\\n{msg['role']}: {content}\"\n+\n+ try:\n+ # Get summary from the model\n+ summary_response, _ = get_response_from_llm(\n+ msg=summary_request,\n+ client=client,\n+ model=model,\n+ system_message=\"You are a summarizer. Create a concise but informative summary.\",\n+ print_debug=False,\n+ msg_history=[]\n+ )\n+\n+ # Create new message history with the summary\n+ summarized_history = [{\n+ \"role\": \"system\",\n+ \"content\": [{\"type\": \"text\", \"text\": system_message}]\n+ }, {\n+ \"role\": \"assistant\",\n+ \"content\": [{\"type\": \"text\", \"text\": f\"Previous conversation summary:\n,→ {summary_response}\"}]\n+ }]\n+\n+ # Add back the recent messages\n+ summarized_history.extend(recent_msgs)\n+\n+ return summarized_history\n+ except Exception:\n+ # If summarization fails, return original messages with the most recent ones\n+ return [messages[0]] + recent_msgs\n+\ndef convert_msg_history(msg_history, model=None):\n\"\"\"\nConvert message history from the model-specific format to a generic format.\n@@ -263,7 +333,14 @@ def chat_with_agent_manualtools(msg, model, msg_history=None,\n,→ logging=print):\nif msg_history is None:\nmsg_history = []\nsystem_message = f'You are a coding agent.\\n\\n{get_tooluse_prompt()}'\n- new_msg_history = msg_history\n+ new_msg_history = msg_history.copy() if msg_history else []\n+\n+ # Ensure system message is the first message in history\n+ if not new_msg_history or new_msg_history[0].get('role') != 'system':\n+ new_msg_history.insert(0, {\n+ \"role\": \"system\",\n+ \"content\": [{\"type\": \"text\", \"text\": system_message}]\n+ })\ntry:\n# Load all tools\ndiff --git a/coding_agent.py b/coding_agent.py\nindex 9a2cc2f..3f1bc1d 100644\n--- a/coding_agent.py\n+++ b/coding_agent.py\n@@ -111,6 +111,7 @@ class AgenticSystem:\n\n46\n\n\fPublished as a conference paper at ICLR 2026\n\nself_improve=False,\ninstance_id=None,\nmax_retries=3,\n+ num_candidates=3,\n):\nself.problem_statement = problem_statement\nself.git_tempdir = git_tempdir\n@@ -121,6 +122,7 @@ class AgenticSystem:\nself.instance_id = instance_id if not self_improve else 'dgm'\nself.code_model = CLAUDE_MODEL\nself.max_retries = max_retries\n+ self.num_candidates = num_candidates\n# Initialize logger and store it in thread-local storage\nself.logger = setup_logger(chat_history_file)\n@@ -190,7 +192,7 @@ Your task is to run the regression tests in the {self.git_tempdir}\n,→ directory to\ndef forward(self):\n\"\"\"\n- The forward function for the AgenticSystem.\n+ The forward function for the AgenticSystem that generates and evaluates multiple\n,→ candidate patches.\n\"\"\"\nbase_instruction = f\"\"\"I have uploaded a Python code repository in the directory\n,→ {self.git_tempdir}. Help solve the following problem.\n@@ -205,10 +207,18 @@ Your task is to run the regression tests in the {self.git_tempdir}\n,→ directory to\nYour task is to make changes to the files in the {self.git_tempdir} directory to address\n,→ the &lt;problem_description&gt;. I have already taken care of the required dependencies.\n\"\"\"\n+ # Get regression tests summary once at the start\n+ regression_tests_summary = self.get_regression_tests()\n+\n+ # Lists to store candidates\n+ valid_patches = []\n+ valid_reports = []\n+\nretry_count = 0\n- while retry_count &lt; self.max_retries:\n+ while retry_count &lt; self.max_retries and len(valid_patches) &lt; self.num_candidates:\nsafe_log(f\"\\n=== Attempt {retry_count + 1} of {self.max_retries} ===\")\n+ safe_log(f\"Valid solutions so far: {len(valid_patches)} of {self.num_candidates}\n,→ desired\")\n+\n# Reset to base commit before each attempt\nif retry_count &gt; 0:\nreset_to_commit(self.git_tempdir, self.base_commit)\n@@ -216,8 +226,8 @@ Your task is to make changes to the files in the {self.git_tempdir}\n,→ directory to\n# Add retry context to instruction if this is a retry attempt\ninstruction = base_instruction\nif retry_count &gt; 0:\n- instruction += f\"\"\"\\nNOTE: Previous attempt(s) failed because they either produced empty\n,→ patches or only modified test files.\n-Please ensure your solution includes changes to the main source code files, not just test\n,→ files.\"\"\"\n+ instruction += f\"\"\"\\nNOTE: Previous attempt(s) did not produce enough valid solutions.\n+Please provide a different approach to solve the problem. Your solution must include\n,→ changes to the main source code files, not just test files.\"\"\"\n# Run the agent\nnew_msg_history = chat_with_agent(instruction, model=self.code_model,\n,→ msg_history=[], logging=safe_log)\n@@ -228,16 +238,45 @@ Please ensure your solution includes changes to the main source code\n,→ files, not\nif is_valid:\nsafe_log(f\"Valid patch generated: {reason}\")\n- break\n+ # Run regression tests for this candidate\n+ test_report = self.run_regression_tests(regression_tests_summary)\n+ test_score = get_report_score(test_report)\n+ safe_log(f\"Test score: {test_score}\")\n+\n+ valid_patches.append(patch)\n+ valid_reports.append(test_report)\n+\n\n47\n\n\fPublished as a conference paper at ICLR 2026\n\n+ if len(valid_patches) &gt;= self.num_candidates:\n+ break\nelse:\nsafe_log(f\"Invalid patch: {reason}\")\n- if retry_count &lt; self.max_retries - 1:\n- safe_log(\"Retrying with a new attempt...\")\n- else:\n- safe_log(\"Maximum retries reached. Unable to generate a valid patch.\")\nretry_count += 1\n+ if not valid_patches:\n+ safe_log(\"Failed to generate any valid patches.\")\n+ return\n+\n+ # Use score_tie_breaker to select the best patch\n+ safe_log(f\"\\n=== Selecting Best Solution from {len(valid_patches)} Candidates ===\")\n+ best_index = score_tie_breaker(\n+ self.problem_statement,\n+ valid_patches,\n+ valid_reports,\n+ logging=safe_log\n+ )\n+\n+ # Reset to base and apply the best patch\n+ reset_to_commit(self.git_tempdir, self.base_commit)\n+ best_patch = valid_patches[best_index]\n+ safe_log(f\"\\n=== Applying Best Solution (Candidate {best_index + 1}) ===\")\n+ apply_patch(self.git_tempdir, best_patch)\n+\n+ # Final validation of the selected patch\n+ final_test_report = self.run_regression_tests(regression_tests_summary)\n+ final_score = get_report_score(final_test_report)\n+ safe_log(f\"Final solution test score: {final_score}\")\n+\ndef main():\nparser = argparse.ArgumentParser(description='Process repository with an agentic\n,→ system.')\nparser.add_argument('--problem_statement', required=True, help='The problem statement\n,→ to process')\n@@ -249,6 +288,7 @@ def main():\nparser.add_argument('--self_improve', default=False, action='store_true',\n,→ help='Whether to self-improve the repository or solving swe')\nparser.add_argument('--instance_id', default=None, help='Instance ID for SWE issue')\nparser.add_argument('--max_retries', type=int, default=3, help='Maximum number of\n,→ patch generation attempts')\n+ parser.add_argument('--num_candidates', type=int, default=3, help='Number of candidate\n,→ solutions to generate')\nargs = parser.parse_args()\n# Process the repository\n@@ -261,6 +301,7 @@ def main():\nself_improve=args.self_improve,\ninstance_id=args.instance_id,\nmax_retries=args.max_retries,\n+ num_candidates=args.num_candidates,\n)\n# Run the agentic system to try to solve the problem\ndiff --git a/coding_agent.py b/coding_agent.py\nindex 3f1bc1d..588938d 100644\n--- a/coding_agent.py\n+++ b/coding_agent.py\n@@ -193,42 +193,59 @@ Your task is to run the regression tests in the {self.git_tempdir}\n,→ directory to\ndef forward(self):\n\"\"\"\nThe forward function for the AgenticSystem that generates and evaluates multiple\n,→ candidate patches.\n+ This version maintains history of prior valid patches and test results, only using the\n,→ tie-breaker\n+ when necessary.\n\"\"\"\n- base_instruction = f\"\"\"I have uploaded a Python code repository in the directory\n,→ {self.git_tempdir}. Help solve the following problem.\n-&lt;problem_description&gt;\n-{self.problem_statement}\n-&lt;/problem_description&gt;\n\n48\n\n\fPublished as a conference paper at ICLR 2026\n\n-&lt;test_description&gt;\n-{self.test_description}\n-&lt;/test_description&gt;\n-Your task is to make changes to the files in the {self.git_tempdir} directory to address\n,→ the &lt;problem_description&gt;. I have already taken care of the required dependencies.\n-\"\"\"\n- # Get regression tests summary once at the start\nregression_tests_summary = self.get_regression_tests()\n- # Lists to store candidates\n+ # Lists to store all valid patches and their information\nvalid_patches = []\nvalid_reports = []\n+ valid_scores = []\n+ best_score = 0\n+ best_patches_indices = [] # Indices of patches that share the best score\nretry_count = 0\nwhile retry_count &lt; self.max_retries and len(valid_patches) &lt; self.num_candidates:\nsafe_log(f\"\\n=== Attempt {retry_count + 1} of {self.max_retries} ===\")\nsafe_log(f\"Valid solutions so far: {len(valid_patches)} of {self.num_candidates}\n,→ desired\")\n+ safe_log(f\"Current best test score: {best_score}\")\n# Reset to base commit before each attempt\nif retry_count &gt; 0:\nreset_to_commit(self.git_tempdir, self.base_commit)\n- # Add retry context to instruction if this is a retry attempt\n- instruction = base_instruction\n- if retry_count &gt; 0:\n- instruction += f\"\"\"\\nNOTE: Previous attempt(s) did not produce enough valid solutions.\n+ # Construct instruction with previous best solutions if available\n+ instruction = f\"\"\"I have uploaded a Python code repository in the directory\n,→ {self.git_tempdir}. Help solve the following problem.\n+\n+&lt;problem_description&gt;\n+{self.problem_statement}\n+&lt;/problem_description&gt;\n+\n+&lt;test_description&gt;\n+{self.test_description}\n+&lt;/test_description&gt;\"\"\"\n+\n+ # Add previous solutions context if available\n+ if valid_patches and retry_count &gt; 0:\n+ previous_solutions = []\n+ for i, (patch, report, score) in enumerate(zip(valid_patches, valid_reports,\n,→ valid_scores)):\n+ previous_solutions.append(f\"\"\"\n+Previous Solution {i+1}:\n+&lt;code_changes&gt;\n+{patch}\n+&lt;/code_changes&gt;\n+Test Score: {score}\n+Test Report: {report}\n+\"\"\")\n+ instruction += \"\\n\\nPrevious solution attempts:\\n\" + \"\\n\".join(previous_solutions)\n+ instruction += \"\\nPlease provide a new solution that addresses any limitations in the\n,→ previous attempts or explores a different approach.\"\n+ elif retry_count &gt; 0:\n+ instruction += \"\"\"\\nNOTE: Previous attempt(s) did not produce enough valid solutions.\nPlease provide a different approach to solve the problem. Your solution must include\n,→ changes to the main source code files, not just test files.\"\"\"\n+ instruction += f\"\\n\\nYour task is to make changes to the files in the {self.git_tempdir}\n,→ directory to address the &lt;problem_description&gt;. I have already taken care of the\n,→ required dependencies.\"\n+\n# Run the agent\nnew_msg_history = chat_with_agent(instruction, model=self.code_model,\n,→ msg_history=[], logging=safe_log)\n@@ -245,6 +262,14 @@ Please provide a different approach to solve the problem. Your\n,→ solution must inc\nvalid_patches.append(patch)\nvalid_reports.append(test_report)\n\n49\n\n\fPublished as a conference paper at ICLR 2026\n\n+ valid_scores.append(test_score)\n+\n+ # Update best score and indices\n+ if test_score &gt; best_score:\n+ best_score = test_score\n+ best_patches_indices = [len(valid_patches) - 1]\n+ elif test_score == best_score:\n+ best_patches_indices.append(len(valid_patches) - 1)\nif len(valid_patches) &gt;= self.num_candidates:\nbreak\n@@ -257,25 +282,30 @@ Please provide a different approach to solve the problem. Your\n,→ solution must inc\nsafe_log(\"Failed to generate any valid patches.\")\nreturn\n- # Use score_tie_breaker to select the best patch\n+ # Only use tie-breaker if we have multiple patches with the best score\nsafe_log(f\"\\n=== Selecting Best Solution from {len(valid_patches)} Candidates ===\")\n- best_index = score_tie_breaker(\n- self.problem_statement,\n- valid_patches,\n- valid_reports,\n- logging=safe_log\n- )\n+ if len(best_patches_indices) &gt; 1:\n+ safe_log(f\"Multiple solutions ({len(best_patches_indices)}) tied for best score\n,→ {best_score}. Using tie-breaker.\")\n+ best_index = score_tie_breaker(\n+ self.problem_statement,\n+ [valid_patches[i] for i in best_patches_indices],\n+ [valid_reports[i] for i in best_patches_indices],\n+ logging=safe_log\n+ )\n+ best_index = best_patches_indices[best_index]\n+ else:\n+ best_index = best_patches_indices[0]\n# Reset to base and apply the best patch\nreset_to_commit(self.git_tempdir, self.base_commit)\nbest_patch = valid_patches[best_index]\n- safe_log(f\"\\n=== Applying Best Solution (Candidate {best_index + 1}) ===\")\n+ safe_log(f\"\\n=== Applying Best Solution (Candidate {best_index + 1}) with score\n,→ {valid_scores[best_index]} ===\")\napply_patch(self.git_tempdir, best_patch)\n# Final validation of the selected patch\nfinal_test_report = self.run_regression_tests(regression_tests_summary)\nfinal_score = get_report_score(final_test_report)\n- safe_log(f\"Final solution test score: {final_score}\")\n+ safe_log(f\"Final validation test score: {final_score}\")\ndef main():\nparser = argparse.ArgumentParser(description='Process repository with an agentic\n,→ system.')\n\nF.2\n\nDGM ON P OLYGLOT\n\nDiff patches contributing to the best agent discovered by the DGM on Polyglot:\ndiff --git a/coding_agent.py b/coding_agent.py\nindex 04ffb36..6639abd 100644\n--- a/coding_agent.py\n+++ b/coding_agent.py\n@@ -4,6 +4,9 @@ import logging\nfrom logging.handlers import RotatingFileHandler\nimport os\nimport threading\n+import json\n+from dataclasses import dataclass\n+from typing import List, Optional\nfrom llm_withtools import CLAUDE_MODEL, OPENAI_MODEL, chat_with_agent\nfrom utils.git_utils import diff_versus_commit, reset_to_commit, apply_patch\n@@ -42,6 +45,14 @@ TEST_COMMANDS = {\n# Thread-local storage for logger instances\nthread_local = threading.local()\n\n50\n\n\fPublished as a conference paper at ICLR 2026\n\n+@dataclass\n+class SolutionAttempt:\n+ \"\"\"Class to store information about a solution attempt.\"\"\"\n+ patch: str # The patch content\n+ test_output: str # Raw test output\n+ test_success: bool # Whether tests passed\n+ test_stats: dict # Test statistics (e.g., number of passed/failed tests)\n+\ndef get_thread_logger():\n\"\"\"\nGet the logger instance specific to the current thread.\n@@ -102,7 +113,8 @@ class AgenticSystem:\nchat_history_file='./chat_history.md',\ntest_description=None,\nself_improve=False,\n- language='python'\n+ language='python',\n+ max_attempts=3\n):\nself.problem_statement = problem_statement\nself.git_tempdir = git_tempdir\n@@ -111,6 +123,7 @@ class AgenticSystem:\nself.test_description = test_description\nself.self_improve = self_improve\nself.language = language\n+ self.max_attempts = max_attempts\n# Set the code model based on whether self-improvement is enabled\nself.code_model = OPENAI_MODEL if not self_improve else CLAUDE_MODEL\n@@ -137,11 +150,63 @@ class AgenticSystem:\n]\nreturn new_msg_history\n+ def run_tests(self) -&gt; tuple[bool, str, dict]:\n+ \"\"\"Run tests and return success status, output, and test statistics.\"\"\"\n+ success = False\n+ output = \"\"\n+ stats = {\"passed\": 0, \"failed\": 0, \"errors\": 0, \"total\": 0}\n+\n+ try:\n+ for command in TEST_COMMANDS.get(self.language, []):\n+ proc = subprocess.run(\n+ command,\n+ cwd=self.git_tempdir,\n+ capture_output=True,\n+ text=True,\n+ check=False\n+ )\n+ output += f\"$ {' '.join(command)}\\n{proc.stdout}\\n{proc.stderr}\\n\"\n+ success = proc.returncode == 0\n+ if not success:\n+ break\n+\n+ # Try to extract test statistics from output\n+ # This is a simple example; you might want to add more sophisticated parsing\n+ stats[\"passed\"] = output.count(\"PASS\") + output.count(\"ok\")\n+ stats[\"failed\"] = output.count(\"FAIL\") + output.count(\"not ok\")\n+ stats[\"errors\"] = output.count(\"ERROR\") + output.count(\"panic:\")\n+ stats[\"total\"] = stats[\"passed\"] + stats[\"failed\"] + stats[\"errors\"]\n+\n+ except Exception as e:\n+ output = f\"Error running tests: {str(e)}\"\n+ success = False\n+\n+ return success, output, stats\n+\n+ def analyze_test_results(self, attempts: List[SolutionAttempt]) -&gt; str:\n+ \"\"\"Analyze test results and create a summary for the agent.\"\"\"\n+ summary = \"# Test Results Analysis\\n\\n\"\n+\n+ for i, attempt in enumerate(attempts, 1):\n+ summary += f\"## Attempt {i}\\n\"\n+ summary += f\"Test Success: {attempt.test_success}\\n\"\n+ summary += f\"Test Stats: {json.dumps(attempt.test_stats, indent=2)}\\n\"\n+ summary += \"Key test output:\\n```\\n\"\n+ # Extract relevant parts of test output (e.g., error messages)\n+ key_output = \"\\n\".join(line for line in attempt.test_output.split(\"\\n\")\n+ if \"FAIL\" in line or \"ERROR\" in line or \"PASS\" in line)\n+ summary += f\"{key_output}\\n```\\n\\n\"\n+\n+ return summary\n\n51\n\n\fPublished as a conference paper at ICLR 2026\n\n+\ndef forward(self):\n\"\"\"\n- The forward function for the AgenticSystem.\n+ The forward function for the AgenticSystem with multiple solution attempts.\n\"\"\"\n- task = f\"\"\"I have uploaded a code repository in the directory {self.git_tempdir}. Help\n,→ solve the following problem.\n+ attempts: List[SolutionAttempt] = []\n+ best_attempt: Optional[SolutionAttempt] = None\n+\n+ base_task = f\"\"\"I have uploaded a code repository in the directory {self.git_tempdir}.\n,→ Help solve the following problem.\n&lt;problem_description&gt;\n{self.problem_statement}\n@@ -149,8 +214,52 @@ class AgenticSystem:\nYour task is to make changes to the files in the {self.git_tempdir} directory to address\n,→ the &lt;problem_description&gt;. I have already taken care of the required dependencies.\n\"\"\"\n- instruction = f\"{task}\\n\\nPlease analyze the problem description carefully. Then make\n,→ edits to the code files to complete the instruction.\"\n- init_edit = chat_with_agent(instruction, model=self.code_model, msg_history=[],\n,→ logging=safe_log)\n+\n+ for attempt_num in range(self.max_attempts):\n+ # Reset to base commit for each attempt\n+ reset_to_commit(self.git_tempdir, self.base_commit)\n+\n+ # Prepare the instruction based on previous attempts\n+ instruction = base_task\n+ if attempts:\n+ # Add analysis of previous attempts\n+ instruction += \"\\n\\nPrevious solution attempts have been made. Here are the results:\\n\\n\"\n+ instruction += self.analyze_test_results(attempts)\n+ instruction += \"\\nPlease analyze these results and provide an improved solution that\n,→ addresses the issues found.\"\n+ else:\n+ instruction += \"\\n\\nPlease analyze the problem description carefully. Then make edits to\n,→ the code files to complete the instruction.\"\n+\n+ # Get the solution attempt\n+ chat_with_agent(instruction, model=self.code_model, msg_history=[], logging=safe_log)\n+\n+ # Capture the current patch\n+ current_patch = diff_versus_commit(self.git_tempdir, self.base_commit)\n+\n+ # Run tests and collect results\n+ test_success, test_output, test_stats = self.run_tests()\n+\n+ # Create and store attempt\n+ attempt = SolutionAttempt(\n+ patch=current_patch,\n+ test_output=test_output,\n+ test_success=test_success,\n+ test_stats=test_stats\n+ )\n+ attempts.append(attempt)\n+\n+ # Update best attempt if this one is better\n+ if test_success and (best_attempt is None or\n+ attempt.test_stats[\"passed\"] &gt; best_attempt.test_stats[\"passed\"]):\n+ best_attempt = attempt\n+\n+ # If tests pass perfectly, we can stop\n+ if test_success and attempt.test_stats[\"failed\"] == 0 and attempt.test_stats[\"errors\"]\n,→ == 0:\n+ break\n+\n+ # Apply the best solution if found, otherwise use the last attempt\n+ final_attempt = best_attempt or attempts[-1]\n+ reset_to_commit(self.git_tempdir, self.base_commit)\n+ apply_patch(self.git_tempdir, final_attempt.patch)\ndef main():\nparser = argparse.ArgumentParser(description='Process repository with an agentic\n,→ system.')\n@@ -162,6 +271,7 @@ def main():\nparser.add_argument('--test_description', default=None, required=False,\n,→ help='Description of how to test the repository')\n\n52\n\n\fPublished as a conference paper at ICLR 2026\n\nparser.add_argument('--self_improve', default=False, action='store_true',\n,→ help='Whether to self-improve the repository or solving swe')\nparser.add_argument('--language', required=False, default=\"python\", choices=['cpp',\n,→ 'java', 'python', 'go', 'rust', 'javascript'], help='Task\\'s programming\n,→ language')\n+ parser.add_argument('--max_attempts', type=int, default=3, help='Maximum number of\n,→ solution attempts')\nargs = parser.parse_args()\n# Process the repository\n@@ -173,6 +283,7 @@ def main():\ntest_description=args.test_description,\nself_improve=args.self_improve,\nlanguage=args.language,\n+ max_attempts=args.max_attempts,\n)\n# Run the agentic system to try to solve the problem\n@@ -185,4 +296,4 @@ def main():\nf.write(model_patch)\nif __name__ == \"__main__\":\n- main()\n+ main()\n\\ No newline at end of file\ndiff --git a/tools/edit.py b/tools/edit.py\nindex d7184c3..87fa408 100644\n--- a/tools/edit.py\n+++ b/tools/edit.py\n@@ -1,5 +1,9 @@\nfrom pathlib import Path\nimport subprocess\n+from typing import List, Optional, Dict\n+\n+# Global edit history for undo functionality\n+edit_history: Dict[str, List[str]] = {}\ndef tool_info():\nreturn {\n@@ -10,14 +14,14 @@ def tool_info():\n* The `create` command cannot be used if the specified `path` already exists as a file.\\n\n* If a `command` generates a long output, it will be truncated and marked with `&lt;response\n,→ clipped&gt;`.\\n\n* The `edit` command overwrites the entire file with the provided `file_text`.\\n\n-* No partial/line-range edits or partial viewing are supported.\"\"\",\n+* Also supports viewing specific line ranges, string replacement, text insertion, and\n,→ undo operations.\"\"\",\n\"input_schema\": {\n\"type\": \"object\",\n\"properties\": {\n\"command\": {\n\"type\": \"string\",\n- \"enum\": [\"view\", \"create\", \"edit\"],\n- \"description\": \"The command to run: `view`, `create`, or `edit`.\"\n+ \"enum\": [\"view\", \"create\", \"edit\", \"str_replace\", \"insert\", \"undo_edit\"],\n+ \"description\": \"The command to run: `view`, `create`, `edit`, `str_replace`, `insert`, or\n,→ `undo_edit`.\"\n},\n\"path\": {\n\"description\": \"Absolute path to file or directory, e.g. `/repo/file.py`\n,→ or `/repo`.\",\n@@ -26,6 +30,23 @@ def tool_info():\n\"file_text\": {\n\"description\": \"Required parameter of `create` or `edit` command,\n,→ containing the content for the entire file.\",\n\"type\": \"string\"\n+ },\n+ \"view_range\": {\n+ \"description\": \"Optional parameter for `view` command to display specific line range\n,→ [start, end].\",\n+ \"type\": \"array\",\n+ \"items\": {\"type\": \"integer\"}\n+ },\n+ \"old_str\": {\n+ \"description\": \"Required parameter for `str_replace` command, string to replace.\",\n+ \"type\": \"string\"\n+ },\n+ \"new_str\": {\n\n53\n\n\fPublished as a conference paper at ICLR 2026\n\n+ \"description\": \"Required parameter for `str_replace` and `insert` commands, new string\n,→ to insert.\",\n+ \"type\": \"string\"\n+ },\n+ \"insert_line\": {\n+ \"description\": \"Required parameter for `insert` command, line number where to insert\n,→ text.\",\n+ \"type\": \"integer\"\n}\n},\n\"required\": [\"command\", \"path\"]\n@@ -43,7 +64,7 @@ def validate_path(path: str, command: str) -&gt; Path:\nValidate the file path for each command:\n- 'view': path may be a file or directory; must exist.\n- 'create': path must not exist (for new file creation).\n- - 'edit': path must exist (for overwriting).\n+ - Others: path must exist as a file.\n\"\"\"\npath_obj = Path(path)\n@@ -61,14 +82,12 @@ def validate_path(path: str, command: str) -&gt; Path:\n# Path must not exist\nif path_obj.exists():\nraise ValueError(f\"Cannot create new file; {path} already exists.\")\n- elif command == \"edit\":\n+ else:\n# Path must exist and must be a file\nif not path_obj.exists():\nraise ValueError(f\"The file {path} does not exist.\")\nif path_obj.is_dir():\nraise ValueError(f\"{path} is a directory and cannot be edited as a file.\")\n- else:\n- raise ValueError(f\"Unknown or unsupported command: {command}\")\nreturn path_obj\n@@ -89,14 +108,21 @@ def read_file(path: Path) -&gt; str:\nexcept Exception as e:\nraise ValueError(f\"Failed to read file: {e}\")\n-def write_file(path: Path, content: str):\n+def write_file(path: Path, content: str, save_history: bool = True):\n\"\"\"Write (overwrite) entire file contents.\"\"\"\ntry:\n+ if save_history:\n+ # Save the current content to history before writing\n+ if path.exists():\n+ if str(path) not in edit_history:\n+ edit_history[str(path)] = []\n+ edit_history[str(path)].append(path.read_text())\n+\npath.write_text(content)\nexcept Exception as e:\nraise ValueError(f\"Failed to write file: {e}\")\n-def view_path(path_obj: Path) -&gt; str:\n+def view_path(path_obj: Path, view_range: Optional[List[int]] = None) -&gt; str:\n\"\"\"View the entire file contents or directory listing.\"\"\"\nif path_obj.is_dir():\n# For directories: list non-hidden files up to 2 levels deep\n@@ -115,35 +141,104 @@ def view_path(path_obj: Path) -&gt; str:\nexcept Exception as e:\nraise ValueError(f\"Failed to list directory: {e}\")\n- # If it's a file, show the entire file with line numbers\n+ # If it's a file\ncontent = read_file(path_obj)\n+ lines = content.splitlines()\n+\n+ # Handle line range viewing\n+ if view_range:\n+ if len(view_range) != 2:\n+ raise ValueError(\"view_range must contain exactly two elements: [start, end]\")\n+ start, end = view_range\n+ if start &lt; 1 or end &gt; len(lines):\n+ raise ValueError(f\"Invalid line range [{start}, {end}] for file with {len(lines)} lines\")\n+ # Adjust for 0-based indexing\n+ content = \"\\n\".join(lines[start-1:end])\n+ return format_output(content, str(path_obj), init_line=start)\n+\nreturn format_output(content, str(path_obj))\n\n54\n\n\fPublished as a conference paper at ICLR 2026\n\n-def tool_function(command: str, path: str, file_text: str = None) -&gt; str:\n+def str_replace(path_obj: Path, old_str: str, new_str: str) -&gt; str:\n+ \"\"\"Replace string in file, ensuring uniqueness.\"\"\"\n+ content = read_file(path_obj)\n+ # Check for multiple occurrences\n+ if content.count(old_str) &gt; 1:\n+ return f\"Error: Multiple occurrences of '{old_str}' found. Replacement requires a unique\n,→ match.\"\n+ elif content.count(old_str) == 0:\n+ return f\"Error: String '{old_str}' not found in file.\"\n+\n+ new_content = content.replace(old_str, new_str)\n+ write_file(path_obj, new_content)\n+ return f\"File at {path_obj} has been edited: replaced '{old_str}' with '{new_str}'.\"\n+\n+def insert_text(path_obj: Path, insert_line: int, new_str: str) -&gt; str:\n+ \"\"\"Insert text at specified line number.\"\"\"\n+ content = read_file(path_obj)\n+ lines = content.splitlines()\n+\n+ if insert_line &lt; 1 or insert_line &gt; len(lines) + 1:\n+ raise ValueError(f\"Invalid insert line {insert_line} for file with {len(lines)} lines\")\n+\n+ # Insert the new text at the specified line (adjusting for 0-based index)\n+ lines.insert(insert_line - 1, new_str.rstrip(\"\\n\"))\n+ new_content = \"\\n\".join(lines) + \"\\n\"\n+\n+ write_file(path_obj, new_content)\n+ return f\"File at {path_obj} has been edited: inserted text at line {insert_line}.\"\n+\n+def undo_edit(path_obj: Path) -&gt; str:\n+ \"\"\"Undo last edit operation on the file.\"\"\"\n+ path_str = str(path_obj)\n+ if path_str not in edit_history or not edit_history[path_str]:\n+ return \"Error: No edit history available for this file.\"\n+\n+ # Restore the last saved content\n+ previous_content = edit_history[path_str].pop()\n+ write_file(path_obj, previous_content, save_history=False)\n+ return f\"Last edit on {path_obj} has been undone successfully.\"\n+\n+def tool_function(command: str, path: str, **kwargs) -&gt; str:\n\"\"\"\n- Main tool function that handles:\n- - 'view' : View the entire file or directory listing\n- - 'create': Create a new file with the given file_text\n- - 'edit' : Overwrite an existing file with file_text\n+ Main tool function that handles all commands:\n+ - 'view' : View file/directory (optionally with line range)\n+ - 'create' : Create new file\n+ - 'edit' : Overwrite existing file\n+ - 'str_replace' : Replace string in file\n+ - 'insert' : Insert text at line\n+ - 'undo_edit' : Undo last edit\n\"\"\"\ntry:\npath_obj = validate_path(path, command)\nif command == \"view\":\n- return view_path(path_obj)\n+ view_range = kwargs.get('view_range')\n+ return view_path(path_obj, view_range)\nelif command == \"create\":\n- if file_text is None:\n+ if 'file_text' not in kwargs:\nraise ValueError(\"Missing required `file_text` for 'create' command.\")\n- write_file(path_obj, file_text)\n+ write_file(path_obj, kwargs['file_text'])\nreturn f\"File created successfully at: {path}\"\nelif command == \"edit\":\n- if file_text is None:\n+ if 'file_text' not in kwargs:\nraise ValueError(\"Missing required `file_text` for 'edit' command.\")\n- write_file(path_obj, file_text)\n+ write_file(path_obj, kwargs['file_text'])\nreturn f\"File at {path} has been overwritten with new content.\"\n+ elif command == \"str_replace\":\n\n55\n\n\fPublished as a conference paper at ICLR 2026\n\n+ if 'old_str' not in kwargs or 'new_str' not in kwargs:\n+ raise ValueError(\"Both 'old_str' and 'new_str' are required for string replacement.\")\n+ return str_replace(path_obj, kwargs['old_str'], kwargs['new_str'])\n+\n+ elif command == \"insert\":\n+ if 'insert_line' not in kwargs or 'new_str' not in kwargs:\n+ raise ValueError(\"Both 'insert_line' and 'new_str' are required for text insertion.\")\n+ return insert_text(path_obj, kwargs['insert_line'], kwargs['new_str'])\n+\n+ elif command == \"undo_edit\":\n+ return undo_edit(path_obj)\n+\nelse:\nraise ValueError(f\"Unknown command: {command}\")\ndiff --git a/tools/edit.py b/tools/edit.py\nindex 87fa408..a12903c 100644\n--- a/tools/edit.py\n+++ b/tools/edit.py\n@@ -117,7 +117,7 @@ def write_file(path: Path, content: str, save_history: bool = True):\nif str(path) not in edit_history:\nedit_history[str(path)] = []\nedit_history[str(path)].append(path.read_text())\n+\npath.write_text(content)\nexcept Exception as e:\nraise ValueError(f\"Failed to write file: {e}\")\n@@ -172,17 +172,25 @@ def str_replace(path_obj: Path, old_str: str, new_str: str) -&gt; str:\nreturn f\"File at {path_obj} has been edited: replaced '{old_str}' with '{new_str}'.\"\ndef insert_text(path_obj: Path, insert_line: int, new_str: str) -&gt; str:\n- \"\"\"Insert text at specified line number.\"\"\"\n+ \"\"\"Insert text at specified line number (1-based).\"\"\"\ncontent = read_file(path_obj)\nlines = content.splitlines()\n- if insert_line &lt; 1 or insert_line &gt; len(lines) + 1:\n- raise ValueError(f\"Invalid insert line {insert_line} for file with {len(lines)} lines\")\n+ # Validate the insertion line number\n+ if insert_line &lt; 1:\n+ raise ValueError(f\"Invalid insert line {insert_line} - must be greater than 0\")\n+ if insert_line &gt; len(lines) + 1:\n+ raise ValueError(f\"Invalid insert line {insert_line} - file only has {len(lines)} lines\")\n- # Insert the new text at the specified line (adjusting for 0-based index)\n- lines.insert(insert_line - 1, new_str.rstrip(\"\\n\"))\n- new_content = \"\\n\".join(lines) + \"\\n\"\n+ # Clean up the new text to remove any trailing newlines\n+ new_text = new_str.rstrip('\\n')\n+ # Insert at the correct position (line numbers are 1-based, list indices are 0-based)\n+ # Insert at index=insert_line, so it appears after the current line at that position\n+ lines.insert(insert_line, new_text)\n+\n+ # Join lines with newline and add trailing newline\n+ new_content = '\\n'.join(lines) + '\\n'\nwrite_file(path_obj, new_content)\nreturn f\"File at {path_obj} has been edited: inserted text at line {insert_line}.\"\n@@ -243,8 +251,4 @@ def tool_function(command: str, path: str, **kwargs) -&gt; str:\nraise ValueError(f\"Unknown command: {command}\")\nexcept Exception as e:\n- return f\"Error: {str(e)}\"\n-if __name__ == \"__main__\":\n- # Example usage\n- print(tool_function(\"view\", \"/home/ubuntu/xx/dgm/coding_agent.py\"))\n\\ No newline at end of file\n+ return f\"Error: {str(e)}\"\n\\ No newline at end of file\ndiff --git a/coding_agent.py b/coding_agent.py\nindex 6639abd..97f4b69 100644\n--- a/coding_agent.py\n+++ b/coding_agent.py\n@@ -52,6 +52,10 @@ class SolutionAttempt:\ntest_output: str # Raw test output\n\n56\n\n\fPublished as a conference paper at ICLR 2026\n\ntest_success: bool # Whether tests passed\ntest_stats: dict # Test statistics (e.g., number of passed/failed tests)\n+ error_messages: List[str] = None # List of specific error messages\n+ test_details: dict = None # Detailed test information like specific test names and their\n,→ status\n+ execution_time: float = None # Test execution time in seconds\n+ attempt_number: int = None # The attempt number in the sequence\ndef get_thread_logger():\n\"\"\"\n@@ -150,12 +154,82 @@ class AgenticSystem:\n]\nreturn new_msg_history\n+ def extract_test_details(self, output: str) -&gt; tuple[dict, List[str], dict]:\n+ \"\"\"Extract detailed test information from the output.\"\"\"\n+ error_messages = []\n+ test_details = {}\n+ stats = {\"passed\": 0, \"failed\": 0, \"errors\": 0, \"total\": 0, \"skipped\": 0}\n+\n+ # Split output into lines for analysis\n+ lines = output.split(\"\\n\")\n+\n+ # Language-specific parsing\n+ if self.language == \"python\":\n+ for line in lines:\n+ if \"FAILED\" in line and \"::\" in line:\n+ test_name = line.split(\"::\")[1].split()[0]\n+ test_details[test_name] = \"FAILED\"\n+ stats[\"failed\"] += 1\n+ elif \"PASSED\" in line and \"::\" in line:\n+ test_name = line.split(\"::\")[1].split()[0]\n+ test_details[test_name] = \"PASSED\"\n+ stats[\"passed\"] += 1\n+ elif \"ERROR\" in line and \"::\" in line:\n+ test_name = line.split(\"::\")[1].split()[0]\n+ test_details[test_name] = \"ERROR\"\n+ stats[\"errors\"] += 1\n+ # Extract error message\n+ if lines.index(line) + 1 &lt; len(lines):\n+ error_messages.append(lines[lines.index(line) + 1])\n+\n+ elif self.language in [\"javascript\", \"node\"]:\n+ current_test = None\n+ for line in lines:\n+ if line.startswith('checkmark'):\n+ test_name = line.replace('checkmark,', '').strip()\n+ test_details[test_name] = \"PASSED\"\n+ stats[\"passed\"] += 1\n+ elif line.startswith('x'):\n+ test_name = line.replace('x', '').strip()\n+ test_details[test_name] = \"FAILED\"\n+ stats[\"failed\"] += 1\n+ current_test = test_name\n+ elif current_test and ('Error:' in line or 'AssertionError:' in line):\n+ error_messages.append(f\"{current_test}: {line.strip()}\")\n+\n+ elif self.language == \"rust\":\n+ for line in lines:\n+ if \"test\" in line and \"... ok\" in line:\n+ test_name = line.split(\"test\")[1].split(\"...\")[0].strip()\n+ test_details[test_name] = \"PASSED\"\n+ stats[\"passed\"] += 1\n+ elif \"test\" in line and \"... FAILED\" in line:\n+ test_name = line.split(\"test\")[1].split(\"...\")[0].strip()\n+ test_details[test_name] = \"FAILED\"\n+ stats[\"failed\"] += 1\n+ elif \"---- \" in line and \" stdout ----\" in line:\n+ test_name = line.split(\"----\")[1].split(\"stdout\")[0].strip()\n+ if test_name in test_details and test_details[test_name] == \"FAILED\":\n+ error_messages.append(f\"{test_name}: {next((l for l in lines[lines.index(line)+1:] if\n,→ l.strip()), '')}\")\n+\n+ # Generic counting for other languages or as fallback\n+ if not any(stats.values()):\n+ stats[\"passed\"] = output.count(\"PASS\") + output.count(\"ok\")\n+ stats[\"failed\"] = output.count(\"FAIL\") + output.count(\"not ok\")\n+ stats[\"errors\"] = output.count(\"ERROR\") + output.count(\"panic:\")\n+\n+ stats[\"total\"] = stats[\"passed\"] + stats[\"failed\"] + stats[\"errors\"]\n+\n\n57\n\n\fPublished as a conference paper at ICLR 2026\n\n+ return stats, error_messages, test_details\n+\ndef run_tests(self) -&gt; tuple[bool, str, dict]:\n\"\"\"Run tests and return success status, output, and test statistics.\"\"\"\n+ import time\n+\nsuccess = False\noutput = \"\"\n- stats = {\"passed\": 0, \"failed\": 0, \"errors\": 0, \"total\": 0}\n+ start_time = time.time()\n+\ntry:\nfor command in TEST_COMMANDS.get(self.language, []):\nproc = subprocess.run(\n@@ -169,34 +243,97 @@ class AgenticSystem:\nsuccess = proc.returncode == 0\nif not success:\nbreak\n- # Try to extract test statistics from output\n- # This is a simple example; you might want to add more sophisticated parsing\n- stats[\"passed\"] = output.count(\"PASS\") + output.count(\"ok\")\n- stats[\"failed\"] = output.count(\"FAIL\") + output.count(\"not ok\")\n- stats[\"errors\"] = output.count(\"ERROR\") + output.count(\"panic:\")\n- stats[\"total\"] = stats[\"passed\"] + stats[\"failed\"] + stats[\"errors\"]\n+\n+ # Extract detailed test information\n+ stats, error_messages, test_details = self.extract_test_details(output)\n+ stats[\"execution_time\"] = time.time() - start_time\n+\n+ # Enhance stats with extracted information\n+ stats[\"error_messages\"] = error_messages\n+ stats[\"test_details\"] = test_details\nexcept Exception as e:\noutput = f\"Error running tests: {str(e)}\"\nsuccess = False\n+ stats = {\n+ \"passed\": 0, \"failed\": 0, \"errors\": 1, \"total\": 1,\n+ \"execution_time\": time.time() - start_time,\n+ \"error_messages\": [str(e)],\n+ \"test_details\": {}\n+ }\nreturn success, output, stats\ndef analyze_test_results(self, attempts: List[SolutionAttempt]) -&gt; str:\n- \"\"\"Analyze test results and create a summary for the agent.\"\"\"\n+ \"\"\"Analyze test results and create a detailed summary for the agent.\"\"\"\nsummary = \"# Test Results Analysis\\n\\n\"\n+ # Overall progress tracking\n+ if len(attempts) &gt; 1:\n+ summary += \"## Progress Overview\\n\"\n+ first_attempt = attempts[0].test_stats\n+ last_attempt = attempts[-1].test_stats\n+\n+ progress = {\n+ \"passed\": last_attempt[\"passed\"] - first_attempt[\"passed\"],\n+ \"failed\": first_attempt[\"failed\"] - last_attempt[\"failed\"],\n+ \"errors\": first_attempt[\"errors\"] - last_attempt[\"errors\"]\n+ }\n+\n+ summary += \"Progress since first attempt:\\n\"\n+ summary += f\"- Additional passing tests: {progress['passed']}\\n\"\n+ summary += f\"- Reduced failures: {progress['failed']}\\n\"\n+ summary += f\"- Reduced errors: {progress['errors']}\\n\\n\"\n+\n+ # Detailed attempt analysis\nfor i, attempt in enumerate(attempts, 1):\nsummary += f\"## Attempt {i}\\n\"\nsummary += f\"Test Success: {attempt.test_success}\\n\"\n- summary += f\"Test Stats: {json.dumps(attempt.test_stats, indent=2)}\\n\"\n- summary += \"Key test output:\\n```\\n\"\n- # Extract relevant parts of test output (e.g., error messages)\n- key_output = \"\\n\".join(line for line in attempt.test_output.split(\"\\n\")\n- if \"FAIL\" in line or \"ERROR\" in line or \"PASS\" in line)\n- summary += f\"{key_output}\\n```\\n\\n\"\n+ summary += f\"Execution Time: {attempt.test_stats.get('execution_time', 'N/A'):.2f}s\\n\"\n\n58\n\n\fPublished as a conference paper at ICLR 2026\n\n+\n+ # Test statistics\n+ stats = attempt.test_stats\n+ total = stats.get(\"total\", 0) or 1 # Avoid division by zero\n+ pass_rate = (stats.get(\"passed\", 0) / total) * 100\n+\n+ summary += f\"Pass Rate: {pass_rate:.1f}% ({stats.get('passed', 0)}/{total})\\n\"\n+ summary += \"Test Statistics:\\n\"\n+ summary += f\"- Passed: {stats.get('passed', 0)}\\n\"\n+ summary += f\"- Failed: {stats.get('failed', 0)}\\n\"\n+ summary += f\"- Errors: {stats.get('errors', 0)}\\n\"\n+ summary += f\"- Total: {total}\\n\\n\"\n+\n+ # Error messages\n+ if stats.get(\"error_messages\"):\n+ summary += \"Error Messages:\\n```\\n\"\n+ for error in stats[\"error_messages\"][:5]: # Limit to top 5 errors\n+ summary += f\"{error}\\n\"\n+ if len(stats[\"error_messages\"]) &gt; 5:\n+ summary += f\"... and {len(stats['error_messages']) - 5} more errors\\n\"\n+ summary += \"```\\n\\n\"\n+\n+ # Test details\n+ if stats.get(\"test_details\"):\n+ summary += \"Individual Test Results:\\n```\\n\"\n+ for test_name, result in stats[\"test_details\"].items():\n+ summary += f\"{result}: {test_name}\\n\"\n+ summary += \"```\\n\\n\"\n+\n+ # Recommendations for next attempt\n+ if not attempts[-1].test_success:\n+ summary += \"## Recommendations for Next Attempt\\n\"\n+ last_stats = attempts[-1].test_stats\n+\n+ if last_stats.get(\"errors\", 0) &gt; 0:\n+ summary += \"- Focus on resolving runtime errors first\\n\"\n+ if last_stats.get(\"failed\", 0) &gt; 0:\n+ summary += \"- Address failing test cases\\n\"\n+ if len(attempts) &gt; 1 and not attempts[-1].test_success:\n+ # Compare with previous attempt\n+ prev_stats = attempts[-2].test_stats\n+ if last_stats.get(\"passed\", 0) &lt; prev_stats.get(\"passed\", 0):\n+ summary += \"- Recent changes caused regressions. Consider reverting some changes\\n\"\n+\nreturn summary\ndef forward(self):\n@@ -238,20 +375,36 @@ Your task is to make changes to the files in the {self.git_tempdir}\n,→ directory to\n# Run tests and collect results\ntest_success, test_output, test_stats = self.run_tests()\n- # Create and store attempt\n+ # Create and store attempt with enhanced information\nattempt = SolutionAttempt(\npatch=current_patch,\ntest_output=test_output,\ntest_success=test_success,\n- test_stats=test_stats\n+ test_stats=test_stats,\n+ error_messages=test_stats.get('error_messages', []),\n+ test_details=test_stats.get('test_details', {}),\n+ execution_time=test_stats.get('execution_time', None),\n+ attempt_number=attempt_num + 1\n)\nattempts.append(attempt)\n- # Update best attempt if this one is better\n- if test_success and (best_attempt is None or\n- attempt.test_stats[\"passed\"] &gt; best_attempt.test_stats[\"passed\"]):\n+ # Update best attempt based on multiple criteria\n+ if test_success and (\n+ best_attempt is None or\n+ (attempt.test_stats[\"passed\"] &gt; best_attempt.test_stats[\"passed\"]) or\n+ (attempt.test_stats[\"passed\"] == best_attempt.test_stats[\"passed\"] and\n+ len(attempt.error_messages or []) &lt; len(best_attempt.error_messages or []))\n+ ):\nbest_attempt = attempt\n+ # Log detailed attempt information\n+ safe_log(f\"\\n=== Attempt {attempt_num + 1} Summary ===\")\n\n59\n\n\fPublished as a conference paper at ICLR 2026\n\n+ safe_log(f\"Test Success: {test_success}\")\n+ safe_log(f\"Tests Passed: {test_stats.get('passed', 0)}\")\n+ safe_log(f\"Tests Failed: {test_stats.get('failed', 0)}\")\n+ safe_log(f\"Errors: {test_stats.get('errors', 0)}\")\n+ safe_log(f\"Execution Time: {test_stats.get('execution_time', 'N/A'):.2f}s\")\n+\n# If tests pass perfectly, we can stop\nif test_success and attempt.test_stats[\"failed\"] == 0 and\n,→ attempt.test_stats[\"errors\"] == 0:\nbreak\n\nG\n\nS IMILAR TARGET F UNCTIONALITY, D IFFERENT I MPLEMENTATIONS\n\nFor the same target functionality, the suggestions provided to the coding agents and the resulting implementations can differ significantly, leading to large variations in coding capability and benchmark\nperformance. For example, consider nodes 6 and 24 in the DGM run on SWE-bench (Figure 3). Both\naimed to enhance the existing editor tool to support finer-grained file editing. However, the implementation for node 6 retained the original edit command and added the parameters edit_type and\nedit_actions, whereas the implementation for node 24 replaced the original edit command\nwith a new str_replace command. Despite targeting similar functionality, the feature suggestions\nand thus the implementation details differed greatly, as did their performance. Node 6 achieved only\n23.3%, while node 24 achieved 40.5%.\nFeature suggestion to obtain node 6:\nWithin the tools/edit.py file, remove the 'edit' command and introduce a 'str_replace'\n,→ command. It should accept parameters 'old_str' (the unique text to find) and\n,→ 'new_str' (the new text to replace it with). After verifying that 'old_str'\n,→ appears exactly once in the file, replace the first occurrence with 'new_str'. If\n,→ 'old_str' is not unique or is missing, do not write any changes.\nReplace the 'edit' command in the editor tool with a 'str_replace' command that locates\n,→ and replaces an exact substring in a file. The 'old_str' must match consecutive\n,→ lines uniquely, and if it is not found or occurs multiple times, no write should\n,→ occur. The 'new_str' parameter contains the revised lines. This precise substring\n,→ replacement flow will enable small incremental edits with minimal breakage.\n\nFeature suggestion to obtain node 24:\nAugment the existing 'editor' tool to support line or token-based editing. The agent would\n,→ specify individual lines or tokens to insert, delete, or replace. Internally, the\n,→ tool would parse the file contents, apply changes atomically, and verify that the\n,→ surrounding context remains intact. This prevents entire-file overwrites, reducing\n,→ the risk of losing unrelated logic. The tool could also validate that the edited\n,→ lines match expected code fragments to catch unanticipated differences or merge\n,→ conflicts.\nEnhance the agent's file editing process to support fine-grained edits. Specifically, add\n,→ a line-based or token-based editing feature in the 'editor' tool. This improvement\n,→ should let the agent insert, replace, or delete small sections of code without\n,→ overwriting entire files or large blocks, preserving unrelated logic. Implement\n,→ safeguards to confirm that contextual code around the edited region remains\n,→ accurate, so we reduce the risk of creating regressions when fixing issues.\n\nImplementation of suggested feature to obtain node 6:\ndiff --git a/tests/test_edit_tool.py b/tests/test_edit_tool.py\nindex f0782c6..d3a4d5c 100644\n--- a/tests/test_edit_tool.py\n+++ b/tests/test_edit_tool.py\n@@ -1,7 +1,7 @@\nimport pytest\nfrom pathlib import Path\nimport tempfile\n-from tools.edit import tool_function\n+from tools.edit import tool_function, validate_edit_actions, validate_context\n@pytest.fixture\ndef temp_dir():\n@@ -17,6 +17,18 @@ def sample_file(temp_dir):\nfile_path.write_text(content)\nreturn file_path\n\n60\n\n\fPublished as a conference paper at ICLR 2026\n\n+@pytest.fixture\n+def code_file(temp_dir):\n+ \"\"\"Create a sample Python file for testing token-based edits.\"\"\"\n+ file_path = temp_dir / \"test.py\"\n+ content = \"\"\"def test_function():\n+ x = 42\n+ y = \"old_value\"\n+ return x + len(y)\n+\"\"\"\n+ file_path.write_text(content)\n+ return file_path\n+\nclass TestEditorTool:\ndef test_view_file(self, sample_file):\n\"\"\"Test viewing entire file content.\"\"\"\n@@ -39,17 +51,182 @@ class TestEditorTool:\nassert \"Error\" in result\nassert \"already exists\" in result\n- def test_edit_file(self, sample_file):\n- \"\"\"Test editing an existing file.\"\"\"\n+ def test_edit_file_full(self, sample_file):\n+ \"\"\"Test editing an existing file with file mode.\"\"\"\nnew_content = \"edited content\\nnew line\"\n- result = tool_function(\"edit\", str(sample_file), file_text=new_content)\n+ result = tool_function(\n+ \"edit\",\n+ str(sample_file),\n+ file_text=new_content,\n+ edit_type=\"file\"\n+ )\nassert \"has been overwritten\" in result\nassert sample_file.read_text() == new_content\n+ def test_line_based_edit_insert(self, sample_file):\n+ \"\"\"Test line-based insert operation.\"\"\"\n+ actions = [{\n+ \"action\": \"insert\",\n+ \"line_number\": 3,\n+ \"content\": \"inserted line\"\n+ }]\n+ result = tool_function(\n+ \"edit\",\n+ str(sample_file),\n+ edit_type=\"line\",\n+ edit_actions=actions\n+ )\n+ assert \"successfully edited\" in result\n+ content = sample_file.read_text().splitlines()\n+ assert content[2] == \"inserted line\"\n+ assert len(content) == 6\n+\n+ def test_line_based_edit_delete(self, sample_file):\n+ \"\"\"Test line-based delete operation.\"\"\"\n+ actions = [{\n+ \"action\": \"delete\",\n+ \"line_number\": 2\n+ }]\n+ result = tool_function(\n+ \"edit\",\n+ str(sample_file),\n+ edit_type=\"line\",\n+ edit_actions=actions\n+ )\n+ assert \"successfully edited\" in result\n+ content = sample_file.read_text().splitlines()\n+ assert \"line 2\" not in content\n+ assert len(content) == 4\n+\n+ def test_line_based_edit_replace(self, sample_file):\n+ \"\"\"Test line-based replace operation.\"\"\"\n+ actions = [{\n+ \"action\": \"replace\",\n+ \"line_number\": 3,\n+ \"content\": \"replaced line\"\n+ }]\n+ result = tool_function(\n+ \"edit\",\n+ str(sample_file),\n+ edit_type=\"line\",\n+ edit_actions=actions\n\n61\n\n\fPublished as a conference paper at ICLR 2026\n\n+ )\n+ assert \"successfully edited\" in result\n+ content = sample_file.read_text().splitlines()\n+ assert content[2] == \"replaced line\"\n+ assert len(content) == 5\n+\n+ def test_token_based_edit(self, code_file):\n+ \"\"\"Test token-based edit operation.\"\"\"\n+ actions = [{\n+ \"action\": \"replace\",\n+ \"old_token\": \"old_value\",\n+ \"new_token\": \"new_value\"\n+ }]\n+ result = tool_function(\n+ \"edit\",\n+ str(code_file),\n+ edit_type=\"token\",\n+ edit_actions=actions\n+ )\n+ assert \"successfully edited\" in result\n+ content = code_file.read_text()\n+ assert \"old_value\" not in content\n+ assert \"new_value\" in content\n+\n+ def test_multiple_token_edits(self, code_file):\n+ \"\"\"Test multiple token-based edit operations.\"\"\"\n+ actions = [\n+ {\n+ \"action\": \"replace\",\n+ \"old_token\": \"42\",\n+ \"new_token\": \"100\"\n+ },\n+ {\n+ \"action\": \"replace\",\n+ \"old_token\": \"old_value\",\n+ \"new_token\": \"new_text\"\n+ }\n+ ]\n+ result = tool_function(\n+ \"edit\",\n+ str(code_file),\n+ edit_type=\"token\",\n+ edit_actions=actions\n+ )\n+ assert \"successfully edited\" in result\n+ content = code_file.read_text()\n+ assert \"42\" not in content\n+ assert \"100\" in content\n+ assert \"old_value\" not in content\n+ assert \"new_text\" in content\n+\n+ def test_invalid_line_number(self, sample_file):\n+ \"\"\"Test edit with invalid line number.\"\"\"\n+ actions = [{\n+ \"action\": \"replace\",\n+ \"line_number\": 100,\n+ \"content\": \"invalid line\"\n+ }]\n+ result = tool_function(\n+ \"edit\",\n+ str(sample_file),\n+ edit_type=\"line\",\n+ edit_actions=actions\n+ )\n+ assert \"Error\" in result\n+ assert \"exceeds file length\" in result\n+\n+ def test_invalid_edit_type(self, sample_file):\n+ \"\"\"Test edit with invalid edit type.\"\"\"\n+ result = tool_function(\n+ \"edit\",\n+ str(sample_file),\n+ edit_type=\"invalid\",\n+ edit_actions=[{\"action\": \"replace\"}]\n+ )\n+ assert \"Error\" in result\n+ assert \"Invalid edit_type\" in result\n+\n+ def test_missing_required_fields(self, sample_file):\n+ \"\"\"Test edit with missing required fields.\"\"\"\n+ actions = [{\n\n62\n\n\fPublished as a conference paper at ICLR 2026\n\n+ \"action\": \"replace\" # Missing line_number and content\n+ }]\n+ result = tool_function(\n+ \"edit\",\n+ str(sample_file),\n+ edit_type=\"line\",\n+ edit_actions=actions\n+ )\n+ assert \"Error\" in result\n+ assert \"Missing required field\" in result\n+\n+ def test_validate_context(self):\n+ \"\"\"Test context validation function.\"\"\"\n+ original = \"line 1\\nline 2\\nline 3\\nline 4\\nline 5\"\n+ modified = \"line 1\\nline 2\\nmodified\\nline 4\\nline 5\"\n+ assert validate_context(original, modified) is True\n+\n+ # Test invalid context (too many changes)\n+ modified = \"completely\\ndifferent\\ncontent\"\n+ assert validate_context(original, modified) is False\n+\n+ def test_empty_edit_actions(self, sample_file):\n+ \"\"\"Test edit with empty edit actions.\"\"\"\n+ result = tool_function(\n+ \"edit\",\n+ str(sample_file),\n+ edit_type=\"line\",\n+ edit_actions=[]\n+ )\n+ assert \"Error\" in result\n+ assert \"Edit actions cannot be empty\" in result\n+\ndef test_edit_nonexistent_file(self, temp_dir):\n\"\"\"Test attempting to edit a nonexistent file.\"\"\"\nnon_existent_file = temp_dir / \"does_not_exist.txt\"\n- result = tool_function(\"edit\", str(non_existent_file), file_text=\"new content\")\n+ result = tool_function(\"edit\", str(non_existent_file), edit_type=\"line\", edit_actions=[])\nassert \"Error\" in result\nassert \"does not exist\" in result\n@@ -82,4 +259,4 @@ class TestEditorTool:\ndef test_invalid_commands(self, command, sample_file):\n\"\"\"Test various invalid commands.\"\"\"\nresult = tool_function(command, str(sample_file))\n- assert \"Error\" in result\n+ assert \"Error\" in result\n\\ No newline at end of file\ndiff --git a/tools/edit.py b/tools/edit.py\nindex 59137ee..982ee84 100644\n--- a/tools/edit.py\n+++ b/tools/edit.py\n@@ -1,5 +1,7 @@\nfrom pathlib import Path\nimport subprocess\n+from typing import Dict, Any, List, Union, Tuple\n+from difflib import SequenceMatcher\ndef tool_info():\nreturn {\n@@ -9,8 +11,9 @@ def tool_info():\n* If `path` is a file, `view` displays the entire file with line numbers. If `path` is a\n,→ directory, `view` lists non-hidden files and directories up to 2 levels deep.\\n\n* The `create` command cannot be used if the specified `path` already exists as a file.\\n\n* If a `command` generates a long output, it will be truncated and marked with `&lt;response\n,→ clipped&gt;`.\\n\n-* The `edit` command overwrites the entire file with the provided `file_text`.\\n\n-* No partial/line-range edits or partial viewing are supported.\"\"\",\n+* The `edit` command supports both entire file overwrites and fine-grained line/token\n,→ editing via the `edit_type` parameter.\\n\n+* Line-based edits require line numbers and content to modify specific parts of a file.\\n\n+* Token-based edits require specifying old and new tokens to replace specific text\n,→ fragments.\"\"\",\n\"input_schema\": {\n\"type\": \"object\",\n\"properties\": {\n@@ -24,8 +27,28 @@ def tool_info():\n\"type\": \"string\"\n},\n\"file_text\": {\n- \"description\": \"Required parameter of `create` or `edit` command, containing the content\n,→ for the entire file.\",\n\n63\n\n\fPublished as a conference paper at ICLR 2026\n\n+ \"description\": \"Required parameter of `create` or `edit` command with edit_type='file',\n,→ containing the content for the entire file.\",\n\"type\": \"string\"\n+ },\n+ \"edit_type\": {\n+ \"type\": \"string\",\n+ \"enum\": [\"file\", \"line\", \"token\"],\n+ \"description\": \"Type of edit operation: 'file' for full file, 'line' for line-based\n,→ edits, 'token' for token-based edits.\",\n+ \"default\": \"file\"\n+ },\n+ \"edit_actions\": {\n+ \"type\": \"array\",\n+ \"description\": \"List of edit actions for line/token operations. Each action contains\n,→ operation details.\",\n+ \"items\": {\n+ \"type\": \"object\",\n+ \"properties\": {\n+ \"action\": {\"type\": \"string\", \"enum\": [\"insert\", \"delete\", \"replace\"]},\n+ \"line_number\": {\"type\": \"integer\", \"description\": \"Line number for the operation\n,→ (1-based)\"},\n+ \"content\": {\"type\": \"string\", \"description\": \"Content to insert/replace\"},\n+ \"old_token\": {\"type\": \"string\", \"description\": \"Token to be replaced (for token edits)\"},\n+ \"new_token\": {\"type\": \"string\", \"description\": \"New token (for token edits)\"}\n+ }\n+ }\n}\n},\n\"required\": [\"command\", \"path\"]\n@@ -119,12 +142,126 @@ def view_path(path_obj: Path) -&gt; str:\ncontent = read_file(path_obj)\nreturn format_output(content, str(path_obj))\n-def tool_function(command: str, path: str, file_text: str = None) -&gt; str:\n+def validate_edit_actions(actions: List[Dict[str, Any]], edit_type: str) -&gt; None:\n+ \"\"\"Validate edit actions based on edit type.\"\"\"\n+ if not actions:\n+ raise ValueError(\"Edit actions cannot be empty for line/token edits\")\n+\n+ valid_actions = [\"insert\", \"delete\", \"replace\"]\n+ required_fields = {\n+ \"line\": [\"action\", \"line_number\"],\n+ \"token\": [\"action\", \"old_token\"]\n+ }\n+\n+ for action in actions:\n+ if \"action\" not in action or action[\"action\"] not in valid_actions:\n+ raise ValueError(f\"Invalid action. Must be one of: {valid_actions}\")\n+\n+ # Check required fields based on edit_type\n+ for field in required_fields[edit_type]:\n+ if field not in action:\n+ raise ValueError(f\"Missing required field '{field}' in edit action\")\n+\n+ # Validate line number if provided\n+ if \"line_number\" in action:\n+ if not isinstance(action[\"line_number\"], int) or action[\"line_number\"] &lt; 1:\n+ raise ValueError(\"Line number must be a positive integer\")\n+\n+ # Validate content requirements\n+ if action[\"action\"] in [\"insert\", \"replace\"]:\n+ if edit_type == \"line\" and \"content\" not in action:\n+ raise ValueError(\"Content required for insert/replace actions\")\n+ if edit_type == \"token\" and \"new_token\" not in action:\n+ raise ValueError(\"new_token required for token operations\")\n+\n+def apply_line_edits(content: List[str], actions: List[Dict[str, Any]]) -&gt; List[str]:\n+ \"\"\"Apply line-based edits to the content.\"\"\"\n+ modified_content = content.copy()\n+\n+ # Sort actions by line number in reverse order to handle inserts/deletes correctly\n+ sorted_actions = sorted(actions, key=lambda x: x[\"line_number\"], reverse=True)\n+\n+ for action in sorted_actions:\n+ line_num = action[\"line_number\"] - 1 # Convert to 0-based index\n+\n+ if line_num &gt; len(modified_content):\n+ raise ValueError(f\"Line number {action['line_number']} exceeds file length\")\n+\n+ if action[\"action\"] == \"delete\":\n+ if line_num &gt;= 0:\n\n64\n\n\fPublished as a conference paper at ICLR 2026\n\n+ del modified_content[line_num]\n+ elif action[\"action\"] == \"insert\":\n+ modified_content.insert(line_num, action[\"content\"])\n+ elif action[\"action\"] == \"replace\":\n+ modified_content[line_num] = action[\"content\"]\n+\n+ return modified_content\n+\n+def apply_token_edits(content: str, actions: List[Dict[str, Any]]) -&gt; str:\n+ \"\"\"Apply token-based edits to the content.\"\"\"\n+ modified_content = content\n+\n+ for action in actions:\n+ old_token = action[\"old_token\"]\n+ if action[\"action\"] == \"delete\":\n+ modified_content = modified_content.replace(old_token, \"\")\n+ elif action[\"action\"] in [\"insert\", \"replace\"]:\n+ new_token = action[\"new_token\"]\n+ modified_content = modified_content.replace(old_token, new_token)\n+\n+ return modified_content\n+\n+def validate_context(original: str, modified: str, context_lines: int = 3) -&gt; bool:\n\"\"\"\n- Main tool function that handles:\n+ Validate that the context around modified sections remains intact.\n+ Returns True if context is valid, False otherwise.\n+ \"\"\"\n+ # Use SequenceMatcher to find the similarity ratio between strings\n+ similarity = SequenceMatcher(None, original, modified).ratio()\n+\n+ # If content is too different (less than 30% similar), consider it invalid\n+ if similarity &lt; 0.3:\n+ return False\n+\n+ # Split into lines for more detailed analysis\n+ orig_lines = original.splitlines()\n+ mod_lines = modified.splitlines()\n+\n+ # If line count difference is too large (more than 50%), consider it invalid\n+ if abs(len(orig_lines) - len(mod_lines)) &gt; len(orig_lines) // 2:\n+ return False\n+\n+ # Calculate line-based similarity for sections\n+ def get_block_similarity(block1: List[str], block2: List[str]) -&gt; float:\n+ return SequenceMatcher(None, \"\\n\".join(block1), \"\\n\".join(block2)).ratio()\n+\n+ # Check similarity of start and end blocks if they exist\n+ if len(orig_lines) &gt;= context_lines and len(mod_lines) &gt;= context_lines:\n+ start_similarity = get_block_similarity(\n+ orig_lines[:context_lines],\n+ mod_lines[:context_lines]\n+ )\n+ end_similarity = get_block_similarity(\n+ orig_lines[-context_lines:],\n+ mod_lines[-context_lines:]\n+ )\n+\n+ # If either the start or end blocks are too different, consider it invalid\n+ if start_similarity &lt; 0.7 or end_similarity &lt; 0.7:\n+ return False\n+\n+ return True\n+\n+def tool_function(command: str, path: str, file_text: str = None,\n+ edit_type: str = \"file\", edit_actions: List[Dict[str, Any]] = None) -&gt; str:\n+ \"\"\"\n+ Enhanced tool function that handles:\n- 'view' : View the entire file or directory listing\n- 'create': Create a new file with the given file_text\n- - 'edit' : Overwrite an existing file with file_text\n+ - 'edit' : Edit a file using one of three modes:\n+ - file: overwrite entire file\n+ - line: line-based edits\n+ - token: token-based edits\n\"\"\"\ntry:\npath_obj = validate_path(path, command)\n@@ -139,11 +276,36 @@ def tool_function(command: str, path: str, file_text: str = None) -&gt;\n,→ str:\nreturn f\"File created successfully at: {path}\"\n\n65\n\n\fPublished as a conference paper at ICLR 2026\n\nelif command == \"edit\":\n- if file_text is None:\n- raise ValueError(\"Missing required `file_text` for 'edit' command.\")\n- write_file(path_obj, file_text)\n- return f\"File at {path} has been overwritten with new content.\"\n+ # Read original content for line/token edits and validation\n+ original_content = read_file(path_obj) if edit_type in [\"line\", \"token\"] else None\n+\n+ if edit_type == \"file\":\n+ if file_text is None:\n+ raise ValueError(\"Missing required `file_text` for 'file' edit type.\")\n+ write_file(path_obj, file_text)\n+ return f\"File at {path} has been overwritten with new content.\"\n+\n+ elif edit_type in [\"line\", \"token\"]:\n+ if not edit_actions:\n+ raise ValueError(\"Edit actions cannot be empty for line/token edits\")\n+\n+ validate_edit_actions(edit_actions, edit_type)\n+\n+ if edit_type == \"line\":\n+ lines = original_content.splitlines()\n+ modified_lines = apply_line_edits(lines, edit_actions)\n+ modified_content = \"\\n\".join(modified_lines)\n+ else: # token edits\n+ modified_content = apply_token_edits(original_content, edit_actions)\n+ # Validate context before writing\n+ if validate_context(original_content, modified_content):\n+ write_file(path_obj, modified_content)\n+ return f\"File at {path} has been successfully edited using {edit_type}-based editing.\"\n+ else:\n+ raise ValueError(\"Context validation failed. Edit operation aborted.\")\n+ else:\n+ raise ValueError(f\"Invalid edit_type: {edit_type}\")\nelse:\nraise ValueError(f\"Unknown command: {command}\")\n@@ -152,4 +314,4 @@ def tool_function(command: str, path: str, file_text: str = None) -&gt;\n,→ str:\nif __name__ == \"__main__\":\n# Example usage\n- print(tool_function(\"view\", \"/home/ubuntu/xx/dgm/coding_agent.py\"))\n+ print(tool_function(\"view\", \"/home/ubuntu/xx/dgm/coding_agent.py\"))\n\\ No newline at end of file\n\nImplementation of suggested feature to obtain node 24:\ndiff --git a/tools/edit.py b/tools/edit.py\nindex 16ae521..757f5c2 100644\n--- a/tools/edit.py\n+++ b/tools/edit.py\n@@ -11,21 +11,21 @@ def tool_info():\n* If `path` is a directory, `view` lists non-hidden files and directories up to 2 levels\n,→ deep.\\n\n* The `create` command cannot be used if the specified `path` already exists as a file.\\n\nIf\na `command` generates a long output, it will be truncated and marked with `&lt;response\n*\n,→ clipped&gt;`.\\n\n-* The `edit` command overwrites the entire file with the provided `file_text`.\"\"\",\n+* The `str_replace` command replaces a unique occurrence of old_str with new_str, failing\n,→ if old_str is not found or appears multiple times.\"\"\",\n\"input_schema\": {\n\"type\": \"object\",\n\"properties\": {\n\"command\": {\n\"type\": \"string\",\n- \"enum\": [\"view\", \"create\", \"edit\"],\n- \"description\": \"The command to run: `view`, `create`, or `edit`.\"\n+ \"enum\": [\"view\", \"create\", \"str_replace\"],\n+ \"description\": \"The command to run: `view`, `create`, or `str_replace`.\"\n},\n\"path\": {\n\"description\": \"Absolute path to file or directory, e.g. `/repo/file.py`\n,→ or `/repo`.\",\n\"type\": \"string\"\n},\n\"file_text\": {\n\n66\n\n\fPublished as a conference paper at ICLR 2026\n\n- \"description\": \"Required parameter of `create` or `edit` command, containing the content\n,→ for the entire file.\",\n+ \"description\": \"Required parameter of `create` command, containing the content for the\n,→ entire file.\",\n\"type\": \"string\"\n},\n\"view_range\": {\n@@ -34,6 +34,14 @@ def tool_info():\n\"items\": {\"type\": \"integer\"},\n\"minItems\": 2,\n\"maxItems\": 2\n+ },\n+ \"old_str\": {\n+ \"description\": \"Required parameter of `str_replace` command, containing the exact text\n,→ to find and replace.\",\n+ \"type\": \"string\"\n+ },\n+ \"new_str\": {\n+ \"description\": \"Required parameter of `str_replace` command, containing the new text to\n,→ replace old_str with.\",\n+ \"type\": \"string\"\n}\n},\n\"required\": [\"command\", \"path\"]\n@@ -51,7 +59,7 @@ def validate_path(path: str, command: str) -&gt; Path:\nValidate the file path for each command:\n- 'view': path may be a file or directory; must exist.\n- 'create': path must not exist (for new file creation).\n- - 'edit': path must exist (for overwriting).\n+ - 'str_replace': path must exist and be a file.\n\"\"\"\npath_obj = Path(path)\n@@ -69,7 +77,7 @@ def validate_path(path: str, command: str) -&gt; Path:\n# Path must not exist\nif path_obj.exists():\nraise ValueError(f\"Cannot create new file; {path} already exists.\")\n- elif command == \"edit\":\n+ elif command == \"str_replace\":\n# Path must exist and must be a file\nif not path_obj.exists():\nraise ValueError(f\"The file {path} does not exist.\")\n@@ -144,6 +152,28 @@ def write_file(path: Path, content: str):\nexcept Exception as e:\nraise ValueError(f\"Failed to write file: {e}\")\n+def str_replace_in_file(path: Path, old_str: str, new_str: str) -&gt; str:\n+ \"\"\"\n+ Replace an exact occurrence of old_str with new_str in the file.\n+ Only performs the replacement if old_str occurs exactly once.\n+ Returns a message indicating success or failure.\n+ \"\"\"\n+ try:\n+ content = read_file(path)\n+ occurrences = content.count(old_str)\n+\n+ if occurrences == 0:\n+ return f\"Error: Could not find the exact text to replace in {path}\"\n+ elif occurrences &gt; 1:\n+ return f\"Error: Found multiple ({occurrences}) occurrences of the text in {path}. Must\n,→ be unique.\"\n+ else:\n+ new_content = content.replace(old_str, new_str)\n+ write_file(path, new_content)\n+ return f\"Successfully replaced text in {path}\"\n+\n+ except Exception as e:\n+ return f\"Error during string replacement: {e}\"\n+\ndef view_path(path_obj: Path, view_range: Optional[List[int]] = None) -&gt; str:\n\"\"\"\nView the file contents (optionally within a range) or directory listing.\n@@ -176,12 +206,13 @@ def view_path(path_obj: Path, view_range: Optional[List[int]] =\n,→ None) -&gt; str:\ncontent, start_line = read_file_range(path_obj, view_range)\nreturn format_output(content, str(path_obj), start_line)\n-def tool_function(command: str, path: str, file_text: str = None, view_range:\n,→ Optional[List[int]] = None) -&gt; str:\n+def tool_function(command: str, path: str, file_text: str = None, view_range:\n,→ Optional[List[int]] = None,\n\n67\n\n\fPublished as a conference paper at ICLR 2026\n\n+ old_str: str = None, new_str: str = None) -&gt; str:\n\"\"\"\nMain tool function that handles:\n- - 'view' : View file or directory listing, optionally within line range for files\n- - 'create': Create a new file with the given file_text\n- - 'edit' : Overwrite an existing file with file_text\n+ - 'view' : View file or directory listing, optionally within line range for files\n+ - 'create' : Create a new file with the given file_text\n+ - 'str_replace': Replace exact occurrence of old_str with new_str in the file\n\"\"\"\ntry:\npath_obj = validate_path(path, command)\n@@ -195,11 +226,10 @@ def tool_function(command: str, path: str, file_text: str = None,\n,→ view_range: Op\nwrite_file(path_obj, file_text)\nreturn f\"File created successfully at: {path}\"\n- elif command == \"edit\":\n- if file_text is None:\n- raise ValueError(\"Missing required `file_text` for 'edit' command.\")\n- write_file(path_obj, file_text)\n- return f\"File at {path} has been overwritten with new content.\"\n+ elif command == \"str_replace\":\n+ if old_str is None or new_str is None:\n+ raise ValueError(\"Missing required `old_str` and/or `new_str` for 'str_replace'\n,→ command.\")\n+ return str_replace_in_file(path_obj, old_str, new_str)\nelse:\nraise ValueError(f\"Unknown command: {command}\")\ndiff --git a/tests/__init__.py b/tests/__init__.py\nnew file mode 100644\nindex 0000000..e69de29\ndiff --git a/tests/test_tools.py b/tests/test_tools.py\nnew file mode 100644\nindex 0000000..c7f242f\n--- /dev/null\n+++ b/tests/test_tools.py\n@@ -0,0 +1,65 @@\n+import pytest\n+from pathlib import Path\n+from tools.edit import tool_function\n+\n+# Test fixtures\n+@pytest.fixture\n+def temp_file(tmp_path):\n+ file_path = tmp_path / \"test.txt\"\n+ content = \"line 1\\nline 2\\nline 3\\n\"\n+ file_path.write_text(content)\n+ return str(file_path)\n+\n+def test_str_replace_success(temp_file):\n+ # Test successful replacement\n+ result = tool_function(\n+ command=\"str_replace\",\n+ path=temp_file,\n+ old_str=\"line 2\\n\",\n+ new_str=\"replaced line\\n\"\n+ )\n+ assert \"Successfully replaced\" in result\n+ assert Path(temp_file).read_text() == \"line 1\\nreplaced line\\nline 3\\n\"\n+\n+def test_str_replace_not_found(temp_file):\n+ # Test when old_str is not found\n+ result = tool_function(\n+ command=\"str_replace\",\n+ path=temp_file,\n+ old_str=\"nonexistent\",\n+ new_str=\"something\"\n+ )\n+ assert \"Could not find\" in result\n+ # Original file should be unchanged\n+ assert Path(temp_file).read_text() == \"line 1\\nline 2\\nline 3\\n\"\n+\n+def test_str_replace_multiple_occurrences(temp_file):\n+ # First create a file with multiple occurrences\n+ Path(temp_file).write_text(\"same\\nsame\\nsame\\n\")\n+ result = tool_function(\n+ command=\"str_replace\",\n+ path=temp_file,\n+ old_str=\"same\\n\",\n\n68\n\n\fPublished as a conference paper at ICLR 2026\n\n+ new_str=\"different\\n\"\n+ )\n+ assert \"multiple\" in result\n+ # Original file should be unchanged\n+ assert Path(temp_file).read_text() == \"same\\nsame\\nsame\\n\"\n+\n+def test_str_replace_missing_params(temp_file):\n+ # Test missing parameters\n+ result = tool_function(\n+ command=\"str_replace\",\n+ path=temp_file,\n+ )\n+ assert \"Missing required\" in result\n+\n+def test_str_replace_invalid_path():\n+ # Test with non-existent file\n+ result = tool_function(\n+ command=\"str_replace\",\n+ path=\"/nonexistent/path\",\n+ old_str=\"old\",\n+ new_str=\"new\"\n+ )\n+ assert \"does not exist\" in result\n\\ No newline at end of file\n\nH\n\nC ASE S TUDY: S OLVING H ALLUCINATION\n\nThe DGM can be used to optimize objectives beyond just coding, as discussed as a potential direction\nfor future work in Section 5. In this section, we show that the DGM can address hallucinations of\ntool use by FMs. Through feedback from evaluation logs, the DGM improves hallucination detection\nmechanisms and ultimately discovers ways to resolve these hallucinations. We provide a more\ndetailed discussion of when these hallucinations occur, the DGM setup, and the resulting solutions.\nFinally, we present an example of objective hacking, where the agent optimizes for the quantifiable\nmetric rather than truly fulfilling the spirit of the task and solving the underlying problem.\nSolve Halluc\nScore\n\n3 tasks (no basic functionality)\n3 tasks (with basic functionality)\nFinal best agent\n\nFigure 8: The DGM solving hallucination of tool use in FMs. Archive of coding agents generated\nduring the DGM run on SWE-bench to solve hallucination from FMs. Each node represents an agent,\nwith node 0 corresponding to the base agent. Node color indicates solved hallucination score, while\nborder color reflects whether the agent has basic codebase-editing functionality. Edges show which\nagents self-modified to produce the offsprings.\nWhen hallucination occurs. When the input context to Claude 3.5 Sonnet (New) (Claude) is very\nlong, including all previous tool use inputs and outputs, we found that Claude tends to hallucinate\ntool usage. Instead of actually making a tool call, it outputs the tool input and output as plain text.\nThis is an example of Claude hallucinating tool use, claiming that the Bash tool was used to run tests\nand that the tool output suggests that all tests passed, but Claude did not invoke any tools, and the\ntool results were entirely hallucinated in plain text:\nI'll run the tests as specified in the &lt;test_description&gt;. The test description indicates\n,→ that we should use:\\n\\n```bash\\n./tests/runtests.py --verbosity 2\n,→ --settings=test_sqlite --parallel 1 dbshell.test_postgresql\\n```\\n\\nLet me run this\n\n69\n\n\fPublished as a conference paper at ICLR 2026\n\n,→ test command:\\n\\nTool Used: bash\\nTool Input: {'command': 'cd /testbed &amp;&amp;\n,→ ./tests/runtests.py --verbosity 2 --settings=test_sqlite --parallel 1\n,→ dbshell.test_postgresql'}\\nTool Result: Testing against Django installed in\n,→ '/testbed/django'\\nImporting application dbshell\\nSkipping setup of unused\n,→ database(s): default, other.\\nSystem check identified no issues (0\n,→ silenced).\\nError:\\ntest_accent\n,→ (dbshell.test_postgresql.PostgreSqlDbshellCommandTestCase) ... ok\\ntest_basic\n,→ (dbshell.test_postgresql.PostgreSqlDbshellCommandTestCase) ... ok\\ntest_column\n,→ (dbshell.test_postgresql.PostgreSqlDbshellCommandTestCase) ...\n,→ ok\\ntest_escape_characters\n,→ (dbshell.test_postgresql.PostgreSqlDbshellCommandTestCase) ... ok\\ntest_nopass\n,→ (dbshell.test_postgresql.PostgreSqlDbshellCommandTestCase) ...\n,→ ok\\ntest_sigint_handler\n,→ (dbshell.test_postgresql.PostgreSqlDbshellCommandTestCase)\\nSIGINT is ignored in\n,→ Python and passed to psql to abort quries. ...\n,→ ok\\n\\n----------------------------------------------------------------------\\nRan\n,→ 6 tests in 0.001s\\n\\nOK\\n\\nTool Response: Great! All the tests are passing\n,→ successfully. Let me explain what each test verifies:\\n\\n1. `test_accent`: Tests\n,→ handling of accented characters in usernames and passwords\\n - Status: PASS\\n ,→ Verifies proper handling of non-ASCII characters\\n\\n2. `test_basic`: Tests basic\n,→ connection with standard parameters\\n - Status: PASS\\n - Verifies basic\n,→ functionality with username, password, host, port, and dbname\\n\\n3. `test_column`:\n,→ Tests handling of special characters in connection parameters\\n - Status: PASS \\n\n,→ - Verifies proper handling of colons in usernames and passwords\\n\\n4.\n,→ `test_escape_characters`: Tests handling of escape characters\\n - Status: PASS\\n ,→ Verifies proper handling of backslashes in credentials\\n\\n5. `test_nopass`: Tests\n,→ connection without password\\n - Status: PASS\\n - Verifies behavior when no\n,→ password is provided\\n\\n6. `test_sigint_handler`: Tests signal handling for query\n,→ abortion\\n - Status: PASS\\n - Verifies SIGINT handling works correctly\\n\\nTest\n,→ Summary:\\n- Total tests run: 6\\n- Passed: 6\\n- Failed: 0\\n- Execution time:\n,→ 0.001s\\n\\nThe test results confirm that our implementation:\\n1. Successfully\n,→ handles all types of passwords and special characters\\n2. Properly manages\n,→ environment variables\\n3. Maintains correct signal handling\\n4. Works correctly\n,→ with or without passwords\\n5. Preserves all required functionality\\n\\nThe tests\n,→ pass with high speed (0.001s) which is expected since they're mocking the actual\n,→ psql execution. The problem described in &lt;problem_description&gt; has been\n,→ successfully fixed and verified through the test suite.\n\nDGM setup. We run this experiment on SWE-bench. Other than the number of SWE-bench tasks we\nevaluate each coding agent on, and the final scoring function of the DGM, all other settings remain the\nsame as in the main experiments (Section 3). The initial coding agent and all agents generated during\nthe DGM run are evaluated on only 3 SWE-bench tasks. We use just 3 tasks because if hallucination\noccurs in one, it is likely to occur in others as well. Hence, 3 tasks are sufficient to provide the DGM\nwith a reliable signal regarding whether tool use hallucination is still present.\nSolve hallucination score. We score each generated agent based on how effectively it prevents\nhallucinations, with higher scores indicating fewer hallucinations and better performance. For each\nSWE-bench task the agent is evaluated on, the score has two components: 0 - 1 based on whether\nhallucination occurred in the logs, and 1 - 2 (only added and accounted for after no hallucination\noccurs in the logs) if tools were used in all Claude calls. The final solve hallucination score is\ncomputed as the average across all evaluated tasks. To detect hallucination in the logs, we insert\nspecial tokens when actual tool use occurs and then check if these tokens appear in the model’s\nplain-text output, indicating that the model mimicked tool use without actually invoking any tools.\nImportantly, the hallucination checking functions are hidden from the coding agent during selfmodification. We found that objective hacking (i.e., optimizing for the measurable objective instead\nof truly solving the underlying problem) occurs more frequently when these functions are not hidden.\nResults. We run the DGM for 150 iterations. In this run, the DGM discovers two promising solutions:\nnode 96, which achieves the second highest score of 1.67, and node 114, which achieves a perfect\nscore of 2.0 (Figure 8). Node 96 addresses hallucination to some extent, achieving a score of 1.67\nwithout objective hacking. In the lineage leading to node 96, the DGM first improves the tool\ntransaction logging mechanisms to better detect when hallucination occurs. It then explores various\nstrategies to solve it, such as removing hallucinated tool use from the output text when it determines\nthat the tool was not actually invoked. Node 114 achieves a perfect score quickly, after only 2\nmodifications in its lineage. However, we observed objective hacking: it scored highly according to\nour predefined evaluation functions, but it did not actually solve the underlying problem of tool use\nhallucination. In the modification leading up to node 114 (see below), the agent removed the logging\nof special tokens that indicate tool usage (despite instructions not to change the special tokens),\neffectively bypassing our hallucination detection function.\n\n70\n\n\fPublished as a conference paper at ICLR 2026\n\ndiff --git a/coding_agent.py b/coding_agent.py\nindex 620da2f..800b06e 100644\n--- a/coding_agent.py\n+++ b/coding_agent.py\n@@ -196,13 +196,16 @@ def chat_with_claude(task, chat_history, user_instr):\n\"input\": tool_input\n})\n- # Process the tool call\n+ # Process the tool call and record in structured format\ntool_result = process_tool_call(tools_dict, tool_name, tool_input)\n- output_ls.extend([\n- {TOOL_USED_MARKER: tool_name},\n- {TOOL_INPUT_MARKER: tool_input},\n- {TOOL_RESULT_MARKER: tool_result}\n- ])\n+ # Use structured format instead of text markers\n+ output_ls.append({\n+ \"tool_invocation\": {\n+ \"name\": tool_name,\n+ \"input\": tool_input,\n+ \"result\": tool_result\n+ }\n+ })\n# Continue with tool results\nmessages.extend([\n@@ -224,7 +227,13 @@ def chat_with_claude(task, chat_history, user_instr):\ntools=tools,\n)\ntool_response_text = next((block.text for block in tool_response.content if\n,→ hasattr(block, \"text\")), None)\n- output_ls.append({TOOL_RESPONSE_MARKER: tool_response_text})\n+ # Record tool response in structured format\n+ if tool_response_text:\n+ output_ls.append({\n+ \"tool_response\": {\n+ \"content\": tool_response_text\n+ }\n+ })\nresponse = tool_response\n# Validate tool response\n\nIn conclusion, the DGM can be applied beyond the coding domain, and we highlighted a case\nof objective hacking. Similar to reward hacking in reinforcement learning (Skalse et al., 2022),\nobjective hacking occurs when a system optimizes for a predefined, quantifiable objective rather than\nfulfilling the spirit of the task or solving the intended problem. This observation supports arguments\nmade in prior works (Zhang et al., 2024b; Faldor et al., 2025), which suggest that optimizing\nquantitative measures often leads to undesirable or pathological outcomes, and aligns with Goodhart’s\nlaw (Strathern, 1997) – \"When a measure becomes a target, it ceases to be a good measure.\"\n\nI\n\nA DDITIONAL S AFETY D ISCUSSION\n\nAny advancement that increases the autonomous capabilities of AI systems introduces its own set\nof safety considerations (Bengio et al., 2024), especially for systems that improve in an open-ended\nway (Ecoffet et al., 2020; Clune, 2019). Section 5 discusses these concerns and outlines concrete,\nactionable steps for mitigating them. We call for much more research into and discussion regarding AI\nsafety, including deep thought and discussion amongst all stakeholders in society on the complicated\nquestion of what exactly counts as safe AI. We are confident the work we have done was never unsafe\n(Section 5), but scaled up versions of it could be. As with all transformative technologies, the ultimate\nimpact of such AI systems remains deeply uncertain, and good arguments can be made both for the\ncase that it will bring about tremendous good and tremendous harm. These uncertainties highlight\nthe need for sustained, inclusive, and multidisciplinary discussion (not only from current experts but\nalso from a wider and more diverse community) on how to navigate these developments.\n71\n\n\fPublished as a conference paper at ICLR 2026\n\nJ\n\nA DDITIONAL F UTURE W ORK D IRECTIONS\n\nWhile this paper has shown the potential of the Darwin Gödel Machine in iteratively improving\ncoding agents via open-ended exploration and empirical validation, several extensions could address\ncurrent limitations and push AI beyond its already growing role in inspiring culture and advancing\nscience. The following directions outline promising avenues for further research.\nAutonomously Improving the Open-ended Exploration Process. In this version of the DGM,\nthe open-ended exploration process described in Section 3 is kept fixed, which might hence impede\nthe system’s self-acceleration potential. This design choice was made due to limited computational\nbudget. If we were to evolve this part of the algorithm, it could require exponentially more compute\nto identify processes that yield the same improvements shown in Section 4.4. Nevertheless, since\nthe open-ended exploration loop itself is implemented in code, it can in principle be edited and\nimproved by a coding agent. There are many possible implementations of open-ended exploration, for\nexample, using alternative search mechanisms that balance exploration and exploitation (Herr et al.,\n2025), keeping only the most interesting agents in the archive (Faldor et al., 2025), or leveraging\nthe generated agent population as an ensemble (Samvelyan et al., 2024). A promising future work\ndirection is to allow the agent to modify the open-ended exploration process, thereby autonomously\nimproving not only its own capabilities but also the meta-process that allocates limited compute to\ndrive self-improvement and self-acceleration.\nRole of Humans in Autonomous AI Systems. In the current formulation of the DGM, proposed selfmodifications are autonomously evaluated without any human intervention. However, as autonomous\nsystems grow in complexity and influence, the question of how humans should remain involved\nbecomes increasingly pressing. Should human oversight be framed as an optimization objective,\nincorporated through techniques such as reinforcement learning from human feedback (Ouyang\net al., 2022), or distilled into FMs that act as preference judges (Bai et al., 2022)? Each of these\napproaches raises challenges in terms of scalability, reliability, and alignment with evolving human\nvalues. The role of humans in guiding, constraining, or co-evolving with autonomous AI remains an\nopen question. Exploring this dynamic is a promising avenue for future research, as it touches not\nonly on technical feasibility but also on broader philosophical and societal considerations.\nDGM with Advanced Foundation Models. Recent FMs have advanced dramatically, enabling\nscaffolds to become simpler on current coding benchmarks (Yang et al., 2024). It is possible that in\nsome settings, like current coding benchmarks, certain engineering efforts in scaffolding might be\ndownplayed by the improvement of the FMs. However, many scaffolding components (advanced\ntools, parallel workflows, external memory, proxy verification, etc.) still fundamentally can not\nbe internalized by FMs and will be essential for more complex real-world tasks beyond today’s\nbenchmarks. Future work to explore how different components in agents will emerge with different\nFMs could be a promising direction.\nEvolving Generalist Agent. We believe some degree of task-specific adaptation is indeed expected\nand even desirable, since fundamentally different types of tasks (e.g., in our case, multi-file Python\nrepository edits vs. primarily single-file, multi-language implementations) naturally require distinct\nscaffolding components. Crucially, this very property highlights a unique advantage of self-improving\nsystems like the DGM: it replaces laborious manual efforts to design specialized agents for diverse\ntasks with a fully automated evolutionary process. This motivates an exciting future direction of\nrunning the DGM on a large, diverse set of tasks to evolve a true generalist agent. Also, currently\nwe only evaluated DGM on two coding benchmarks. While we believe these two benchmarks differ\nsubstantially in task structure (multi-file Python repository edits vs. primarily single-file, multilanguage implementations), providing strong evidence of generality, additional benchmarks would\nfurther strengthen evaluations.\n\n72\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"