Tokyo-based Sakana AI shipped its first commercial product ‘Sakana Marlin’ this week. Sakana team positions it as a Virtual CSO (Chief Strategy Officer). It is a B2B autonomous research agent built for enterprises.
Marlin does not answer in seconds like a chatbot. You give it one research topic. It then runs autonomously for up to about eight hours. Each run returns a long report plus a presentation slide deck. Sakana says a single session issues hundreds to thousands of LLM queries.
What is Sakana Marlin
Marlin is an enterprise research agent, not a chat assistant. You give it one topic or question. It then plans hypotheses, browses sources, and verifies findings on its own. It compresses weeks of strategy work into hours.
The deliverable is structured for decision-makers. The Japanese announcement describes reports of dozens of pages. The English announcement cites reports of up to roughly 100 pages. At a press hands-on, reports ran 60–100 pages and cited 60–80 sources. Each report includes a main body, references, and appendices. Presentation slides are generated using image-generation AI.
Sakana team refined Marlin through a closed beta in April 2026. Around 300 professionals tested it on real tasks during that beta. Those tasks spanned strategy formulation, market research, risk analysis, and competitive analysis. Sakana has also partnered with MUFG and taken strategic investment from Citigroup.
How Sakana Marlin Works — pipeline walkthrough
#mtp-marlin-flow *{box-sizing:border-box!important;margin:0;padding:0}
#mtp-marlin-flow{
background:#111!important;color:#e8e8e8!important;border:1px solid #2a2a2a!important;
border-radius:14px!important;max-width:900px;margin:24px auto;padding:20px 20px 14px;
font-family:-apple-system,BlinkMacSystemFont,”Segoe UI”,Roboto,Helvetica,Arial,sans-serif;
line-height:1.5;overflow:hidden
}
#mtp-marlin-flow h3{color:#fff!important;font-size:19px;font-weight:700;margin:0 0 4px}
#mtp-marlin-flow .mf-sub{color:#9aa0a6!important;font-size:13px;margin-bottom:14px}
#mtp-marlin-flow .mf-label{color:#76B900!important;font-size:11px;letter-spacing:.06em;text-transform:uppercase;margin:0 0 7px;font-weight:700}
#mtp-marlin-flow .mf-topics{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:12px}
#mtp-marlin-flow .mf-topic{
background:#161616!important;color:#cfcfcf!important;border:1px solid #2a2a2a!important;border-radius:20px!important;
font-size:12.5px;padding:7px 13px;cursor:pointer;transition:all .15s;text-align:left
}
#mtp-marlin-flow .mf-topic:hover{border-color:#3f4f22!important}
#mtp-marlin-flow .mf-topic.on{background:#1b2410!important;border-color:#76B900!important;color:#fff!important}
#mtp-marlin-flow .mf-controls{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin-bottom:14px}
#mtp-marlin-flow button{
background:#76B900!important;color:#0a0a0a!important;border:0!important;border-radius:8px!important;
font-weight:700;font-size:13px;padding:9px 15px;cursor:pointer;transition:filter .15s
}
#mtp-marlin-flow button:hover{filter:brightness(1.1)}
#mtp-marlin-flow button.mf-ghost{background:#1c1c1c!important;color:#76B900!important;border:1px solid #2f3b1a!important}
#mtp-marlin-flow button:disabled{opacity:.4;cursor:not-allowed}
#mtp-marlin-flow .mf-speed{display:flex;align-items:center;gap:8px;font-size:12px;color:#bdbdbd!important;margin-left:auto}
#mtp-marlin-flow input[type=range]{accent-color:#76B900;width:110px}
/* stepper */
#mtp-marlin-flow .mf-rail{display:flex;gap:6px;margin-bottom:14px}
#mtp-marlin-flow .mf-step{flex:1;background:#0b0b0b!important;border:1px solid #232323!important;border-radius:9px!important;padding:9px 8px;text-align:center;position:relative;transition:all .25s}
#mtp-marlin-flow .mf-step .n{font-size:10px;color:#666!important;font-weight:700}
#mtp-marlin-flow .mf-step .t{font-size:11.5px;color:#9aa0a6!important;margin-top:2px;display:block;line-height:1.25}
#mtp-marlin-flow .mf-step.active{border-color:#76B900!important;background:#15200a!important}
#mtp-marlin-flow .mf-step.active .t{color:#fff!important}
#mtp-marlin-flow .mf-step.done{border-color:#33401d!important}
#mtp-marlin-flow .mf-step.done .n:after{content:” ✓”;color:#76B900}
#mtp-marlin-flow .mf-bar{height:6px;background:#1a1a1a!important;border-radius:4px!important;overflow:hidden;margin-bottom:14px}
#mtp-marlin-flow .mf-bar i{display:block;height:100%;width:0;background:#76B900!important;transition:width .2s linear}
/* grid */
#mtp-marlin-flow .mf-grid{display:grid;grid-template-columns:1.25fr 1fr;gap:12px}
#mtp-marlin-flow .mf-panel{background:#0b0b0b!important;border:1px solid #232323!important;border-radius:10px!important;padding:12px}
#mtp-marlin-flow .mf-console{font-size:12.5px;height:206px;overflow-y:auto}
#mtp-marlin-flow .mf-console div{padding:3px 0;border-bottom:1px solid #161616;color:#cfcfcf!important}
#mtp-marlin-flow .mf-console .g{color:#76B900!important}
#mtp-marlin-flow .mf-console .b{color:#7fb3ff!important}
#mtp-marlin-flow .mf-console .o{color:#ffb454!important}
#mtp-marlin-flow .mf-console .r{color:#ff7a90!important}
#mtp-marlin-flow .mf-console .d{color:#888!important}
#mtp-marlin-flow .mf-stat{display:flex;justify-content:space-between;align-items:baseline;font-size:13px;padding:5px 0;border-bottom:1px solid #1a1a1a}
#mtp-marlin-flow .mf-stat b{color:#fff!important;font-size:15px;font-variant-numeric:tabular-nums}
#mtp-marlin-flow .mf-stat .u{color:#76B900!important}
#mtp-marlin-flow .mf-comp-label{color:#76B900!important;font-size:10px;letter-spacing:.06em;text-transform:uppercase;font-weight:700;margin:12px 0 7px}
#mtp-marlin-flow .mf-models{display:flex;flex-direction:column;gap:6px}
#mtp-marlin-flow .mf-model{display:flex;align-items:center;gap:8px;background:#141414!important;border:1px solid #232323!important;border-radius:8px!important;padding:8px 10px;font-size:11.5px;color:#9aa0a6!important;transition:all .15s}
#mtp-marlin-flow .mf-model .dot{width:9px;height:9px;border-radius:50%;display:inline-block;flex:0 0 auto;opacity:.4}
#mtp-marlin-flow .mf-model .nm{flex:1;line-height:1.25}
#mtp-marlin-flow .mf-model.live{border-color:currentColor!important;color:#fff!important;background:#181f10!important}
#mtp-marlin-flow .mf-model.live .dot{opacity:1}
#mtp-marlin-flow .mf-model .c{color:#fff!important;font-size:13px;font-weight:700;font-variant-numeric:tabular-nums;flex:0 0 auto}
/* output */
#mtp-marlin-flow .mf-cap{font-size:10.5px;color:#777!important;margin-top:8px;line-height:1.4}
#mtp-marlin-flow .mf-out{margin-top:12px;background:#0b0b0b!important;border:1px solid #232323!important;border-radius:10px!important;padding:14px;display:none}
#mtp-marlin-flow .mf-out.show{display:block}
#mtp-marlin-flow .mf-out-grid{display:grid;grid-template-columns:1fr 1.4fr;gap:14px;align-items:center}
#mtp-marlin-flow .mf-doc{background:#fff!important;border-radius:4px!important;aspect-ratio:1/1.3;padding:10px;position:relative;box-shadow:0 4px 14px rgba(0,0,0,.5)}
#mtp-marlin-flow .mf-doc:before{content:””;display:block;height:8px;width:60%;background:#76B900;border-radius:2px;margin-bottom:6px}
#mtp-marlin-flow .mf-doc i{display:block;height:3px;background:#d7d7d7;border-radius:2px;margin:4px 0}
#mtp-marlin-flow .mf-doc i:nth-child(3){width:90%}
#mtp-marlin-flow .mf-doc i:nth-child(4){width:96%}
#mtp-marlin-flow .mf-doc i:nth-child(5){width:80%}
#mtp-marlin-flow .mf-doc i:nth-child(6){width:93%}
#mtp-marlin-flow .mf-doc i:nth-child(7){width:70%}
#mtp-marlin-flow .mf-slides{display:flex;gap:7px;margin-top:9px}
#mtp-marlin-flow .mf-slide{flex:1;background:#161616!important;border:1px solid #2a2a2a!important;border-radius:4px!important;aspect-ratio:16/10;position:relative}
#mtp-marlin-flow .mf-slide:before{content:””;position:absolute;left:7px;top:7px;height:4px;width:50%;background:#76B900;border-radius:2px}
#mtp-marlin-flow .mf-slide:after{content:””;position:absolute;left:7px;top:16px;right:7px;bottom:7px;background:repeating-linear-gradient(#2c2c2c,#2c2c2c 2px,transparent 2px,transparent 6px)}
#mtp-marlin-flow .mf-out h4{color:#fff!important;font-size:15px;margin-bottom:4px}
#mtp-marlin-flow .mf-out p{color:#9aa0a6!important;font-size:12.5px;margin-bottom:8px}
#mtp-marlin-flow .mf-tags{display:flex;flex-wrap:wrap;gap:6px}
#mtp-marlin-flow .mf-tag{background:#15200a!important;color:#76B900!important;border:1px solid #33401d!important;border-radius:6px!important;font-size:11px;padding:3px 8px;font-weight:600}
#mtp-marlin-flow .mf-note{font-size:11px;color:#777!important;margin-top:10px}
#mtp-marlin-flow .mf-foot{text-align:center;color:#76B900!important;font-size:12px;font-weight:600;margin-top:14px;padding-top:10px;border-top:1px solid #232323}
#mtp-marlin-flow hr,#mtp-marlin-flow p:empty,#mtp-marlin-flow del,#mtp-marlin-flow s{display:none!important}
@media (max-width:640px){
#mtp-marlin-flow{padding:14px}
#mtp-marlin-flow .mf-grid,#mtp-marlin-flow .mf-out-grid{grid-template-columns:1fr}
#mtp-marlin-flow .mf-rail{flex-wrap:wrap}
#mtp-marlin-flow .mf-step{flex:1 1 30%}
#mtp-marlin-flow .mf-speed{margin-left:0;width:100%}
#mtp-marlin-flow input[type=range]{flex:1}
}
How Sakana Marlin Works — pipeline walkthrough
An illustrative simulation of Marlin’s autonomous research run: one prompt in, a report and slides out. Numbers are simulated, not live Marlin output.
1 · Pick a research topic
► Run research
Reset
Speed
Research console
Live metrics
Elapsed (simulated)0h 0m
LLM queries0
Sources gathered0
Hypotheses (kept / tested)0 / 0
Search policy (wider / deeper)0 / 0
Framework components (active)
Marlin’s framework — a Hypothesis Generation Engine, a Web Exploration Agent, and a Contradiction Resolution Validator — runs on Sakana AI’s proprietary long-term inference architecture, orchestrated by AB-MCTS. The commercial product does not route to third-party models.
5 · Deliverable
Strategy report + slides
Marlin’s real outputs include a main body, references, and appendices, with slides generated using image-generation AI. Always review cited output before deciding.
© Marktechpost · Illustrative simulation of Sakana Marlin’s workflow
(function(){
var $=function(id){return document.getElementById(id);};
var COMPONENTS=[
{k:”Hypothesis Generation Engine”,c:”#76B900″,cls:”g”},
{k:”Web Exploration Agent”,c:”#7fb3ff”,cls:”b”},
{k:”Contradiction Resolution Validator”,c:”#ffb454″,cls:”o”}
];
var STEPS=[
{n:”01″,t:”Prompt”,a:0,b:6},
{n:”02″,t:”Plan hypotheses”,a:6,b:16},
{n:”03″,t:”Deep research (AB-MCTS)”,a:16,b:82},
{n:”04″,t:”Synthesize”,a:82,b:93},
{n:”05″,t:”Report + slides”,a:93,b:100}
];
var TOPICS=[
{p:”Assess Japan’s stablecoin & tokenized-payments market after regulatory change”,
hyp:[“Regulatory impact on issuers”,”Bank vs non-bank rails”,”Adoption drivers”,”Settlement & custody risk”,”ROI gap”],
pages:78,src:71,slides:14,q:1180,title:”Market-entry strategy report + slides”,
desc:”A structured assessment of drivers, risks, and ranked entry options for the payments market.”,
tags:[“78 pages”,”71 sources”,”Body + refs + appendix”,”Summary slides”]},
{p:”Model resolution scenarios for a Strait of Hormuz blockade”,
hyp:[“Supply-shock pathways”,”Price & insurance effects”,”Diplomatic off-ramps”,”Re-routing options”,”Duration scenarios”],
pages:64,src:66,slides:12,q:960,title:”Risk-scenario report + slides”,
desc:”Compared hypotheses across scenarios, with likelihood framing and contingency options.”,
tags:[“64 pages”,”66 sources”,”Scenario comparison”,”Summary slides”]},
{p:”Profile three rivals and rank our competitive positioning gaps”,
hyp:[“Pricing & packaging”,”Feature parity”,”GTM motion”,”Hiring signals”,”Positioning whitespace”],
pages:88,src:80,slides:16,q:1440,title:”Competitive-analysis report + slides”,
desc:”Side-by-side rival profiles with ranked positioning gaps, ready for a strategy review.”,
tags:[“88 pages”,”80 sources”,”Rival profiles”,”Summary slides”]}
];
var sel=0, prog=0, running=false, timer=null, wider=0, deeper=0, lastLogAt=-9, mq=[0,0,0], plannedShown=false;
// build topic pills
TOPICS.forEach(function(t,i){
var b=document.createElement(“button”); b.className=”mf-topic”+(i===0?” on”:””); b.textContent=t.p;
b.onclick=function(){ if(running) return; sel=i; document.querySelectorAll(“#mtp-marlin-flow .mf-topic”).forEach(function(e,j){e.className=”mf-topic”+(j===i?” on”:””);}); reset(); };
$(“mf-topics”).appendChild(b);
});
// build stepper
STEPS.forEach(function(s){
var d=document.createElement(“div”); d.className=”mf-step”;
d.innerHTML=”+s.n+”+s.t+”; $(“mf-rail”).appendChild(d);
});
// build component chips
COMPONENTS.forEach(function(m){
var d=document.createElement(“div”); d.className=”mf-model”; d.style.color=m.c;
d.innerHTML=”+m.k+’0′;
$(“mf-models”).appendChild(d);
});
function log(msg,cls){
var d=document.createElement(“div”); if(cls) d.className=cls; d.innerHTML=msg;
var box=$(“mf-console”); box.insertBefore(d,box.firstChild);
while(box.children.length>60) box.removeChild(box.lastChild);
}
function fmtTime(p){ var mins=Math.round((p/100)*8*60); return Math.floor(mins/60)+”h “+(mins%60)+”m”; }
function ease(x){ return x1?1:(x*x*(3-2*x)); }
function stageIndex(p){ for(var i=0;i=STEPS[i].a && p=6 && !plannedShown){
plannedShown=true;
log(‘Planning: framing the question into testable hypotheses…’,’g’);
TOPICS[sel].hyp.forEach(function(h){ log(‘• hypothesis: ‘+h,’d’); });
}
if(prog>=16 && prog=2.4){
lastLogAt=prog;
var roll=Math.random();
if(roll=100? t.hyp.length:tested);
$(“mf-wd”).textContent = wider+” / “+deeper;
}
function showOutput(){
var t=TOPICS[sel];
$(“mf-out-title”).textContent=t.title;
$(“mf-out-desc”).textContent=t.desc;
var tg=$(“mf-out-tags”); tg.innerHTML=””;
t.tags.forEach(function(x){ var s=document.createElement(“span”); s.className=”mf-tag”; s.textContent=x; tg.appendChild(s); });
$(“mf-out”).className=”mf-out show”;
}
$(“mf-run”).onclick=function(){
if(prog>=100) reset();
if(running){ return; }
running=true; this.textContent=”● Running…”;
log(‘Prompt submitted: “‘+TOPICS[sel].p+'”‘,’g’);
log(‘Starting autonomous run (target up to ~8h, hundreds–thousands of queries)…’,’d’);
var spd=+$(“mf-speed”).value;
timer=setInterval(tick, Math.max(120, 360 – spd*30));
};
$(“mf-reset”).onclick=reset;
reset();
})();
Inside AB-MCTS: Wider or Deeper
The backbone of Marlin is AB-MCTS, or Adaptive Branching Monte Carlo Tree Search. It comes from the Sakana’s past research “Wider or Deeper? Scaling LLM Inference-Time Compute with Adaptive Branching Tree Search.”
AB-MCTS treats reasoning as a tree-search problem. At each step the algorithm makes one decision. It can go wider by generating a new candidate answer. Or it can go deeper by refining a promising existing answer. Standard repeated sampling only goes wider in parallel, then hopes one answer is right.
A multi-LLM variant adds a second choice. It can route a step to a different model entirely. In Sakana’s reported ARC-AGI-2 experiments, this collaboration helped. Combining o4-mini, Gemini 2.5 Pro, and DeepSeek-R1 solved about 27.5% of tasks. The o4-mini model alone solved about 23%. Marlin applies the same adaptive search to long-horizon research.
The second key component for Marlin is workflow automation from Sakana’s AI Scientist project. That project demonstrated autonomous scientific discovery and was published in Nature.
Interactive demo: The embeddable widget (marlin-abmcts-demo.html) shows the “wider or deeper” decision live. Press Run and watch the tree grow. Greener nodes carry higher scores, and the best path is highlighted. Toggle “Multi-LLM” to see steps routed across different models.
#mtp-abmcts-demo *{box-sizing:border-box!important;margin:0;padding:0}
#mtp-abmcts-demo{
background:#111!important;color:#e8e8e8!important;border:1px solid #2a2a2a!important;
border-radius:14px!important;max-width:880px;margin:24px auto;padding:20px 20px 14px;
font-family:-apple-system,BlinkMacSystemFont,”Segoe UI”,Roboto,Helvetica,Arial,sans-serif;
line-height:1.5;overflow:hidden
}
#mtp-abmcts-demo h3{color:#fff!important;font-size:19px;font-weight:700;margin:0 0 4px}
#mtp-abmcts-demo .mtp-sub{color:#9aa0a6!important;font-size:13px;margin-bottom:14px}
#mtp-abmcts-demo .mtp-controls{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin-bottom:12px}
#mtp-abmcts-demo button{
background:#76B900!important;color:#0a0a0a!important;border:0!important;border-radius:8px!important;
font-weight:700;font-size:13px;padding:9px 14px;cursor:pointer;transition:filter .15s
}
#mtp-abmcts-demo button:hover{filter:brightness(1.1)}
#mtp-abmcts-demo button.mtp-ghost{background:#1c1c1c!important;color:#76B900!important;border:1px solid #2f3b1a!important}
#mtp-abmcts-demo button:disabled{opacity:.4;cursor:not-allowed}
#mtp-abmcts-demo .mtp-slider{display:flex;align-items:center;gap:8px;font-size:12px;color:#bdbdbd!important;margin-left:auto}
#mtp-abmcts-demo input[type=range]{accent-color:#76B900;width:120px}
#mtp-abmcts-demo .mtp-toggle{display:flex;align-items:center;gap:6px;font-size:12px;color:#bdbdbd!important;cursor:pointer;user-select:none}
#mtp-abmcts-demo .mtp-stage{
background:#0b0b0b!important;border:1px solid #232323!important;border-radius:10px!important;
position:relative;overflow:hidden;min-height:260px
}
#mtp-abmcts-demo svg{display:block;width:100%;height:auto}
#mtp-abmcts-demo .mtp-edge{stroke:#3a3a3a;stroke-width:1.5;fill:none}
#mtp-abmcts-demo .mtp-edge.best{stroke:#76B900;stroke-width:2.6}
#mtp-abmcts-demo text{font-family:inherit}
#mtp-abmcts-demo .mtp-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:12px}
#mtp-abmcts-demo .mtp-panel{background:#0b0b0b!important;border:1px solid #232323!important;border-radius:10px!important;padding:12px}
#mtp-abmcts-demo .mtp-panel h4{color:#76B900!important;font-size:12px;letter-spacing:.05em;text-transform:uppercase;margin-bottom:8px}
#mtp-abmcts-demo .mtp-stat{display:flex;justify-content:space-between;font-size:13px;padding:3px 0;border-bottom:1px solid #1a1a1a}
#mtp-abmcts-demo .mtp-stat b{color:#fff!important}
#mtp-abmcts-demo .mtp-log{font-size:12.5px;max-height:132px;overflow-y:auto}
#mtp-abmcts-demo .mtp-log div{padding:3px 0;border-bottom:1px solid #1a1a1a;color:#cfcfcf!important}
#mtp-abmcts-demo .mtp-log .w{color:#7fb3ff!important}
#mtp-abmcts-demo .mtp-log .d{color:#76B900!important}
#mtp-abmcts-demo .mtp-legend{display:flex;flex-wrap:wrap;gap:14px;font-size:11.5px;color:#9aa0a6!important;margin-top:10px;align-items:center}
#mtp-abmcts-demo .mtp-chip{display:inline-flex;align-items:center;gap:5px}
#mtp-abmcts-demo .mtp-dot{width:10px;height:10px;border-radius:50%;display:inline-block}
#mtp-abmcts-demo .mtp-foot{text-align:center;color:#76B900!important;font-size:12px;font-weight:600;margin-top:14px;padding-top:10px;border-top:1px solid #232323}
#mtp-abmcts-demo hr,#mtp-abmcts-demo p:empty,#mtp-abmcts-demo del,#mtp-abmcts-demo s{display:none!important}
@media (max-width:640px){
#mtp-abmcts-demo{padding:14px}
#mtp-abmcts-demo .mtp-grid{grid-template-columns:1fr}
#mtp-abmcts-demo .mtp-slider{margin-left:0;width:100%}
#mtp-abmcts-demo input[type=range]{flex:1}
}
AB-MCTS: “Wider or Deeper?” — interactive search
A simplified visual of Sakana AI’s Adaptive Branching Monte Carlo Tree Search. Each step the policy chooses to widen (new candidate) or deepen (refine a promising line).
► Run
Step
Reset
Multi-LLM
DeeperWider
Search state
Budget used0 / 24
Nodes (candidates)1
Best score0.00
Wider / Deeper0 / 0
Decision log
low score
high score
best path
Gemini 2.5 Pro
o4-mini
DeepSeek-R1
© Marktechpost · Illustrative model of AB-MCTS (TreeQuest, Apache 2.0)
(function(){
var SVGNS=”http://www.w3.org/2000/svg”;
var BUDGET=24, MODELS=[{n:”Gemini 2.5 Pro”,c:”#7fb3ff”},{n:”o4-mini”,c:”#ffb454″},{n:”DeepSeek-R1″,c:”#ff7a90″}];
var nodes, idc, used, widers, deepers, timer=null;
var svg=document.getElementById(“mtp-svg”);
var $=function(id){return document.getElementById(id);};
function reset(){
if(timer){clearInterval(timer);timer=null;$(“mtp-run”).textContent=”► Run”;}
idc=0; used=0; widers=0; deepers=0;
nodes=[{id:idc++,parent:null,depth:0,score:0,model:0,children:[]}];
$(“mtp-log”).innerHTML=””;
log(‘Initialized search tree at the root.’,”);
render();
}
function chooseModel(){return Math.floor(Math.random()*MODELS.length);}
// One AB-MCTS step: descend from root, at each node decide widen-here vs go-deeper.
function step(){
if(used>=BUDGET) return false;
var bias=(+$(“mtp-bias”).value)/100; // 1 = always wider, 0 = always deeper
var cur=nodes[0];
// Descend until we decide to branch (widen) at the current node.
while(true){
var kids=cur.children.map(function(i){return nodes[i];});
// Probability of branching here (going wider) rises with the bias and with few kids.
var pWiden = bias*0.6 + 0.4/(kids.length+1);
if(kids.length===0 || Math.random()best.score) best=n; });
var set={}, cur=best;
while(cur){ set[cur.id]=true; cur = cur.parent===null?null:nodes.find(function(x){return x.id===cur.parent;}); }
return set;
}
function render(){
var pos=layout();
var maxX=0,maxY=0;
for(var k in pos){ if(pos[k].x>maxX)maxX=pos[k].x; if(pos[k].y>maxY)maxY=pos[k].y; }
var padX=40, padY=34, gapX=Math.max(54, 520/(maxX+1)), gapY=64;
var W=padX*2 + maxX*gapX, H=padY*2 + maxY*gapY;
W=Math.max(W,560); H=Math.max(H,240);
svg.setAttribute(“viewBox”,”0 0 “+W+” “+H);
while(svg.firstChild) svg.removeChild(svg.firstChild);
var best=bestPath();
var XY=function(id){return {x:padX+pos[id].x*gapX, y:padY+pos[id].y*gapY};};
// edges
nodes.forEach(function(n){
if(n.parent===null) return;
var a=XY(n.parent), b=XY(n.id);
var e=document.createElementNS(SVGNS,”path”);
e.setAttribute(“d”,”M”+a.x+”,”+a.y+” C”+a.x+”,”+(a.y+gapY/2)+” “+b.x+”,”+(b.y-gapY/2)+” “+b.x+”,”+b.y);
e.setAttribute(“class”,”mtp-edge”+((best[n.id]&&best[n.parent])?” best”:””));
svg.appendChild(e);
});
// nodes
nodes.forEach(function(n){
var p=XY(n.id);
var g=document.createElementNS(SVGNS,”circle”);
g.setAttribute(“cx”,p.x); g.setAttribute(“cy”,p.y); g.setAttribute(“r”,n.id===0?13:11);
// fill = score ramp toward NVIDIA green
var t=n.score; var r=Math.round(42+(118-42)*t), gg=Math.round(42+(185-42)*t), bb=Math.round(42+(0-42)*t);
g.setAttribute(“fill”,”rgb(“+r+”,”+gg+”,”+bb+”)”);
var stroke = $(“mtp-multi”).checked ? MODELS[n.model].c : (best[n.id]?”#76B900″:”#555″);
g.setAttribute(“stroke”, best[n.id]?”#76B900″:stroke);
g.setAttribute(“stroke-width”, best[n.id]?3:1.5);
svg.appendChild(g);
var tx=document.createElementNS(SVGNS,”text”);
tx.setAttribute(“x”,p.x); tx.setAttribute(“y”,p.y+3.5); tx.setAttribute(“text-anchor”,”middle”);
tx.setAttribute(“font-size”,”9″); tx.setAttribute(“fill”, t>0.55?”#0a0a0a”:”#e8e8e8″);
tx.textContent = n.id===0?”root”:n.score.toFixed(2);
svg.appendChild(tx);
});
// stats
var bestScore=0; nodes.forEach(function(n){if(n.score>bestScore)bestScore=n.score;});
$(“mtp-budget”).textContent=used+” / “+BUDGET;
$(“mtp-nodes”).textContent=nodes.length;
$(“mtp-best”).textContent=bestScore.toFixed(2);
$(“mtp-wd”).textContent=widers+” / “+deepers;
$(“mtp-step”).disabled = used>=BUDGET;
if(used>=BUDGET && timer){clearInterval(timer);timer=null;$(“mtp-run”).textContent=”✓ Done”;}
}
$(“mtp-run”).onclick=function(){
if(used>=BUDGET) reset();
if(timer){clearInterval(timer);timer=null;this.textContent=”► Run”;return;}
this.textContent=”⏸ Pause”;
var self=this;
timer=setInterval(function(){ if(!step()){clearInterval(timer);timer=null;self.textContent=”✓ Done”;} },520);
};
$(“mtp-step”).onclick=function(){ if(used

