PageSourceSearch

https://letsdatascience.com/_next/static/chunks/59351.9f5ea6c802c30f55.js

js letsdatascience.com collected 2026-10-01 10:25:22 UTC 16,988 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[59351],{6132:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(71847).A)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},48314:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(71847).A)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]])},50906:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(71847).A)("activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]])},53511:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(71847).A)("pause",[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]])},76314:(e,t,a)=>{a.d(t,{A:()=>r.A});var r=a(92864)},76907:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(71847).A)("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},78874:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(71847).A)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},88950:(e,t,a)=>{a.r(t),a.d(t,{default:()=>f});var r=a(95155),s=a(12115),l=a(6132),n=a(48314),i=a(78874),o=a(61362),d=a(76907),c=a(76314);let h=["v3_schema","v4_packed","v5_grounded"],p=["all","v0_naive","v1_contract","v2_fewshot","v3_schema","v4_packed","v5_grounded"],u=[{id:0,label:"call sent",note:"schema attached (v3+), validator waiting"},{id:1,label:"attempt 1 returns",note:"handcrafted illustration - never occurred in the matrix"},{id:2,label:"validator rules",note:'a named defect, not just "false"'},{id:3,label:"the one retry",note:"same call + the exact appended line"},{id:4,label:"attempt 2 returns",note:"valid - the loop closes; else: fail loudly"}],m=[{title:"The policy, in one sentence",why:"From v3 up, every call in the matrix ran armed: validate the response; if the schema check fails, retry ONCE with a correction line appended to the user message; if that fails too, record the cell as invalid and let every grade go false. No second retry, no silent salvage. The exact appended line is on the card below - all 91 characters of it, verbatim from the harness.",insight:"A repair loop is three decisions: when it fires (validator), how often (once), and what happens after (fail loudly).",stage:0,panel:"loop"},{title:"Attempt one comes back broken",why:'To watch the loop work, a broken response has to be manufactured - the big label on it is not decoration; not one of the 612 real cells produced anything like this. The illustration bundles two classic defects: prose wrapped around the object, and category set to "refunds", an enum value the schema does not admit and the dispatcher cannot route.',insight:"Every failure shape on this screen is handcrafted. Hold that thought - it IS the module's measured finding.",stage:1,panel:"loop"},{title:"The validator names the defect",why:"The tolerant parser digs the object out of the prose (the outermost-braces fallback from graders.py), so parsing is not what fails - the enum check is. The verdict names the field and the illegal value. That specificity is what separates a validator you can operate from a boolean you can only stare at.",insight:'Validators should return diagnoses, not verdicts. "False" pages you at 3am; "illegal_enum:category" fixes itself by lunch.',stage:2,panel:"loop"},{title:"One retry, then the loop closes",why:"The harness repeats the request with a correction line, and this authored illustration makes the second attempt valid. A retry adds another call. Cost and latency would be roughly doubled only if both attempts were similar; output length and provider timing can differ. If both attempts fail, stop and inspect the evidence. Repeated failure alone does not establish its cause.",insight:'"Retry forever" converts a design signal into an infinite bill. One retry catches blips; humans catch patterns.',stage:4,panel:"loop"},{title:"Now the real ledger",why:"Your browser just re-counted retry_used across all 612 recorded cells of the matrix: zero fired. Not rare - zero, including every cell of the three armed rungs. The loop below was correct engineering that never once ran in production conditions. Filter by rung and the count stays stubbornly at 0.",insight:"The most honest number in this module: armed on 306 cells, fired on 0. Insurance, not machinery.",stage:4,panel:"ledger",design:"all"},{title:"The scope of that zero",why:"Why zero? The second recount answers it: all 612 raw responses parse as JSON with no cleanup at all - even v0's, where the schema was a polite prose description. That is a fact about two capable July-2026 minis on a 900-token task, not a law of nature. Older models, smaller local models, longer outputs that hit token limits mid-string - those are the worlds this loop was built for, and they still exist.",insight:"Scope your conclusions like a measurement, not a proverb: THESE models, THIS task, 2026. The loop stays in the codebase.",stage:4,panel:"scope",design:"all"},{title:"Price the insurance",why:"What does keeping the loop cost? Nothing until it fires - the code path is dormant. When it fires, a ticket bills roughly twice. Drag the assumed failure rate (labeled: an assumption, our measured rate is 0.0) and read the expected premium. At 1% on gpt's v3 economics it is about 2 cents per 1,000 tickets. The argument for deleting the loop has to beat that number.",insight:"Un-fired insurance costs code review, not dollars. Price it before you delete it.",stage:4,panel:"price",rate:.01}],x=m.length;
1function f(){let[e,t]=(0,s.useState)("guided"),[a,f]=(0,s.useState)(0),[g,b]=(0,s.useState)(!1),[y,v]=(0,s.useState)(null),[w,j]=(0,s.useState)(null),[N,k]=(0,s.useState)(null),[_,T]=(0,s.useState)(0),[A,S]=(0,s.useState)("loop"),[z,E]=(0,s.useState)("all"),[C,O]=(0,s.useState)(.01);(0,s.useEffect)(()=>{let e=!1;return Promise.all([fetch("/learn/context-engineering/matrix_cells.json").then(e=>e.json()),fetch("/learn/context-engineering/matrix_ladder.json").then(e=>e.json())]).then(t=>{let[a,r]=t;if(e)return;v(a.cells);let s=r.ladder["gpt-5.4-mini__v3_schema"];if(!s)throw Error("gpt v3 ladder row missing");j(s.mean_est_cost)}).catch(t=>!e&&k(String(t))),()=>{e=!0}},[]),(0,s.useEffect)(()=>{var t,r,s,l,n,i;if("guided"!==e)return;let o=m[a];T(o.stage),S(o.panel),E(null!=(l=null!=(s=o.design)?s:null==(t=[...m.slice(0,a)].reverse().find(e=>void 0!==e.design))?void 0:t.design)?l:"all"),O(null!=(i=null!=(n=o.rate)?n:null==(r=[...m.slice(0,a)].reverse().find(e=>void 0!==e.rate))?void 0:r.rate)?i:.01)},[a,e]);let M=(0,s.useCallback)(()=>{"guided"===e&&t("explore")},[e]),P=(0,s.useCallback)(()=>{f(0),b(!1),t("guided")},[]),I=(0,s.useMemo)(()=>{if(!y)return null;let e="all"===z?y:y.filter(e=>e.design===z),t=0,a=0;for(let r of e){r.retry_used&&(t+=1);try{JSON.parse(r.response_text),a+=1}catch(e){}}let r="all"===z?y.filter(e=>h.includes(e.design)).length:h.includes(z)?e.length:0;return{n:e.length,fired:t,strict:a,armed:r}},[y,z]);if(N)return(0,r.jsxs)("div",{className:"bg-white rounded-2xl border border-neutral-200 p-6 flex items-start gap-3",children:[(0,r.jsx)(l.A,{size:18,className:"text-rose-600 flex-shrink-0 mt-0.5"}),(0,r.jsxs)("div",{className:"text-sm text-neutral-700",children:["This component needs the shipped artifacts (matrix_cells.json, matrix_ladder.json) and they failed to load (",N,"). Refresh to retry - the retry counts and cost numbers are recomputed from those files, so there is no hardcoded fallback."]})]});let J=null!==w?C*w*1e3:null;return(0,r.jsx)(c.A,{mode:e,onMode:t,stepTitle:m[a].title,explanation:m[a].why,icon:n.A,title:"The Repair Loop, in Reality",subtitle:"Step the armed retry through a manufactured failure - then count the real ones: zero",currentStep:a,totalSteps:x,isPlaying:g,onReset:P,onTogglePlay:()=>b(e=>!e),onPrev:()=>f(e=>Math.max(0,e-1)),onNext:()=>f(e=>Math.min(x-1,e+1)),onJumpTo:e=>f(e),keyInsight:"guided"===e?m[a].insight:"Walk the stages, recount any rung, and price the armed loop under your own assumed failure rate.",children:(0,r.jsxs)("div",{className:"mx-auto",children:[(0,r.jsxs)("div",{className:"flex flex-wrap gap-1.5 mb-3",children:[u.map(e=>(0,r.jsx)("button",{onClick:()=>{M(),T(e.id),S("loop")},"aria-pressed":_===e.id&&"loop"===A,className:"px-2 py-1 rounded-lg border text-left transition-colors ".concat(_>=e.id&&"loop"===A?"bg-neutral-900 text-white border-neutral-900":"bg-white border-neutral-200 hover:border-neutral-400"),children:(0,r.jsxs)("div",{className:"text-xs font-bold ".concat(_>=e.id&&"loop"===A?"text-white":"text-neutral-700"),children:[e.id+1,". ",e.label]})},e.id)),(0,r.jsx)("button",{onClick:()=>{M(),S("ledger")},"aria-pressed":"loop"!==A,className:"px-2 py-1 rounded-lg border transition-colors text-xs font-bold ".concat("loop"!==A?"bg-amber-500 text-neutral-900 border-amber-500":"bg-white text-neutral-700 border-neutral-200 hover:border-neutral-400"),children:"the real ledger"})]}),"loop"===A&&(0,r.jsxs)("div",{className:"space-y-2 mb-2",children:[(0,r.jsxs)("div",{className:"rounded-xl border border-neutral-300 overflow-hidden",children:[(0,r.jsx)("div",{className:"px-3 py-1.5 bg-neutral-900 text-white text-xs font-bold",children:"THE ARMED POLICY (v3+, every call)"}),(0,r.jsxs)("div",{className:"p-2.5 bg-white text-xs text-neutral-700 leading-relaxed",children:[(0,r.jsx)("span",{className:"font-mono",children:"validate(response)"})," ","->"," valid: done | invalid: append the line below, retry ",(0,r.jsx)("strong",{children:"once"})," ","->"," still invalid: record the cell as failed, surface it",(0,r.jsx)("div",{className:"mt-1.5 bg-neutral-50 border border-neutral-200 rounded-lg p-2 font-mono text-xs text-neutral-700",style:{whiteSpace:"pre-wrap"}
1,children:"\n\nYour previous output was invalid JSON for the required schema. Output ONLY the JSON object.".trim()}),(0,r.jsx)("div",{className:"mt-1 text-xs text-neutral-600",children:"verbatim from 03_run_matrix.py - appended to the user message on a fired retry"})]})]}),_>=1&&(0,r.jsxs)("div",{className:"rounded-xl border border-rose-200 overflow-hidden",children:[(0,r.jsxs)("div",{className:"px-3 py-1.5 bg-rose-600 text-white text-xs font-bold flex items-center justify-between flex-wrap gap-1",children:[(0,r.jsx)("span",{children:"ATTEMPT 1"}),(0,r.jsx)("span",{className:"px-1.5 py-0.5 rounded-full bg-white/20 font-bold uppercase tracking-normal",children:"handcrafted illustration - never occurred in the matrix"})]}),(0,r.jsx)("div",{className:"p-2.5 bg-white font-mono text-xs text-neutral-700 max-h-28 overflow-y-auto",role:"region","aria-label":"First repair attempt",tabIndex:0,style:{whiteSpace:"pre-wrap"},children:'Here is the triage you asked for:\n\n{"category": "refunds", "priority": "P3", "refund_eligible": null, "reply_draft": "Hi, happy to help with this refund question.", "citations": [], "escalate": true, "escalation_reason": "missing_info"}'}),_>=2&&(0,r.jsx)("div",{className:"px-2.5 pb-2.5 bg-white",children:(0,r.jsxs)("div",{className:"rounded-lg px-2.5 py-1.5 bg-rose-50 text-rose-800 text-xs font-mono flex items-center gap-1.5",children:[(0,r.jsx)(i.A,{size:13})," validator: ",'illegal_enum:category="refunds"']})})]}),_>=3&&(0,r.jsxs)("div",{className:"rounded-xl border border-emerald-200 overflow-hidden",children:[(0,r.jsxs)("div",{className:"px-3 py-1.5 bg-neutral-900 text-white text-xs font-bold flex items-center justify-between flex-wrap gap-1",children:[(0,r.jsxs)("span",{children:["RETRY (the one) ","->"," ATTEMPT 2"]}),(0,r.jsx)("span",{className:"px-1.5 py-0.5 rounded-full bg-white/20 font-bold uppercase tracking-normal",children:"handcrafted illustration"})]}),_>=4?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"p-2.5 bg-white font-mono text-xs text-neutral-700 max-h-28 overflow-y-auto",role:"region","aria-label":"Second repair attempt",tabIndex:0,style:{whiteSpace:"pre-wrap"},children:'{"category": "billing", "priority": "P3", "refund_eligible": null, "reply_draft": "Hi, happy to help with this refund question - could you share the purchase date so I can check eligibility?", "citations": [], "escalate": true, "escalation_reason": "missing_info"}'}),(0,r.jsx)("div",{className:"px-2.5 pb-2.5 bg-white",children:(0,r.jsxs)("div",{className:"rounded-lg px-2.5 py-1.5 bg-emerald-50 text-emerald-800 text-xs font-mono flex items-center gap-1.5",children:[(0,r.jsx)(o.A,{size:13})," validator: valid - loop closes; the ticket billed ~2x"]})})]}):(0,r.jsx)("div",{className:"p-2.5 bg-white text-xs text-neutral-600",children:"correction line appended, identical call re-sent..."})]})]}),"loop"!==A&&I&&(0,r.jsxs)("div",{className:"space-y-2 mb-2",children:[(0,r.jsxs)("div",{"aria-live":"polite",className:"bg-neutral-900 text-white rounded-xl p-3",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-1 mb-1.5",children:[(0,r.jsx)("span",{className:"text-xs text-neutral-400",children:"re-counted from matrix_cells.json in your browser, just now"}),(0,r.jsx)("span",{className:"px-1.5 py-0.5 rounded-full bg-amber-500/20 text-amber-300 text-xs font-bold uppercase tracking-normal",children:"real cells - offline replay"})]}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-x-5 gap-y-1.5 text-[13px] mb-1.5",children:[(0,r.jsxs)("span",{children:["cells ",(0,r.jsx)("span",{className:"font-mono font-bold text-amber-300",children:I.n})]}),(0,r.jsxs)("span",{children:["retry armed ",(0,r.jsx)("span",{className:"font-mono font-bold text-amber-300",children:I.armed})]}),(0,r.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,r.jsx)(d.A,{size:14,className:"text-emerald-400"})," retries fired ",(0,r.jsx)("span",{className:"font-mono font-bold text-emerald-300",children:I.fired})]}),(0,r.jsxs)("span",{children:["strict JSON parse ",(0,r.jsxs)("span",{className:"font-mono font-bold text-amber-300",children:[I.strict,"/",I.n]})]})]}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,r.jsx)("span",{className:"text-xs font-bold uppercase tracking-normal text-neutral-500",children:"rung"}),p.map(e=>(0,r.jsx)("button",{onClick:()=>{M(),E(e)},"aria-pressed":z===e,className:"px-2 py-0.5 rounded-lg text-xs font-mono border transition-colors ".concat(z===e?"bg-white text-neutral-900 border-white":"bg-transparent text-neutral-400 border-neutral-600 hover:border-neutral-400"),children:"all"===e?"all 612":e.split("_")[0]},e))]})]}),"scope"===A&&(0,r.jsxs)("div",{className:"rounded-xl border border-amber-200 bg-amber-50 p-3 text-xs text-amber-900 leading-relaxed",children:[(0,r.jsx)("strong",{children:"Scope, stated plainly:"}
1)," zero fired retries and a 612/612 strict-parse rate describe gpt-5.4-mini and gemini-3.5-flash - two capable minis measured in July 2026 - on a 900-token triage task. They do not describe your older fine-tune, a 7B model running locally, or any output long enough to hit a token limit mid-string (truncation is a documented failure mode of native modes, and it produces invalid JSON). The loop stays."]}),"price"===A&&(0,r.jsxs)("div",{className:"rounded-xl border border-neutral-200 bg-white p-3",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-1 mb-1.5",children:[(0,r.jsx)("span",{className:"text-xs font-bold uppercase tracking-normal text-neutral-500",children:"price the armed loop"}),(0,r.jsx)("span",{className:"text-xs px-1.5 py-0.5 rounded bg-neutral-100 text-neutral-600 font-bold uppercase",children:"assumptions labeled - measured rate is 0.0"})]}),(0,r.jsx)("div",{className:"text-xs text-neutral-600 mb-2",children:"Assumption: a fired retry re-bills the whole call (~2x that ticket). Expected premium = rate x mean v3 cost, on gpt-5.4-mini's real ladder row."}),(0,r.jsxs)("div",{className:"flex items-center gap-2 flex-wrap mb-1.5",children:[(0,r.jsx)("label",{htmlFor:"rl-rate",className:"text-xs font-bold uppercase tracking-normal text-neutral-500",children:"assumed failure rate"}),(0,r.jsx)("input",{id:"rl-rate",type:"range",min:0,max:.2,step:.005,value:C,onChange:e=>{M(),O(Number(e.target.value))},className:"flex-1 min-w-[120px] accent-neutral-900"}),(0,r.jsxs)("span",{className:"font-mono text-xs text-neutral-900",children:[(100*C).toFixed(1),"%"]})]}),null!==J&&(0,r.jsxs)("div",{"aria-live":"polite",className:"text-sm text-neutral-800",children:["expected premium: ",(0,r.jsxs)("span",{className:"font-mono font-bold",children:["+$",J.toFixed(3)]})," per 1,000 tickets",0===C&&(0,r.jsx)("span",{className:"text-xs text-neutral-500",children:" - the measured world: the loop is free"})]})]})]})]})})}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.