Update logbook: Repro - Solving Positive Linear Programs with Differential Privacy
Browse filesFiles changed (19)
- .serve.logAdded
- README.md+13-5
- bucket-icon.svgAdded
- index.html+52-17
- logbook.cssAdded+1602
- logbook.jsAdded+2275
- logbook.jsonAdded+71
- pages/claim-1-instance-dependent-a-max-opt-1-5-bound-improving-hsu-et-al-by-opt-0-5/page.mdAdded+451
- pages/claim-2-data-independent-d-1-5-alpha-3-5-bound/page.mdAdded+447
- pages/claim-3-mixed-packing-covering-bounds-theorem-2/page.mdAdded+356
- pages/claim-4-truncated-softmax-and-algorithms-1-2/page.mdAdded+295
- pages/claim-5-mwu-variants-for-mixed-packing-covering-algorithms-3-4/page.mdAdded+47
- pages/conclusion/page.mdAdded
- pages/index.mdAdded+14
- pages/private-positive-lp-repro/page.mdAdded+19
- pages/setup-and-methodology/page.mdAdded+55
- trackio-logo-light.pngAdded
- trackio-logo.pngAdded
- trackio-wordmark-dark.pngAdded
12345678910---title: Repro Positive Linear Programs Dpemoji: 🔥colorFrom: indigocolorTo: pinksdk: staticpinned: false---Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference123456789101112131415161718---title: "Repro - Solving Positive Linear Programs with Differential Privacy"emoji: 🔒colorFrom: yellowcolorTo: redsdk: staticpinned: falsetags:- trackio- trackio-logbook- open-experiment- icml2026-repro- paper-zlSioMUQ2Y---# Repro - Solving Positive Linear Programs with Differential PrivacyAn open experiment logbook, published with [Trackio](https://github.com/gradio-app/trackio).
12345678910111213141516171819<!doctype html><html><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width" /><title>My static Space</title><link rel="stylesheet" href="style.css" /></head><body><div class="card"><h1>Welcome to your static Space!</h1><p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p><p>Also don't forget to check the<a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.</p></div></body></html>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354<!doctype html><html lang="en"><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" /><title>Repro - Solving Positive Linear Programs with Differential Privacy</title><link rel="stylesheet" href="./logbook.css" /></head><body><div id="app"><aside id="sidebar"><div id="book-head"><img id="book-wordmark" src="./trackio-wordmark-dark.png" alt="" /><div id="book-title" class="sr-only">Logbook</div></div><nav id="tree"></nav><div id="sidebar-foot" hidden><button id="connect-btn" type="button"><span class="ico">ⓘ</span> Collaborate with your agent</button></div></aside><main id="content"><div id="page"></div></main></div><div id="modal" hidden><div class="modal-backdrop"></div><div class="modal-card" role="dialog" aria-modal="true"><div class="modal-head"><div class="modal-title"><img class="modal-logo" src="./trackio-logo.png" alt="" />Collaborate with your agent</div><div class="modal-actions"><button id="copy-agent" class="btn">Copy for agent</button><button id="modal-close" class="btn icon" aria-label="Close">×</button></div></div><div class="modal-body"><p class="modal-intro">Point your coding agent at this logbook. It reads a compact,token-efficient version — and if you've given it write access to thisSpace, it can add findings that sync back automatically.</p><ol id="connect-steps"></ol></div></div></div><script src="./logbook.js"></script></body></html>
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602:root { --bg: #ffffff; --paper: #fdfcf9; --panel: #ffffff; --ink: #1f2937; --muted: #6b7280; --line: #e5e7eb; --accent: #f97316; --accent-strong: #ea580c; --accent-soft: #fff7ed; --accent-line: rgba(249, 115, 22, 0.16); --grid-line: rgba(31, 41, 55, 0.045); --code-bg: #f3f4f6; --radius: 12px; --serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Georgia, serif; --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; --mono: "SFMono-Regular", "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, ui-monospace, monospace;}
* { box-sizing: border-box;}
html,body { margin: 0; padding: 0;}
html { scroll-behavior: smooth;}
body { background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 13px; line-height: 1.65; -webkit-font-smoothing: antialiased;}
#app { display: flex; min-height: 100vh;}
/* ---- sidebar (composition-book cover) ---- */#sidebar { width: 280px; flex: 0 0 280px; background: #17181c; color: #e7e7ea; position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 22px 16px; display: flex; flex-direction: column;}
#book-head { display: flex; align-items: center; gap: 10px; padding: 8px; margin-bottom: 12px; border-radius: 10px; cursor: pointer; transition: background 0.12s;}#book-head:hover { background: rgba(255, 255, 255, 0.05);}#book-wordmark { width: 154px; height: auto; object-fit: contain;}.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;}
#tree { flex: 1; padding-top: 8px;}
#tree a { display: block; padding: 6px 10px; border-radius: 8px; color: #c3c4cb; text-decoration: none; font-size: 14px; transition: background 0.12s, color 0.12s;}
#tree a:hover { background: rgba(255, 255, 255, 0.06); color: #ffffff;}
#tree a.active { background: rgba(249, 115, 22, 0.16); color: #fdba74; font-weight: 600;}
#tree a .tree-mark { color: #6b6d76;}
#tree a:hover .tree-mark,#tree a.active .tree-mark { color: inherit; opacity: 0.6;}
#tree .depth-1 { padding-left: 22px;}#tree .depth-2 { padding-left: 34px;}#tree .depth-3 { padding-left: 46px;}
/* ---- content ---- */#content { flex: 1; min-width: 0; padding: 48px 40px 120px; background-color: var(--paper); background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px); background-size: 26px 26px; background-position: center top;}
#page { width: 100%; min-width: 0; max-width: 1052px; margin: 0 auto;}
.page-section { scroll-margin-top: 40px; padding: 0 0 35px; margin: 0 0 32px;}
.page-section:last-child { margin-bottom: 0;}
.page-layout { display: grid; grid-template-columns: minmax(0, 760px) 248px; gap: 44px; align-items: start;}
.page-body { min-width: 0;}
.resource-anchor { display: block; height: 0; overflow: hidden;}
/* ---- pinned notes ---- */.pinned-notes { margin: 30px 0 0;}.pinned-notes-list .cell { margin: 0; border-color: rgba(249, 115, 22, 0.55);}.pinned-notes-list .cell + .cell { margin-top: 12px;}.cell.pinned-source { border-color: rgba(249, 115, 22, 0.55);}.book-intro.has-pinned-notes { border-bottom: none; padding-bottom: 22px; margin-bottom: 30px;}.book-intro.book-intro-tight { border-bottom: none; padding-bottom: 4px; margin-bottom: 20px;}
#page h1 { font-family: var(--serif); font-size: 34px; line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 8px; overflow-wrap: anywhere;}
#page .page-section:not(.book-intro) h1 { font-size: 26px;}
#page h2 { font-family: var(--serif); font-size: 24px; margin: 36px 0 10px;}
#page h3 { font-size: 17px; font-weight: 700; margin: 26px 0 2px; letter-spacing: -0.01em;}
#page h3::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 2px; background: var(--accent); margin-right: 10px; vertical-align: middle; transform: translateY(-1px);}
#page p { margin: 10px 0;}
#page blockquote { margin: 14px 0; padding: 2px 16px; border-left: 3px solid #fdba74; color: var(--muted);}
#page hr { display: none;}
#page code { font-family: var(--mono); font-size: 0.86em; background: var(--code-bg); padding: 2px 6px; border-radius: 6px;}
#page pre { max-width: 100%; background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; overflow-x: auto;}#page pre code { background: none; padding: 0; font-size: 11.5px;}
/* ---- code blocks + collapsible accordion ---- */#page pre.hl { background: #17181c; border: none; color: #e7e7ea; font-size: 13px; line-height: 1.58;}#page pre.hl code { color: inherit; font-family: var(--mono);}.code-accordion { border: 1px solid rgba(249, 115, 22, 0.2); border-radius: 8px; overflow: hidden; margin: 12px 0; background: #17181c;}.code-accordion summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 9px; padding: 9px 12px; font-family: var(--mono); font-size: 11.5px; font-weight: 700; color: #e7e7ea; background: #1e2027; user-select: none; overflow-wrap: anywhere;}.code-accordion summary::-webkit-details-marker { display: none;}.code-accordion summary::after { content: "▸"; margin-left: auto; color: var(--accent); transition: transform 0.12s; transform: rotate(180deg);}.code-accordion[open] summary::after { transform: rotate(90deg);}.code-accordion .code-ico { color: var(--accent); font-weight: 700;}.code-accordion pre.hl { margin: 0; border-radius: 0; border: none; border-top: 1px solid rgba(249, 115, 22, 0.16);}.tok-comment { color: #7a7d87; font-style: italic;}.tok-string { color: #a5d6a7;}.tok-keyword { color: #fdba74;}.tok-number { color: #7fd0e0;}
#page a { color: var(--accent);}
#page ul { padding-left: 20px;}
.ts { font-family: var(--mono); font-size: 12px; color: var(--muted); background: none; padding: 0;}
/* ---- notebook-style cells ---- */.cell { max-width: 100%; border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, 0.86); margin: 18px 0; overflow: hidden; box-shadow: 0 2px 10px rgba(31, 41, 55, 0.035);}.cell-head { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 14px 18px; background: rgba(255, 255, 255, 0.92); border-bottom: 1px solid var(--line);}.cell-head.no-title { justify-content: flex-end; padding-top: 10px; padding-bottom: 10px;}.cell-title { flex: 1; min-width: 0; font-size: 13px; font-weight: 650; color: var(--ink); line-height: 1.35; overflow-wrap: anywhere;}.cell-meta { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; font-family: var(--sans); font-size: 13px; color: var(--muted);}.cell-open { flex: 0 0 auto; font-family: var(--mono); font-size: 12px; color: var(--accent); text-decoration: none;}.cell-open:hover { color: var(--accent-strong);}.cell-body { min-width: 0; padding: 14px 18px 18px;}.cell.dashboard .cell-body { padding: 0;}#page .cell-body h1,#page .cell-body h2 { font-family: var(--sans); font-size: 17px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.35; margin: 22px 0 6px;}#page .cell-body > :first-child { margin-top: 0;}#page .cell-body > :last-child { margin-bottom: 0;}.cell.code .cell-head { background: #fbfbfc;}.figure-fit { position: relative; overflow: hidden; min-height: 160px; border: 1px solid var(--line); border-radius: 8px; background: #fff;}.figure-fit[hidden] { display: none;}.figure-fit:fullscreen,.figure-fit:-webkit-full-screen { width: 100%; height: 100%; border: none; border-radius: 0;}.figure-frame { display: block; width: 100%; min-height: 160px; border: none; background: #fff;}.figure-frame[hidden],.figure-raw[hidden] { display: none;}.fig-switch { position: relative; display: inline-flex; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 999px; background: var(--code-bg); padding: 2px;}.fig-switch button { position: relative; z-index: 1; flex: 1; min-width: 62px; border: none; background: none; font-family: var(--sans); font-size: 12px; font-weight: 600; color: var(--muted); padding: 3px 12px; border-radius: 999px; cursor: pointer; transition: color 0.15s;}.fig-switch button.active { color: var(--accent-strong);}.fig-switch-thumb { position: absolute; top: 2px; bottom: 2px; left: 2px; width: calc(50% - 2px); border-radius: 999px; background: var(--panel); border: 1px solid rgba(249, 115, 22, 0.35); box-shadow: 0 1px 4px rgba(31, 41, 55, 0.08); transition: transform 0.18s ease;}.fig-switch.raw .fig-switch-thumb { transform: translateX(100%);}#page .figure-raw pre { margin: 0; max-height: 420px; overflow: auto; font-family: var(--mono); font-size: 13px; line-height: 1.55; background: var(--code-bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px;}/* ---- figure fullscreen ---- */.cell-fullscreen { position: relative; display: inline-flex; flex: 0 0 auto;}.cell-fullscreen-btn { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; padding: 0; border: 1px solid var(--line); border-radius: 999px; background: var(--code-bg); color: var(--muted); cursor: pointer; transition: color 0.15s, border-color 0.15s, background 0.15s;}.cell-fullscreen-btn:hover { color: var(--accent-strong); border-color: rgba(249, 115, 22, 0.35); background: var(--accent-soft);}.cell-fullscreen-btn svg { width: 14px; height: 14px;}/* ---- copyable snippets ---- */.snippet { position: relative;}.copy-snippet { position: absolute; top: 7px; right: 8px; width: 24px; height: 24px; border: none; border-radius: 6px; background: rgba(255, 255, 255, 0.08); color: #9a9da8; font-size: 12px; line-height: 1; cursor: pointer; opacity: 0; transition: opacity 0.12s, color 0.12s, background 0.12s;}.snippet:hover .copy-snippet,.jp-out:hover .copy-snippet,.figure-raw:hover .copy-snippet,.code-accordion summary:hover .copy-snippet { opacity: 1;}.copy-snippet:hover { color: #ffffff; background: rgba(255, 255, 255, 0.16);}.copy-snippet.copied { color: #52d08a; opacity: 1;}.code-accordion .code-name { user-select: text; cursor: text;}.jp-out,.figure-raw { position: relative;}.jp-out .copy-snippet,.figure-raw .copy-snippet { background: var(--code-bg); color: var(--muted); border: 1px solid var(--line);}.jp-out .copy-snippet:hover,.figure-raw .copy-snippet:hover { color: var(--accent-strong); background: var(--panel);}
/* ---- jupyter-style code cells ---- */.jp { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin: 12px 0; background: var(--panel);}.jp-gutter { flex: 0 0 46px; padding: 13px 0 0 13px; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.07em; text-transform: uppercase; font-weight: 600; user-select: none;}.jp-in { display: flex; background: #17181c;}.jp-in .jp-gutter { color: #6f727d;}.jp-in-body { flex: 1; min-width: 0;}#page .jp-in-body pre.hl { margin: 0; border: none; border-radius: 0; background: none; padding: 12px 16px 12px 0;}.jp-in-body .code-accordion { margin: 0; border: none; border-top: 1px solid rgba(255, 255, 255, 0.09); border-radius: 0; background: none;}.jp-in-body .code-accordion summary { background: none; padding: 9px 16px 9px 0;}.jp-in-body .code-accordion pre.hl { border-top: 1px solid rgba(255, 255, 255, 0.09);}.jp-meta { padding: 5px 14px; font-family: var(--mono); font-size: 11.5px; color: var(--muted); background: #fbfbfc; border-top: 1px solid var(--line);}.jp-out { display: flex; border-top: 1px solid var(--line); background: var(--panel);}.jp-out .jp-gutter { color: var(--accent-strong);}.jp-out-body { flex: 1; min-width: 0;}#page .jp-out-pre { min-width: 0; margin: 0; border: none; border-radius: 0; background: none; color: var(--ink); font-family: var(--mono); font-size: 13px; line-height: 1.55; padding: 12px 16px 12px 0; white-space: pre; overflow-x: auto; overflow-y: auto; max-height: 26em;}.jp-artifacts { display: flex; flex-direction: column;}.jp-out-body .jp-out-pre + .jp-artifacts { border-top: 1px solid var(--line);}.out-artifact { display: flex; align-items: baseline; gap: 8px; padding: 9px 16px 9px 0; text-decoration: none; color: inherit;}.out-artifact + .out-artifact { border-top: 1px solid var(--line);}a.out-artifact:hover .out-artifact-name { color: var(--accent-strong);}.out-artifact-ico { flex: 0 0 auto; font-size: 13px;}.out-artifact-name { font-family: var(--mono); font-size: 12.5px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}.out-artifact-meta { flex: 0 0 auto; margin-left: auto; padding-left: 12px; font-size: 12px; color: var(--muted); white-space: nowrap;}.out-artifact-state.open { color: var(--accent); font-weight: 600;}.trackio-embed { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel);}.trackio-cell-meta { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end;}
/* ---- unfurl cards ---- */.unfurl { display: block; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); margin: 12px 0; overflow: hidden; text-decoration: none; color: inherit; transition: border-color 0.14s, box-shadow 0.14s;}.unfurl:hover { border-color: #cfcbe6; box-shadow: 0 4px 18px rgba(30, 20, 80, 0.06);}
.unfurl-body { padding: 13px 16px; display: flex; gap: 12px; align-items: flex-start;}
.unfurl-ico { font-size: 20px; line-height: 1.3; flex: 0 0 auto;}
.unfurl-main { min-width: 0; flex: 1;}
.unfurl-kind { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); font-weight: 600;}
.unfurl-title { font-weight: 650; font-size: 15px; margin: 1px 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;}
.unfurl-desc { color: var(--muted); font-size: 13.5px; line-height: 1.45;}
.unfurl-meta { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px;}
.chip { font-size: 11.5px; background: var(--code-bg); border-radius: 999px; padding: 2px 9px; color: var(--muted); font-family: var(--mono);}
.unfurl-raw { font-family: var(--mono); font-size: 11px; color: var(--muted); border-top: 1px solid var(--line); padding: 7px 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;}
.unfurl.embed { padding: 0; overflow: hidden;}.embed-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line);}.embed-head .unfurl-kind { flex: 0 0 auto;}.embed-title { flex: 1; min-width: 0; font-weight: 650; font-size: 14px; color: var(--ink); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;}.embed-title:hover { color: var(--accent);}.embed-open { flex: 0 0 auto; font-family: var(--mono); font-size: 12px; color: var(--accent); text-decoration: none;}.embed-frame { display: block; width: 100%; height: 560px; border: 0; background: var(--code-bg);}
.dashboard-shell { display: block;}.dashboard-shell .dashboard-frame { display: block; width: 100%; height: 900px; border: 0; background: var(--code-bg);}
.unfurl.image { padding: 0;}.unfurl.image img { display: block; width: 100%; height: auto; max-height: 460px; object-fit: contain; background: var(--code-bg);}
.artifact-chip { border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); padding: 10px 14px; margin: 8px 0; font-size: 14px;}.cell.dashboard .artifact-chip { margin: 14px 18px 18px;}.artifact-chip code { color: var(--accent);}
/* ---- task board ---- */.board-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); margin: 12px 0 20px; background: var(--panel);}table.board { border-collapse: collapse; width: 100%; font-size: 14px;}table.board th,table.board td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: top;}table.board thead th { background: var(--accent-soft); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: #9a4a12; font-weight: 600; border-bottom: 1px solid var(--line);}table.board tbody tr:last-child td { border-bottom: none;}table.board .col-check { text-align: center; width: 92px; white-space: nowrap;}table.board tr.section-row td { background: var(--accent-soft); text-align: center; font-weight: 700; font-size: 13px; color: var(--accent-strong); padding: 7px 14px; letter-spacing: 0.02em;}.box { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border: 1.5px solid #cfcbe0; border-radius: 5px; font-size: 12px; color: #fff; line-height: 1;}.box.on { background: var(--accent); border-color: var(--accent);}.who-chip { display: inline-block; padding: 3px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap;}.who-chip.muted { background: var(--code-bg); color: var(--muted); font-weight: 500;}
/* ---- status badges + clickable rows ---- */table.board .col-status { width: 130px; white-space: nowrap;}.badge { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: 0.01em;}.badge.gray { background: var(--code-bg); color: var(--muted);}.badge.amber { background: var(--accent-soft); color: #b45309;}.badge.green { background: #e6f7ee; color: #1a8a55;}.badge.red { background: #fde8ec; color: #c62a4b;}table.board tr.linked-row { cursor: pointer;}table.board tr.linked-row:hover td { background: var(--accent-soft);}table.board tr.linked-row a { color: var(--ink); font-weight: 600; text-decoration: none;}table.board tr.linked-row:hover a { color: var(--accent-strong);}
/* ---- agent read hint ---- */.agent-hint { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 4px 0 22px; font-size: 12.5px; color: var(--muted);}#page .agent-hint code { background: var(--code-bg); padding: 2px 9px; border-radius: 6px; font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--ink);}.agent-hint .copy { flex: 0 0 auto; background: none; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; width: 22px; height: 22px; font-size: 11px; line-height: 1; cursor: pointer; transition: color 0.12s, border-color 0.12s;}.agent-hint .copy:hover { color: var(--accent-strong); border-color: var(--accent);}.agent-hint .copy.copied { color: #1a8a55; border-color: #1a8a55;}.agent-hint-note { margin-left: auto; font-size: 12px; color: var(--muted);}
/* ---- logbook summary stats ---- */.logbook-stats { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 28px;}.stat-tile { position: relative; display: inline-flex; align-items: center; gap: 11px; border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); padding: 12px 23px; font: inherit; text-align: left; cursor: pointer; transition: border-color 0.12s, box-shadow 0.12s;}.stat-tile:hover:not([disabled]) { border-color: rgba(249, 115, 22, 0.45); box-shadow: 0 3px 12px rgba(31, 41, 55, 0.06);}.stat-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px;}.stat-tile[disabled] { cursor: default; opacity: 0.7;}.stat-tile.open { border-color: rgba(249, 115, 22, 0.6); box-shadow: 0 3px 12px rgba(31, 41, 55, 0.08);}.stat-icon { width: 24px; height: 24px; flex: 0 0 24px; object-fit: contain; align-self: center;}.stat-text { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; line-height: 1;}.stat-num { font-family: var(--mono); font-size: 20px; font-weight: 600; line-height: 1; color: var(--accent-strong);}.stat-label { font-size: 15px; line-height: 1; color: var(--muted);}.stat-caret { margin-left: 2px; font-size: 10px; color: var(--muted); align-self: center; transition: transform 0.12s;}.stat-tile.open .stat-caret { transform: rotate(180deg);}.stat-popover { position: absolute; top: 100%; left: 0; margin-top: 6px; min-width: 300px; max-width: min(460px, 92vw); max-height: 340px; overflow-y: auto; z-index: 20; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 28px rgba(31, 41, 55, 0.12); padding: 6px;}.stat-popover[hidden] { display: none;}.stat-pop-head { padding: 6px 10px 8px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; color: var(--muted);}.stat-row { display: flex; align-items: flex-start; gap: 10px; padding: 9px 11px; border-radius: 9px; border: 1px solid transparent; text-decoration: none; color: inherit; cursor: pointer;}.stat-row:hover { border-color: rgba(249, 115, 22, 0.4); background: var(--accent-soft);}.stat-row-ico { font-size: 15px; line-height: 1.3; flex: 0 0 auto;}.stat-row-main { min-width: 0; flex: 1;}.stat-row-title { font-family: var(--mono); font-size: 12.5px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}.stat-row-meta { margin-top: 2px; font-size: 12px; color: var(--muted);}.stat-row-state.open { color: var(--accent); font-weight: 600; border-radius: 5px; padding: 1px 5px; margin: -1px -2px;}.stat-row-state.open:hover { background: rgba(249, 115, 22, 0.14); text-decoration: underline;}.art-ico { width: 1em; height: 1em; object-fit: contain; vertical-align: -0.15em;}
/* ---- scroll-to-resource highlight ---- */.res-flash { animation: res-flash 1.5s ease; border-radius: 8px;}@keyframes res-flash { 0%, 25% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 0 0 3px rgba(249, 115, 22, 0); }}
/* ---- inline resource chips ---- */#page .res-chip { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 0 9px 0 6px; margin: 0 1px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); font-family: var(--mono); font-size: 0.78em; font-weight: 600; color: var(--ink); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; line-height: 1.65; transform: translateY(-0.08em); transition: border-color 0.12s, background 0.12s, color 0.12s;}.res-chip-ico { font-size: 1.05em; line-height: 1;}#page .res-chip:hover,#page .res-chip.res-hl { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong);}#page a.res-link.res-hl { background: var(--accent-soft); border-radius: 4px;}.rail-item.res-hl { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 3px 12px rgba(249, 115, 22, 0.14);}.rail-item.res-hl .rail-title { color: var(--accent-strong);}.rail-item.rail-local { cursor: default;}.artifact-chip.res-hl { border-color: var(--accent); background: var(--accent-soft);}
/* ---- contextual resources rail ---- */.context-rail { position: relative; width: 248px;}.context-rail[hidden] { display: none;}.rail-kind { display: flex; align-items: center; gap: 5px; font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; color: var(--accent); margin-bottom: 4px;}.rail-item { position: absolute; left: 0; right: 0; display: block; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: 9px 12px; margin-bottom: 8px; text-decoration: none; color: inherit; transition: border-color 0.14s, box-shadow 0.14s;}.rail-item:hover { border-color: rgba(249, 115, 22, 0.45); box-shadow: 0 3px 12px rgba(31, 41, 55, 0.06);}.rail-title { font-family: var(--mono); font-size: 12.5px; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; line-height: 1.4;}.rail-item:hover .rail-title { color: var(--accent-strong);}.rail-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px;}
@media (max-width: 1400px) { .page-layout { display: block; } .context-rail { width: 100%; margin-top: 28px; position: static; min-height: 0 !important; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; } .context-rail[hidden] { display: none; } .context-rail .rail-item { position: static; margin-bottom: 0; }}
/* ---- connect footer + modal ---- */#sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, 0.1);}
#connect-btn { width: 100%; display: flex; align-items: center; gap: 8px; background: rgba(255, 255, 255, 0.05); color: #c3c4cb; border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 9px; padding: 9px 12px; font-size: 13.5px; font-family: var(--sans); cursor: pointer; transition: background 0.12s, color 0.12s, border-color 0.12s;}#connect-btn:hover { background: rgba(249, 115, 22, 0.14); border-color: rgba(249, 115, 22, 0.4); color: #fdba74;}#connect-btn .ico { font-size: 15px;}
#modal[hidden] { display: none;}#modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px;}.modal-backdrop { position: absolute; inset: 0; background: rgba(20, 18, 30, 0.5); backdrop-filter: blur(2px);}.modal-card { position: relative; background: var(--panel); border-radius: 16px; width: 100%; max-width: 620px; max-height: 85vh; overflow-y: auto; box-shadow: 0 24px 70px rgba(20, 15, 50, 0.28);}.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel);}.modal-title { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 21px; letter-spacing: -0.01em;}.modal-logo { width: 26px; height: 26px; object-fit: contain;}.modal-actions { display: flex; align-items: center; gap: 8px;}.btn { font-family: var(--sans); font-size: 13.5px; font-weight: 600; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 9px; padding: 8px 13px; cursor: pointer; transition: background 0.12s, border-color 0.12s, color 0.12s;}.btn:hover { border-color: var(--accent); color: var(--accent-strong);}.btn.copied { border-color: #1a8a55; color: #1a8a55;}.btn.icon { font-size: 18px; line-height: 1; padding: 6px 11px; font-weight: 400;}.modal-body { padding: 20px 22px 26px;}.modal-intro { margin: 0 0 20px; color: var(--muted); line-height: 1.55;}#connect-steps { list-style: none; margin: 0; padding: 0;}#connect-steps li { margin-bottom: 18px;}.step-title { font-weight: 600; font-size: 14.5px; margin-bottom: 8px;}.codeblock { display: flex; align-items: center; gap: 8px; background: #17181c; border-radius: 10px; padding: 11px 12px 11px 15px;}.codeblock code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; font-family: var(--mono); font-size: 13px; color: #f0efff; background: none; padding: 0;}.codeblock .copy { flex: 0 0 auto; background: rgba(255, 255, 255, 0.08); color: #c3c4cb; border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 7px; width: 30px; height: 30px; font-size: 14px; cursor: pointer; transition: background 0.12s, color 0.12s;}.codeblock .copy:hover { background: rgba(249, 115, 22, 0.2); color: #fdba74;}.codeblock .copy.copied { color: #52d08a;}
@media (max-width: 720px) { #app { flex-direction: column; } #sidebar { width: 100%; flex: none; height: auto; position: static; } #content { display: block; width: 100%; padding: 28px 20px 80px; overflow-x: hidden; } #page { width: 100%; max-width: 100%; } #page h1 { font-size: 30px; } .cell-head { align-items: flex-start; flex-direction: column; gap: 4px; }}1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275(function () { "use strict";
let MANIFEST = null; const PAGE_CACHE = {}; const UNFURL_CACHE = {}; const LIVE_RELOAD_MS = 1500; const FIGURE_FRAME_WINDOWS = new Set(); let FIGURE_NAVIGATION_READY = false;
function esc(s) { return String(s) .replace(/&/g, "&") .replace(/</g, "<") .replace(/>/g, ">") .replace(/"/g, """) .replace(/'/g, "'"); }
function flattenTree(node, depth, acc) { acc.push({ node: node, depth: depth }); (node.children || []).forEach((c) => flattenTree(c, depth + 1, acc)); return acc; }
function findNode(node, slug) { if (node.slug === slug) return node; for (const c of node.children || []) { const hit = findNode(c, slug); if (hit) return hit; } return null; }
/* -------------------- minimal markdown -------------------- */
function inline(text) { let t = esc(text); t = t.replace(/`([^`]+)`/g, (_, c) => `<code>${c}</code>`); t = t.replace(/\*\*([^*]+)\*\*/g, (_, c) => `<strong>${c}</strong>`); t = t.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, txt, url) => { const safe = esc(url); const attrs = /^https?:/.test(url) ? ' target="_blank" rel="noopener"' : ""; const item = /^https?:/.test(url) ? classifyResource(url) : null; const data = item ? ` class="res-link" data-res-url="${esc(item.url)}"` : ""; return `<a href="${safe}"${attrs}${data}>${txt}</a>`; }); t = t.replace(/(^|[\s(])(https?:\/\/[^\s<>)"'`]+)/g, (m, pre, url) => { let rest = ""; const cut = url.search(/"|'|<|>/); if (cut !== -1) { rest = url.slice(cut); url = url.slice(0, cut); } const trailing = (url.match(/[.,;:!?`]+$/) || [""])[0]; const clean = trailing ? url.slice(0, -trailing.length) : url; if (!clean) return m; const item = classifyResource(clean); if (item) return `${pre}${resChipHtml(item)}${trailing}${rest}`; return `${pre}<a href="${clean}" target="_blank" rel="noopener">${clean}</a>${trailing}${rest}`; }); return t; }
function resChipHtml(item) { return ( `<a class="res-chip" href="${esc(item.url)}" target="_blank" ` + `rel="noopener" data-res-url="${esc(item.url)}">` + `<span class="res-chip-ico">${RESOURCE_ICONS[item.kind]}</span>` + `${esc(item.id)}</a>` ); }
const URL_ONLY = /^(https?:\/\/[^\s]+)$/; const DETECTED_URL = /(https?:\/\/[^\s<>)\]"'`]+|trackio-local-dashboard:\/\/[^\s<>)\]"'`]+|trackio-artifact:\/\/[^\s<>)\]"'`]+|trackio-local-path:\/\/[^\s<>)\]"'`]+)/g;
function renderMarkdown(md, container) { const cellRe = /(^|\n)---\n<!-- trackio-cell\n([\s\S]*?)\n-->\n([\s\S]*?)(?=\n---\n<!-- trackio-cell\n|\s*$)/g; const tokens = []; let pos = 0; let found = false; let match; while ((match = cellRe.exec(md))) { found = true; tokens.push({ kind: "md", text: md.slice(pos, match.index + match[1].length), }); tokens.push({ kind: "cell", meta: parseCellMeta(match[2]), body: match[3], }); pos = match.index + match[0].length; } tokens.push({ kind: "md", text: found ? md.slice(pos) : md });
for (let i = 0; i < tokens.length; i++) { const t = tokens[i]; if (t.kind === "md") { renderMarkdownPlain(t.text, container); continue; } if (t.consumed) continue; if (t.meta.type === "code") { const arts = []; for (let j = i + 1; j < tokens.length; j++) { const n = tokens[j]; if (n.kind === "md") { if (n.text.trim() === "") continue; break; } if (n.meta.type === "artifact") { arts.push(n); n.consumed = true; continue; } break; } renderCell(t.meta, t.body, container, arts); } else { renderCell(t.meta, t.body, container); } } }
function parseCellMeta(raw) { try { return JSON.parse(raw); } catch (e) { return { type: "markdown", title: "Note" }; } }
function renderMarkdownPlain(md, container) { const lines = md.replace(/<!--[\s\S]*?-->/g, "").split("\n"); let i = 0; let para = [];
function flushPara() { if (!para.length) return; const joined = para.join(" ").trim(); para = []; if (!joined) return; if (/^trackio-artifact:\/\/\S+$/.test(joined)) return; if (/^trackio-local-path:\/\/\S+$/.test(joined)) return; if (joined.indexOf("📦 Artifact") !== -1) { const div = document.createElement("div"); div.className = "artifact-chip"; div.innerHTML = ARTIFACT_ICON_IMG + inline(joined.replace(/📦\s*/, "")); container.appendChild(div); return; } if (URL_ONLY.test(joined) || IMG_PATH.test(joined)) { const el = renderStandaloneUrl(joined); if (el) container.appendChild(el); return; } const p = document.createElement("p"); p.innerHTML = inline(joined); container.appendChild(p); }
while (i < lines.length) { const line = lines[i]; const trimmed = line.trim();
if (trimmed === "") { flushPara(); i++; continue; } const fence = trimmed.match(/^(`{3,}|~{3,})(.*)$/); if (fence) { flushPara(); const marker = fence[1][0]; const closeRe = new RegExp("^" + marker + "{" + fence[1].length + ",}\\s*$"); const info = fence[2].trim(); const buf = []; i++; while (i < lines.length && !closeRe.test(lines[i].trim())) { buf.push(lines[i]); i++; } i++; const lang = (info.split(/\s+/)[0] || "").toLowerCase(); const tm = info.match(/title=(\S+)/); container.appendChild( renderCode(buf.join("\n"), lang, tm ? tm[1] : null) ); continue; } if (trimmed === "---") { flushPara(); container.appendChild(document.createElement("hr")); i++; continue; } const h = trimmed.match(/^(#{1,4})\s+(.*)$/); if (h) { flushPara(); const el = document.createElement("h" + h[1].length); el.innerHTML = inline(h[2]); container.appendChild(el); i++; continue; } if ( trimmed.startsWith("|") && i + 1 < lines.length && /^\|?[\s:|-]*-{2,}[\s:|-]*\|?$/.test(lines[i + 1].trim()) ) { flushPara(); const rows = []; while (i < lines.length && lines[i].trim().startsWith("|")) { rows.push(parseRow(lines[i].trim())); i++; } renderTable(rows, container); continue; } if (trimmed.startsWith("> ")) { flushPara(); const bq = document.createElement("blockquote"); bq.innerHTML = inline(trimmed.slice(2)); container.appendChild(bq); i++; continue; } if (/^`[^`]+`$/.test(trimmed)) { flushPara(); const el = document.createElement("div"); el.className = "ts"; el.textContent = trimmed.replace(/`/g, ""); container.appendChild(el); i++; continue; } if (trimmed.startsWith("- ")) { flushPara(); const items = []; while (i < lines.length && lines[i].trim().startsWith("- ")) { items.push(lines[i].trim().slice(2).trim()); i++; } renderList(items, container); continue; } para.push(trimmed); i++; } flushPara(); }
function renderCell(meta, body, container, artifacts) { const cell = document.createElement("section"); cell.className = `cell ${meta.type || "markdown"}`; if (meta.id) cell.dataset.cellId = meta.id; if (isPinned(meta)) cell.classList.add("pinned-source");
const head = document.createElement("div"); head.className = "cell-head"; const rawTitle = (meta.title || "").trim(); const title = rawTitle && rawTitle.toLowerCase() !== "untitled" ? esc(rawTitle) : ""; const when = meta.created_at ? `<span>${esc(formatTime(meta.created_at))}</span>` : ""; head.innerHTML = (title ? `<div class="cell-title">${title}</div>` : "") + `<div class="cell-meta">${when}</div>`; if (!title) head.classList.add("no-title"); cell.appendChild(head);
const bodyEl = document.createElement("div"); bodyEl.className = "cell-body"; if (meta.type === "code") { renderCodeCell(body, bodyEl, artifacts); } else if (meta.type === "figure") { cell.dataset.resUrl = `trackio-figure://${(meta.title || "Figure").trim()}`; renderFigureCell(body, bodyEl, head); } else if (meta.type === "artifact") { renderMarkdownPlain(body, bodyEl); const chip = bodyEl.querySelector(".artifact-chip"); const uri = body.match( /(trackio-artifact:\/\/\S+|trackio-local-path:\/\/\S+|https:\/\/huggingface\.co\/buckets\/[^\s<)]+#\S+)/ ); if (chip && uri) chip.dataset.resUrl = uri[1]; } else if (meta.type === "dashboard") { const sp = body.match(/https:\/\/huggingface\.co\/spaces\/[^\s<>)"'`]+/); cell.dataset.resUrl = sp ? sp[0] : `trackio-local-dashboard://${(meta.dashboard_project || "").trim()}`; renderDashboardCell(meta, body, bodyEl, head); } else { const cleaned = stripDuplicateTitle(body, meta.title); renderMarkdownPlain(cleaned, bodyEl); renderDetectedEmbeds(cleaned, bodyEl); } cell.appendChild(bodyEl); container.appendChild(cell); return cell; }
function isPinned(meta) { return Boolean(meta && (meta.pinned === true || meta.pinned === "true")); }
function stripDuplicateTitle(body, title) { if (!title) return body; const m = body.match(/^\s*#{1,6}\s+([^\n]+)\n?/); if (!m) return body; const norm = (s) => s .toLowerCase() .replace(/[*_`#]/g, "") .replace(/\s+/g, " ") .trim(); return norm(m[1]) === norm(title) ? body.slice(m[0].length) : body; }
function formatTime(iso) { const d = new Date(iso); if (Number.isNaN(d.getTime())) return iso; return d.toLocaleString(undefined, { month: "short", day: "numeric", hour: "2-digit", minute: "2-digit", }); }
function parseFences(text) { const fenceRe = /(`{3,4}|~{3,4})([^\n]*)\n([\s\S]*?)\n\1/g; const parts = []; let pos = 0; let match; while ((match = fenceRe.exec(text))) { if (match.index > pos) { parts.push({ kind: "text", text: text.slice(pos, match.index) }); } const info = match[2].trim(); const lang = (info.split(/\s+/)[0] || "").toLowerCase(); const titleMatch = info.match(/title=(\S+)/); parts.push({ kind: lang === "result" || lang === "output" ? "output" : "code", lang, title: titleMatch ? titleMatch[1] : null, text: match[3], }); pos = match.index + match[0].length; } if (pos < text.length) parts.push({ kind: "text", text: text.slice(pos) }); return parts; }
function fitFigureFrame(frame, wrap) { let doc; try { doc = frame.contentDocument; } catch (e) { return; } if (!doc || !doc.body) return; frame.style.transform = "none"; frame.style.width = "100%"; frame.style.height = "auto"; frame.style.position = ""; frame.style.left = ""; frame.style.top = ""; const avail = wrap.clientWidth; const isFullscreen = document.fullscreenElement === wrap || document.webkitFullscreenElement === wrap; const availHeight = isFullscreen ? wrap.clientHeight : Infinity; const cw = Math.max(doc.body.scrollWidth, doc.documentElement.scrollWidth, 1); const ch = Math.max(doc.body.scrollHeight, doc.documentElement.scrollHeight, 1); const scale = Math.min(avail / cw, availHeight / ch); if (avail && scale < 1 - 1e-3) { frame.style.width = `${cw}px`; frame.style.height = `${ch}px`; frame.style.transformOrigin = "top left"; frame.style.transform = `scale(${scale})`; if (isFullscreen) { frame.style.position = "absolute"; frame.style.left = `${Math.max(0, (avail - cw * scale) / 2)}px`; frame.style.top = `${Math.max(0, (availHeight - ch * scale) / 2)}px`; wrap.style.height = "100%"; } else { wrap.style.height = `${Math.ceil(ch * scale)}px`; } } else { frame.style.width = "100%"; frame.style.height = `${ch}px`; wrap.style.height = isFullscreen ? "100%" : `${ch}px`; } }
function attachFigureFit(frame, wrap) { const refit = () => fitFigureFrame(frame, wrap); frame.addEventListener("load", refit); if (window.ResizeObserver) { const ro = new ResizeObserver(() => refit()); ro.observe(wrap); } }
function renderFigureCell(text, container, head) { const parts = parseFences(text); const htmlPart = parts.find((part) => part.lang === "html"); const rawPart = parts.find((part) => part.lang === "raw"); if (!htmlPart || !htmlPart.text.trim()) { const empty = document.createElement("p"); empty.className = "muted"; empty.textContent = "No figure HTML."; container.appendChild(empty); return; } const frame = document.createElement("iframe"); frame.className = "figure-frame"; frame.sandbox = "allow-scripts allow-same-origin"; frame.loading = "lazy"; frame.srcdoc = htmlPart.text; registerFigureNavigation(frame); const figWrap = document.createElement("div"); figWrap.className = "figure-fit"; figWrap.appendChild(frame); attachFigureFit(frame, figWrap); if (head) { const metaEl = head.querySelector(".cell-meta"); if (metaEl) metaEl.insertBefore(buildFullscreenControl(figWrap, frame), metaEl.firstChild); } if (!rawPart || !rawPart.text.trim()) { container.appendChild(figWrap); return; } const sw = document.createElement("div"); sw.className = "fig-switch"; const thumb = document.createElement("span"); thumb.className = "fig-switch-thumb"; const figBtn = document.createElement("button"); figBtn.type = "button"; figBtn.className = "active"; figBtn.textContent = "Figure"; const rawBtn = document.createElement("button"); rawBtn.type = "button"; rawBtn.textContent = "Raw"; sw.appendChild(thumb); sw.appendChild(figBtn); sw.appendChild(rawBtn); const rawView = document.createElement("div"); rawView.className = "figure-raw"; rawView.hidden = true; const pre = document.createElement("pre"); const code = document.createElement("code"); code.textContent = rawPart.text; pre.appendChild(code); rawView.appendChild(pre); rawView.appendChild(copySnippetBtn(rawPart.text)); const select = (showRaw) => { sw.classList.toggle("raw", showRaw); figBtn.classList.toggle("active", !showRaw); rawBtn.classList.toggle("active", showRaw); figWrap.hidden = showRaw; rawView.hidden = !showRaw; }; figBtn.addEventListener("click", () => select(false)); rawBtn.addEventListener("click", () => select(true)); if (head) { head.insertBefore(sw, head.querySelector(".cell-meta")); } else { container.appendChild(sw); } container.appendChild(figWrap); container.appendChild(rawView); }
// Poster embeds can send `{ type: "trackio-logbook:navigate", target: "..." }` // from their iframe. Only accept messages from figure frames we created, and // only route to pages that are present in this logbook's manifest. function registerFigureNavigation(frame) { const registerFrameWindow = () => { if (frame.contentWindow) FIGURE_FRAME_WINDOWS.add(frame.contentWindow); }; // `srcdoc` replaces the initial about:blank document. Register after that // navigation as well, so messages come from the live figure document. frame.addEventListener("load", registerFrameWindow); registerFrameWindow(); if (FIGURE_NAVIGATION_READY) return; FIGURE_NAVIGATION_READY = true; window.addEventListener("message", (event) => { if (!FIGURE_FRAME_WINDOWS.has(event.source)) return; const message = event.data; if (!message || message.type !== "trackio-logbook:navigate") return; const target = String(message.target || "").replace(/^#?\//, ""); if (!target || !MANIFEST || !findNode(MANIFEST.root, target)) return; const hash = "#/" + target; if (location.hash === hash) scrollToHash(); else location.hash = hash; }); }
const FULLSCREEN_ICON = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" ' + 'stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">' + '<path d="M8 3H3v5M16 3h5v5M21 16v5h-5M3 16v5h5"/>' + '<path d="M3 8 8 3M16 3l5 5M21 16l-5 5M8 21l-5-5"/></svg>';
// Figures are rendered in same-origin iframes, so fullscreen the fitted // wrapper rather than the iframe document. This uses the browser's native // fullscreen UI and preserves the figure's existing responsive sizing. function buildFullscreenControl(figWrap, frame) { const wrap = document.createElement("span"); wrap.className = "cell-fullscreen"; const btn = document.createElement("button"); btn.type = "button"; btn.className = "cell-fullscreen-btn"; btn.setAttribute("aria-label", "Open figure in fullscreen"); btn.title = "Open figure in fullscreen"; btn.innerHTML = FULLSCREEN_ICON; wrap.appendChild(btn);
btn.addEventListener("click", async () => { const request = figWrap.requestFullscreen || figWrap.webkitRequestFullscreen; if (!request) return; try { await request.call(figWrap); } catch (_) { // Fullscreen can be disabled by the embedding browser or policy. } }); document.addEventListener("fullscreenchange", () => { if (document.fullscreenElement === figWrap) fitFigureFrame(frame, figWrap); }); return wrap; }
function extractUrls(text) { const seen = new Set(); const urls = []; let match; while ((match = DETECTED_URL.exec(text))) { const url = match[1].replace(/[.,;:!?'"`]+$/, ""); if (!seen.has(url)) { seen.add(url); urls.push(url); } } DETECTED_URL.lastIndex = 0; return urls; }
const IMG_URL = /(\.(png|jpe?g|gif|svg|webp)(\?|$)|\/artifact_blob\/)/i;
function renderDetectedEmbeds(text, container) { extractUrls(text).forEach((url) => { if (url.startsWith("trackio-local-dashboard://")) { const div = document.createElement("div"); div.className = "artifact-chip"; div.dataset.resUrl = url; div.innerHTML = "🎯 <strong>Local Trackio dashboard</strong> — publish the logbook to share it"; container.appendChild(div); } else if (IMG_URL.test(url)) { container.appendChild(renderImage(url)); } else if (/huggingface\.co\/spaces\//.test(url)) { maybeEmbedTrackioSpace(url, container); } }); }
function renderStandaloneUrl(url) { if (IMG_URL.test(url) || IMG_PATH.test(url)) return renderImage(url); const item = classifyResource(url); if (item) { const marker = document.createElement("span"); marker.className = "resource-anchor"; marker.dataset.resUrl = item.url; marker.setAttribute("aria-hidden", "true"); return marker; } const p = document.createElement("p"); p.innerHTML = inline(url); return p; }
function renderImage(url) { const a = document.createElement("a"); a.className = "unfurl image"; a.href = url; a.target = "_blank"; a.rel = "noopener"; const img = document.createElement("img"); img.loading = "lazy"; img.src = url; img.alt = "artifact image"; a.appendChild(img); return a; }
function maybeEmbedTrackioSpace(url, container) { const id = url.split("/spaces/")[1].split(/[?#]/)[0].replace(/\/$/, ""); const holder = document.createElement("div"); container.appendChild(holder); getJSON(`https://huggingface.co/api/spaces/${id}`).then((d) => { const tags = (d && d.tags) || []; if (tags.some((t) => String(t).toLowerCase() === "trackio")) { renderTrackioSpaceEmbed(holder, url, id); } else { holder.remove(); } }); }
function jpGutter(label) { const g = document.createElement("div"); g.className = "jp-gutter"; g.textContent = label; return g; }
function renderOutArtifact(info) { const remote = !info.local && !!info.url; const el = document.createElement(remote ? "a" : "div"); el.className = "out-artifact"; if (remote) { el.href = info.url; el.target = "_blank"; el.rel = "noopener"; } el.dataset.resUrl = info.resUrl; const parts = [info.type, info.size].filter(Boolean).map(esc); const state = remote ? `<span class="out-artifact-state open">Open ↗</span>` : `<span class="out-artifact-state">publish to share</span>`; const meta = parts.length ? `${parts.join(" · ")} · ${state}` : state; el.innerHTML = `<span class="out-artifact-ico">${ARTIFACT_ICON_IMG}</span>` + `<span class="out-artifact-name">${esc(info.name)}</span>` + `<span class="out-artifact-meta">${meta}</span>`; return el; }
function renderCodeCell(body, container, artifacts) { const parts = parseFences(body); const block = document.createElement("div"); block.className = "jp"; const input = document.createElement("div"); input.className = "jp-in"; const inputBody = document.createElement("div"); inputBody.className = "jp-in-body"; input.appendChild(jpGutter("In")); input.appendChild(inputBody); let metaEl = null; let outputEl = null; let outBody = null; const ensureOut = () => { if (outputEl) return; outputEl = document.createElement("div"); outputEl.className = "jp-out"; outputEl.appendChild(jpGutter("Out")); outBody = document.createElement("div"); outBody.className = "jp-out-body"; outputEl.appendChild(outBody); }; const embedTexts = []; parts.forEach((part) => { if (part.kind === "text") { const text = part.text.trim(); if (!text) return; if (/^exit\s+\S+(\s|·)/.test(text)) { metaEl = document.createElement("div"); metaEl.className = "jp-meta"; metaEl.textContent = text.replace( /\s*·\s*[A-Z][a-z]{2} \d{1,2}, \d{4}.*$/, "" ); } else { renderMarkdownPlain(text, container); embedTexts.push(text); } return; } if (part.kind === "output") { ensureOut(); const pre = document.createElement("pre"); pre.className = "jp-out-pre"; const c = document.createElement("code"); c.textContent = part.text; pre.appendChild(c); outBody.appendChild(pre); outputEl.appendChild(copySnippetBtn(part.text)); embedTexts.push(part.text); return; } inputBody.appendChild(renderCode(part.text, part.lang, part.title)); }); if (artifacts && artifacts.length) { ensureOut(); const artWrap = document.createElement("div"); artWrap.className = "jp-artifacts"; artifacts.forEach((a) => { artWrap.appendChild( renderOutArtifact(artifactInfoFromCell(a.meta, a.body)) ); }); outBody.appendChild(artWrap); } if (inputBody.childNodes.length > 0) block.appendChild(input); if (metaEl) block.appendChild(metaEl); if (outputEl) block.appendChild(outputEl); if (block.childNodes.length) container.appendChild(block); embedTexts.forEach((text) => renderDetectedEmbeds(text, container)); }
function parseRow(line) { let s = line.trim(); if (s.startsWith("|")) s = s.slice(1); if (s.endsWith("|")) s = s.slice(0, -1); return s.split(/(?<!\\)\|/).map((c) => c.replace(/\\\|/g, "|").trim()); }
const TRUTHY = ["x", "✓", "✔", "yes", "done", "true", "[x]"]; const CHIP_COLORS = [ ["#e7f0ff", "#2158d0"], ["#fde8ec", "#c62a4b"], ["#e6f7ee", "#1a8a55"], ["#fdf0e0", "#b26a12"], ["#efe9ff", "#5b3bd6"], ["#e6f6f8", "#127b88"], ];
function chipColor(name) { let h = 0; for (let i = 0; i < name.length; i++) h = (h * 31 + name.charCodeAt(i)) >>> 0; return CHIP_COLORS[h % CHIP_COLORS.length]; }
const STATUS_MAP = { "": ["Planned", "gray"], planned: ["Planned", "gray"], todo: ["Planned", "gray"], "to do": ["Planned", "gray"], backlog: ["Planned", "gray"], "in progress": ["In progress", "amber"], "in-progress": ["In progress", "amber"], wip: ["In progress", "amber"], running: ["In progress", "amber"], active: ["In progress", "amber"], done: ["Done", "green"], complete: ["Done", "green"], completed: ["Done", "green"], blocked: ["Blocked", "red"], failed: ["Failed", "red"], abandoned: ["Abandoned", "gray"], };
function statusBadge(val) { const [label, tone] = STATUS_MAP[val.toLowerCase()] || [val || "—", "gray"]; return `<span class="badge ${tone}">${esc(label)}</span>`; }
function renderTable(rows, container) { if (rows.length < 2) return; const header = rows[0]; const body = rows.slice(2); const roles = header.map((h) => { const t = h.toLowerCase(); if (t.includes("status") || t.includes("state")) return "status"; if (t.includes("progress") || t.includes("complete") || t.includes("done")) return "check"; if (t === "who" || t.includes("assign") || t.includes("owner")) return "who"; return "text"; }); const table = document.createElement("table"); table.className = "board"; const thead = document.createElement("thead"); const htr = document.createElement("tr"); header.forEach((h, c) => { const th = document.createElement("th"); th.textContent = h; if (roles[c] === "check") th.className = "col-check"; htr.appendChild(th); }); thead.appendChild(htr); table.appendChild(thead); const tbody = document.createElement("tbody"); body.forEach((cells) => { const nonEmpty = cells.filter((x) => x !== "").length; if (header.length > 1 && nonEmpty === 1 && cells[0]) { const tr = document.createElement("tr"); tr.className = "section-row"; const td = document.createElement("td"); td.colSpan = header.length; td.innerHTML = inline(cells[0]); tr.appendChild(td); tbody.appendChild(tr); return; } const tr = document.createElement("tr"); header.forEach((_, c) => { const td = document.createElement("td"); const val = (cells[c] || "").trim(); if (roles[c] === "status") { td.className = "col-status"; td.innerHTML = statusBadge(val); } else if (roles[c] === "check") { td.className = "col-check"; const on = TRUTHY.indexOf(val.toLowerCase()) !== -1; td.innerHTML = `<span class="box ${on ? "on" : ""}">${on ? "✓" : ""}</span>`; } else if (roles[c] === "who") { if (!val || /^to assign$/i.test(val)) { td.innerHTML = `<span class="who-chip muted">${esc(val || "—")}</span>`; } else { const [bg, fg] = chipColor(val); td.innerHTML = `<span class="who-chip" style="background:${bg};color:${fg}">${esc(val)}</span>`; } } else { td.innerHTML = inline(val); } tr.appendChild(td); }); const link = tr.querySelector('a[href^="#/"]'); if (link) { tr.classList.add("linked-row"); tr.addEventListener("click", (e) => { if (e.target.tagName !== "A") location.hash = link.getAttribute("href"); }); } tbody.appendChild(tr); }); table.appendChild(tbody); const wrap = document.createElement("div"); wrap.className = "board-wrap"; wrap.appendChild(table); container.appendChild(wrap); }
const HL_RULES = { python: [ ["comment", /#[^\n]*/], ["string", /'''[\s\S]*?'''|"""[\s\S]*?"""|'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"/], [ "keyword", /\b(?:def|class|return|if|elif|else|for|while|import|from|as|with|try|except|finally|raise|in|not|and|or|is|None|True|False|lambda|yield|global|nonlocal|assert|pass|break|continue|async|await|print)\b/, ], ["number", /\b\d[\d_.eE+-]*\b/], ], bash: [ ["comment", /#[^\n]*/], ["string", /'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"/], ["keyword", /\b(?:if|then|else|fi|for|in|do|done|while|case|esac|function|export|source|echo|cd|return|local)\b/], ["number", /(?<=\s)-{1,2}[a-zA-Z][\w-]*/], ], json: [ ["string", /"(?:\\.|[^"\\])*"/], ["keyword", /\b(?:true|false|null)\b/], ["number", /-?\b\d[\d.eE+-]*\b/], ], yaml: [ ["comment", /#[^\n]*/], ["string", /'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"/], ["keyword", /\b(?:true|false|null|yes|no)\b/], ["number", /-?\b\d[\d.eE+-]*\b/], ], }; HL_RULES.javascript = HL_RULES.python; HL_RULES.typescript = HL_RULES.python; HL_RULES.sql = [ ["comment", /--[^\n]*/], ["string", /'(?:\\.|[^'\\])*'/], [ "keyword", /\b(?:SELECT|FROM|WHERE|JOIN|LEFT|RIGHT|INNER|OUTER|ON|GROUP|BY|ORDER|LIMIT|INSERT|INTO|VALUES|UPDATE|SET|DELETE|CREATE|TABLE|AS|AND|OR|NOT|NULL|COUNT|DISTINCT|IN)\b/i, ], ["number", /\b\d[\d.]*\b/], ];
function highlightCode(code, lang) { const rules = HL_RULES[lang]; if (!rules) return esc(code); const combined = new RegExp(rules.map((r) => "(" + r[1].source + ")").join("|"), "g"); let out = ""; let last = 0; let m; while ((m = combined.exec(code))) { if (m[0] === "") { combined.lastIndex++; continue; } out += esc(code.slice(last, m.index)); let gi = 1; while (gi < m.length && m[gi] === undefined) gi++; out += `<span class="tok-${rules[gi - 1][0]}">${esc(m[0])}</span>`; last = m.index + m[0].length; } out += esc(code.slice(last)); return out; }
function copySnippetBtn(text) { const btn = document.createElement("button"); btn.type = "button"; btn.className = "copy-snippet"; btn.title = "Copy"; btn.textContent = "⧉"; btn.addEventListener("click", (e) => { e.preventDefault(); e.stopPropagation(); copyText(text, btn, "⧉"); }); return btn; }
function renderCode(code, lang, title) { const pre = document.createElement("pre"); pre.className = "hl"; const c = document.createElement("code"); c.innerHTML = highlightCode(code, lang); pre.appendChild(c); if (!title) { const wrap = document.createElement("div"); wrap.className = "snippet"; wrap.appendChild(pre); wrap.appendChild(copySnippetBtn(code)); return wrap; } const det = document.createElement("details"); det.className = "code-accordion"; det.dataset.resUrl = `trackio-script://${title}`; const sum = document.createElement("summary"); sum.innerHTML = `<span class="code-ico"></></span>` + `<span class="code-name">${esc(title)}</span>`; sum .querySelector(".code-name") .addEventListener("click", (e) => e.preventDefault()); det.appendChild(sum); const wrap = document.createElement("div"); wrap.className = "snippet"; wrap.appendChild(pre); wrap.appendChild(copySnippetBtn(code)); det.appendChild(wrap); return det; }
const IMG_PATH = /^[^\s]+\.(png|jpe?g|gif|svg|webp)$/i;
function renderList(items, container) { let ul = null; items.forEach((item) => { if (URL_ONLY.test(item) || IMG_PATH.test(item)) { const el = renderStandaloneUrl(item); if (el) { ul = null; container.appendChild(el); } } else if (item.indexOf("📦 Artifact") !== -1) { ul = null; const div = document.createElement("div"); div.className = "artifact-chip"; div.innerHTML = inline(item.replace("📦", "🪣")); container.appendChild(div); } else if (item.indexOf("trackio-local-dashboard://") !== -1) { ul = null; const uri = item.match(/trackio-local-dashboard:\/\/\S+/)?.[0] || ""; const div = document.createElement("div"); div.className = "artifact-chip"; if (uri) div.dataset.resUrl = uri; div.innerHTML = "🎯 <strong>Local dashboard</strong> — publish the logbook to share it"; container.appendChild(div); } else { if (!ul) { ul = document.createElement("ul"); container.appendChild(ul); } const li = document.createElement("li"); li.innerHTML = inline(item); ul.appendChild(li); } }); }
/* -------------------- resources rail -------------------- */
function fmt(n) { if (n == null) return null; if (n >= 1e6) return (n / 1e6).toFixed(1) + "M"; if (n >= 1e3) return (n / 1e3).toFixed(1) + "k"; return String(n); }
const RESOURCE_SECTIONS = [ ["dashboard", "Dashboards", "🎯"], ["model", "Models", "🤗"], ["dataset", "Datasets", "📊"], ["space", "Spaces", "🚀"], ["artifact", "Artifacts", "🪣"], ["paper", "Papers", "📄"], ["repo", "Code", "🐙"], ["job", "Jobs", "⚙️"], ["bucket", "Buckets", "🪣"], ];
const RESOURCE_ICONS = Object.fromEntries( RESOURCE_SECTIONS.map(([kind, , icon]) => [kind, icon]) );
const ARTIFACT_ICON_IMG = `<img class="art-ico" src="./bucket-icon.svg" alt="" />`; const DASHBOARD_ICON_IMG = `<img class="art-ico" src="./trackio-logo-light.png" alt="" />`;
const RESOURCE_DESC = { dashboard: "Dashboard", model: "Model", dataset: "Dataset", space: "Space", artifact: "Artifact — in Bucket", paper: "Paper", repo: "Repository", job: "Job — status & logs", bucket: "Bucket — artifacts & data", };
const HF_NON_MODEL_PREFIX = /^(datasets|spaces|jobs|buckets|papers|blog|docs|api|posts|collections|organizations|settings|new|join|login|pricing|tasks|learn|chat|models)(\/|$)/;
function hfId(url, marker) { return url.split(marker)[1].split(/[?#]/)[0].replace(/\/$/, ""); }
function classifyResource(url) { if (IMG_URL.test(url)) { return null; } let m; if (url.startsWith("trackio-local-dashboard://")) { return { kind: "dashboard", id: url.slice("trackio-local-dashboard://".length), url, local: true, }; } if (url.startsWith("trackio-artifact://")) { return { kind: "artifact", id: url.slice("trackio-artifact://".length), url, local: true, }; } if (url.startsWith("trackio-local-path://")) { return { kind: "artifact", id: url.slice("trackio-local-path://".length), url, local: true, }; } if ((m = url.match(/huggingface\.co\/buckets\/[^#\s]+#(.+)/))) { return { kind: "artifact", id: decodeURIComponent(m[1]), url }; } if (/huggingface\.co\/datasets\/[^/]+\/[^/]+/.test(url)) { return { kind: "dataset", id: hfId(url, "/datasets/"), url }; } if (/huggingface\.co\/spaces\/[^/]+\/[^/]+/.test(url)) { return { kind: "space", id: hfId(url, "/spaces/"), url }; } if (/huggingface\.co\/jobs\//.test(url)) { const parts = hfId(url, "/jobs/").split("/"); const jid = parts[1] || ""; return { kind: "job", id: parts[0] + (jid ? ` · ${jid.slice(0, 12)}${jid.length > 12 ? "…" : ""}` : ""), url, }; } if (/huggingface\.co\/buckets\//.test(url)) { return { kind: "bucket", id: hfId(url, "/buckets/"), url }; } if (/huggingface\.co\/papers\//.test(url)) { return { kind: "paper", id: `Paper ${hfId(url, "/papers/")}`, url }; } if ((m = url.match(/arxiv\.org\/(?:abs|pdf)\/([^?#\s]+)/))) { return { kind: "paper", id: `arXiv:${m[1].replace(/\.pdf$/, "")}`, url }; } if ((m = url.match(/github\.com\/([^/?#]+\/[^/?#]+)/))) { return { kind: "repo", id: m[1], url }; } if ((m = url.match(/huggingface\.co\/([^?#]+)/))) { const rest = m[1].replace(/\/$/, ""); if (/^[^/]+\/[^/]+$/.test(rest) && !HF_NON_MODEL_PREFIX.test(rest)) { return { kind: "model", id: rest, url }; } } return null; }
async function fillRailMeta(item, el) { if (item.local) return; const meta = el.querySelector(".rail-meta"); const set = (parts) => { const text = parts.filter(Boolean).join(" · "); if (text) meta.textContent = text; }; if (item.kind === "model") { const d = await getJSON(`https://huggingface.co/api/models/${item.id}`); if (d) set([d.pipeline_tag, `↓ ${fmt(d.downloads)}`, `♥ ${fmt(d.likes)}`]); } else if (item.kind === "dataset") { const d = await getJSON(`https://huggingface.co/api/datasets/${item.id}`); if (d) set([`↓ ${fmt(d.downloads)}`, `♥ ${fmt(d.likes)}`]); } else if (item.kind === "space" || item.kind === "dashboard") { const d = await getJSON(`https://huggingface.co/api/spaces/${item.id}`); if (d) set([d.sdk, `♥ ${fmt(d.likes)}`]); } else if (item.kind === "repo") { const d = await getJSON(`https://api.github.com/repos/${item.id}`); if (d) set([`★ ${fmt(d.stargazers_count)}`, d.language]); } else if (item.kind === "paper") { const m = item.id.match(/^(?:arXiv:|Paper )(.+)$/); if (!m) return; const arxivId = m[1].replace(/v\d+$/, ""); const d = await getJSON(`https://huggingface.co/api/papers/${arxivId}`); if (d && d.id) { if (el.href) el.href = `https://huggingface.co/papers/${d.id}`; const title = d.title && d.title.length > 70 ? `${d.title.slice(0, 69)}…` : d.title; set([title, d.upvotes ? `▲ ${fmt(d.upvotes)}` : null]); } } }
const BARE_ID_SKIP_DIRS = new Set([ "scripts", "configs", "config", "results", "figures", "data", "datasets", "src", "tests", "test", "examples", "pages", "assets", "docs", "outputs", "output", "checkpoints", "models", "utils", "lib", "bin", "tmp", "node_modules", "dist", "build", ]); const FILE_EXT_RE = /\.(py|pyc|js|ts|jsx|tsx|json|jsonl|yaml|yml|csv|tsv|md|txt|sh|bash|html|css|png|jpe?g|svg|gif|webp|ipynb|toml|cfg|ini|lock|pdf|whl|gz|zip|tar|pt|pth|bin|safetensors|db|sqlite)$/i;
async function detectBareModelIds(text, groups) { const stripped = text.replace(DETECTED_URL, " "); DETECTED_URL.lastIndex = 0; const seen = new Set(); const candidates = []; const re = /(^|[\s"'`(=[])([A-Za-z0-9][\w.-]*\/[A-Za-z0-9][\w.-]*)/g; let m; while ((m = re.exec(stripped)) && candidates.length < 15) { const id = m[2].replace(/[.:,]+$/, ""); if (seen.has(id)) continue; seen.add(id); if (FILE_EXT_RE.test(id)) continue; if (BARE_ID_SKIP_DIRS.has(id.split("/")[0].toLowerCase())) continue; candidates.push(id); } const results = await Promise.all( candidates.map((id) => getJSON(`https://huggingface.co/api/models/${id}`)) ); let added = false; const confirmed = []; results.forEach((d, i) => { if (!d || !d.id) return; const id = candidates[i]; confirmed.push(id); const url = `https://huggingface.co/${id}`; if (!groups.has("model")) groups.set("model", new Map()); if (!groups.get("model").has(url)) { groups.get("model").set(url, { kind: "model", id, url }); added = true; } }); return { added, confirmed }; }
function chipifyBareIds(ids, container) { if (!ids.length) return; const escaped = ids.map((id) => id.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")); const pattern = new RegExp("(" + escaped.join("|") + ")"); const splitter = new RegExp(pattern.source, "g"); container .querySelectorAll(".cell.markdown .cell-body") .forEach((body) => { const walker = document.createTreeWalker(body, NodeFilter.SHOW_TEXT, { acceptNode(node) { if (!pattern.test(node.nodeValue)) return NodeFilter.FILTER_REJECT; for ( let el = node.parentElement; el && el !== body; el = el.parentElement ) { if (["A", "CODE", "PRE", "BUTTON"].indexOf(el.tagName) !== -1) { return NodeFilter.FILTER_REJECT; } } return NodeFilter.FILTER_ACCEPT; }, }); const nodes = []; while (walker.nextNode()) nodes.push(walker.currentNode); nodes.forEach((node) => { const frag = document.createDocumentFragment(); node.nodeValue.split(splitter).forEach((part) => { if (ids.indexOf(part) !== -1) { const holder = document.createElement("span"); holder.innerHTML = resChipHtml({ kind: "model", id: part, url: `https://huggingface.co/${part}`, }); frag.appendChild(holder.firstChild); } else if (part) { frag.appendChild(document.createTextNode(part)); } }); node.parentNode.replaceChild(frag, node); }); }); }
let RAIL_TOKEN = 0; const RAIL_EXCLUDE_KINDS = new Set(["paper", "repo", "artifact", "dashboard"]);
function railDashboardItem(it) { return { kind: "dashboard", id: it.id, url: it.local ? it.resUrl : it.url || it.resUrl, local: it.local, railLabel: "Dashboard", }; }
function promoteTrackioSpacesInRail(groups, dashResUrls, body, rail, token) { const spaceGroup = groups.get("space"); if (!spaceGroup || !spaceGroup.size) return; spaceGroup.forEach((item, url) => { getJSON(`https://huggingface.co/api/spaces/${item.id}`) .then((d) => { if (rail.dataset.renderToken !== token) return; const tags = (d && d.tags) || []; if (!tags.some((t) => String(t).toLowerCase() === "trackio")) return; if (dashResUrls.has(url)) return; spaceGroup.delete(url); if (!spaceGroup.size) groups.delete("space"); if (!groups.has("dashboard")) groups.set("dashboard", new Map()); groups.get("dashboard").set(url, { kind: "dashboard", id: item.id, url: item.url, local: false, railLabel: "Dashboard", }); dashResUrls.add(url); paintRail(groups, body, rail); }) .catch(() => {}); }); }
function renderRail(md, body, rail) { const token = String(++RAIL_TOKEN); rail.dataset.renderToken = token; const scanText = md.replace( /(`{3,4}|~{3,4})(html|raw)[^\n]*\n[\s\S]*?\n\1/g, " " ); const groups = new Map(); const dashMap = new Map(); const dashResUrls = new Set(); cellDashboardItems(md).forEach((it) => { if (dashMap.has(it.resUrl)) return; dashMap.set(it.resUrl, railDashboardItem(it)); dashResUrls.add(it.resUrl); }); if (dashMap.size) groups.set("dashboard", dashMap); extractUrls(scanText).forEach((url) => { const item = classifyResource(url); if (!item) return; if (RAIL_EXCLUDE_KINDS.has(item.kind)) return; if (dashResUrls.has(url)) return; if (!groups.has(item.kind)) groups.set(item.kind, new Map()); groups.get(item.kind).set(item.url, item); }); const artMap = new Map(); cellArtifactItems(md).forEach((it) => { if (artMap.has(it.resUrl)) return; const label = it.type ? it.type.charAt(0).toUpperCase() + it.type.slice(1) : "Artifact"; artMap.set(it.resUrl, { kind: "artifact", id: it.name, url: it.local ? it.resUrl : it.url || it.resUrl, local: it.local, railLabel: label, size: it.size, }); }); if (artMap.size) groups.set("artifact", artMap); paintRail(groups, body, rail); promoteTrackioSpacesInRail(groups, dashResUrls, body, rail, token); detectBareModelIds(scanText, groups) .then((result) => { if (rail.dataset.renderToken !== token) return; chipifyBareIds(result.confirmed, body); if (result.added) paintRail(groups, body, rail); }) .catch(() => {}); }
function paintRail(groups, body, rail) { rail.innerHTML = ""; RESOURCE_SECTIONS.forEach(([kind, label, icon]) => { const group = groups.get(kind); if (!group || !group.size) return; group.forEach((item) => { const el = document.createElement(item.local ? "div" : "a"); el.className = item.local ? "rail-item rail-local" : "rail-item"; if (!item.local) { el.href = item.url; el.target = "_blank"; el.rel = "noopener"; } el.dataset.resUrl = item.url; let desc; if (kind === "artifact") { const state = item.local ? "publish to share" : "Open ↗"; desc = item.size ? `${item.size} · ${state}` : state; } else if (kind === "dashboard") { desc = item.local ? "publish to share" : "Open ↗"; } else { desc = item.local ? "publish to share" : RESOURCE_DESC[kind]; } const kindLabel = item.railLabel || label.replace(/s$/, ""); const iconHtml = kind === "artifact" ? ARTIFACT_ICON_IMG : kind === "dashboard" ? DASHBOARD_ICON_IMG : `<span>${icon}</span>`; el.innerHTML = `<div class="rail-kind">${iconHtml}${esc(kindLabel)}</div>` + `<div class="rail-title">${esc(item.id)}</div>` + `<div class="rail-meta">${esc(desc)}</div>`; rail.appendChild(el); fillRailMeta(item, el) .catch(() => {}) .finally(() => scheduleRailPosition(body, rail)); }); }); rail.hidden = !rail.childElementCount; scheduleRailPosition(body, rail); }
function resourceAnchor(body, url) { return body.querySelector(`[data-res-url="${CSS.escape(url)}"]`); }
function positionRail(body, rail) { if (rail.hidden || !rail.isConnected) return; const bodyRect = body.getBoundingClientRect(); const items = Array.from(rail.querySelectorAll(".rail-item")).map((el, index) => { const anchor = resourceAnchor(body, el.dataset.resUrl); return { el, index, desired: anchor ? Math.max(0, anchor.getBoundingClientRect().top - bodyRect.top) : 0, }; }); items.sort((a, b) => a.desired - b.desired || a.index - b.index); let cursor = 0; items.forEach(({ el, desired }) => { const top = Math.max(desired, cursor); el.style.top = `${top}px`; cursor = top + el.offsetHeight + 10; }); rail.style.minHeight = `${Math.max(body.offsetHeight, cursor)}px`; }
function scheduleRailPosition(body, rail) { cancelAnimationFrame(Number(rail.dataset.positionFrame || 0)); rail.dataset.positionFrame = String( requestAnimationFrame(() => positionRail(body, rail)) ); }
function dashboardSubdomainFromUrl(url) { return spaceIdFromUrl(url).toLowerCase().replace(/[^a-z0-9-]/g, "-"); }
function dashboardOpenLink(head, url) { if (!head || !url) return; const meta = head.querySelector(".cell-meta"); if (!meta) return; let link = meta.querySelector(".cell-open"); if (!link) { link = document.createElement("a"); link.className = "cell-open"; link.target = "_blank"; link.rel = "noopener"; meta.insertBefore(link, meta.firstChild); } link.href = url; link.textContent = "Open ↗"; }
function dashboardFrame(src) { const iframe = document.createElement("iframe"); iframe.className = "dashboard-frame"; iframe.src = src; iframe.loading = "lazy"; iframe.allow = "clipboard-read; clipboard-write; fullscreen"; return iframe; }
function renderDashboardCell(meta, body, container, head) { const project = meta.dashboard_project || ""; const holder = document.createElement("div"); holder.className = "dashboard-shell"; container.appendChild(holder); const space = body.match(/https:\/\/huggingface\.co\/spaces\/[^\s<>)"'`]+/); if (space) { const url = space[0]; dashboardOpenLink(head, url); holder.appendChild( dashboardFrame( `https://${dashboardSubdomainFromUrl(url)}.hf.space/?sidebar=hidden&hide_empty_tabs=true` ) ); return; } if (!isLocalPreview()) { holder.className = "artifact-chip"; holder.dataset.resUrl = `trackio-local-dashboard://${project}`; holder.innerHTML = "🎯 <strong>Local Trackio dashboard</strong> — publish the logbook to share it"; return; } const open = "/dashboard/?project=" + encodeURIComponent(project); dashboardOpenLink(head, open); holder.appendChild( dashboardFrame(open + "&sidebar=hidden&hide_empty_tabs=true"), ); }
const CACHE_PREFIX = "trackio-logbook:"; const CACHE_TTL_MS = 24 * 60 * 60 * 1000; const CACHE_MISS_TTL_MS = 60 * 60 * 1000;
function cacheGet(url) { try { const raw = localStorage.getItem(CACHE_PREFIX + url); if (!raw) return undefined; const entry = JSON.parse(raw); const ttl = entry.d === null ? CACHE_MISS_TTL_MS : CACHE_TTL_MS; if (Date.now() - entry.t > ttl) { localStorage.removeItem(CACHE_PREFIX + url); return undefined; } return entry.d; } catch (e) { return undefined; } }
function cacheSet(url, data) { try { localStorage.setItem( CACHE_PREFIX + url, JSON.stringify({ t: Date.now(), d: data }) ); } catch (e) {} }
async function getJSON(url) { if (UNFURL_CACHE[url] !== undefined) return UNFURL_CACHE[url]; const cached = cacheGet(url); if (cached !== undefined) { UNFURL_CACHE[url] = cached; return cached; } try { const r = await fetch(url); if (!r.ok) throw new Error(r.status); const j = await r.json(); UNFURL_CACHE[url] = j; cacheSet(url, j); return j; } catch (e) { UNFURL_CACHE[url] = null; cacheSet(url, null); return null; } }
/* -------------------- routing / render -------------------- */
function buildTree() { const tree = document.getElementById("tree"); tree.innerHTML = ""; const nodes = []; (MANIFEST.root.children || []).forEach((c) => flattenTree(c, 0, nodes)); nodes.forEach(({ node, depth }) => { const a = document.createElement("a"); a.href = "#/" + node.slug; a.className = "depth-" + depth; a.dataset.slug = node.slug; const mark = document.createElement("span"); mark.className = "tree-mark"; mark.textContent = "§"; a.appendChild(mark); a.appendChild(document.createTextNode(" " + node.title)); tree.appendChild(a); }); }
function highlight(slug) { document .querySelectorAll("#tree a") .forEach((a) => a.classList.toggle("active", a.dataset.slug === slug)); document .getElementById("book-head") .classList.toggle("active", slug === MANIFEST.root.slug); }
function clearPageCache() { Object.keys(PAGE_CACHE).forEach((key) => { delete PAGE_CACHE[key]; }); }
function isLocalPreview() { return ["localhost", "127.0.0.1", "::1"].includes(location.hostname); }
async function fetchManifest() { const suffix = isLocalPreview() ? `?t=${Date.now()}` : ""; return await (await fetch("./logbook.json" + suffix, { cache: "no-store" })).json(); }
async function fetchPage(node) { if (PAGE_CACHE[node.file]) return PAGE_CACHE[node.file]; try { const suffix = isLocalPreview() ? `?rev=${encodeURIComponent(MANIFEST.revision || "")}` : ""; const r = await fetch("./" + node.file + suffix, { cache: "no-store" }); PAGE_CACHE[node.file] = await r.text(); } catch (e) { PAGE_CACHE[node.file] = "# " + node.title + "\n\n_Could not load section._"; } return PAGE_CACHE[node.file]; }
function allNodes() { const nodes = []; flattenTree(MANIFEST.root, 0, nodes); return nodes.map(({ node }) => node); }
function collectPinnedCells(markdown, nodes) { const cells = []; markdown.forEach((text, index) => { const cellRe = /(^|\n)---\n<!-- trackio-cell\n([\s\S]*?)\n-->\n([\s\S]*?)(?=\n---\n<!-- trackio-cell\n|\s*$)/g; let match; let cellIndex = 0; while ((match = cellRe.exec(text))) { const meta = parseCellMeta(match[2]); if (isPinned(meta)) { cells.push({ meta, body: match[3], node: nodes[index], index: cells.length, order: meta.pinned_at || meta.created_at || "", cellIndex, }); } cellIndex++; } }); return cells.sort( (a, b) => a.order.localeCompare(b.order) || a.index - b.index || a.cellIndex - b.cellIndex ); }
function renderPinnedNotes(cells, container) { if (!cells.length) return; const deck = document.createElement("section"); deck.className = "pinned-notes"; const list = document.createElement("div"); list.className = "pinned-notes-list"; cells.forEach(({ meta, body }) => { const cell = renderCell(meta, body, list); cell.classList.add("pinned-copy"); }); deck.appendChild(list); const anchor = container.querySelector(".logbook-stats") || container.querySelector(".agent-hint"); container.insertBefore(deck, anchor ? anchor.nextSibling : container.firstChild); container.closest(".book-intro").classList.add("has-pinned-notes"); }
function removeIndexProse(body) { const h1 = Array.from(body.children).find((el) => el.tagName === "H1"); if (!h1) return; let current = h1.nextElementSibling; while (current && current.tagName !== "H2") { const next = current.nextElementSibling; current.remove(); current = next; } }
function removePageDirectory(body) { const heading = Array.from(body.children).find( (el) => el.tagName === "H2" && el.textContent.trim().toLowerCase() === "pages" ); if (!heading) return; let current = heading; while (current) { const next = current.nextElementSibling; current.remove(); if (next && ["H1", "H2"].includes(next.tagName)) break; current = next; } }
const RAIL_OBSERVERS = [];
async function renderLogbook(opts = {}) { const scrollY = window.scrollY; const page = document.getElementById("page"); RAIL_OBSERVERS.splice(0).forEach((observer) => observer.disconnect()); page.innerHTML = ""; const nodes = allNodes(); const markdown = await Promise.all(nodes.map(fetchPage)); const pinnedCells = collectPinnedCells(markdown, nodes); let bookIntroBody = null; nodes.forEach((node, index) => { const section = document.createElement("section"); section.className = "page-section"; section.id = "/" + node.slug; section.dataset.slug = node.slug;
const layout = document.createElement("div"); layout.className = "page-layout"; const body = document.createElement("div"); body.className = "page-body"; const rail = document.createElement("aside"); rail.className = "context-rail"; rail.setAttribute("aria-label", `Resources for ${node.title}`);
renderMarkdown(markdown[index], body); if (node.slug === MANIFEST.root.slug) { section.classList.add("book-intro"); removeIndexProse(body); removePageDirectory(body); const hint = buildAgentHint(); const h1 = body.querySelector("h1"); if (h1 && h1.parentNode === body) { body.insertBefore(hint, h1.nextSibling); } else { body.prepend(hint); } hint.after(buildLogbookStats(markdown)); bookIntroBody = body; } layout.appendChild(body); layout.appendChild(rail); section.appendChild(layout); page.appendChild(section); renderRail(markdown[index], body, rail); if (window.ResizeObserver) { const observer = new ResizeObserver(() => scheduleRailPosition(body, rail)); observer.observe(body); observer.observe(rail); RAIL_OBSERVERS.push(observer); } }); if (bookIntroBody) renderPinnedNotes(pinnedCells, bookIntroBody); if (bookIntroBody) { const section = bookIntroBody.closest(".book-intro"); const hasExtra = Array.from(bookIntroBody.children).some( (el) => el.tagName !== "H1" && !el.classList.contains("agent-hint") && !el.classList.contains("logbook-stats") && !el.classList.contains("pinned-notes") ); if (section && !section.classList.contains("has-pinned-notes") && !hasExtra) { section.classList.add("book-intro-tight"); } } requestAnimationFrame(() => { if (opts.preserveScroll) { window.scrollTo(0, scrollY); } else { scrollToHash({ behavior: "auto" }); } updateActiveSection(); }); }
function setupResourceHover() { document.addEventListener("mouseover", (e) => { const el = e.target.closest && e.target.closest("[data-res-url]"); if (!el || el.classList.contains("rail-item")) return; const url = el.getAttribute("data-res-url"); const section = el.closest(".page-section"); const scope = section || document; scope.querySelectorAll(".context-rail [data-res-url]").forEach((n) => { n.classList.toggle("res-hl", n.getAttribute("data-res-url") === url); }); }); document.addEventListener("mouseout", (e) => { const el = e.target.closest && e.target.closest("[data-res-url]"); if (!el || el.classList.contains("rail-item")) return; document.querySelectorAll(".context-rail .res-hl").forEach((n) => { n.classList.remove("res-hl"); }); }); }
let STATS_TOKEN = 0; let STATS_LISTENERS = false;
function fmtBytes(n) { if (n == null || isNaN(n)) return null; if (n < 1000) return `${n} B`; const units = ["kB", "MB", "GB", "TB"]; let v = n; let i = -1; do { v /= 1000; i++; } while (v >= 1000 && i < units.length - 1); return `${v.toFixed(v < 10 ? 1 : 0)} ${units[i]}`; }
function spaceIdFromUrl(url) { return url.split("/spaces/")[1].split(/[?#]/)[0].replace(/\/$/, ""); }
const LB_CELL_RE = /(^|\n)---\n<!-- trackio-cell\n([\s\S]*?)\n-->\n([\s\S]*?)(?=\n---\n<!-- trackio-cell\n|\s*$)/g;
function cellDashboardItems(md) { const re = new RegExp(LB_CELL_RE.source, "g"); const items = []; let m; while ((m = re.exec(md))) { const meta = parseCellMeta(m[2]); if (meta.type !== "dashboard") continue; const body = m[3]; const project = meta.dashboard_project || ""; const sp = body.match(/https:\/\/huggingface\.co\/spaces\/[^\s<>)"'`]+/); const local = !sp; const url = sp ? sp[0] : ""; const resUrl = local ? `trackio-local-dashboard://${project}` : url; items.push({ id: local ? project : spaceIdFromUrl(url), local, url, resUrl, }); } return items; }
function artifactInfoFromCell(meta, body) { const name = meta.artifact || meta.path || ""; let size = null; const sm = body.match(/·\s*([\d.]+\s*[kMGT]?B)\b/); if (sm) size = sm[1].trim(); if (!size && meta.size != null) size = fmtBytes(meta.size); const bucket = body.match(/https:\/\/huggingface\.co\/buckets\/[^\s<>)"'`]+/); const artUri = body.match(/trackio-artifact:\/\/\S+/); const pathUri = body.match(/trackio-local-path:\/\/\S+/); const url = bucket ? bucket[0] : ""; const local = !bucket; const resUrl = url || (artUri ? artUri[0] : pathUri ? pathUri[0] : `trackio-artifact://${name}`); return { name, type: meta.artifact_type || "", size, local, isPathRef: !!meta.path, url, resUrl, }; }
function cellArtifactItems(md) { const re = new RegExp(LB_CELL_RE.source, "g"); const items = []; let m; while ((m = re.exec(md))) { const meta = parseCellMeta(m[2]); const body = m[3]; const order = meta.created_at || ""; if (meta.type === "artifact") { const info = artifactInfoFromCell(meta, body); if (info.name) items.push({ ...info, order }); } } return items; }
function collectLogbookResources(markdownList) { const re = new RegExp(LB_CELL_RE.source, "g"); const dashboards = new Map(); markdownList.forEach((md) => { let m; while ((m = re.exec(md))) { const meta = parseCellMeta(m[2]); const body = m[3]; if (meta.type !== "dashboard") continue; const project = meta.dashboard_project || ""; const space = body.match(/https:\/\/huggingface\.co\/spaces\/[^\s<>)"'`]+/); const local = !space; const url = space ? space[0] : ""; const key = local ? `local:${project}` : `space:${spaceIdFromUrl(url)}`; const resUrl = local ? `trackio-local-dashboard://${project}` : url; if (!dashboards.has(key)) dashboards.set(key, { project, local, url, resUrl }); } }); const artifacts = new Map(); markdownList.forEach((md) => { cellArtifactItems(md).forEach((it) => { const key = `${it.type}:${it.name}`; const prev = artifacts.get(key); if (!prev || it.order >= prev.order) artifacts.set(key, it); }); }); return { dashboards: Array.from(dashboards.values()).sort((a, b) => a.project.localeCompare(b.project) ), artifacts: Array.from(artifacts.values()).sort((a, b) => a.name.localeCompare(b.name) ), }; }
function closeStatPopovers() { document .querySelectorAll(".stat-popover") .forEach((p) => (p.hidden = true)); document .querySelectorAll(".stat-tile.open") .forEach((t) => t.classList.remove("open")); }
function ensureStatListeners() { if (STATS_LISTENERS) return; STATS_LISTENERS = true; document.addEventListener("click", closeStatPopovers); document.addEventListener("keydown", (e) => { if (e.key === "Escape") closeStatPopovers(); }); }
function stateHtml(remote, url) { return remote ? `<a class="stat-row-state open" href="${esc(url)}" target="_blank" rel="noopener" title="Open in a new tab">Open ↗</a>` : `<span class="stat-row-state">publish to share</span>`; }
function scrollToResource(resUrl) { closeStatPopovers(); if (!resUrl) return; const el = document.querySelector( `#page .page-body [data-res-url="${CSS.escape(resUrl)}"]:not(.stat-row)` ); if (!el) return; el.scrollIntoView({ behavior: "smooth", block: "center" }); el.classList.add("res-flash"); setTimeout(() => el.classList.remove("res-flash"), 1500); }
function dashRowHtml(d) { const inner = `<span class="stat-row-ico">${DASHBOARD_ICON_IMG}</span>` + `<div class="stat-row-main"><div class="stat-row-title">${esc(d.project)}</div>` + `<div class="stat-row-meta">${stateHtml(!d.local, d.url)}</div></div>`; return `<div class="stat-row" data-res-url="${esc(d.resUrl)}" title="Jump to it in the logbook">${inner}</div>`; }
function artRowHtml(a) { const remote = !a.local && !!a.url; const parts = [a.type, a.size].filter(Boolean).map(esc); const meta = parts.length ? `${parts.join(" · ")} · ${stateHtml(remote, a.url)}` : stateHtml(remote, a.url); const inner = `<span class="stat-row-ico">${ARTIFACT_ICON_IMG}</span>` + `<div class="stat-row-main"><div class="stat-row-title">${esc(a.name)}</div>` + `<div class="stat-row-meta">${meta}</div></div>`; return `<div class="stat-row" data-res-url="${esc(a.resUrl)}" title="Jump to it in the logbook">${inner}</div>`; }
function statTile(icon, alt, singular, plural, head, rowFn) { const tile = document.createElement("button"); tile.type = "button"; tile.className = "stat-tile"; const render = (items) => { const count = items.length; const label = count === 1 ? singular : plural; const caret = count > 0 ? `<span class="stat-caret">▾</span>` : ""; tile.innerHTML = `<img class="stat-icon" src="${icon}" alt="${esc(alt)}" />` + `<div class="stat-text"><div class="stat-num">${count}</div>` + `<div class="stat-label">${esc(label)}</div></div>` + caret; tile.disabled = count === 0; if (count > 0) { const pop = document.createElement("div"); pop.className = "stat-popover"; pop.hidden = true; pop.innerHTML = `<div class="stat-pop-head">${esc(head)}</div>` + items.map(rowFn).join(""); pop.addEventListener("click", (e) => { if (e.target.closest("a.stat-row-state")) { e.stopPropagation(); return; } e.stopPropagation(); const row = e.target.closest(".stat-row"); if (row) scrollToResource(row.dataset.resUrl); }); tile.appendChild(pop); } }; tile.addEventListener("click", (e) => { if (tile.disabled) return; e.stopPropagation(); const pop = tile.querySelector(".stat-popover"); if (!pop) return; const isOpen = !pop.hidden; closeStatPopovers(); if (!isOpen) { pop.hidden = false; tile.classList.add("open"); } }); return { tile, render }; }
function buildLogbookStats(markdownList) { const token = ++STATS_TOKEN; ensureStatListeners(); const { dashboards, artifacts } = collectLogbookResources(markdownList);
const el = document.createElement("div"); el.className = "logbook-stats"; const dash = statTile( "./trackio-logo-light.png", "Trackio", "Trackio Dashboard", "Trackio Dashboards", "Dashboards created in this logbook", dashRowHtml ); const art = statTile( "./bucket-icon.svg", "Bucket", "Artifact", "Artifacts", "Artifacts created in this logbook", artRowHtml ); dash.render(dashboards); art.render(artifacts); el.appendChild(dash.tile); el.appendChild(art.tile);
const scanText = markdownList .map((md) => md.replace(/(`{3,4}|~{3,4})(html|raw)[^\n]*\n[\s\S]*?\n\1/g, " ") ) .join("\n"); const seen = new Set( dashboards.map((d) => d.local ? `local:${d.project}` : `space:${spaceIdFromUrl(d.url)}` ) ); const remoteSpaces = new Map(); extractUrls(scanText).forEach((url) => { const item = classifyResource(url); if (item && item.kind === "space" && !item.local) { remoteSpaces.set(item.url, item); } }); remoteSpaces.forEach((s) => { const key = `space:${s.id}`; if (seen.has(key)) return; getJSON(`https://huggingface.co/api/spaces/${s.id}`) .then((d) => { if (STATS_TOKEN !== token) return; const tags = (d && d.tags) || []; if ( !seen.has(key) && tags.some((t) => String(t).toLowerCase() === "trackio") ) { seen.add(key); dashboards.push({ project: s.id, local: false, url: s.url, resUrl: s.url, }); dashboards.sort((a, b) => a.project.localeCompare(b.project)); dash.render(dashboards); } }) .catch(() => {}); }); return el; }
function buildAgentHint() { const onSpaces = /\.hf\.space$/.test(location.hostname) || /(^|\.)huggingface\.co$/.test(location.hostname); let source = ""; if (onSpaces && MANIFEST.space_id) { source = ` ${MANIFEST.space_id}`; } else if (/^https?:$/.test(location.protocol)) { source = ` ${location.origin}/`; } const command = `trackio logbook read${source}`; const tokens = MANIFEST.agent_view_tokens; const div = document.createElement("div"); div.className = "agent-hint"; const label = document.createElement("span"); label.className = "agent-hint-label"; label.textContent = "Read from the CLI:"; const code = document.createElement("code"); code.textContent = command; const copy = document.createElement("button"); copy.className = "copy"; copy.type = "button"; copy.title = "Copy"; copy.textContent = "⧉"; copy.addEventListener("click", () => copyText(command, copy, "⧉")); const note = document.createElement("span"); note.className = "agent-hint-note"; note.textContent = "compact view for agents" + (tokens ? ` · ~${fmt(tokens)} tokens` : ""); div.appendChild(label); div.appendChild(code); div.appendChild(copy); div.appendChild(note); return div; }
function currentSlug() { const slug = (location.hash || "").replace(/^#\//, "") || MANIFEST.root.slug; return findNode(MANIFEST.root, slug) ? slug : MANIFEST.root.slug; }
function scrollToHash(opts = {}) { const slug = currentSlug(); if (!location.hash) { window.scrollTo({ top: 0, behavior: opts.behavior || "auto" }); highlight(slug); return; } const section = document.getElementById("/" + slug); if (section) section.scrollIntoView({ behavior: opts.behavior || "smooth" }); highlight(slug); }
function navigateToLogbookSlug(target) { const slug = String(target || "").replace(/^#?\//, "").trim(); if (!slug || !findNode(MANIFEST.root, slug)) return; const hash = "#/" + slug; if (location.hash === hash) { scrollToHash({ behavior: "smooth" }); } else { location.hash = hash; } }
function setupFigureNavigation() { window.addEventListener("message", (event) => { const data = event.data; if (!data || data.type !== "trackio-logbook:navigate") return; // Only accept messages from one of this logbook's sandboxed figure // iframes, rather than from an arbitrary same-origin page. const isFigureFrame = Array.from( document.querySelectorAll("iframe.figure-frame") ).some((frame) => frame.contentWindow === event.source); if (!isFigureFrame) return; navigateToLogbookSlug(data.target); }); }
let SCROLL_FRAME = 0; function updateActiveSection() { cancelAnimationFrame(SCROLL_FRAME); SCROLL_FRAME = requestAnimationFrame(() => { const sections = Array.from(document.querySelectorAll(".page-section")); if (!sections.length) return; const marker = Math.min(window.innerHeight * 0.28, 180); let active = sections[0]; sections.forEach((section) => { if (section.getBoundingClientRect().top <= marker) active = section; }); if ( window.innerHeight + window.scrollY >= document.documentElement.scrollHeight - 2 ) { active = sections[sections.length - 1]; } highlight(active.dataset.slug); }); }
function startLiveReload() { if (!isLocalPreview()) return; setInterval(async () => { try { const next = await fetchManifest(); if (!next || next.revision === MANIFEST.revision) return; MANIFEST = next; clearPageCache(); document.title = MANIFEST.title + " · Trackio Logbook"; document.getElementById("book-title").textContent = MANIFEST.title; document.getElementById("book-head").setAttribute("aria-label", MANIFEST.title); buildTree(); renderLogbook({ preserveScroll: true }); } catch (e) {} }, LIVE_RELOAD_MS); }
function setupConnect() { const space = MANIFEST.space_id; if (!space) return; const steps = [ { t: "Install Trackio, if you don't have it yet.", c: "uv tool install trackio" }, { t: "Add the Trackio skill for your agent, then reload it.", c: "trackio skills add" }, { t: "Connect to this logbook.", c: `trackio logbook open ${space}` }, ]; const ol = document.getElementById("connect-steps"); steps.forEach((s, i) => { const li = document.createElement("li"); const title = document.createElement("div"); title.className = "step-title"; title.textContent = `${i + 1}. ${s.t}`; const block = document.createElement("div"); block.className = "codeblock"; const code = document.createElement("code"); code.textContent = s.c; const copy = document.createElement("button"); copy.className = "copy"; copy.type = "button"; copy.title = "Copy"; copy.textContent = "⧉"; copy.addEventListener("click", () => copyText(s.c, copy, "⧉")); block.appendChild(code); block.appendChild(copy); li.appendChild(title); li.appendChild(block); ol.appendChild(li); });
const agentPrompt = `Read and help maintain this Trackio experiment logbook ("${MANIFEST.title}").\n\n` + "1. If you don't have Trackio, install it: uv tool install trackio\n" + "2. Add the Trackio skill for your agent: trackio skills add (then reload)\n" + `3. Connect to this logbook: trackio logbook open ${space}\n\n` + "Start with `trackio logbook read`; use `trackio logbook read page \"...\"` " + "for a page-level view, then fetch relevant details with " + "`trackio logbook read cell cell_<id>`. If I've given you " + 'write access to the Space, add findings with `trackio logbook cell markdown "..." ' + '--page "..."` and they will sync back automatically.';
const foot = document.getElementById("sidebar-foot"); foot.hidden = false; const modal = document.getElementById("modal"); const open = () => (modal.hidden = false); const close = () => (modal.hidden = true); document.getElementById("connect-btn").addEventListener("click", open); document.getElementById("modal-close").addEventListener("click", close); modal.querySelector(".modal-backdrop").addEventListener("click", close); document.addEventListener("keydown", (e) => { if (e.key === "Escape") close(); }); const agentBtn = document.getElementById("copy-agent"); agentBtn.addEventListener("click", () => copyText(agentPrompt, agentBtn, "Copy for agent") ); }
function copyText(text, btn, restore) { const done = () => { const prev = btn.textContent; btn.textContent = restore === "⧉" ? "✓" : "Copied!"; btn.classList.add("copied"); setTimeout(() => { btn.textContent = restore; btn.classList.remove("copied"); }, 1400); void prev; }; if (navigator.clipboard && navigator.clipboard.writeText) { navigator.clipboard.writeText(text).then(done, done); } else { const ta = document.createElement("textarea"); ta.value = text; document.body.appendChild(ta); ta.select(); try { document.execCommand("copy"); } catch (e) {} document.body.removeChild(ta); done(); } }
async function init() { MANIFEST = await fetchManifest(); document.title = MANIFEST.title + " · Trackio Logbook"; document.getElementById("book-title").textContent = MANIFEST.title; document.getElementById("book-head").setAttribute("aria-label", MANIFEST.title); document.getElementById("book-head").addEventListener("click", () => { const target = "#/" + MANIFEST.root.slug; if (location.hash === target) scrollToHash(); else location.hash = target; }); buildTree(); setupConnect(); setupResourceHover(); setupFigureNavigation(); window.addEventListener("hashchange", () => scrollToHash()); window.addEventListener("scroll", updateActiveSection, { passive: true }); await renderLogbook(); startLiveReload(); }
init();})();1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071{ "schema_version": 1, "title": "Repro - Solving Positive Linear Programs with Differential Privacy", "emoji": "🔒", "space_id": "txus/repro-positive-linear-programs-dp", "paper": { "arxiv_id": "2604.26838" }, "tags": [ "icml2026-repro", "paper-zlSioMUQ2Y" ], "updated_at": "2026-07-17T09:01:30+00:00", "root": { "slug": "index", "title": "Repro - Solving Positive Linear Programs with Differential Privacy", "file": "pages/index.md", "children": [ { "slug": "claim-1-instance-dependent-a-max-opt-1-5-bound-improving-hsu-et-al-by-opt-0-5", "title": "Claim 1: instance-dependent (A_max·OPT)^1.5 bound, improving Hsu et al. by OPT^0.5", "file": "pages/claim-1-instance-dependent-a-max-opt-1-5-bound-improving-hsu-et-al-by-opt-0-5/page.md", "children": [] }, { "slug": "claim-2-data-independent-d-1-5-alpha-3-5-bound", "title": "Claim 2: data-independent d^1.5 / alpha^3.5 bound", "file": "pages/claim-2-data-independent-d-1-5-alpha-3-5-bound/page.md", "children": [] }, { "slug": "claim-3-mixed-packing-covering-bounds-theorem-2", "title": "Claim 3: mixed packing-covering bounds (Theorem 2)", "file": "pages/claim-3-mixed-packing-covering-bounds-theorem-2/page.md", "children": [] }, { "slug": "claim-4-truncated-softmax-and-algorithms-1-2", "title": "Claim 4: truncated softmax and Algorithms 1-2", "file": "pages/claim-4-truncated-softmax-and-algorithms-1-2/page.md", "children": [] }, { "slug": "claim-5-mwu-variants-for-mixed-packing-covering-algorithms-3-4", "title": "Claim 5: MWU variants for mixed packing-covering (Algorithms 3-4)", "file": "pages/claim-5-mwu-variants-for-mixed-packing-covering-algorithms-3-4/page.md", "children": [] }, { "slug": "setup-and-methodology", "title": "Setup and methodology", "file": "pages/setup-and-methodology/page.md", "children": [] }, { "slug": "conclusion", "title": "Conclusion", "file": "pages/conclusion/page.md", "children": [] }, { "slug": "private-positive-lp-repro", "title": "private-positive-lp-repro", "file": "pages/private-positive-lp-repro/page.md", "children": [] } ] }, "agent_view_tokens": 12644, "revision": "1784278890332411000"}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451# Claim 1: instance-dependent (A_max·OPT)^1.5 bound, improving Hsu et al. by OPT^0.5
---<!-- trackio-cell{"type": "code", "id": "cell_cf996b0cb648", "created_at": "2026-07-17T08:17:56+00:00", "title": "Run: uv exp_claim1_width.py (exit 0)", "command": ["uv", "run", "python", "exp_claim1_width.py"], "exit_code": 0, "duration_s": 7.341}-->````bash$ uv run python exp_claim1_width.py````
exit 0 · 7.3s
````python title=exp_claim1_width.py"""Claim 1: the OPT^0.5 improvement over Hsu et al. (2014).
The paper's Section 3.1 is explicit about *where* the improvement comes from. BothHsu et al. and this paper run a dense MWU on smax^U; they differ in the per-stepincrease bound:
Hsu et al. (no positivity): smax(eta A x_{t+1}) - smax(eta A x_t) <~ <grad, eta A Delta> + eta^2 ||A Delta||_inf^2 this paper (positivity): smax(eta A x_{t+1}) - smax(eta A x_t) <~ (1 + eta ||A Delta||_inf) <grad, eta A Delta>
The quadratic error term forces Hsu et al. to take eta ~ alpha/rho^2-ish, givingT ~ rho^2 log n / alpha^2 iterations; the positivity bound gives T ~ rho log n / alpha^2.Here rho = width = max_i,j A_ij * OPT <= A_max * OPT.
Since s ~ 1/eps' ~ sqrt(T), a factor rho in T is a factor sqrt(rho) in s. Withrho = A_max*OPT this is exactly the claimed OPT^0.5 (Theorem 1 vs Hsu et al.'sOPT^2/(alpha^2 eps) for set cover where A_max = 1).
This script verifies the two ingredients empirically: (a) the positivity-based per-step bound HOLDS on real iterates of Algorithm 1, and the Hsu-style bound is LOOSER (larger) by a factor ~ rho; (b) T_paper / T_hsu = 1/rho and s_paper / s_hsu = 1/sqrt(rho), so the exponent of OPT in s drops from 2.0 to 1.5."""
from __future__ import annotations
import json
import numpy as np
from ppl.fitting import fit_bothfrom ppl.instances import PackingLP, solve_packing_optfrom ppl.smax import grad_smax, smax
def wide_packing(n, d, spread, rng): """Packing instance with a controllable width rho = A_max * OPT.
NOTE: rho is scale-invariant -- rescaling A by c scales OPT by 1/c, leaving A_max*OPT fixed -- so sweeping a_max does nothing. The width is driven by the *spread* of the column scales: a column with small entries admits a large x_j (raising OPT) while some other entry keeps A_max at 1. """ scales = np.logspace(-np.log10(spread), 0, d) # column scales in [1/spread, 1] A = rng.uniform(0.0, 1.0, size=(n, d)) * scales[None, :] A[rng.integers(n), d - 1] = 1.0 # pin A_max = 1 return PackingLP(A=A, opt=solve_packing_opt(A))
def per_step_bounds(n=400, d=12, spread=1.0, alpha=0.5, seed=0, steps=60): """(a) Compare the two per-step increase bounds on real Algorithm-1 iterates.""" rng = np.random.default_rng(seed) lp = wide_packing(n, d, spread, rng) A, opt = lp.A, lp.opt a_max = float(A.max()) H = a_max eta = alpha / (10.0 * H * opt) U = 1.0 / min(n, 50)
rows = [] x = np.zeros(d) Ax = np.zeros(n) for t in range(steps): g = grad_smax(eta * Ax, U) j = int(np.argmin(g @ A)) # greedy (non-private) oracle step delta = np.zeros(d) delta[j] = opt ADelta = opt * A[:, j]
actual = smax(eta * (Ax + ADelta), U) - smax(eta * Ax, U) lin = float(g @ (eta * ADelta)) w = float(np.abs(eta * ADelta).max()) bound_paper = (1.0 + w) * lin # eq (1), needs w <= 1 bound_hsu = lin + float(np.linalg.norm(eta * ADelta, np.inf)) ** 2
rows.append({ "t": t, "actual": actual, "bound_paper": bound_paper, "bound_hsu": bound_hsu, "linear": lin, "eta_ADelta_inf": w, }) x, Ax = x + delta, Ax + ADelta
paper_ok = all(r["actual"] <= r["bound_paper"] + 1e-9 for r in rows) hsu_ok = all(r["actual"] <= r["bound_hsu"] + 1e-9 for r in rows) # how much slack does each bound carry, relative to the actual increase? ratio_paper = float(np.median([r["bound_paper"] / max(r["actual"], 1e-15) for r in rows])) ratio_hsu = float(np.median([r["bound_hsu"] / max(r["actual"], 1e-15) for r in rows])) return { "rho_width": float(A.max() * opt), "paper_bound_holds": paper_ok, "hsu_bound_holds": hsu_ok, "median_slack_paper": ratio_paper, "median_slack_hsu": ratio_hsu, "rows": rows, }
def iteration_and_s_scaling(alpha=0.5, eps=1.0, delta=1e-6, beta=0.1, n=1000, d=10): """(b) T and s as a function of the width rho = A_max*OPT, for both analyses.""" out = [] for rho in np.logspace(0, 3, 25): # paper: T ~ rho log n / alpha^2 (Alg 1 line 3 with H*OPT = rho) T_paper = 20.0 * rho * np.log(n) / alpha**2 # Hsu-style: quadratic error term costs an extra factor rho T_hsu = 20.0 * rho**2 * np.log(n) / alpha**2 # s ~ 60 * rho * (log d + log(T/beta)) / (alpha * eps'), eps' = eps/(2 sqrt(T log 1/delta)) def s_of(T): epsp = eps / (2.0 * np.sqrt(T * np.log(1.0 / delta))) return 60.0 * rho * (np.log(d) + np.log(T / beta)) / (alpha * epsp)
def L_of(T): # the polylog factor O~(.) hides return np.log(d) + np.log(T / beta)
out.append({"rho": float(rho), "T_paper": T_paper, "T_hsu": T_hsu, "s_paper": s_of(T_paper), "s_hsu": s_of(T_hsu), "L_paper": L_of(T_paper), "L_hsu": L_of(T_hsu)}) return out
def fit_exponent(xs, ys) -> float: return float(np.polyfit(np.log(xs), np.log(ys), 1)[0])
def max_certifiable_eta(lp, alpha=0.5, steps=25): """The crux of Claim 1, measured rather than assumed.
Both analyses run the same MWU; they differ in the per-step inequality they can certify, and hence in the largest step size eta they may take. T = 2 log n/(eta alpha), so a smaller admissible eta means proportionally more iterations.
paper (uses positivity, eq. 1): needs eta*||A Delta||_inf <= alpha/10 Hsu-style (generic, quadratic): needs eta^2 ||A Delta||_inf^2 <= (alpha/10) * <grad smax(eta A x), eta A Delta> i.e. the quadratic error must not swamp the linear signal.
We bisect on eta for each criterion, on real greedy MWU iterates. """ A, opt = lp.A, lp.opt n, d = A.shape U = 1.0 / min(n, 50)
def worst(eta): """Return (max eta||A Delta||_inf, max quadratic/linear ratio).
The maxima are over BOTH the iterates t and the candidate coordinates j: the exponential mechanism may return any j in [d], so each analysis must certify its per-step inequality uniformly over j -- that is exactly why the worst-case width rho = A_max*OPT (rather than the width realised along the greedy path) enters the iteration count. """ Ax = np.zeros(n) w_max, q_max = 0.0, 0.0 for _ in range(steps): g = grad_smax(eta * Ax, U) gA = g @ A # (d,) linear term per candidate column colmax = A.max(axis=0) # (d,) width per candidate column w_j = eta * opt * colmax # eta ||A Delta||_inf for each j lin_j = eta * opt * gA w_max = max(w_max, float(w_j.max())) q_max = max(q_max, float((w_j**2 / np.maximum(lin_j, 1e-300)).max())) j = int(np.argmin(gA)) # the algorithm itself still follows greedy Ax += opt * A[:, j] return w_max, q_max
def bisect(ok): lo, hi = 1e-12, 1e3 if ok(lo) is False: return lo for _ in range(40): mid = np.sqrt(lo * hi) if ok(mid): lo = mid else: hi = mid return lo
thr = alpha / 10.0 eta_paper = bisect(lambda e: worst(e)[0] <= thr) eta_hsu = bisect(lambda e: worst(e)[1] <= thr) return { "eta_paper": eta_paper, "eta_hsu": eta_hsu, # T = 2 log n / (eta alpha), so the T ratio is the inverse eta ratio "T_ratio_hsu_over_paper": eta_paper / max(eta_hsu, 1e-300), }
def eta_sweep(alpha=0.5, seed=3): """T_hsu/T_paper should grow linearly in the width rho = A_max*OPT.""" rng = np.random.default_rng(seed) rows = [] for spread in [1.0, 3.0, 10.0, 30.0, 100.0]: lp = wide_packing(300, 8, spread, rng) rho = float(lp.A.max() * lp.opt) m = max_certifiable_eta(lp, alpha=alpha) m.update({"spread": spread, "rho": rho}) rows.append(m) return rows
def per_step_sweep(): """The looseness of the Hsu-style bound relative to the paper's grows with the width.
We sweep A_max (hence rho = A_max*OPT) and report the median ratio of the two per-step bounds on real Algorithm-1 iterates. """ rows = [] for spread in [1.0, 3.0, 10.0, 30.0, 100.0, 300.0]: r = per_step_bounds(spread=spread, steps=40) ratios = [x["bound_hsu"] / max(x["bound_paper"], 1e-15) for x in r["rows"]] rows.append({ "spread": spread, "rho": r["rho_width"], "paper_bound_holds": r["paper_bound_holds"], "hsu_bound_holds": r["hsu_bound_holds"], "median_bound_ratio_hsu_over_paper": float(np.median(ratios)), }) return rows
def main() -> dict: res: dict = {} res["per_step"] = per_step_bounds() res["per_step_sweep"] = per_step_sweep() res["eta_sweep"] = eta_sweep() # does T_hsu/T_paper grow like rho^1? es = res["eta_sweep"] res["T_ratio_exponent_in_rho"] = fit_exponent( [x["rho"] for x in es], [x["T_ratio_hsu_over_paper"] for x in es] )
sc = iteration_and_s_scaling() rho = np.array([r["rho"] for r in sc]) res["scaling_rows"] = sc res["T_exponent_paper"] = fit_exponent(rho, [r["T_paper"] for r in sc]) res["T_exponent_hsu"] = fit_exponent(rho, [r["T_hsu"] for r in sc]) # s exponent in rho = A_max*OPT. Paper predicts 1.5, Hsu-style 2.0. # O~(.) hides a (log d + log(T/beta)) factor, so we fit both raw and corrected. res["s_exponent_paper"] = fit_both(rho, [r["s_paper"] for r in sc], [r["L_paper"] for r in sc]) res["s_exponent_hsu"] = fit_both(rho, [r["s_hsu"] for r in sc], [r["L_hsu"] for r in sc]) res["improvement_factor_at_rho_1000"] = sc[-1]["s_hsu"] / sc[-1]["s_paper"] res["sqrt_rho_at_1000"] = float(np.sqrt(1000.0)) # the polynomial part of the improvement is exactly sqrt(rho); the residual is the # ratio of the hidden log factors res["improvement_polylog_corrected_at_rho_1000"] = ( (sc[-1]["s_hsu"] / sc[-1]["L_hsu"]) / (sc[-1]["s_paper"] / sc[-1]["L_paper"]) ) return res
if __name__ == "__main__": r = main() with open("outputs/claim1_width.json", "w") as f: json.dump(r, f, indent=2) ps = r["per_step"] print(f"width rho = A_max*OPT : {ps['rho_width']:.3f}") print(f"paper per-step bound holds : {ps['paper_bound_holds']}") print(f"Hsu-style per-step bound holds : {ps['hsu_bound_holds']}") print(f"median slack, paper bound : {ps['median_slack_paper']:.4f}") print(f"median slack, Hsu-style bound : {ps['median_slack_hsu']:.4f}") print() print(f"T exponent in rho: paper {r['T_exponent_paper']:.4f} | Hsu {r['T_exponent_hsu']:.4f}") print(f"s exponent in rho (raw) : paper {r['s_exponent_paper']['raw']:.4f} " f"| Hsu {r['s_exponent_hsu']['raw']:.4f} <- biased by the log(T/beta) O~ hides") print(f"s exponent in rho (polylog-corrected): paper " f"{r['s_exponent_paper']['polylog_corrected']:.4f} (predicted 1.5) " f"| Hsu {r['s_exponent_hsu']['polylog_corrected']:.4f} (predicted 2.0)") print(f"improvement at rho=1000: {r['improvement_factor_at_rho_1000']:.2f}x raw, " f"{r['improvement_polylog_corrected_at_rho_1000']:.2f}x polylog-corrected " f"(sqrt(rho) = {r['sqrt_rho_at_1000']:.2f})")
print("\nper-step bound ratio (Hsu / paper) vs width, on real Alg-1 iterates:") for row in r["per_step_sweep"]: print(f" spread={row['spread']:>6} rho={row['rho']:10.3f} " f"ratio={row['median_bound_ratio_hsu_over_paper']:8.3f} " f"paper bound holds={row['paper_bound_holds']}")
print("\nlargest step size each analysis can certify (measured by bisection):") for row in r["eta_sweep"]: print(f" rho={row['rho']:9.3f} eta_paper={row['eta_paper']:.3e} " f"eta_hsu={row['eta_hsu']:.3e} T_hsu/T_paper={row['T_ratio_hsu_over_paper']:9.3f}") print(f" -> T_hsu/T_paper exponent in rho: {r['T_ratio_exponent_in_rho']:.4f}") print(" OBSERVATION (not a refutation): on these positive instances the generic") print(" quadratic analysis costs only a constant factor ~2, not a factor rho.") print(" Positivity makes the linear term <grad smax, A Delta> grow with the width,") print(" so the additive eta^2||A Delta||_inf^2 term stays proportional to it.") print(" The rho-factor separation the paper's T relies on is a WORST-CASE") print(" statement; we could not exhibit it on random or structured instances.")
ok = ( all(x["paper_bound_holds"] for x in r["per_step_sweep"]) and ps["paper_bound_holds"] and abs(r["s_exponent_paper"]["polylog_corrected"] - 1.5) < 0.02 and abs(r["s_exponent_hsu"]["polylog_corrected"] - 2.0) < 0.02 and abs(r["improvement_polylog_corrected_at_rho_1000"] - r["sqrt_rho_at_1000"]) < 0.5 ) print(f"\n[{'PASS' if ok else 'FAIL'}] Claim 1 mechanism") raise SystemExit(0 if ok else 1)
````
````outputwidth rho = A_max*OPT : 1.478paper per-step bound holds : TrueHsu-style per-step bound holds : Truemedian slack, paper bound : 1.0455median slack, Hsu-style bound : 1.0940
T exponent in rho: paper 1.0000 | Hsu 2.0000s exponent in rho (raw) : paper 1.5705 | Hsu 2.1161 <- biased by the log(T/beta) O~ hidess exponent in rho (polylog-corrected): paper 1.5000 (predicted 1.5) | Hsu 2.0000 (predicted 2.0)improvement at rho=1000: 43.88x raw, 31.62x polylog-corrected (sqrt(rho) = 31.62)
per-step bound ratio (Hsu / paper) vs width, on real Alg-1 iterates: spread= 1.0 rho= 1.478 ratio= 1.047 paper bound holds=True spread= 3.0 rho= 3.284 ratio= 1.015 paper bound holds=True spread= 10.0 rho= 10.346 ratio= 1.005 paper bound holds=True spread= 30.0 rho= 30.342 ratio= 1.002 paper bound holds=True spread= 100.0 rho= 100.482 ratio= 1.000 paper bound holds=True spread= 300.0 rho= 301.271 ratio= 1.000 paper bound holds=True
largest step size each analysis can certify (measured by bisection): rho= 1.399 eta_paper=3.575e-02 eta_hsu=1.729e-02 T_hsu/T_paper= 2.067 rho= 3.099 eta_paper=1.613e-02 eta_hsu=8.128e-03 T_hsu/T_paper= 1.985 rho= 10.123 eta_paper=4.939e-03 eta_hsu=2.541e-03 T_hsu/T_paper= 1.944 rho= 30.170 eta_paper=1.657e-03 eta_hsu=8.291e-04 T_hsu/T_paper= 1.999 rho= 100.267 eta_paper=4.987e-04 eta_hsu=2.523e-04 T_hsu/T_paper= 1.976 -> T_hsu/T_paper exponent in rho: -0.0072 OBSERVATION (not a refutation): on these positive instances the generic quadratic analysis costs only a constant factor ~2, not a factor rho. Positivity makes the linear term <grad smax, A Delta> grow with the width, so the additive eta^2||A Delta||_inf^2 term stays proportional to it. The rho-factor separation the paper's T relies on is a WORST-CASE statement; we could not exhibit it on random or structured instances.
[PASS] Claim 1 mechanism
````
---<!-- trackio-cell{"type": "markdown", "id": "cell_3cecb6791415", "created_at": "2026-07-17T08:18:23+00:00", "title": "Claim 1 verdict"}-->## Verdict: **partially reproduced** — the bound and its exponent reproduce exactly; the *superiority over Hsu et al.* is a worst-case claim we could confirm analytically but **not exhibit empirically**.
Claim 1 (Theorem 1 / Theorem 6.1): `s = O~((A_max·OPT)^1.5 / (alpha^2 eps))`, improving Hsu et al. (2014)'s `O~(OPT^2/(alpha^2 eps))` for private set cover (where `A_max = 1`) by a factor `OPT^0.5`.
### What reproduces exactly
Writing `rho = A_max·OPT` for the width, the two analyses differ **only** in the per-step increase bound they can certify, hence in the step size `eta`, hence in `T = 2 log n/(eta·alpha)`:
| | per-step bound | admissible `eta` | `T` | `s ~ sqrt(T)·rho` ||---|---|---|---|---|| **this paper** (uses positivity, eq. 1) | `(1 + eta\|\|A Delta\|\|_inf)<grad, eta A Delta>` | `~alpha/(10 rho)` | `~rho log n/alpha^2` | **`rho^1.5`** || **Hsu et al.** (generic, quadratic error) | `<grad, eta A Delta> + eta^2\|\|A Delta\|\|_inf^2` | `~alpha/rho^2` | `~rho^2 log n/alpha^2` | **`rho^2`** |
Measured (fitting the bound formula over `rho` from 1 to 1000):
- `T` exponent in `rho`: **1.0000** (paper) vs **2.0000** (Hsu) — exact.- `s` exponent in `rho`, raw fit: 1.5705 vs 2.1161. **Polylog-corrected: 1.5000 vs 2.0000** — exactly the claimed 1.5 and 2.0. (The raw fit is biased by the `log(T/beta)` factor `O~()` hides; see *Setup and methodology*.)- Improvement at `rho = 1000`: **31.62x** polylog-corrected, versus `sqrt(rho) = 31.62`. **Exact.** Since `rho = A_max·OPT` and `A_max = 1` for set cover, `sqrt(rho) = OPT^0.5` — precisely the claimed factor.
The paper's own per-step inequality **eq (1)** was also checked on real Algorithm-1 iterates at every width tested (`rho` from 1.5 to 301): **always holds**.
### What does not reproduce empirically, and why that is not a refutation
The `rho`-factor separation is a **worst-case** statement. We tried to exhibit it by measuring, via bisection on real iterates, the largest step size each analysis can actually certify:
| `rho` | `eta` paper | `eta` Hsu | `T_hsu/T_paper` ||---|---|---|---|| 1.4 | 3.58e-02 | 1.73e-02 | 2.07 || 3.1 | 1.61e-02 | 8.13e-03 | 1.99 || 10.1 | 4.94e-03 | 2.54e-03 | 1.94 || 30.2 | 1.66e-03 | 8.29e-04 | 2.00 || 100.3 | 4.99e-04 | 2.52e-04 | 1.98 |
The ratio is a **constant ~2**, not `rho` (fitted exponent **-0.007**, theory would want 1.0). The reason is structural and, we think, interesting: **on positive LPs the smax weights are largest exactly where the entries are large**, so the linear term `<grad smax, A Delta>` grows *in proportion to* the width, and the additive `eta^2\|\|A Delta\|\|_inf^2` term never gets a chance to dominate it. Every random and structured positive instance we constructed has this property.
This does **not** contradict Theorem 1, which is an upper bound proved for the worst case. It does mean our experiments cannot independently confirm that Hsu et al.'s analysis is *necessarily* worse on positive LPs — only that the paper's stated bounds stand in the claimed 1.5-vs-2.0 relation. Constructing a positive instance that realises the `rho` gap (if one exists) is the obvious follow-up; note the paper never claims one does, since `A_max·OPT` enters as an upper bound on `\|\|A Delta\|\|_inf`.
A related caveat worth recording: `rho = A_max·OPT` is **scale-invariant** for packing LPs (rescaling `A` by `c` scales `OPT` by `1/c`), so it cannot be varied by changing `A_max` — only by spreading the column scales. We initially swept `a_max` and got a flat `rho = 1.478`; the sweep above varies the column-scale spread instead.
---<!-- trackio-cell{"type": "figure", "id": "cell_7dc1cd0e2a21", "created_at": "2026-07-17T08:20:49+00:00", "title": "s vs width: OPT^1.5 (this paper) vs OPT^2 (Hsu et al.)"}-->````html<html><head><meta charset="utf-8" /></head><body> <div style="height:430px; width:100%;"> <script>window.PlotlyConfig = {MathJaxConfig: 'local'};</script> <script charset="utf-8" src="https://cdn.plot.ly/plotly-3.7.0.min.js" integrity="sha256-jvTGqxNp8AGWEcvNLVuKr+8j5dGe9Yw51LQkmDH+IYA=" crossorigin="anonymous"></script> <div id="d2764f66-ecf5-4719-9fd6-d8ac42523162" class="plotly-graph-div" style="height:100%; width:100%;"></div> <script> window.PLOTLYENV=window.PLOTLYENV || {}; if (document.getElementById("d2764f66-ecf5-4719-9fd6-d8ac42523162")) { Plotly.newPlot( "d2764f66-ecf5-4719-9fd6-d8ac42523162", [{"line":{"color":"#3b82f6","width":3},"name":"this paper (Thm 1)","x":[1.0,1.333521432163324,1.7782794100389228,2.371373705661655,3.1622776601683795,4.216965034285822,5.623413251903491,7.498942093324558,10.0,13.33521432163324,17.78279410038923,23.71373705661655,31.622776601683793,42.169650342858226,56.23413251903491,74.98942093324558,100.0,133.3521432163324,177.82794100389228,237.13737056616552,316.22776601683796,421.6965034285823,562.341325190349,749.8942093324558,1000.0],"y":[228994.2161962393,361928.9357603394,571657.0744152949,902351.0238231798,1423495.9998806124,2244347.0087403054,3536618.000651512,5570078.260578346,8768379.597669134,13796583.54040601,21698345.106561273,34110858.96669057,53601548.05689052,84195297.35017353,132199841.87312756,207497572.20603308,325566802.15546685,510643622.5691143,800666765.4467572,1255009121.767217,1966563559.5343215,3080631149.293448,4824434132.012157,7553220481.947926,11822272909.30469],"type":"scatter"},{"line":{"color":"#ef4444","dash":"dash","width":3},"name":"Hsu et al. (2014)","x":[1.0,1.333521432163324,1.7782794100389228,2.371373705661655,3.1622776601683795,4.216965034285822,5.623413251903491,7.498942093324558,10.0,13.33521432163324,17.78279410038923,23.71373705661655,31.622776601683793,42.169650342858226,56.23413251903491,74.98942093324558,100.0,133.3521432163324,177.82794100389228,237.13737056616552,316.22776601683796,421.6965034285823,562.341325190349,749.8942093324558,1000.0],"y":[228994.2161962393,428682.3298279625,800490.6269760244,1491379.4448373257,2772805.0917585306,5145488.504207166,9531852.925578024,17629132.246641807,32556680.21554668,60041537.10134708,110587995.81395802,203444700.44910344,373853095.1350805,686281891.6062249,1258574623.7213583,2305980784.317889,4221393881.146944,7721484121.989789,14112692893.031359,25775145641.447433,47042568109.43082,85801493279.17332,156396395488.49136,284904834397.1599,518711974073.92194],"type":"scatter"}], {"template":{"data":{"barpolar":[{"marker":{"line":{"color":"white","width":0.5},"pattern":{"fillmode":"overlay","size":10,"solidity":0.2}},"type":"barpolar"}],"bar":[{"error_x":{"color":"#2a3f5f"},"error_y":{"color":"#2a3f5f"},"marker":{"line":{"color":"white","width":0.5},"pattern":{"fillmode":"overlay","size":10,"solidity":0.2}},"type":"bar"}],"carpet":[{"aaxis":{"endlinecolor":"#2a3f5f","gridcolor":"#C8D4E3","linecolor":"#C8D4E3","minorgridcolor":"#C8D4E3","startlinecolor":"#2a3f5f"},"baxis":{"endlinecolor":"#2a3f5f","gridcolor":"#C8D4E3","linecolor":"#C8D4E3","minorgridcolor":"#C8D4E3","startlinecolor":"#2a3f5f"},"type":"carpet"}],"choropleth":[{"colorbar":{"outlinewidth":0,"ticks":""},"type":"choropleth"}],"contourcarpet":[{"colorbar":{"outlinewidth":0,"ticks":""},"type":"contourcarpet"}],"contour":[{"colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]],"type":"contour"}],"heatmap":[{"colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]],"type":"heatmap"}],"histogram2dcontour":[{"colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]],"type":"histogram2dcontour"}],"histogram2d":[{"colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]],"type":"histogram2d"}],"histogram":[{"marker":{"pattern":{"fillmode":"overlay","size":10,"solidity":0.2}},"type":"histogram"}],"mesh3d":[{"colorbar":{"outlinewidth":0,"ticks":""},"type":"mesh3d"}],"parcoords":[{"line":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"parcoords"}],"pie":[{"automargin":true,"type":"pie"}],"scatter3d":[{"line":{"colorbar":{"outlinewidth":0,"ticks":""}},"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scatter3d"}],"scattercarpet":[{"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scattercarpet"}],"scattergeo":[{"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scattergeo"}],"scattergl":[{"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scattergl"}],"scattermapbox":[{"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scattermapbox"}],"scattermap":[{"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scattermap"}],"scatterpolargl":[{"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scatterpolargl"}],"scatterpolar":[{"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scatterpolar"}],"scatter":[{"fillpattern":{"fillmode":"overlay","size":10,"solidity":0.2},"type":"scatter"}],"scatterternary":[{"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scatterternary"}],"surface":[{"colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]],"type":"surface"}],"table":[{"cells":{"fill":{"color":"#EBF0F8"},"line":{"color":"white"}},"header":{"fill":{"color":"#C8D4E3"},"line":{"color":"white"}},"type":"table"}]},"layout":{"annotationdefaults":{"arrowcolor":"#2a3f5f","arrowhead":0,"arrowwidth":1},"autotypenumbers":"strict","coloraxis":{"colorbar":{"outlinewidth":0,"ticks":""}},"colorscale":{"diverging":[[0,"#8e0152"],[0.1,"#c51b7d"],[0.2,"#de77ae"],[0.3,"#f1b6da"],[0.4,"#fde0ef"],[0.5,"#f7f7f7"],[0.6,"#e6f5d0"],[0.7,"#b8e186"],[0.8,"#7fbc41"],[0.9,"#4d9221"],[1,"#276419"]],"sequential":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]],"sequentialminus":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]]},"colorway":["#636efa","#EF553B","#00cc96","#ab63fa","#FFA15A","#19d3f3","#FF6692","#B6E880","#FF97FF","#FECB52"],"font":{"color":"#2a3f5f"},"geo":{"bgcolor":"white","lakecolor":"white","landcolor":"white","showlakes":true,"showland":true,"subunitcolor":"#C8D4E3"},"hoverlabel":{"align":"left"},"hovermode":"closest","mapbox":{"style":"light"},"paper_bgcolor":"white","plot_bgcolor":"white","polar":{"angularaxis":{"gridcolor":"#EBF0F8","linecolor":"#EBF0F8","ticks":""},"bgcolor":"white","radialaxis":{"gridcolor":"#EBF0F8","linecolor":"#EBF0F8","ticks":""}},"scene":{"xaxis":{"backgroundcolor":"white","gridcolor":"#DFE8F3","gridwidth":2,"linecolor":"#EBF0F8","showbackground":true,"ticks":"","zerolinecolor":"#EBF0F8"},"yaxis":{"backgroundcolor":"white","gridcolor":"#DFE8F3","gridwidth":2,"linecolor":"#EBF0F8","showbackground":true,"ticks":"","zerolinecolor":"#EBF0F8"},"zaxis":{"backgroundcolor":"white","gridcolor":"#DFE8F3","gridwidth":2,"linecolor":"#EBF0F8","showbackground":true,"ticks":"","zerolinecolor":"#EBF0F8"}},"shapedefaults":{"line":{"color":"#2a3f5f"}},"ternary":{"aaxis":{"gridcolor":"#DFE8F3","linecolor":"#A2B1C6","ticks":""},"baxis":{"gridcolor":"#DFE8F3","linecolor":"#A2B1C6","ticks":""},"bgcolor":"white","caxis":{"gridcolor":"#DFE8F3","linecolor":"#A2B1C6","ticks":""}},"title":{"x":0.05},"xaxis":{"automargin":true,"gridcolor":"#EBF0F8","linecolor":"#EBF0F8","ticks":"","title":{"standoff":15},"zerolinecolor":"#EBF0F8","zerolinewidth":2},"yaxis":{"automargin":true,"gridcolor":"#EBF0F8","linecolor":"#EBF0F8","ticks":"","title":{"standoff":15},"zerolinecolor":"#EBF0F8","zerolinewidth":2}}},"xaxis":{"type":"log","title":{"text":"ρ = A\u003csub\u003emax\u003c\u002fsub\u003e · OPT"}},"yaxis":{"type":"log","title":{"text":"s (constraints allowed to be violated)"}},"font":{"size":13},"margin":{"l":70,"r":30,"t":60,"b":60},"legend":{"orientation":"h","yanchor":"bottom","y":1.02,"x":0},"title":{"text":"Claim 1: violated-constraint bound vs width ρ = A\u003csub\u003emax\u003c\u002fsub\u003e·OPT\u003cbr\u003e\u003csub\u003epolylog-corrected exponents: paper 1.500 (theory 1.5), Hsu 2.000 (theory 2.0) — a √ρ = OPT\u003csup\u003e0.5\u003c\u002fsup\u003e improvement\u003c\u002fsub\u003e"},"height":430}, {"responsive": true} ) }; </script> </div></body></html>````
````rawrho,T_paper,T_hsu,s_paper,s_hsu,L_paper,L_hsu1.0,552.620422318571,552.620422318571,228994.2161962393,228994.2161962393,10.919841554578039,10.9198415545780391.333521432163324,736.9311770129616,982.7135185761288,361928.9357603394,428682.3298279625,11.207664691202293,11.4954878278265511.7782794100389228,982.7135185761288,1747.539216050832,571657.0744152949,800490.6269760244,11.495487827826551,12.071134101075062.371373705661655,1310.4695386978983,3107.6130061387553,902351.0238231798,1491379.4448373257,11.783310964450806,12.6467803743235733.1622776601683795,1747.5392160508322,5526.20422318571,1423495.9998806124,2772805.0917585306,12.07113410107506,13.2224266475720854.216965034285822,2330.380998149678,9827.135185761286,2244347.0087403054,5145488.504207166,12.358957237699318,13.7980729208205945.623413251903491,3107.6130061387557,17475.392160508323,3536618.000651512,9531852.925578024,12.646780374323573,14.3737191940691077.498942093324558,4144.068546555526,31076.130061387554,5570078.260578346,17629132.246641807,12.934603510947827,14.9493654673176210.0,5526.204223185709,55262.04223185709,8768379.597669134,32556680.21554668,13.222426647572085,15.52501174056612913.33521432163324,7369.311770129616,98271.35185761287,13796583.54040601,60041537.10134708,13.51024978419634,16.1006580138146417.78279410038923,9827.135185761286,174753.92160508322,21698345.106561273,110587995.81395802,13.798072920820594,16.67630428706315423.71373705661655,13104.695386978985,310761.3006138755,34110858.96669057,203444700.44910344,14.085896057444852,17.25195056031166331.622776601683793,17475.39216050832,552620.4223185709,53601548.05689052,373853095.1350805,14.373719194069107,17.82759683356017542.169650342858226,23303.809981496783,982713.5185761286,84195297.35017353,686281891.6062249,14.661542330693361,18.40324310680868856.23413251903491,31076.130061387554,1747539.2160508323,132199841.87312756,1258574623.7213583,14.94936546731762,18.978889380057274.98942093324558,41440.68546555526,3107613.0061387555,207497572.20603308,2305980784.317889,15.237188603941874,19.55453565330571100.0,55262.04223185709,5526204.22318571,325566802.15546685,4221393881.146944,15.525011740566129,20.130181926554222133.3521432163324,73693.11770129616,9827135.185761288,510643622.5691143,7721484121.989789,15.812834877190387,20.705828199802735177.82794100389228,98271.35185761287,17475392.16050832,800666765.4467572,14112692893.031359,16.10065801381464,21.281474473051244237.13737056616552,131046.95386978984,31076130.06138755,1255009121.767217,25775145641.447433,16.388481150438896,21.857120746299756316.22776601683796,174753.92160508322,55262042.2318571,1966563559.5343215,47042568109.43082,16.676304287063154,22.43276701954827421.6965034285823,233038.09981496786,98271351.8576129,3080631149.293448,85801493279.17332,16.96412742368741,23.008413292796778562.341325190349,310761.3006138755,174753921.6050832,4824434132.012157,156396395488.49136,17.251950560311663,23.58405956604529749.8942093324558,414406.8546555526,310761300.61387557,7553220481.947926,284904834397.1599,17.53977369693592,24.1597058392938031000.0,552620.4223185709,552620422.318571,11822272909.30469,518711974073.92194,17.827596833560175,24.735352112542312
````123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447# Claim 2: data-independent d^1.5 / alpha^3.5 bound
---<!-- trackio-cell{"type": "code", "id": "cell_ca7f3bc8d029", "created_at": "2026-07-17T08:18:48+00:00", "title": "Run: uv exp_claim2_algs.py (exit 0)", "command": ["uv", "run", "python", "exp_claim2_algs.py"], "exit_code": 0, "duration_s": 1.884}-->````bash$ uv run python exp_claim2_algs.py````
exit 0 · 1.9s
````python title=exp_claim2_algs.py"""Claims 1, 2, 4: end-to-end Algorithms 1 and 2, plus the two lemmas that theprivacy argument rests on.
Checks: A. Sensitivity of the oracle score Q is <= 3H*OPT/s (proof of Lemma 8 / Claim 17). This is THE privacy-critical inequality: it is what U = 1/s buys. We measure it empirically over random neighbouring instances (differing in one constraint). B. Lemma 7 / 15: eps' = eps/(2 sqrt(T log 1/delta)) composes to (eps, delta)-DP. C. Lemma 8: <grad smax^U(eta A x), A Delta_t> <= 1 + alpha/10 at every iteration. Lemma 16: <grad smin^U(eta A x), A Delta_t> >= 1 - alpha/10. D. Theorem 6 / 10 end-to-end utility: 1^T x >= (1-alpha) OPT (packing) resp. 1^T x <= (1+alpha) OPT (covering), and #violated <= s. E. Data-independent bound (Theorem 6.2 / 10.2): s scales as d^1.5 / alpha^3.5."""
from __future__ import annotations
import jsonimport sys
import numpy as np
from ppl.algorithms import ( covering_algorithm2, covering_params, packing_algorithm1, packing_params,)from ppl.fitting import fit_bothfrom ppl.mechanism import strong_composition_epsfrom ppl.smax import grad_smax, grad_sminfrom ppl.instances import random_covering, random_packing
# ---------------------------------------------------------------- A. sensitivitydef sensitivity_check(trials=300, n=150, d=8, alpha=0.5, eps=1.0, delta=1e-6, beta=0.1, seed=0, preprocess=True): """Empirical max |Q(j,A) - Q(j,A')| over neighbouring A, A' vs the claimed 3H*OPT/s.""" rng = np.random.default_rng(seed) worst_ratio = 0.0 rows = [] for _ in range(trials): lp = random_packing(n, d, rng, a_max=1.0) A, opt = lp.A, lp.opt p = packing_params(1.0, opt, n, d, alpha, beta, eps, delta, preprocess) H = p.H Ap = np.minimum(A, H) if preprocess else A.copy() U = max(p.U, 1.0 / n)
# neighbouring instance: replace one constraint (row) arbitrarily A2 = Ap.copy() i = rng.integers(n) A2[i] = rng.uniform(0, min(1.0, H), size=d)
x = rng.uniform(0, opt / d, size=d) # arbitrary iterate g1 = grad_smax(p.eta * (Ap @ x), U) g2 = grad_smax(p.eta * (A2 @ x), U) q1 = -(g1 @ Ap) * opt q2 = -(g2 @ A2) * opt observed = float(np.abs(q1 - q2).max()) claimed = 3.0 * H * opt / (1.0 / U) # 3H*OPT*U, with U clamped as in the alg rows.append({"observed": observed, "claimed_bound": claimed}) worst_ratio = max(worst_ratio, observed / claimed) return {"max_observed_over_claimed": worst_ratio, "n_trials": trials, "holds": worst_ratio <= 1.0}
# ---------------------------------------------------------------- B. compositiondef composition_check(): rows = [] ok = True for eps in [0.1, 0.5, 1.0, 2.0]: for T in [10, 100, 10_000, 1_000_000]: for delta in [1e-4, 1e-6, 1e-9]: epsp = eps / (2.0 * np.sqrt(T * np.log(1.0 / delta))) total = strong_composition_eps(epsp, T, delta) rows.append({"eps": eps, "T": T, "delta": delta, "composed_eps": float(total), "within_budget": bool(total <= eps)}) ok &= total <= eps return {"holds": bool(ok), "rows": rows}
# ---------------------------------------------------------------- C+D. end-to-enddef run_packing(n=300, d=6, alpha=0.5, eps=1.0, delta=1e-6, beta=0.1, seed=0, preprocess=False, cap_iters=4000): rng = np.random.default_rng(seed) lp = random_packing(n, d, rng, a_max=1.0) p = packing_params(1.0, lp.opt, n, d, alpha, beta, eps, delta, preprocess) r = packing_algorithm1(lp.A, lp.opt, alpha, eps, delta, beta, rng, preprocess=preprocess, max_iters=cap_iters) obj_ratio = r.obj / lp.opt return { "n": n, "d": d, "alpha": alpha, "opt": lp.opt, "a_max": lp.a_max, "T_theory": p.T, "T_run": min(p.T, cap_iters), "iters_capped": p.T > cap_iters, "s_bound": p.s, "s_bound_vacuous": bool(p.s >= n), "obj": r.obj, "obj_over_opt": obj_ratio, "utility_ok": bool(obj_ratio >= 1.0 - alpha - 1e-9), "violations": r.violations, "violations_le_s": bool(r.violations <= p.s), "max_residual": float((lp.A @ r.x).max()), }
def run_covering(n=300, d=6, alpha=0.5, eps=1.0, delta=1e-6, beta=0.1, seed=0, preprocess=False, cap_iters=4000): rng = np.random.default_rng(seed) lp = random_covering(n, d, rng, a_max=1.0) p = covering_params(1.0, lp.opt, n, d, alpha, beta, eps, delta, preprocess) r = covering_algorithm2(lp.A, lp.opt, alpha, eps, delta, beta, rng, preprocess=preprocess, max_iters=cap_iters) obj_ratio = r.obj / lp.opt return { "n": n, "d": d, "alpha": alpha, "opt": lp.opt, "T_theory": p.T, "T_run": min(p.T, cap_iters), "iters_capped": p.T > cap_iters, "s_bound": p.s, "s_bound_vacuous": bool(p.s >= n), "obj": r.obj, "obj_over_opt": obj_ratio, "utility_ok": bool(obj_ratio <= 1.0 + alpha + 1e-9), "violations": r.violations, "violations_le_s": bool(r.violations <= p.s), "min_residual": float((lp.A @ r.x).min()), }
# ---------------------------------------------------------------- C. oracle lemmadef oracle_lemma_check(n=200, d=6, alpha=0.5, eps=1.0, delta=1e-6, beta=0.1, seed=1, steps=300): """Lemma 8 (packing) and Lemma 16 (covering) at every iteration.""" rng = np.random.default_rng(seed) lp = random_packing(n, d, rng, a_max=1.0) p = packing_params(1.0, lp.opt, n, d, alpha, beta, eps, delta, False) from ppl.mechanism import exponential_mechanism
U = max(p.U, 1.0 / n) Ax = np.zeros(n) worst_pack = -np.inf for _ in range(steps): g = grad_smax(p.eta * Ax, U) scores = -(g @ lp.A) * lp.opt j = exponential_mechanism(scores, p.eps_prime, p.sensitivity, rng) val = float(g @ (lp.opt * lp.A[:, j])) # <grad smax, A Delta_t> worst_pack = max(worst_pack, val) Ax += lp.opt * lp.A[:, j]
lpc = random_covering(n, d, rng, a_max=1.0) pc = covering_params(1.0, lpc.opt, n, d, alpha, beta, eps, delta, False) Uc = max(pc.U, 1.0 / n) Ax = np.zeros(n) worst_cov = np.inf for _ in range(steps): g = grad_smin(pc.eta * Ax, Uc) scores = (g @ lpc.A) * lpc.opt j = exponential_mechanism(scores, pc.eps_prime, pc.sensitivity, rng) val = float(g @ (lpc.opt * lpc.A[:, j])) worst_cov = min(worst_cov, val) Ax += lpc.opt * lpc.A[:, j]
return { "packing_max_inner": worst_pack, "packing_bound": 1.0 + alpha / 10.0, "packing_lemma8_holds": bool(worst_pack <= 1.0 + alpha / 10.0 + 1e-9), "covering_min_inner": worst_cov, "covering_bound": 1.0 - alpha / 10.0, "covering_lemma16_holds": bool(worst_cov >= 1.0 - alpha / 10.0 - 1e-9), }
# ---------------------------------------------------------------- E. d^1.5 scalingdef data_independent_scaling(alpha=0.5, eps=1.0, delta=1e-6, beta=0.1, n=10**6): """Theorem 6.2: with pre/post-processing, s = O~(d^1.5 / (alpha^3.5 eps)).
The bound must not depend on OPT. We vary d at fixed OPT and vary OPT at fixed d. """ def L(p, d): # the polylog factor hidden by O~(.) return np.log(d) + np.log(p.T / beta)
ds = np.unique(np.round(np.logspace(0.7, 3.5, 22)).astype(int)) P_d = [packing_params(1.0, 10.0, n, int(d), alpha, beta, eps, delta, True) for d in ds] s_vs_d, L_d = [p.s for p in P_d], [L(p, d) for p, d in zip(P_d, ds)]
alphas = np.logspace(np.log10(0.02), np.log10(0.5), 18) P_a = [packing_params(1.0, 10.0, n, 50, float(a), beta, eps, delta, True) for a in alphas] s_vs_alpha, L_a = [p.s for p in P_a], [L(p, 50) for p in P_a]
opts = np.logspace(0, 4, 18) P_o = [packing_params(1.0, float(o), n, 50, alpha, beta, eps, delta, True) for o in opts] s_vs_opt, L_o = [p.s for p in P_o], [L(p, 50) for p in P_o]
# without preprocessing, s should scale as OPT^1.5 (Theorem 6.1) P_on = [packing_params(1.0, float(o), n, 50, alpha, beta, eps, delta, False) for o in opts] s_vs_opt_nopre, L_on = [p.s for p in P_on], [L(p, 50) for p in P_on]
return { "d_exponent": fit_both(ds, s_vs_d, L_d), "alpha_exponent": fit_both(alphas, s_vs_alpha, L_a), "opt_exponent_with_preprocessing": fit_both(opts, s_vs_opt, L_o), "opt_exponent_without_preprocessing": fit_both(opts, s_vs_opt_nopre, L_on), "rows_d": [{"d": int(a), "s": float(b)} for a, b in zip(ds, s_vs_d)], "rows_alpha": [{"alpha": float(a), "s": float(b)} for a, b in zip(alphas, s_vs_alpha)], "rows_opt": [{"opt": float(a), "s_pre": float(b), "s_nopre": float(c)} for a, b, c in zip(opts, s_vs_opt, s_vs_opt_nopre)], }
def main() -> dict: out: dict = {} print("A. sensitivity (Lemma 8 core inequality) ...", flush=True) out["sensitivity"] = sensitivity_check() print("B. DP composition (Lemma 7) ...", flush=True) out["composition"] = composition_check() print("C. oracle lemmas 8 / 16 ...", flush=True) out["oracle_lemmas"] = oracle_lemma_check() print("D. end-to-end Algorithm 1 / 2 ...", flush=True) out["packing_runs"] = [run_packing(seed=s, alpha=a) for s in range(3) for a in (0.3, 0.5)] out["covering_runs"] = [run_covering(seed=s, alpha=a) for s in range(3) for a in (0.3, 0.5)] print("E. data-independent scaling (Theorem 6.2) ...", flush=True) out["scaling"] = data_independent_scaling() return out
if __name__ == "__main__": r = main() with open("outputs/claim2_algs.json", "w") as f: json.dump(r, f, indent=2)
sc = r["scaling"] checks = { "sensitivity <= 3H*OPT/s (Lemma 8)": r["sensitivity"]["holds"], "eps' composes within (eps, delta) (Lemma 7)": r["composition"]["holds"], "Lemma 8 oracle bound": r["oracle_lemmas"]["packing_lemma8_holds"], "Lemma 16 oracle bound": r["oracle_lemmas"]["covering_lemma16_holds"], "Alg 1 utility 1^T x >= (1-a)OPT": all(x["utility_ok"] for x in r["packing_runs"]), "Alg 1 violations <= s": all(x["violations_le_s"] for x in r["packing_runs"]), "Alg 2 utility 1^T x <= (1+a)OPT": all(x["utility_ok"] for x in r["covering_runs"]), "Alg 2 violations <= s": all(x["violations_le_s"] for x in r["covering_runs"]), "s ~ d^1.5 (Thm 6.2)": abs(sc["d_exponent"]["polylog_corrected"] - 1.5) < 0.02, "s ~ alpha^-3.5 (Thm 6.2)": abs(sc["alpha_exponent"]["polylog_corrected"] + 3.5) < 0.02, "s independent of OPT with preprocessing": abs(sc["opt_exponent_with_preprocessing"]["polylog_corrected"]) < 0.02, "s ~ OPT^1.5 without preprocessing (Thm 6.1)": abs(sc["opt_exponent_without_preprocessing"]["polylog_corrected"] - 1.5) < 0.02, } print() print(f"sensitivity observed/claimed max : {r['sensitivity']['max_observed_over_claimed']:.4f}") print("exponents of s (raw | polylog-corrected | predicted)") for key, pred in [("d_exponent", 1.5), ("alpha_exponent", -3.5), ("opt_exponent_with_preprocessing", 0.0), ("opt_exponent_without_preprocessing", 1.5)]: print(f" {key:38s} {sc[key]['raw']:+.4f} | {sc[key]['polylog_corrected']:+.4f} | {pred:+.1f}") print() for k, v in checks.items(): print(f" [{'PASS' if v else 'FAIL'}] {k}") sys.exit(0 if all(checks.values()) else 1)
````
````outputA. sensitivity (Lemma 8 core inequality) ...B. DP composition (Lemma 7) ...C. oracle lemmas 8 / 16 ...D. end-to-end Algorithm 1 / 2 ...E. data-independent scaling (Theorem 6.2) ...
sensitivity observed/claimed max : 0.0146exponents of s (raw | polylog-corrected | predicted) d_exponent +1.6004 | +1.5000 | +1.5 alpha_exponent -3.6297 | -3.5000 | -3.5 opt_exponent_with_preprocessing +0.0000 | +0.0000 | +0.0 opt_exponent_without_preprocessing +1.5569 | +1.5000 | +1.5
[PASS] sensitivity <= 3H*OPT/s (Lemma 8) [PASS] eps' composes within (eps, delta) (Lemma 7) [PASS] Lemma 8 oracle bound [PASS] Lemma 16 oracle bound [PASS] Alg 1 utility 1^T x >= (1-a)OPT [PASS] Alg 1 violations <= s [PASS] Alg 2 utility 1^T x <= (1+a)OPT [PASS] Alg 2 violations <= s [PASS] s ~ d^1.5 (Thm 6.2) [PASS] s ~ alpha^-3.5 (Thm 6.2) [PASS] s independent of OPT with preprocessing [PASS] s ~ OPT^1.5 without preprocessing (Thm 6.1)
````
---<!-- trackio-cell{"type": "markdown", "id": "cell_7eacc6483a72", "created_at": "2026-07-17T08:19:09+00:00", "title": "Claim 2 verdict"}-->## Verdict: **reproduced**. All 12 checks pass; the exponents are exact.
Claim 2 (Theorem 1 / Theorem 6.2): with pre- and post-processing, `s = O~(d^1.5/(alpha^3.5 eps))` — depending only on the LP dimension `d`, **not** on `OPT` — improving Kaplan et al. (2024)'s `O~(d^9/eps)` and Ene et al. (2025)'s `O~(d^4/eps)` when an approximation factor `alpha` is tolerated.
### The exponents (the substance of the claim)
| quantity | raw fit | **polylog-corrected** | theorem ||---|---|---|---|| `s` vs `d` (with pre/post-processing) | +1.6004 | **+1.5000** | **+1.5** || `s` vs `alpha` | -3.6297 | **-3.5000** | **-3.5** || `s` vs `OPT` (with pre/post-processing) | +0.0000 | **+0.0000** | **0** (data-independent) || `s` vs `OPT` (without) | +1.5569 | **+1.5000** | **+1.5** (Thm 6.1) |
The polylog-corrected values are exact to 4 decimal places. The raw fits are visibly biased upward by the `(log d + log(T/beta))` factor `O~()` hides — reporting only the raw fit would have understated the agreement (and reporting it as a *failure* would have been wrong).
The third row is the crux of the data-independent claim and it is worth stating plainly: **turning pre-processing on makes the exponent of `OPT` fall from 1.5 to exactly 0**. The mechanism is the clip `A_ij <- min{A_ij, H}` with `H = 2d/(alpha·OPT)`, which makes `H·OPT = 2d/alpha` — the product that drives `s` — free of `OPT` by construction. This reproduces.
### The lemmas the privacy argument rests on
| Paper statement | What we measured | Result ||---|---|---|| **Lemma 8 sensitivity**: `\|Q(j,A) - Q(j,A')\| <= 3H·OPT/s` over neighbouring instances | max observed / claimed, 300 random neighbouring pairs | **0.0146** — holds with 68x margin || **Lemma 7**: `eps' = eps/(2 sqrt(T log 1/delta))` composes to `(eps, delta)`-DP over `T` rounds | strong composition, 36 `(eps, T, delta)` settings | **holds in all** || **Lemma 8**: `<grad smax^U(eta A x), A Delta_t> <= 1 + alpha/10` every iteration | max over 300 iterations | **holds** || **Lemma 16**: `<grad smin^U(eta A x), A Delta_t> >= 1 - alpha/10` | min over 300 iterations | **holds** |
The sensitivity result is the one that matters most — it is the inequality the whole privacy analysis is built on, and it is *not* tight (observed is 68x below the bound), which is consistent with the constants being conservative.
### End-to-end (Theorems 6 and 10)
Algorithm 1 satisfied `1^T x >= (1-alpha) OPT` and Algorithm 2 satisfied `1^T x <= (1+alpha) OPT` on every run (3 seeds x alpha in {0.3, 0.5}), and both stayed within their `s` budget.
**Honest caveat:** at these local scales `s >> n`, so 'violations <= s' is *vacuously* true and carries no information. The claim only acquires content at `n ~ 1e6`; that is what the GPU job on the Conclusion page is for. The utility half (`1^T x` vs `OPT`) is meaningful at every scale and does hold.
---<!-- trackio-cell{"type": "figure", "id": "cell_6ca7465c978f", "created_at": "2026-07-17T08:20:49+00:00", "title": "s scales as d^1.5 (data-independent bound)"}-->````html<html><head><meta charset="utf-8" /></head><body> <div style="height:430px; width:100%;"> <script>window.PlotlyConfig = {MathJaxConfig: 'local'};</script> <script charset="utf-8" src="https://cdn.plot.ly/plotly-3.7.0.min.js" integrity="sha256-jvTGqxNp8AGWEcvNLVuKr+8j5dGe9Yw51LQkmDH+IYA=" crossorigin="anonymous"></script> <div id="f85c05ce-cce0-44bc-89cb-a0d12ccec7cb" class="plotly-graph-div" style="height:100%; width:100%;"></div> <script> window.PLOTLYENV=window.PLOTLYENV || {}; if (document.getElementById("f85c05ce-cce0-44bc-89cb-a0d12ccec7cb")) { Plotly.newPlot( "f85c05ce-cce0-44bc-89cb-a0d12ccec7cb", [{"line":{"color":"#3b82f6","width":3},"name":"with pre\u002fpost-processing (Thm 6.2)","x":[5,7,9,13,17,23,32,43,58,79,108,147,200,271,369,501,681,926,1259,1711,2326,3162],"y":[36912320.22650394,64102276.21410177,96672114.1996676,176002060.37390402,272116453.274127,444047629.37753576,757086754.061539,1218830885.1534035,1972055493.3677976,3237816429.08668,5341964456.719146,8743567362.579014,14289001521.39374,23180881638.918102,37869381988.203224,61538050497.84409,100111632111.71373,162846819196.2297,264679171413.7877,429632156496.73724,697328562146.2605,1131169243154.5298],"type":"scatter"},{"line":{"color":"#94a3b8","dash":"dot","width":2},"name":"d\u003csup\u003e1.5\u003c\u002fsup\u003e reference","x":[5,7,9,13,17,23,32,43,58,79,108,147,200,271,369,501,681,926,1259,1711,2326,3162],"y":[36912320.22650394,61145344.80300931,89141533.8123995,154750252.67198053,231414048.59805745,364173292.2800333,597642268.8627448,930934277.8252705,1458338457.6958504,2318232421.163079,3705543975.064679,5884266590.033262,9338160450.980385,14728898679.209803,23402156944.360718,37023112537.22146,58672825935.05109,93032098720.28706,147487404694.30618,233663755580.42603,370365823290.9903,587028432614.8685],"type":"scatter"}], {"template":{"data":{"barpolar":[{"marker":{"line":{"color":"white","width":0.5},"pattern":{"fillmode":"overlay","size":10,"solidity":0.2}},"type":"barpolar"}],"bar":[{"error_x":{"color":"#2a3f5f"},"error_y":{"color":"#2a3f5f"},"marker":{"line":{"color":"white","width":0.5},"pattern":{"fillmode":"overlay","size":10,"solidity":0.2}},"type":"bar"}],"carpet":[{"aaxis":{"endlinecolor":"#2a3f5f","gridcolor":"#C8D4E3","linecolor":"#C8D4E3","minorgridcolor":"#C8D4E3","startlinecolor":"#2a3f5f"},"baxis":{"endlinecolor":"#2a3f5f","gridcolor":"#C8D4E3","linecolor":"#C8D4E3","minorgridcolor":"#C8D4E3","startlinecolor":"#2a3f5f"},"type":"carpet"}],"choropleth":[{"colorbar":{"outlinewidth":0,"ticks":""},"type":"choropleth"}],"contourcarpet":[{"colorbar":{"outlinewidth":0,"ticks":""},"type":"contourcarpet"}],"contour":[{"colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]],"type":"contour"}],"heatmap":[{"colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]],"type":"heatmap"}],"histogram2dcontour":[{"colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]],"type":"histogram2dcontour"}],"histogram2d":[{"colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]],"type":"histogram2d"}],"histogram":[{"marker":{"pattern":{"fillmode":"overlay","size":10,"solidity":0.2}},"type":"histogram"}],"mesh3d":[{"colorbar":{"outlinewidth":0,"ticks":""},"type":"mesh3d"}],"parcoords":[{"line":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"parcoords"}],"pie":[{"automargin":true,"type":"pie"}],"scatter3d":[{"line":{"colorbar":{"outlinewidth":0,"ticks":""}},"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scatter3d"}],"scattercarpet":[{"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scattercarpet"}],"scattergeo":[{"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scattergeo"}],"scattergl":[{"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scattergl"}],"scattermapbox":[{"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scattermapbox"}],"scattermap":[{"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scattermap"}],"scatterpolargl":[{"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scatterpolargl"}],"scatterpolar":[{"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scatterpolar"}],"scatter":[{"fillpattern":{"fillmode":"overlay","size":10,"solidity":0.2},"type":"scatter"}],"scatterternary":[{"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scatterternary"}],"surface":[{"colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]],"type":"surface"}],"table":[{"cells":{"fill":{"color":"#EBF0F8"},"line":{"color":"white"}},"header":{"fill":{"color":"#C8D4E3"},"line":{"color":"white"}},"type":"table"}]},"layout":{"annotationdefaults":{"arrowcolor":"#2a3f5f","arrowhead":0,"arrowwidth":1},"autotypenumbers":"strict","coloraxis":{"colorbar":{"outlinewidth":0,"ticks":""}},"colorscale":{"diverging":[[0,"#8e0152"],[0.1,"#c51b7d"],[0.2,"#de77ae"],[0.3,"#f1b6da"],[0.4,"#fde0ef"],[0.5,"#f7f7f7"],[0.6,"#e6f5d0"],[0.7,"#b8e186"],[0.8,"#7fbc41"],[0.9,"#4d9221"],[1,"#276419"]],"sequential":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]],"sequentialminus":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]]},"colorway":["#636efa","#EF553B","#00cc96","#ab63fa","#FFA15A","#19d3f3","#FF6692","#B6E880","#FF97FF","#FECB52"],"font":{"color":"#2a3f5f"},"geo":{"bgcolor":"white","lakecolor":"white","landcolor":"white","showlakes":true,"showland":true,"subunitcolor":"#C8D4E3"},"hoverlabel":{"align":"left"},"hovermode":"closest","mapbox":{"style":"light"},"paper_bgcolor":"white","plot_bgcolor":"white","polar":{"angularaxis":{"gridcolor":"#EBF0F8","linecolor":"#EBF0F8","ticks":""},"bgcolor":"white","radialaxis":{"gridcolor":"#EBF0F8","linecolor":"#EBF0F8","ticks":""}},"scene":{"xaxis":{"backgroundcolor":"white","gridcolor":"#DFE8F3","gridwidth":2,"linecolor":"#EBF0F8","showbackground":true,"ticks":"","zerolinecolor":"#EBF0F8"},"yaxis":{"backgroundcolor":"white","gridcolor":"#DFE8F3","gridwidth":2,"linecolor":"#EBF0F8","showbackground":true,"ticks":"","zerolinecolor":"#EBF0F8"},"zaxis":{"backgroundcolor":"white","gridcolor":"#DFE8F3","gridwidth":2,"linecolor":"#EBF0F8","showbackground":true,"ticks":"","zerolinecolor":"#EBF0F8"}},"shapedefaults":{"line":{"color":"#2a3f5f"}},"ternary":{"aaxis":{"gridcolor":"#DFE8F3","linecolor":"#A2B1C6","ticks":""},"baxis":{"gridcolor":"#DFE8F3","linecolor":"#A2B1C6","ticks":""},"bgcolor":"white","caxis":{"gridcolor":"#DFE8F3","linecolor":"#A2B1C6","ticks":""}},"title":{"x":0.05},"xaxis":{"automargin":true,"gridcolor":"#EBF0F8","linecolor":"#EBF0F8","ticks":"","title":{"standoff":15},"zerolinecolor":"#EBF0F8","zerolinewidth":2},"yaxis":{"automargin":true,"gridcolor":"#EBF0F8","linecolor":"#EBF0F8","ticks":"","title":{"standoff":15},"zerolinecolor":"#EBF0F8","zerolinewidth":2}}},"xaxis":{"type":"log","title":{"text":"d (LP dimension)"}},"yaxis":{"type":"log","title":{"text":"s"}},"font":{"size":13},"margin":{"l":70,"r":30,"t":60,"b":60},"legend":{"orientation":"h","yanchor":"bottom","y":1.02,"x":0},"title":{"text":"Claim 2: data-independent bound scales as d\u003csup\u003e1.5\u003c\u002fsup\u003e\u003cbr\u003e\u003csub\u003epolylog-corrected exponent 1.5000 (theory 1.5); independent of OPT (exponent 0.0000)\u003c\u002fsub\u003e"},"height":430}, {"responsive": true} ) }; </script> </div></body></html>````
````rawd,s5,36912320.226503947,64102276.214101779,96672114.199667613,176002060.3739040217,272116453.27412723,444047629.3775357632,757086754.06153943,1218830885.153403558,1972055493.367797679,3237816429.08668108,5341964456.719146147,8743567362.579014200,14289001521.39374271,23180881638.918102369,37869381988.203224501,61538050497.84409681,100111632111.71373926,162846819196.22971259,264679171413.78771711,429632156496.737242326,697328562146.26053162,1131169243154.5298
````
---<!-- trackio-cell{"type": "figure", "id": "cell_20a7ab4c48dc", "created_at": "2026-07-17T08:20:50+00:00", "title": "Pre/post-processing removes the OPT dependence"}-->````html<html><head><meta charset="utf-8" /></head><body> <div style="height:430px; width:100%;"> <script>window.PlotlyConfig = {MathJaxConfig: 'local'};</script> <script charset="utf-8" src="https://cdn.plot.ly/plotly-3.7.0.min.js" integrity="sha256-jvTGqxNp8AGWEcvNLVuKr+8j5dGe9Yw51LQkmDH+IYA=" crossorigin="anonymous"></script> <div id="5ec7e170-5934-43ea-8754-e3b70d2cbcbd" class="plotly-graph-div" style="height:100%; width:100%;"></div> <script> window.PLOTLYENV=window.PLOTLYENV || {}; if (document.getElementById("5ec7e170-5934-43ea-8754-e3b70d2cbcbd")) { Plotly.newPlot( "5ec7e170-5934-43ea-8754-e3b70d2cbcbd", [{"line":{"color":"#3b82f6","width":3},"name":"instance-dependent (Thm 6.1): ~OPT\u003csup\u003e1.5\u003c\u002fsup\u003e","x":[1.0,1.7190722018585745,2.955209235202887,5.0802180469130205,8.733261623828433,15.013107289081734,25.808615404180742,44.366873309786115,76.26985859023443,131.11339374215643,225.39339047347912,387.4675120456132,666.0846290809154,1145.0475699382812,1968.4194472866113,3383.8551534282333,5817.091329374358,10000.0],"y":[392288.8760560214,920062.1155485939,2155673.0086954813,5042131.856501529,11779600.817240719,27484947.300785545,64054367.28946883,149123423.2632838,346814174.43855,805816745.962966,1870627209.9283626,4338817415.577282,10055620099.466639,23287274416.137215,53891190257.67331,124629938897.78572,288036317505.7833,665282396440.1139],"type":"scatter"},{"line":{"color":"#10b981","width":3},"name":"data-independent (Thm 6.2): flat in OPT","x":[1.0,1.7190722018585745,2.955209235202887,5.0802180469130205,8.733261623828433,15.013107289081734,25.808615404180742,44.366873309786115,76.26985859023443,131.11339374215643,225.39339047347912,387.4675120456132,666.0846290809154,1145.0475699382812,1968.4194472866113,3383.8551534282333,5817.091329374358,10000.0],"y":[1553558106.6148667,1553558106.6148667,1553558106.6148667,1553558106.6148667,1553558106.6148667,1553558106.6148663,1553558106.6148667,1553558106.6148667,1553558106.6148667,1553558106.614867,1553558106.6148667,1553558106.6148667,1553558106.6148667,1553558106.6148667,1553558106.6148667,1553558106.6148667,1553558106.6148667,1553558106.6148667],"type":"scatter"}], {"template":{"data":{"barpolar":[{"marker":{"line":{"color":"white","width":0.5},"pattern":{"fillmode":"overlay","size":10,"solidity":0.2}},"type":"barpolar"}],"bar":[{"error_x":{"color":"#2a3f5f"},"error_y":{"color":"#2a3f5f"},"marker":{"line":{"color":"white","width":0.5},"pattern":{"fillmode":"overlay","size":10,"solidity":0.2}},"type":"bar"}],"carpet":[{"aaxis":{"endlinecolor":"#2a3f5f","gridcolor":"#C8D4E3","linecolor":"#C8D4E3","minorgridcolor":"#C8D4E3","startlinecolor":"#2a3f5f"},"baxis":{"endlinecolor":"#2a3f5f","gridcolor":"#C8D4E3","linecolor":"#C8D4E3","minorgridcolor":"#C8D4E3","startlinecolor":"#2a3f5f"},"type":"carpet"}],"choropleth":[{"colorbar":{"outlinewidth":0,"ticks":""},"type":"choropleth"}],"contourcarpet":[{"colorbar":{"outlinewidth":0,"ticks":""},"type":"contourcarpet"}],"contour":[{"colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]],"type":"contour"}],"heatmap":[{"colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]],"type":"heatmap"}],"histogram2dcontour":[{"colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]],"type":"histogram2dcontour"}],"histogram2d":[{"colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]],"type":"histogram2d"}],"histogram":[{"marker":{"pattern":{"fillmode":"overlay","size":10,"solidity":0.2}},"type":"histogram"}],"mesh3d":[{"colorbar":{"outlinewidth":0,"ticks":""},"type":"mesh3d"}],"parcoords":[{"line":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"parcoords"}],"pie":[{"automargin":true,"type":"pie"}],"scatter3d":[{"line":{"colorbar":{"outlinewidth":0,"ticks":""}},"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scatter3d"}],"scattercarpet":[{"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scattercarpet"}],"scattergeo":[{"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scattergeo"}],"scattergl":[{"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scattergl"}],"scattermapbox":[{"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scattermapbox"}],"scattermap":[{"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scattermap"}],"scatterpolargl":[{"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scatterpolargl"}],"scatterpolar":[{"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scatterpolar"}],"scatter":[{"fillpattern":{"fillmode":"overlay","size":10,"solidity":0.2},"type":"scatter"}],"scatterternary":[{"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scatterternary"}],"surface":[{"colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]],"type":"surface"}],"table":[{"cells":{"fill":{"color":"#EBF0F8"},"line":{"color":"white"}},"header":{"fill":{"color":"#C8D4E3"},"line":{"color":"white"}},"type":"table"}]},"layout":{"annotationdefaults":{"arrowcolor":"#2a3f5f","arrowhead":0,"arrowwidth":1},"autotypenumbers":"strict","coloraxis":{"colorbar":{"outlinewidth":0,"ticks":""}},"colorscale":{"diverging":[[0,"#8e0152"],[0.1,"#c51b7d"],[0.2,"#de77ae"],[0.3,"#f1b6da"],[0.4,"#fde0ef"],[0.5,"#f7f7f7"],[0.6,"#e6f5d0"],[0.7,"#b8e186"],[0.8,"#7fbc41"],[0.9,"#4d9221"],[1,"#276419"]],"sequential":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]],"sequentialminus":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]]},"colorway":["#636efa","#EF553B","#00cc96","#ab63fa","#FFA15A","#19d3f3","#FF6692","#B6E880","#FF97FF","#FECB52"],"font":{"color":"#2a3f5f"},"geo":{"bgcolor":"white","lakecolor":"white","landcolor":"white","showlakes":true,"showland":true,"subunitcolor":"#C8D4E3"},"hoverlabel":{"align":"left"},"hovermode":"closest","mapbox":{"style":"light"},"paper_bgcolor":"white","plot_bgcolor":"white","polar":{"angularaxis":{"gridcolor":"#EBF0F8","linecolor":"#EBF0F8","ticks":""},"bgcolor":"white","radialaxis":{"gridcolor":"#EBF0F8","linecolor":"#EBF0F8","ticks":""}},"scene":{"xaxis":{"backgroundcolor":"white","gridcolor":"#DFE8F3","gridwidth":2,"linecolor":"#EBF0F8","showbackground":true,"ticks":"","zerolinecolor":"#EBF0F8"},"yaxis":{"backgroundcolor":"white","gridcolor":"#DFE8F3","gridwidth":2,"linecolor":"#EBF0F8","showbackground":true,"ticks":"","zerolinecolor":"#EBF0F8"},"zaxis":{"backgroundcolor":"white","gridcolor":"#DFE8F3","gridwidth":2,"linecolor":"#EBF0F8","showbackground":true,"ticks":"","zerolinecolor":"#EBF0F8"}},"shapedefaults":{"line":{"color":"#2a3f5f"}},"ternary":{"aaxis":{"gridcolor":"#DFE8F3","linecolor":"#A2B1C6","ticks":""},"baxis":{"gridcolor":"#DFE8F3","linecolor":"#A2B1C6","ticks":""},"bgcolor":"white","caxis":{"gridcolor":"#DFE8F3","linecolor":"#A2B1C6","ticks":""}},"title":{"x":0.05},"xaxis":{"automargin":true,"gridcolor":"#EBF0F8","linecolor":"#EBF0F8","ticks":"","title":{"standoff":15},"zerolinecolor":"#EBF0F8","zerolinewidth":2},"yaxis":{"automargin":true,"gridcolor":"#EBF0F8","linecolor":"#EBF0F8","ticks":"","title":{"standoff":15},"zerolinecolor":"#EBF0F8","zerolinewidth":2}}},"xaxis":{"type":"log","title":{"text":"OPT"}},"yaxis":{"type":"log","title":{"text":"s"}},"font":{"size":13},"margin":{"l":70,"r":30,"t":60,"b":60},"legend":{"orientation":"h","yanchor":"bottom","y":1.02,"x":0},"title":{"text":"Claim 2: pre\u002fpost-processing removes the OPT dependence"},"height":430}, {"responsive": true} ) }; </script> </div></body></html>````
````rawopt,s_pre,s_nopre1.0,1553558106.6148667,392288.87605602141.7190722018585745,1553558106.6148667,920062.11554859392.955209235202887,1553558106.6148667,2155673.00869548135.0802180469130205,1553558106.6148667,5042131.8565015298.733261623828433,1553558106.6148667,11779600.81724071915.013107289081734,1553558106.6148663,27484947.30078554525.808615404180742,1553558106.6148667,64054367.2894688344.366873309786115,1553558106.6148667,149123423.263283876.26985859023443,1553558106.6148667,346814174.43855131.11339374215643,1553558106.614867,805816745.962966225.39339047347912,1553558106.6148667,1870627209.9283626387.4675120456132,1553558106.6148667,4338817415.577282666.0846290809154,1553558106.6148667,10055620099.4666391145.0475699382812,1553558106.6148667,23287274416.1372151968.4194472866113,1553558106.6148667,53891190257.673313383.8551534282333,1553558106.6148667,124629938897.785725817.091329374358,1553558106.6148667,288036317505.783310000.0,1553558106.6148667,665282396440.1139
````
---<!-- trackio-cell{"type": "markdown", "id": "cell_c96b1add9d44", "created_at": "2026-07-17T08:50:53+00:00", "title": "Correction: what the utility check does and does not show"}-->## Correction / precision on the end-to-end runs
Re-reading our own output caught something a reader should not have to: **the objective half of Theorems 6 and 10 is satisfied *by construction*, not empirically.** Every run reports `1^T x / OPT = 1.0000` **exactly**, because each update is `Delta_t = 1_j · OPT`, so
```1^T x_bar = (1/T) sum_t 1^T Delta_t = (1/T) · T · OPT = OPT identically.```
This is the paper's own argument (Lemma 9: *'since `Delta_t = 1_j OPT` for some coordinate `j`, we have `1^T Delta_t = OPT`'*), so the algorithm cannot fail it and our 'utility_ok' check was never at risk. It is a correct check, but it carries **no evidence**. We are flagging it rather than letting a green PASS imply more than it does.
**The half that is genuinely at risk is the constraint violation count**, and there the runs are informative. With every run now at its full theoretical `T` (no iteration cap — the earlier covering runs were capped at 4000 vs a required 4862, now raised):
| | violated / 300 constraints | rate ||---|---|---|| **Algorithm 1** (packing), 6 runs | 0, 0, 0, 0, 6, 0 | **0–2%** || **Algorithm 2** (covering), 6 runs | 31, 14, 45, 25, 43, 23 | **4.7–15%** |
The bound `s` for these runs is `~3e5–9e5` against `n = 300` — vacuous by three orders of magnitude. So the honest reading is: **the algorithms violate few constraints in practice (0–15%), far below their own bound, but the theorem is not what certifies that at this scale** — it is asserting nothing here. The bound only starts to constrain at `n ~ 1e6` (see Conclusion).
Note also that Algorithm 2's violation rate is consistently ~10x Algorithm 1's, which tracks the constant in its `s`: Algorithm 2 uses `s = 120·H·OPT(...)/(alpha eps')` against Algorithm 1's `60·H·OPT(...)`, and a `40d/(alpha·OPT)` clip against `2d/(alpha·OPT)` — the covering side is uniformly looser in the paper's own accounting.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356# Claim 3: mixed packing-covering bounds (Theorem 2)
---<!-- trackio-cell{"type": "code", "id": "cell_ca7ae82d00ca", "created_at": "2026-07-17T08:19:22+00:00", "title": "Run: uv exp_claim3_mixed.py (exit 0)", "command": ["uv", "run", "python", "exp_claim3_mixed.py"], "exit_code": 0, "duration_s": 5.022}-->````bash$ uv run python exp_claim3_mixed.py````
exit 0 · 5.0s
````python title=exp_claim3_mixed.py"""Claims 3 and 5: mixed packing-covering (Section 5, Algorithms 3 and 4, Theorem 11).
Checks: A. Lemma 20: the ratio score <grad smax^U(Px), P 1_j> / <grad smin^U(Cx), C 1_j> has sensitivity <= 3 S R V^2 / (s alpha^2) under a single-constraint change -- in BOTH cases of the proof (a covering constraint changes; a packing constraint changes). This is the inequality that makes the mixed case work, and it is the reason the line-3 perturbation C_ij <- C_ij + alpha/V is needed (it lower-bounds C_min, which otherwise appears in the denominator). B. Algorithm 3 end-to-end: Px <= 1+alpha and Cx >= 1-alpha except <= s constraints. C. Algorithm 4 end-to-end (data-independent variant, with MaxEstimator preprocessing). D. Theorem 11 scaling: s_3 ~ P_max C_max sqrt(P_max+C_max) V^2.5 / (alpha^4.5 eps) and s_4 ~ d^3 / (alpha^6 eps)."""
from __future__ import annotations
import jsonimport sys
import numpy as np
from ppl.algorithms import mixed_algorithm3, mixed_algorithm4, mixed_paramsfrom ppl.fitting import fit_bothfrom ppl.instances import random_mixedfrom ppl.smax import grad_smax, grad_smin
def ratio_sensitivity_check(trials=200, n_p=40, n_c=40, d=5, alpha=0.5, eps=1.0, delta=1e-6, beta=0.1, seed=0): """Lemma 20, both cases.""" rng = np.random.default_rng(seed) worst = {"packing_change": 0.0, "covering_change": 0.0} for _ in range(trials): lp = random_mixed(n_p, n_c, d, rng, a_max=1.0) P, C_raw, V = lp.P, lp.C, lp.V S, R = float(P.max()), float(C_raw.max()) p = mixed_params(S, R, V, n_p + n_c, d, alpha, beta, eps, delta) C = C_raw + alpha / V # line 3 perturbation U_p = max(p.U, 1.0 / n_p) U_c = max(p.U, 1.0 / n_c) claimed = 3.0 * S * R * V**2 / ((1.0 / max(p.U, 1.0 / max(n_p, n_c))) * alpha**2)
x = rng.uniform(0, V / d, size=d)
def ratio(Pm, Cm): gp = grad_smax(Pm @ x, U_p) gc = grad_smin(Cm @ x, U_c) return (gp @ Pm) / np.maximum(gc @ Cm, 1e-300)
base = ratio(P, C)
# Case 2: a packing constraint changes P2 = P.copy() P2[rng.integers(n_p)] = rng.uniform(0, S, size=d) worst["packing_change"] = max( worst["packing_change"], float(np.abs(ratio(P2, C) - base).max()) / claimed )
# Case 1: a covering constraint changes (perturbation applied to the new row too) C2 = C_raw.copy() C2[rng.integers(n_c)] = rng.uniform(0, R, size=d) worst["covering_change"] = max( worst["covering_change"], float(np.abs(ratio(P, C2 + alpha / V) - base).max()) / claimed ) return { "max_observed_over_claimed_packing_change": worst["packing_change"], "max_observed_over_claimed_covering_change": worst["covering_change"], "holds": bool(max(worst.values()) <= 1.0), "n_trials": trials, }
def run_alg3(n_p=60, n_c=60, d=5, alpha=0.5, eps=1.0, delta=1e-6, beta=0.1, seed=0, cap_iters=3000): rng = np.random.default_rng(seed) lp = random_mixed(n_p, n_c, d, rng, a_max=1.0) p = mixed_params(lp.p_max, lp.c_max, lp.V, n_p + n_c, d, alpha, beta, eps, delta) r = mixed_algorithm3(lp.P, lp.C, lp.V, alpha, eps, delta, beta, rng, max_iters=cap_iters) n_viol_p = int((lp.P @ r.x > 1.0 + alpha).sum()) n_viol_c = int((lp.C @ r.x < 1.0 - alpha).sum()) return { "n_p": n_p, "n_c": n_c, "d": d, "alpha": alpha, "V": lp.V, "P_max": lp.p_max, "C_max": lp.c_max, "T_theory": p.T, "T_run": min(p.T, cap_iters), "iters_capped": p.T > cap_iters, "s_bound": p.s, "s_bound_vacuous": bool(p.s >= n_p + n_c), "violations": r.violations, "violations_packing": n_viol_p, "violations_covering": n_viol_c, "violations_le_s": bool(r.violations <= p.s), "max_packing_residual": float((lp.P @ r.x).max()), "min_covering_residual": float((lp.C @ r.x).min()), }
def run_alg4(n_p=60, n_c=60, d=5, alpha=0.5, eps=1.0, delta=1e-6, beta=0.1, seed=0, cap_iters=3000): rng = np.random.default_rng(seed) lp = random_mixed(n_p, n_c, d, rng, a_max=1.0) m, M = 0.05, 1.0 # the known range [m, M] for column maxima T_theory = int(np.ceil(np.log(n_p + n_c) * d**2 / alpha**4)) s = d**3 * (np.log(d) + np.log(T_theory / beta)) * np.sqrt(np.log(1.0 / delta) * np.log(n_p + n_c)) / (alpha**6 * eps) r = mixed_algorithm4(lp.P, lp.C, m, M, alpha, eps, delta, beta, rng, max_iters=cap_iters) return { "n_p": n_p, "n_c": n_c, "d": d, "alpha": alpha, "T_theory": T_theory, "T_run": min(T_theory, cap_iters), "s_bound": s, "s_bound_vacuous": bool(s >= n_p + n_c), "n_filtered_by_maxestimator": r.history[0]["n_filtered"], "violations": r.violations, "violations_le_s": bool(r.violations <= s), "max_packing_residual": float((lp.P @ r.x).max()), "min_covering_residual": float((lp.C @ r.x).min()), }
def alg3_mechanism_check(n_p=20, n_c=20, d=3, alpha=0.5, eps=1.0, delta=1e-6, beta=0.1, seed=0): """Is the Algorithm-3 MWU itself correct, run to its FULL iteration count?
The end-to-end runs above cap T far below the theoretical value and their bound s is vacuous, so they cannot distinguish "the mechanism is wrong" from "the bound does not bite at this scale". Here we run a small instance to the full T = Theta((S+R)V log n/alpha^3) and check the actual engine of Lemma 21:
smax^U(P x_T) / smin^U(C x_T) <= 1 + alpha
which is what licenses "there is a scale k with k*x_T nearly feasible". We then compare the violations at the BEST scale (chosen non-privately) against those at the scale the private exponential mechanism actually returns -- isolating the MWU from the private scale-selection step. """ rng = np.random.default_rng(seed) lp = random_mixed(n_p, n_c, d, rng, a_max=1.0) P, C_init, V = lp.P, lp.C, lp.V S, R = float(P.max()), float(C_init.max()) p = mixed_params(S, R, V, n_p + n_c, d, alpha, beta, eps, delta) C = C_init + alpha / V
from ppl.algorithms import _clamp_U, _count_mixed_violations from ppl.mechanism import exponential_mechanism from ppl.smax import smax, smin
U_p, U_c = _clamp_U(p.U, n_p), _clamp_U(p.U, n_c) x = np.zeros(d) for _ in range(p.T): # FULL theoretical iteration count, no cap gp = grad_smax(P @ x, U_p) gc = grad_smin(C @ x, U_c) scores = -(gp @ P) / np.maximum(gc @ C, 1e-300) j = exponential_mechanism(scores, p.eps_prime, p.sensitivity, rng) x[j] += p.step
ratio = smax(P @ x, U_p) / smin(C @ x, U_c)
# the scale search of line 9 m, M = float(min(P.min(), C_init.min())), float(max(S, R)) ks, k = [], m / (alpha * p.T * M) while k <= 60.0 * M / (alpha * m): ks.append(k) k *= 1.0 + alpha ks = np.array(ks) counts = np.array([_count_mixed_violations(P, C_init, kk * x, alpha) for kk in ks]) best = int(counts.argmin()) j_priv = exponential_mechanism(-counts.astype(float), p.eps_prime, 1.0, rng)
return { "T": p.T, "n_p": n_p, "n_c": n_c, "d": d, "alpha": alpha, "V": V, "smax_over_smin": float(ratio), "ratio_bound": 1.0 + alpha, "lemma21_ratio_holds": bool(ratio <= 1.0 + alpha + 1e-9), "violations_at_best_scale": int(counts[best]), "violations_at_private_scale": int(counts[j_priv]), "n_constraints": n_p + n_c, "n_scale_candidates": len(ks), "eps_prime": p.eps_prime, "s_bound": p.s, "s_vacuous": bool(p.s >= n_p + n_c), }
def theorem11_scaling(alpha=0.5, eps=1.0, delta=1e-6, beta=0.1, n=10**6, d=20): """Thm 11.1: s ~ P_max C_max sqrt(P_max+C_max) V^2.5 / (alpha^4.5 eps). Thm 11.2: s ~ d^3 / (alpha^6 eps)."""
def L3(p): # polylog hidden by O~(.) return np.log(d) + np.log(p.T / beta)
# --- Algorithm 3: exponent in V, at fixed S=R=1 Vs = np.logspace(0, 3, 20) P_V = [mixed_params(1.0, 1.0, float(v), n, d, alpha, beta, eps, delta) for v in Vs] # exponent in alpha alphas = np.logspace(np.log10(0.02), np.log10(0.5), 18) P_a = [mixed_params(1.0, 1.0, 10.0, n, d, float(a), beta, eps, delta) for a in alphas] # exponent in S=R=A (P_max=C_max=A): predicted P_max*C_max*sqrt(P_max+C_max) ~ A^2.5 As = np.logspace(0, 2, 18) P_A = [mixed_params(float(a), float(a), 10.0, n, d, alpha, beta, eps, delta) for a in As]
# --- Algorithm 4: exponent in d and alpha ds = np.unique(np.round(np.logspace(0.7, 3, 20)).astype(int))
def s4(dd, aa): T = np.ceil(np.log(n) * dd**2 / aa**4) L = np.log(dd) + np.log(T / beta) return (dd**3 * L * np.sqrt(np.log(1.0 / delta) * np.log(n)) / (aa**6 * eps), L)
s4_d = [s4(int(x), alpha) for x in ds] s4_a = [s4(50, float(x)) for x in alphas]
return { "alg3_V_exponent": fit_both(Vs, [p.s for p in P_V], [L3(p) for p in P_V]), "alg3_alpha_exponent": fit_both(alphas, [p.s for p in P_a], [L3(p) for p in P_a]), "alg3_Amax_exponent": fit_both(As, [p.s for p in P_A], [L3(p) for p in P_A]), "alg4_d_exponent": fit_both(ds, [v[0] for v in s4_d], [v[1] for v in s4_d]), "alg4_alpha_exponent": fit_both(alphas, [v[0] for v in s4_a], [v[1] for v in s4_a]), "rows_V": [{"V": float(a), "s": float(p.s)} for a, p in zip(Vs, P_V)], "rows_d4": [{"d": int(a), "s": float(b[0])} for a, b in zip(ds, s4_d)], }
def main() -> dict: out: dict = {} print("A. Lemma 20 ratio-score sensitivity ...", flush=True) out["ratio_sensitivity"] = ratio_sensitivity_check() print("B. Algorithm 3 end-to-end ...", flush=True) out["alg3_runs"] = [run_alg3(seed=s, alpha=a) for s in range(3) for a in (0.3, 0.5)] print("C. Algorithm 4 end-to-end ...", flush=True) out["alg4_runs"] = [run_alg4(seed=s, alpha=a) for s in range(3) for a in (0.3, 0.5)] print("D. Theorem 11 scaling ...", flush=True) out["scaling"] = theorem11_scaling() print("E. Algorithm 3 mechanism at full T ...", flush=True) out["alg3_mechanism"] = [alg3_mechanism_check(seed=s) for s in range(3)] return out
if __name__ == "__main__": r = main() with open("outputs/claim3_mixed.json", "w") as f: json.dump(r, f, indent=2)
sc = r["scaling"] checks = { "Lemma 20 ratio sensitivity": r["ratio_sensitivity"]["holds"], "Alg 3 violations <= s": all(x["violations_le_s"] for x in r["alg3_runs"]), "Alg 4 violations <= s": all(x["violations_le_s"] for x in r["alg4_runs"]), "s3 ~ V^2.5 (Thm 11.1)": abs(sc["alg3_V_exponent"]["polylog_corrected"] - 2.5) < 0.02, "s3 ~ alpha^-4.5 (Thm 11.1)": abs(sc["alg3_alpha_exponent"]["polylog_corrected"] + 4.5) < 0.02, "s3 ~ Amax^2.5 (Thm 11.1)": abs(sc["alg3_Amax_exponent"]["polylog_corrected"] - 2.5) < 0.02, "s4 ~ d^3 (Thm 11.2)": abs(sc["alg4_d_exponent"]["polylog_corrected"] - 3.0) < 0.02, "s4 ~ alpha^-6 (Thm 11.2)": abs(sc["alg4_alpha_exponent"]["polylog_corrected"] + 6.0) < 0.02, "Alg 3 MWU ratio smax/smin <= 1+alpha at full T (Lemma 21)": all(x["lemma21_ratio_holds"] for x in r["alg3_mechanism"]), } print() print("Algorithm 3 at FULL T (small instances):") for x in r["alg3_mechanism"]: print(f" T={x['T']:>7} smax/smin={x['smax_over_smin']:.4f} (bound {x['ratio_bound']}) " f"-> {x['lemma21_ratio_holds']}; violations: best scale " f"{x['violations_at_best_scale']}/{x['n_constraints']}, " f"private scale {x['violations_at_private_scale']}/{x['n_constraints']} " f"(eps'={x['eps_prime']:.2e} over {x['n_scale_candidates']} candidates)") print("exponents of s (raw | polylog-corrected | predicted)") for key, pred in [("alg3_V_exponent", 2.5), ("alg3_alpha_exponent", -4.5), ("alg3_Amax_exponent", 2.5), ("alg4_d_exponent", 3.0), ("alg4_alpha_exponent", -6.0)]: print(f" {key:24s} {sc[key]['raw']:+.4f} | {sc[key]['polylog_corrected']:+.4f} | {pred:+.1f}") print() for k, v in checks.items(): print(f" [{'PASS' if v else 'FAIL'}] {k}") sys.exit(0 if all(checks.values()) else 1)
````
````outputA. Lemma 20 ratio-score sensitivity ...B. Algorithm 3 end-to-end ...C. Algorithm 4 end-to-end ...D. Theorem 11 scaling ...E. Algorithm 3 mechanism at full T ...
Algorithm 3 at FULL T (small instances): T= 48524 smax/smin=0.2705 (bound 1.5) -> True; violations: best scale 0/40, private scale 20/40 (eps'=6.11e-04 over 57 candidates) T= 46943 smax/smin=0.3422 (bound 1.5) -> True; violations: best scale 0/40, private scale 20/40 (eps'=6.21e-04 over 55 candidates) T= 51147 smax/smin=0.3213 (bound 1.5) -> True; violations: best scale 0/40, private scale 20/40 (eps'=5.95e-04 over 54 candidates)exponents of s (raw | polylog-corrected | predicted) alg3_V_exponent +2.5495 | +2.5000 | +2.5 alg3_alpha_exponent -4.6261 | -4.5000 | -4.5 alg3_Amax_exponent +2.5467 | +2.5000 | +2.5 alg4_d_exponent +3.1514 | +3.0000 | +3.0 alg4_alpha_exponent -6.1568 | -6.0000 | -6.0
[PASS] Lemma 20 ratio sensitivity [PASS] Alg 3 violations <= s [PASS] Alg 4 violations <= s [PASS] s3 ~ V^2.5 (Thm 11.1) [PASS] s3 ~ alpha^-4.5 (Thm 11.1) [PASS] s3 ~ Amax^2.5 (Thm 11.1) [PASS] s4 ~ d^3 (Thm 11.2) [PASS] s4 ~ alpha^-6 (Thm 11.2) [PASS] Alg 3 MWU ratio smax/smin <= 1+alpha at full T (Lemma 21)
````
---<!-- trackio-cell{"type": "markdown", "id": "cell_ded7e59c4f05", "created_at": "2026-07-17T08:19:43+00:00", "title": "Claim 3 verdict"}-->## Verdict: **reproduced at the level of the bounds and the sensitivity lemma.** All five exponents of Theorem 2 are exact.
Claim 3 (Theorem 2 / Theorem 11): mixed packing-covering (`Px <= 1, Cx >= 1`) admits an instance-dependent bound `s = O~(P_max C_max sqrt(P_max+C_max) V^2.5/(alpha^4.5 eps))` and a data-independent bound `s = O~(d^3/(alpha^6 eps))`.
### The exponents
| quantity | raw fit | **polylog-corrected** | theorem ||---|---|---|---|| `s_3` vs `V` | +2.5495 | **+2.5000** | **+2.5** || `s_3` vs `alpha` | -4.6261 | **-4.5000** | **-4.5** || `s_3` vs `P_max = C_max` | +2.5467 | **+2.5000** | **+2.5** || `s_4` vs `d` | +3.1514 | **+3.0000** | **+3.0** || `s_4` vs `alpha` | -6.1568 | **-6.0000** | **-6.0** |
The third row deserves a note: Theorem 2's `P_max·C_max·sqrt(P_max+C_max)` prefactor predicts exponent `1 + 1 + 0.5 = 2.5` when `P_max = C_max` are varied together, and that is what we measure — a non-trivial consistency check on the *shape* of the prefactor, not just one variable.
### Lemma 20 (the sensitivity that makes the mixed case work)
Algorithm 3 scores coordinates by a **ratio** `<grad smax^U(Px), P1_j> / <grad smin^U(Cx), C1_j>`, whose sensitivity Lemma 20 bounds by `3 S R V^2/(s alpha^2)` in two separate cases. Measured over 200 random neighbouring instances:
- a **packing** constraint changes: max observed/claimed = **0.023**- a **covering** constraint changes: max observed/claimed = **0.023**
Both hold. This also confirms *why* line 3 of Algorithm 3 perturbs `C_ij <- C_ij + alpha/V`: `C_min` sits in the denominator of that ratio, and without the perturbation the sensitivity is unbounded as `C_min -> 0`.
### Instance generation (a trap worth recording)
Sampling `P` and `C` independently at the same scale essentially **never** yields a feasible mixed instance: for `x = t·1` the packing rows force `t <~ 1/max_i sum_j P_ij` while the covering rows need `t >~ 1/min_i sum_j C_ij`, and with iid entries the former is smaller. Our first generator raised `could not sample a feasible mixed instance` after 200 tries. We now pick a witness `x*` first and rescale each row around it (`P_i <- P_i/max(1, P_i x*)`, `C_i <- C_i·max(1, 1/(C_i x*))`), making `x*` feasible by construction.
### What is *not* established here
The end-to-end runs of Algorithms 3 and 4 pass 'violations <= s' **only vacuously** (`s ~ 4e7` against `n = 120` constraints), and their raw output is poor. That is unpacked on the **Claim 5** page, which separates the MWU engine (correct) from the private scale-selection step (needs `n ~ 1e5` to do anything). We did not attempt a scaled mixed-LP run: `T = Theta((S+R)V log n/alpha^3)` is ~50k iterations even on a 40-constraint instance, and the scale-selection step would need `n >~ 2e4` *simultaneously*, which we judged out of budget rather than infeasible in principle.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295# Claim 4: truncated softmax and Algorithms 1-2
---<!-- trackio-cell{"type": "code", "id": "cell_775b34c658e3", "created_at": "2026-07-17T08:17:19+00:00", "title": "Run: uv exp_claim4_smax.py (exit 0)", "command": ["uv", "run", "python", "exp_claim4_smax.py"], "exit_code": 0, "duration_s": 13.287}-->````bash$ uv run python exp_claim4_smax.py````
exit 0 · 13.3s
````python title=exp_claim4_smax.py"""Claim 4 (Section 2.4, Appendix A): the truncated softmax smax^U and its properties.
We verify, against independent numerical ground truth where possible:
P12 grad smax^U(x)_i = min{U, exp(x_i - t_U(x))}, and it is the argmax of the variational problem max_{r in D^U} <x,r> - omega(r) [checked vs SLSQP] -- smax^U value matches the numerically-solved optimum -- coordinates of grad smax^U are capped at U and sum to 1 (the privacy lever) P13 Hessian bound grad^2 smax^U(x) <= diag([grad smax^U|_Cbar ; 0_C]) P14 smax^U(x+u) <= smax^U(x) + (e^D - 1)/D <grad smax^U(x), u>, D = max u_i (1) smax^U(x+u) <= smax^U(x) + (1+D) <grad smax^U(x), u> for u >= 0, D <= 1 (2) smin^U(x+u) >= smin^U(x) + (1-D) <grad smin^U(x), u> top-s max_{|S|=s=1/U} <1_S/|S|, x> <= smax^U(x) -- the bound that converts a smax^U certificate into "at most s violated constraints""""
from __future__ import annotations
import json
import numpy as npfrom scipy.optimize import minimize
from ppl.smax import bottomk_mean, grad_smax, grad_smin, smax, smin, topk_mean
def linear_max_over_capped_simplex(g: np.ndarray, U: float) -> float: """max_{r in D^U} <g, r>, exactly: greedily put mass U on the largest coordinates.
D^U = {r >= 0 : sum r = 1, max r <= U}, so the LP optimum fills floor(1/U) of the largest coordinates to the cap and puts the remaining 1 - U*floor(1/U) on the next. """ gs = np.sort(g)[::-1] k = int(np.floor(1.0 / U + 1e-12)) k = min(k, gs.size) val = U * gs[:k].sum() rem = 1.0 - U * k if rem > 1e-15 and k < gs.size: val += rem * gs[k] return float(val)
def optimality_gap(x: np.ndarray, U: float, r: np.ndarray) -> float: """Exact first-order certificate that r maximises <x,r> - omega(r) over D^U.
The objective is concave and differentiable on r > 0 with gradient grad(r) = x - log r - 1. For a concave maximisation over a convex set, r is optimal iff max_{r' in D^U} <grad(r), r' - r> <= 0. The inner maximisation is a linear program over the capped simplex, solved exactly above -- so this certifies optimality without relying on a numerical optimiser (SLSQP does not converge tightly enough here to serve as ground truth). """ grad = x - np.log(np.clip(r, 1e-300, None)) - 1.0 return linear_max_over_capped_simplex(grad, U) - float(grad @ r)
def numeric_smax(x: np.ndarray, U: float) -> tuple[float, np.ndarray]: """Ground truth: solve max_{r in D^U} <x,r> - sum r log r with SLSQP.""" n = x.size
def neg_obj(r): rr = np.clip(r, 1e-300, None) return -(x @ r - np.sum(rr * np.log(rr)))
def neg_grad(r): rr = np.clip(r, 1e-300, None) return -(x - (np.log(rr) + 1.0))
r0 = np.full(n, 1.0 / n) res = minimize( neg_obj, r0, jac=neg_grad, method="SLSQP", bounds=[(0.0, U)] * n, constraints=[{"type": "eq", "fun": lambda r: r.sum() - 1.0, "jac": lambda r: np.ones(n)}], options={"maxiter": 800, "ftol": 1e-14}, ) return float(-res.fun), np.asarray(res.x)
def main() -> dict: rng = np.random.default_rng(0) out: dict = {}
# ---- P12: exact optimality certificate for the closed form --------------- # (Primary check. We certify that the Proposition-12 closed form is the exact # argmax of the variational problem, via the first-order condition.) gaps = [] for _ in range(400): n = int(rng.integers(4, 60)) U = float(rng.uniform(1.0 / n + 1e-3, 1.0)) x = rng.normal(0, rng.uniform(0.5, 6.0), size=n) gaps.append(optimality_gap(x, U, grad_smax(x, U))) out["P12_max_optimality_gap"] = float(np.max(gaps)) # <= 0 up to numerical noise
# ---- P12 secondary: closed form vs SLSQP --------------------------------- # SLSQP is NOT a reliable ground truth for this problem (it stalls early), so we # report the *signed* comparison: the closed form must never be worse. Where they # differ it is SLSQP that is suboptimal -- confirmed by the certificate above. signed, grad_err = [], [] for _ in range(200): n = int(rng.integers(4, 25)) U = float(rng.uniform(1.0 / n + 1e-3, 1.0)) x = rng.normal(0, rng.uniform(0.5, 4.0), size=n) v_num, r_num = numeric_smax(x, U) v_cf, r_cf = smax(x, U), grad_smax(x, U) signed.append(v_cf - v_num) # >= 0: closed form at least as good grad_err.append(float(np.abs(r_cf - r_num).max())) out["P12_min_signed_advantage_over_slsqp"] = float(np.min(signed)) out["P12_max_signed_advantage_over_slsqp"] = float(np.max(signed)) out["P12_grad_max_abs_err_vs_slsqp"] = float(np.max(grad_err))
# ---- simplex + cap: the privacy lever ------------------------------------ cap_slack, sum_err = [], [] for _ in range(500): n = int(rng.integers(5, 400)) U = float(rng.uniform(1.0 / n, 1.0)) x = rng.normal(0, rng.uniform(0.5, 20.0), size=n) r = grad_smax(x, U) cap_slack.append(float(r.max() - U)) # must be <= 0 sum_err.append(abs(float(r.sum()) - 1.0)) out["cap_max_violation"] = float(np.max(cap_slack)) # <= ~0 out["simplex_max_sum_err"] = float(np.max(sum_err))
# ---- P13 Hessian bound --------------------------------------------------- def hess_fd(x, U, h=1e-5): n = x.size Hm = np.zeros((n, n)) for i in range(n): e = np.zeros(n) e[i] = h Hm[:, i] = (grad_smax(x + e, U) - grad_smax(x - e, U)) / (2 * h) return 0.5 * (Hm + Hm.T)
worst_p13 = -np.inf for _ in range(60): n = int(rng.integers(4, 10)) U = float(rng.uniform(1.0 / n + 1e-2, 1.0)) x = rng.normal(0, 1.5, size=n) g = grad_smax(x, U) Hm = hess_fd(x, U) C = g >= U - 1e-9 diag = np.where(C, 0.0, g) # PSD check of diag(diag) - H (allow FD noise) w = np.linalg.eigvalsh(np.diag(diag) - Hm) worst_p13 = max(worst_p13, float(-w.min())) out["P13_max_psd_violation"] = worst_p13 # ~0 up to finite-difference noise
# ---- P14 / eq (1) / eq (2) ---------------------------------------------- p14_slack, eq1_slack, eq2_slack = [], [], [] for _ in range(2000): n = int(rng.integers(5, 200)) U = float(rng.uniform(1.0 / n, 1.0)) x = rng.normal(0, rng.uniform(0.5, 5.0), size=n) u = rng.uniform(0, rng.uniform(0.05, 1.0), size=n) # u >= 0, max <= 1 D = float(u.max()) lhs = smax(x + u, U) rhs_p14 = smax(x, U) + (np.exp(D) - 1.0) / D * (grad_smax(x, U) @ u) rhs_eq1 = smax(x, U) + (1.0 + D) * (grad_smax(x, U) @ u) p14_slack.append(lhs - rhs_p14) # <= 0 eq1_slack.append(lhs - rhs_eq1) # <= 0 lhs2 = smin(x + u, U) rhs_eq2 = smin(x, U) + (1.0 - D) * (grad_smin(x, U) @ u) eq2_slack.append(rhs_eq2 - lhs2) # <= 0 out["P14_max_violation"] = float(np.max(p14_slack)) out["eq1_max_violation"] = float(np.max(eq1_slack)) out["eq2_max_violation"] = float(np.max(eq2_slack))
# ---- top-s bound: max_{|S|=s} <1_S/|S|, x> <= smax^U(x), s = 1/U --------- tops_slack, bots_slack = [], [] for _ in range(2000): n = int(rng.integers(10, 500)) s = int(rng.integers(1, n + 1)) U = 1.0 / s x = rng.uniform(0, rng.uniform(0.5, 10.0), size=n) tops_slack.append(topk_mean(x, s) - smax(x, U)) # <= 0 bots_slack.append(smin(x, U) - bottomk_mean(x, s)) # <= 0 out["top_s_max_violation"] = float(np.max(tops_slack)) out["bottom_s_max_violation"] = float(np.max(bots_slack))
return out
if __name__ == "__main__": res = main() print(json.dumps(res, indent=2)) with open("outputs/claim4_smax.json", "w") as f: json.dump(res, f, indent=2)
tol = 1e-6 checks = { "P12 closed form is the exact argmax (first-order certificate)": res["P12_max_optimality_gap"] < 1e-8, "P12 closed form never worse than SLSQP": res["P12_min_signed_advantage_over_slsqp"] > -1e-8, "coordinate cap <= U": res["cap_max_violation"] < tol, "weights on simplex": res["simplex_max_sum_err"] < tol, "P13 Hessian bound": res["P13_max_psd_violation"] < 1e-4, "P14 smax increase": res["P14_max_violation"] < tol, "eq (1)": res["eq1_max_violation"] < tol, "eq (2)": res["eq2_max_violation"] < tol, "top-s bound": res["top_s_max_violation"] < tol, "bottom-s bound": res["bottom_s_max_violation"] < tol, } print() for k, v in checks.items(): print(f" [{'PASS' if v else 'FAIL'}] {k}") raise SystemExit(0 if all(checks.values()) else 1)
````
````output{ "P12_max_optimality_gap": 5.329070518200751e-15, "P12_min_signed_advantage_over_slsqp": -2.007283228522283e-13, "P12_max_signed_advantage_over_slsqp": 0.00027838197758356387, "P12_grad_max_abs_err_vs_slsqp": 0.0002192671027614959, "cap_max_violation": 1.6653345369377348e-15, "simplex_max_sum_err": 2.220446049250313e-16, "P13_max_psd_violation": 2.103299661080561e-11, "P14_max_violation": -0.00015971538624981463, "eq1_max_violation": -0.000493655001106319, "eq2_max_violation": -0.0006833993316992526, "top_s_max_violation": -0.2695476857573116, "bottom_s_max_violation": -0.46878953790966127}
[PASS] P12 closed form is the exact argmax (first-order certificate) [PASS] P12 closed form never worse than SLSQP [PASS] coordinate cap <= U [PASS] weights on simplex [PASS] P13 Hessian bound [PASS] P14 smax increase [PASS] eq (1) [PASS] eq (2) [PASS] top-s bound [PASS] bottom-s bound
````
---<!-- trackio-cell{"type": "markdown", "id": "cell_b4d42983d230", "created_at": "2026-07-17T08:17:43+00:00", "title": "Claim 4 verdict"}-->## Verdict: **reproduced**. Every property of `smax^U` that the paper's analysis uses holds.
Claim 4 says Algorithms 1–2 solve packing/covering via a dense MWU built on a *truncated* softmax`smax^U(x) = max_{r in D^U} <x,r> - omega(r)`, `D^U = {r in simplex : max r <= U}`, whose coordinates are capped at `U = 1/s` in order to control privacy sensitivity. This page tests that machinery directly.
### Results (400–2000 random instances per row)
| Paper statement | What we measured | Result ||---|---|---|| **Prop 12** gradient closed form `min{U, exp(x_i - t_U(x))}` | exact first-order optimality gap | **5.3e-15** — it *is* the argmax || — (secondary) | closed form vs SLSQP, signed | never worse (min advantage **-2.0e-13**, i.e. 0) || coordinates capped at `U` | `max_i grad - U` | **1.7e-15** (<= 0) || weights on the simplex | `abs(sum grad - 1)` | **2.2e-16** || **Prop 13** Hessian bound | min eigenvalue of `diag(g) - H` | **-2.1e-11** (= 0 up to finite-difference noise) || **Prop 14** `smax^U(x+u) <= smax^U(x) + ((e^D-1)/D)<grad, u>` | max violation | **-1.6e-4** (<= 0) || **eq (1)** `smax^U(x+u) <= smax^U(x) + (1+D)<grad, u>` | max violation | **-4.9e-4** (<= 0) || **eq (2)** `smin^U(x+u) >= smin^U(x) + (1-D)<grad, u>` | max violation | **-6.8e-4** (<= 0) || **top-s bound** `max_{|S|=s=1/U} <1_S/|S|, x> <= smax^U(x)` | max violation | **-0.27** (<= 0) || bottom-s bound (covering analogue) | max violation | **-0.47** (<= 0) |
All ten pass. Negative numbers are slack: the inequality holds with room to spare.
### Why the top-s bound is the load-bearing one
This is the step that turns an optimisation certificate into a *privacy* guarantee, and it is worth spelling out because it is the whole architecture of the paper:
1. The cap `U` bounds every weight, so changing **one constraint** moves the score `Q` by at most `3H/s` (verified separately on the Claim 1 page: observed/claimed = **0.015**).2. Low sensitivity ⇒ the exponential mechanism is accurate at small `eps'` ⇒ the MWU converges.3. Conversely `max_{|S|=s} <1_S/|S|, Ax> <= smax^U(Ax) <= 1+alpha` means *the average of the `s` largest constraint values is at most `1+alpha`*, so **at most `s = 1/U` constraints can exceed `1+alpha`**.
So the single parameter `U` simultaneously buys the privacy sensitivity **and** names the number of constraints that get dropped — `s = 1/U` is not a coincidence, it is the same quantity read two ways. Our measurements confirm both directions of that identity.
### Note on Prop 12's degenerate case
At `U·n = 1` exactly, `D^U` is the single point `{uniform}` and the gradient formula's `t_U(x)` is `-inf`; `smax^U(x)` degenerates to `mean(x) + log n`. The paper does not discuss this, and it is not a defect (the regime is uninteresting: no truncation freedom), but any implementation must special-case it — a naive bracket search hangs forever. Verified our handling matches the analytic value.1234567891011121314151617181920212223242526272829303132333435363738394041424344454647# Claim 5: MWU variants for mixed packing-covering (Algorithms 3-4)
---<!-- trackio-cell{"type": "markdown", "id": "cell_1a8e2815f79a", "created_at": "2026-07-17T08:20:10+00:00", "title": "Claim 5 verdict"}-->## Verdict: **the MWU engine reproduces; the private scale-selection step is vacuous at every scale we could run.**
Claim 5 (Section 5): Algorithms 3 (data-dependent) and 4 (data-independent) give MWU variants for mixed packing-covering, paralleling the pure constructions of Sections 3.1–3.2 and 4.1. Both are implemented, including Algorithm 4's `MaxEstimator` pre-processing.
### The problem with a naive end-to-end test
Run as written with a practical iteration cap, Algorithm 3's output looks like garbage:
| alpha | T run / T theory | s bound | violations | max `Px` ||---|---|---|---|---|| 0.3 | 3,000 / 332,500 | 4.1e7 | 60/120 | **1902.2** || 0.5 | 3,000 / 71,820 | 3.8e6 | 60/120 | **1448.8** || 0.3 | 3,000 / 378,785 | 5.5e7 | 60/120 | **0.001** |
`max Px` should be `<= 1+alpha`; it is 1900 or 0.001. And 'violations <= s' *passes* — because `s = 4e7` and there are only 120 constraints. **A reproduction that stopped here could report 'all checks pass' while the algorithm is producing nothing.** So we separated the two possible causes.
### Isolating the MWU from the scale selection
We ran small instances (20+20 constraints, d=3) to their **full** theoretical `T ~ 48,000` iterations — no cap — and measured the actual engine of Lemma 21, `smax^U(P x_T)/smin^U(C x_T) <= 1+alpha`, then compared the *best* scale `k` against the one the private exponential mechanism returns:
| T (full) | `smax/smin` | bound `1+alpha` | violations @ **best** scale | violations @ **private** scale ||---|---|---|---|---|| 48,524 | **0.2705** | 1.5 | **0 / 40** | 20 / 40 || 46,943 | **0.3422** | 1.5 | **0 / 40** | 20 / 40 || 51,147 | **0.3213** | 1.5 | **0 / 40** | 20 / 40 |
Two clean conclusions:
1. **The MWU engine of Algorithm 3 is correct.** Lemma 21's ratio bound holds with large margin, and the iterate `x_T` it produces is — at the right scale — **exactly feasible (0/40 violations)**. The construction does what Section 5 says it does.2. **The private scale selection (line 9) is what destroys the solution at this scale**, and it does so for a reason the theory predicts. That step runs an exponential mechanism over ~57 candidate powers of `(1+alpha)` with score `-(number of violated constraints)`, sensitivity 1, at `eps' = 6.1e-4`. Its utility guarantee is `count <= min_count + 2(log(#cands) + log(1/beta))/eps' ~ 0 + 20,760` — i.e. it promises 'at most 20,760 violations' on an instance with **40 constraints**. It is vacuous, so it picks a near-uniformly random scale, and we observe exactly that.
For line 9 to do anything, one needs `n >> 2(log(#cands)+log(1/beta))/eps' ~ 2e4` constraints *while simultaneously* running `T ~ 5e4` iterations. That product is what put a faithful scaled mixed-LP run out of our budget — not any obstacle in principle.
### Algorithm 4
Implemented with the `MaxEstimator(m, M, {a_i}, eps, beta)` sub-routine of Lemma 22 (exponential mechanism over `k` with `2^k m in [m, 2M]`, score `-|{a_i >= 2^k m}| - c·k`), the per-coordinate filtering of Lemma 23, and the `C_ij <- min{C_ij + alpha M_j/d, 40 d M_j/alpha}` clip. It runs and its bound exponents are exact (`d^3`, `alpha^-6`; see Claim 3). Its end-to-end output suffers from the same vacuous scale-selection step, for the same reason.
### Summary
Claim 5 says Sections 5.1–5.2 *give* these two algorithms paralleling the pure case. That is reproduced: both exist, both are implementable from the pseudocode, both have the stated bounds, and Algorithm 3's MWU provably converges to a scalable feasible point at full `T`. What we cannot show at our scale is the *end-to-end private* guarantee, because its final step needs `n` far larger than the iteration budget allows.1234567891011121314# Repro - Solving Positive Linear Programs with Differential Privacy
## Pages
| Page || --- || [Claim 1: instance-dependent (A_max·OPT)^1.5 bound, improving Hsu et al. by OPT^0.5](#/claim-1-instance-dependent-a-max-opt-1-5-bound-improving-hsu-et-al-by-opt-0-5) || [Claim 2: data-independent d^1.5 / alpha^3.5 bound](#/claim-2-data-independent-d-1-5-alpha-3-5-bound) || [Claim 3: mixed packing-covering bounds (Theorem 2)](#/claim-3-mixed-packing-covering-bounds-theorem-2) || [Claim 4: truncated softmax and Algorithms 1-2](#/claim-4-truncated-softmax-and-algorithms-1-2) || [Claim 5: MWU variants for mixed packing-covering (Algorithms 3-4)](#/claim-5-mwu-variants-for-mixed-packing-covering-algorithms-3-4) || [Setup and methodology](#/setup-and-methodology) || [Conclusion](#/conclusion) || [private-positive-lp-repro](#/private-positive-lp-repro) |12345678910111213141516171819# private-positive-lp-repro
---<!-- trackio-cell{"type": "artifact", "id": "cell_e251ec1a8579", "created_at": "2026-07-17T08:42:32+00:00", "title": "Artifact: private-positive-lp-repro/repro-bundle:v0", "artifact": "private-positive-lp-repro/repro-bundle:v0", "artifact_type": "dataset"}-->**📦 Artifact** `private-positive-lp-repro/repro-bundle:v0` · dataset · 6.3 MB
https://huggingface.co/buckets/txus/repro-solving-positive-linear-programs-with-differential-privacy-artifacts#private-positive-lp-repro/repro-bundle:v0
---<!-- trackio-cell{"type": "artifact", "id": "cell_b1ec72a5a828", "created_at": "2026-07-17T08:58:22+00:00", "title": "Artifact: private-positive-lp-repro/repro-bundle:v1", "artifact": "private-positive-lp-repro/repro-bundle:v1", "artifact_type": "dataset"}-->**📦 Artifact** `private-positive-lp-repro/repro-bundle:v1` · dataset · 7.4 MB
https://huggingface.co/buckets/txus/repro-solving-positive-linear-programs-with-differential-privacy-artifacts#private-positive-lp-repro/repro-bundle:v112345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455# Setup and methodology
---<!-- trackio-cell{"type": "markdown", "id": "cell_5c4d04cb966a", "created_at": "2026-07-17T08:16:59+00:00", "title": "Setup and methodology"}-->## What kind of paper this is
[Solving Positive Linear Programs with Differential Privacy](https://arxiv.org/abs/2604.26838) (Ene, Nguyen, Nguyen, Vladu; ICML 2026, OpenReview `zlSioMUQ2Y`) is a **pure theory paper**. It contains no experiments, no figures, no tables, no code, no datasets — the five claims are Theorems 1, 2 and the algorithms of Sections 2.4, 3, 4 and 5. There are no reported numbers to match.
So 'reproduction' here cannot mean 're-run their experiments'. It means: **implement Algorithms 1–4 from the pseudocode and empirically test the mathematical statements the theorems make** — the closed forms, the inequalities each proof rests on, and the end-to-end guarantees. Where a statement is a worst-case asymptotic claim, we say so rather than pretending a finite experiment settles it.
## What is and isn't checkable
| Statement type | Example | Testable? ||---|---|---|| Closed form | Prop 12: `grad smax^U(x)_i = min{U, exp(x_i - t_U(x))}` | **Yes, exactly** — certify it is the argmax || Inequality on iterates | eq (1), Lemmas 8/16/20/21 | **Yes** — evaluate on real algorithm runs || DP composition arithmetic | Lemma 7: `eps'` composes to `(eps, delta)` | **Yes** — numerically || End-to-end utility | Thm 6: `1^T x >= (1-alpha) OPT` | **Yes** — run the algorithm || `O~()` polynomial exponent | Thm 1: `s ~ d^1.5` | **Yes**, with care (see below) || Worst-case asymptotic superiority | 'improves Hsu et al. by `OPT^0.5`' | **Only partly** — a finite sample of instances cannot establish a worst case || `(eps, delta)`-DP itself | Lemma 7 | **No** — we verify the composition arithmetic and the sensitivity bound it depends on, not privacy by audit |
## Two methodological points that materially changed the results
**1. `O~()` hides a polylog, which biases a naive exponent fit.** The bounds are stated as `O~()`, hiding a `(log d + log(T/beta))` factor that *itself grows* with `d`, `OPT` and `1/alpha`. Fitting `log s` against `log d` directly gives **1.60**, not the claimed 1.5 — the log factor inflates the slope. Dividing out that known factor before fitting recovers **1.5000**. Every exponent below is reported **both ways**; the polylog-corrected one is the one the theorem actually asserts.
**2. SLSQP is not a valid ground truth for `smax^U`.** Our first attempt validated the Prop-12 closed form against `scipy.optimize.minimize(method='SLSQP')` and it *failed* (max discrepancy 0.049). Investigating: the closed form attains a **strictly higher** objective than SLSQP on every disagreeing instance, and both are feasible — since this is a maximisation, SLSQP was the one stalling, not the closed form. We replaced it with an **exact first-order optimality certificate**: the objective is concave, so `r` is optimal iff `max_{r' in D^U} <grad(r), r' - r> <= 0`, and that inner maximisation is a linear program over the capped simplex with an exact greedy solution. Gap measured: **5.3e-15**.
## The scale problem (why a GPU job is needed, and what it can and cannot show)
The bounds carry large constants (`s = 60 H·OPT (log d + log(T/beta)) / (alpha eps')`) and `1/eps' = 2 sqrt(T log(1/delta))/eps`. The result is that **`s > n` on any small instance**, making 'at most `s` constraints violated' *vacuously true*. A reproduction that only ran small instances and reported 'guarantee holds' would be reporting nothing.
We computed where the bound starts to bite for packing without pre-processing (`H = A_max = 1`, `OPT ~ 1`):
| n | alpha=0.3 | alpha=0.5 ||---|---|---|| 1e5 | s/n = 8.98 (vacuous) | s/n = 2.96 (vacuous) || **1e6** | **s/n = 0.999** | **s/n = 0.329** || **2e6** | **s/n = 0.514** | **s/n = 0.169** |
So `n = 2e6` is the smallest round scale at which the theorem says something non-trivial, and reaching it with the full `T` iteration count is what the GPU job is for. Note this is a property of the *packing, no-pre-processing* branch — the covering and pre-processing branches have `s` in the `1e7`–`1e10` range and stay vacuous at every scale we can run. We report that rather than hide it.
## Implementation
Algorithms 1–4 are transcribed from the pseudocode. Two places where the typeset pseudocode is ambiguous were resolved against the proofs (which are authoritative):
- **Alg 1 line 10**: the post-processing threshold reads `x_j <= 2/H`; the proof of Lemma 9 truncates entries below `alpha·OPT/d`. With `H = 2d/(alpha·OPT)` these are *identical* (`2/H = alpha·OPT/d`), so there is no real ambiguity — we use `alpha·OPT/d`.- **Alg 2 line 3**: reads `T = 20 H OPT log n / alpha`; the proof of Lemma 18 fixes `T = 2 log n/(eta·alpha)` with `eta = alpha/(10 H OPT)`, i.e. `T = 20 H OPT log n / alpha^2`, matching Algorithm 1. We use the proof's value and believe the `alpha` in the pseudocode is a typo.
The exponential mechanism follows the paper's own Theorem 4 accounting: sampling `j` with probability proportional to `exp(eps·Q(j)/(2·Delta))`, which is what reproduces the `2 Delta (log d + log 1/beta)/eps` utility term that Lemmas 8 and 16 plug in.
**One real bug we hit and fixed** (worth recording for the next agent): when `U·n == 1` exactly, `D^U` collapses to the single uniform point, `f(t) = sum_i min(U, exp(x_i - t))` approaches 1 from below and never exceeds it, so a bisection bracket search of the form `while f(lo) < 1: lo -= 10` **never terminates**. This is not an edge case — it is the *common* path, because `U = 1/s` is clamped to `1/n` whenever the bound is vacuous. Guarded by returning the uniform vector directly; verified `smax^U(x) = mean(x) + log n` there, as it must be..serve.logAdded
README.md+13-5
bucket-icon.svgAdded
index.html+52-17
logbook.cssAdded+1602
logbook.jsAdded+2275
logbook.jsonAdded+71
pages/claim-1-instance-dependent-a-max-opt-1-5-bound-improving-hsu-et-al-by-opt-0-5/page.mdAdded+451
pages/claim-2-data-independent-d-1-5-alpha-3-5-bound/page.mdAdded+447
pages/claim-3-mixed-packing-covering-bounds-theorem-2/page.mdAdded+356
pages/claim-4-truncated-softmax-and-algorithms-1-2/page.mdAdded+295
pages/claim-5-mwu-variants-for-mixed-packing-covering-algorithms-3-4/page.mdAdded+47
pages/conclusion/page.mdAdded
pages/index.mdAdded+14
pages/private-positive-lp-repro/page.mdAdded+19
pages/setup-and-methodology/page.mdAdded+55
trackio-logo-light.pngAdded

trackio-logo.pngAdded

trackio-wordmark-dark.pngAdded
