Download index.html from jizej/CBE: direct link, hf CLI and curl.
- Browser
- Download file 44.4 kB
-
https://huggingface.co/spaces/jizej/CBE/resolve/main/index.html
- Command line
-
hf download hf://spaces/jizej/CBE/index.html
-
curl -L -o index.html https://huggingface.co/spaces/jizej/CBE/resolve/main/index.html
44.4 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <title>CBE Results Explorer</title> | |
| <meta name="description" content="Interactive results for Competence-Based Evaluation of Logical Reasoning in Large Language Models (arXiv:2610.22894): accuracy and consistency of LLMs on an ordering task as problems grow from 4 to 1024 entities."> | |
| <script src="https://cdn.jsdelivr.net/npm/d3@7.9.0/dist/d3.min.js"></script> | |
| <style> | |
| :root { | |
| color-scheme: light; | |
| --bg: #f7f7f5; --panel: #fcfcfb; --fg: #0b0b0b; --fg-muted: #52514e; --line: #e2e1dc; | |
| --grid: #ecebe7; --axis: #b9b8b2; --ref: #8d8c86; --muted-mark: #b9b8b2; --hl: #ecebe7; | |
| --s1: #2a78d6; --s2: #eb6834; --critical: #d03b3b; | |
| --seq0: #f0efec; --seq1: #cde2fb; --seq2: #86b6ef; --seq3: #3987e5; --seq4: #1c5cab; --seq5: #0d366b; | |
| --popover: #ffffff; --shadow: 0 4px 16px rgba(0,0,0,.10); | |
| --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; | |
| --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; | |
| --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; | |
| } | |
| @media (prefers-color-scheme: dark) { | |
| :root:not([data-theme="light"]) { | |
| color-scheme: dark; | |
| --bg: #121211; --panel: #1a1a19; --fg: #f0efec; --fg-muted: #c3c2b7; --line: #34342f; | |
| --grid: #2a2a27; --axis: #5c5b55; --ref: #8d8c86; --muted-mark: #6f6e68; --hl: #2a2a27; | |
| --s1: #3987e5; --s2: #d95926; --critical: #e66767; | |
| --seq0: #383835; --seq1: #0d366b; --seq2: #1c5cab; --seq3: #2a78d6; --seq4: #6da7ec; --seq5: #cde2fb; | |
| --popover: #242422; --shadow: 0 4px 16px rgba(0,0,0,.45); | |
| } | |
| } | |
| :root[data-theme="dark"] { | |
| color-scheme: dark; | |
| --bg: #121211; --panel: #1a1a19; --fg: #f0efec; --fg-muted: #c3c2b7; --line: #34342f; | |
| --grid: #2a2a27; --axis: #5c5b55; --ref: #8d8c86; --muted-mark: #6f6e68; --hl: #2a2a27; | |
| --s1: #3987e5; --s2: #d95926; --critical: #e66767; | |
| --seq0: #383835; --seq1: #0d366b; --seq2: #1c5cab; --seq3: #2a78d6; --seq4: #6da7ec; --seq5: #cde2fb; | |
| --popover: #242422; --shadow: 0 4px 16px rgba(0,0,0,.45); | |
| } | |
| * { box-sizing: border-box; } | |
| [hidden] { display: none ; } | |
| html, body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--sans); font-size: 15px; line-height: 1.5; } | |
| a { color: var(--s1); } | |
| .cx { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; max-width: 1120px; margin: 0 auto; padding: 32px 16px 48px; } | |
| .cx h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(1.7rem, 3.5vw, 2.4rem); line-height: 1.15; margin: 0; text-wrap: balance; } | |
| .cx h2 { font-size: 1.05rem; font-weight: 600; margin: 0; } | |
| .cx .byline { margin: 8px 0 0; color: var(--fg-muted); } | |
| .cx .links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; } | |
| .cx .links a { border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; text-decoration: none; color: var(--fg); background: var(--panel); font-size: .9rem; } | |
| .cx .links a:hover { border-color: var(--fg-muted); } | |
| .cx .lede { color: var(--fg-muted); margin: 14px 0 0; max-width: 75ch; } | |
| .cx .card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 20px; display: grid; gap: 10px; min-width: 0; } | |
| .cx .note { color: var(--fg-muted); font-size: .85rem; margin: 0; max-width: 85ch; } | |
| .cx .controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; } | |
| .cx .chip { border: 1px solid var(--line); background: var(--bg); color: var(--fg); border-radius: 999px; padding: 3px 12px; font: inherit; font-size: .85rem; cursor: pointer; } | |
| .cx .chip[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); } | |
| .cx select { font: inherit; font-size: .9rem; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--fg); max-width: 100%; } | |
| .cx label { font-size: .8rem; color: var(--fg-muted); display: grid; gap: 2px; min-width: 0; max-width: 100%; } | |
| .cx label select { width: 100%; min-width: 0; } | |
| .cx .tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: 14px; } | |
| .cx .tile .v { font-family: var(--serif); font-size: 1.9rem; font-variant-numeric: tabular-nums; line-height: 1.2; } | |
| .cx .tile .k { font-size: .8rem; color: var(--fg-muted); } | |
| .cx .chart { position: relative; min-height: 120px; } | |
| .cx .chart svg { display: block; overflow: visible; } | |
| .cx .chart svg text { fill: var(--fg-muted); font-size: 12px; font-family: var(--sans); } | |
| .cx .chart svg .lbl { fill: var(--fg); } | |
| .cx .chart svg .row:focus { outline: none; } | |
| .cx .chart svg .row:focus-visible .bg { stroke: var(--fg); stroke-width: 1.5; } | |
| .cx .tip { position: absolute; pointer-events: none; background: var(--popover); border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); padding: 6px 10px; font-size: .8rem; z-index: 2; max-width: min(340px, calc(100vw - 40px)); white-space: normal; overflow-wrap: anywhere; } | |
| .cx .tip .h { color: var(--fg-muted); } | |
| .cx .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; } | |
| .cx .legend { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: .8rem; color: var(--fg-muted); } | |
| .cx .ramp { display: inline-flex; border-radius: 3px; overflow: hidden; vertical-align: middle; } | |
| .cx .ramp span { width: 22px; height: 10px; } | |
| .cx .tbl { max-height: 34rem; overflow: auto; } | |
| .cx table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: .85rem; } | |
| .cx th, .cx td { text-align: right; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; } | |
| .cx th:first-child, .cx td:first-child, .cx th:nth-child(2), .cx td:nth-child(2) { text-align: left; } | |
| .cx th { position: sticky; top: 0; background: var(--panel); font-weight: 600; } | |
| .cx th button { all: unset; cursor: pointer; } | |
| .cx td sup { color: var(--fg-muted); } | |
| .cx th button:focus-visible, .cx .chip:focus-visible, .cx select:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; } | |
| .cx .fail { display: flex; align-items: center; justify-content: center; min-height: 120px; color: var(--fg-muted); font-size: .85rem; } | |
| .cx .skeleton { min-height: 160px; border-radius: 6px; background: linear-gradient(90deg, var(--grid), var(--hl), var(--grid)); background-size: 200% 100%; animation: sk 1.4s ease-in-out infinite; } | |
| @keyframes sk { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } } | |
| @media (prefers-reduced-motion: reduce) { .cx .skeleton { animation: none; } } | |
| .cx pre { margin: 0; padding: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; overflow-x: auto; font-family: var(--mono); font-size: .78rem; line-height: 1.45; } | |
| .cx ol.notes { margin: 0; padding-left: 1.4rem; color: var(--fg-muted); font-size: .8rem; display: grid; gap: 2px; } | |
| .cx footer { color: var(--fg-muted); font-size: .8rem; } | |
| .cx .copy { justify-self: start; } | |
| @media (max-width: 640px) { .cx .hide-narrow { display: none; } .cx .card { padding: 14px; } } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="cx"> | |
| <header id="top"> | |
| <h1>Competence-Based Evaluation of Logical Reasoning in Large Language Models</h1> | |
| <p class="byline">Jize Jiang and Chengxiang Zhai · University of Illinois Urbana-Champaign</p> | |
| <div class="links"> | |
| <a href="https://arxiv.org/abs/2610.22894">Paper (arXiv:2610.22894)</a> | |
| <a href="#cite">Cite</a> | |
| </div> | |
| <p class="lede">Each problem lists facts of the form “A is in front of B” for <i>n</i> people standing in a line, and asks a yes/no question about the order of the two people at the ends of the line. The rule never changes; only the number of people grows, from 4 to 1024, so <i>n</i> measures input size rather than the depth of reasoning. Every problem also comes in an equivalent rewording with the same answer, and a model counts as correct on a pair only when it answers both versions correctly. This page shows how accuracy and consistency hold up as problems grow and as their wording changes.</p> | |
| </header> | |
| <section class="tiles" id="summary" aria-label="Summary"> | |
| <div class="card tile"><div class="k">Model configurations</div><div class="v" id="t-models">—</div><div class="k">API, open-weight and fine-tuned</div></div> | |
| <div class="card tile"><div class="k">Problem sizes</div><div class="v" id="t-sizes">—</div><div class="k">people per problem, doubling</div></div> | |
| <div class="card tile"><div class="k">Item pairs per size</div><div class="v" id="t-pairs">—</div><div class="k">original + equivalent rewording</div></div> | |
| </section> | |
| <section class="card" id="overview"> | |
| <div class="controls" role="group" aria-label="Model group"> | |
| <h2 style="margin-right:auto">Both versions correct, by problem size</h2> | |
| <button class="chip" data-g="six">Paper's six base models</button> | |
| <button class="chip" data-g="base">Not fine-tuned</button> | |
| <button class="chip" data-g="Fine-tuned Qwen3.5-9B">Fine-tuned 9B</button> | |
| <button class="chip" data-g="all">All</button> | |
| </div> | |
| <p class="note">Each cell is the share of item pairs (200 per size) where the model answers both the original and the reworded problem correctly. Half the problems have the answer yes at every size, so always answering yes (or always no) scores 50%. A pair with a missing or unparseable answer counts as a failure; the paper's paired measures use only pairs where both answers parse, so values can differ for models that often fail to answer. Rows are sorted by the average share; models shown with the original wording only come last. Hover a cell for details, or click it to compare that model below.</p> | |
| <div class="legend" id="heat-legend"></div> | |
| <div class="chart skeleton" id="heat"></div> | |
| </section> | |
| <section class="card" id="compare"> | |
| <div class="controls"> | |
| <h2 style="margin-right:auto">Compare two models as n grows</h2> | |
| <label for="pick-a">Model A<select id="pick-a"></select></label> | |
| <label for="pick-b">Model B<select id="pick-b"></select></label> | |
| <label for="pick-m">Measure<select id="pick-m"> | |
| <option value="both_correct">Both versions correct</option> | |
| <option value="acc_original">Accuracy, original</option> | |
| <option value="acc_equivalent">Accuracy, reworded</option> | |
| <option value="agreement">Same answer on both</option> | |
| <option value="no_answer_rate">No answer given</option> | |
| </select></label> | |
| </div> | |
| <p class="note" id="cmp-note"></p> | |
| <div class="legend" id="cmp-legend"></div> | |
| <div class="chart skeleton" id="cmp"></div> | |
| </section> | |
| <section class="card" id="perturbations"> | |
| <div class="controls"> | |
| <h2 style="margin-right:auto">Accuracy and consistency under perturbations</h2> | |
| <div class="controls" role="group" aria-label="View"> | |
| <button class="chip pv" data-v="model">One model</button> | |
| <button class="chip pv" data-v="pert">One perturbation</button> | |
| </div> | |
| <label for="pick-pm" id="pmw">Model<select id="pick-pm"></select></label> | |
| <label for="pick-pp" id="ppw">Perturbation<select id="pick-pp"></select></label> | |
| </div> | |
| <p class="note">Each perturbation rewrites the same problems without changing the answer: restating some or all premises with the inverse phrase, or using other words for the relation. Left: accuracy on the original problems (hollow dot) and after the perturbation (filled dot); the connecting line turns red when accuracy drops by more than 2 points. Right: share of problems where the model's answer stays the same, compared item by item; the dashed tick marks the model's repeat agreement when the identical prompt is simply sent again. A missing answer counts as wrong and as a change of answer. Averages over n = 4 to 1024. Select a row (or focus it and press Enter) to see it by n below.</p> | |
| <p class="note">For relation wordings only accuracy is shown: they change the vocabulary of the whole problem, and the paper reports their consistency within each wording as family means rather than per wording. Each model shows the perturbations it was evaluated on in the paper.</p> | |
| <div class="chart skeleton" id="pchart"></div> | |
| <h2 id="pn-title">By n</h2> | |
| <p class="note" id="pn-desc">—</p> | |
| <div class="chart skeleton" id="pn"></div> | |
| </section> | |
| <section class="card" id="table"> | |
| <h2>All model configurations</h2> | |
| <p class="note">Averages over the nine sizes (n = 4 to 1024). Select a header to sort. A missing or unparseable answer counts as wrong and as a change of answer, so models that often fail to answer score lower here than on answered items alone.</p> | |
| <div class="tbl"> | |
| <table id="tbl"> | |
| <thead><tr> | |
| <th data-field="model"><button data-k="model">Model</button></th> | |
| <th data-field="group" class="hide-narrow"><button data-k="group">Group</button></th> | |
| <th data-field="both_correct"><button data-k="both_correct">Both correct</button></th> | |
| <th data-field="acc_original"><button data-k="acc_original">Original</button></th> | |
| <th data-field="acc_equivalent" class="hide-narrow"><button data-k="acc_equivalent">Reworded</button></th> | |
| <th data-field="agreement" class="hide-narrow"><button data-k="agreement">Same answer</button></th> | |
| <th data-field="no_answer_rate" class="hide-narrow"><button data-k="no_answer_rate">No answer</button></th> | |
| </tr></thead> | |
| <tbody></tbody> | |
| </table> | |
| </div> | |
| <ol class="notes" id="tbl-notes"></ol> | |
| </section> | |
| <section class="card" id="cite"> | |
| <h2>Cite</h2> | |
| <pre id="bib">@misc{jiang2026cbe, | |
| title = {Competence-Based Evaluation of Logical Reasoning in Large Language Models}, | |
| author = {Jiang, Jize and Zhai, Chengxiang}, | |
| year = {2026}, | |
| eprint = {2610.22894}, | |
| archivePrefix = {arXiv}, | |
| primaryClass = {cs.CL}, | |
| url = {https://arxiv.org/abs/2610.22894} | |
| }</pre> | |
| <button class="chip copy" id="copy-bib">Copy BibTeX</button> | |
| </section> | |
| <footer>Computed from the archived model answers of the paper's experiments on the ordering task. Data files: <a href="data/models.json">models.json</a>, <a href="data/per_n.json">per_n.json</a>, <a href="data/pert_summary.json">pert_summary.json</a>, <a href="data/pert_per_n.json">pert_per_n.json</a>.</footer> | |
| </div> | |
| <script> | |
| if (typeof d3 === 'undefined') { | |
| document.querySelectorAll('.chart').forEach((el) => { el.classList.remove('skeleton'); el.innerHTML = '<div class="fail">The chart library could not be loaded. The data files linked at the bottom of the page are still available.</div>'; }); | |
| throw new Error('d3 failed to load'); | |
| } | |
| /* Minimal state + data layer: view state lives in the URL query so a view can be linked. */ | |
| const site = (() => { | |
| const DEFAULTS = {group: 'six', a: 'GPT-4.1', b: 'Qwen3.5-27B', metric: 'both_correct', pview: 'model', pmodel: 'GPT-4.1', psel: 'rewording', ppert: 'rewording'}; | |
| const ALLOWED = {group: ['six', 'base', 'Fine-tuned Qwen3.5-9B', 'all'], metric: ['both_correct', 'acc_original', 'acc_equivalent', 'agreement', 'no_answer_rate'], pview: ['model', 'pert']}; | |
| const SOURCES = ['models', 'per_n', 'pert_summary', 'pert_per_n']; | |
| const ok = (k, v) => Object.prototype.hasOwnProperty.call(DEFAULTS, k) && (!ALLOWED[k] || ALLOWED[k].includes(v)); | |
| const data = {}, subs = []; | |
| let params = {...DEFAULTS}; | |
| try { new URLSearchParams(location.search).forEach((v, k) => { if (ok(k, v)) params[k] = v; }); } catch (e) { /* ignore */ } | |
| const run = () => subs.forEach((f) => { try { f(); } catch (e) { console.error(e); } }); | |
| SOURCES.forEach((s) => { | |
| data[s] = {status: 'loading'}; | |
| fetch(`data/${s}.json`).then((r) => { if (!r.ok) throw new Error(r.status); return r.json(); }) | |
| .then((d) => { data[s] = {status: 'ok', data: d}; run(); }) | |
| .catch(() => { data[s] = {status: 'error'}; run(); }); | |
| }); | |
| return { | |
| params: () => params, | |
| setParams(p) { | |
| Object.entries(p).forEach(([k, v]) => { if (ok(k, v)) params[k] = v; }); | |
| try { | |
| const q = new URLSearchParams(); | |
| Object.entries(params).forEach(([k, v]) => { if (v !== DEFAULTS[k]) q.set(k, v); }); | |
| history.replaceState(null, '', `${location.pathname}${q.toString() ? '?' + q : ''}${location.hash}`); | |
| } catch (e) { /* ignore */ } | |
| run(); | |
| }, | |
| redraw: run, | |
| data: (s) => data[s], | |
| onData(f) { subs.push(f); f(); }, | |
| color: (i) => `var(--s${i + 1})`, | |
| }; | |
| })(); | |
| const pct = d3.format('.1%'), pct0 = d3.format('.0%'), sgn = d3.format('+.1%'); | |
| const ready = (el) => el.classList.remove('skeleton'); | |
| function failBox(el, d) { el.replaceChildren(); if (d.status === 'error') { ready(el); const f = document.createElement('div'); f.className = 'fail'; f.textContent = 'Could not load the data file.'; el.append(f); } else { el.classList.add('skeleton'); } } | |
| function emptyBox(el, msg) { ready(el); el.replaceChildren(); const f = document.createElement('div'); f.className = 'fail'; f.textContent = msg; el.append(f); } | |
| function tipLines(tip, lines) { tip.replaceChildren(...lines.filter((t) => t != null).map((t, i) => { const d = document.createElement('div'); if (!i) d.className = 'h'; if (Array.isArray(t)) { const sw = document.createElement('span'); sw.className = 'sw'; sw.style.background = t[0]; d.append(sw, t[1]); } else d.textContent = t; return d; })); } | |
| function placeTip(tip, x, y, W) { tip.hidden = false; tip.style.left = `${Math.max(4, Math.min(x + 12, W - tip.offsetWidth - 4))}px`; tip.style.top = `${y}px`; } | |
| function legend(el, items) { el.replaceChildren(...items.map(([c, t, dashA]) => { const s = document.createElement('span'); s.innerHTML = `<svg width="18" height="10" aria-hidden="true"><line x1="0" x2="18" y1="5" y2="5" stroke="${c}" stroke-width="2" ${dashA ? `stroke-dasharray="${dashA}"` : ''}/></svg> `; s.append(t); return s; })); } | |
| const textW = (svg, s) => { const t = svg.append('text').attr('class', 'lbl').text(s); const w = t.node().getComputedTextLength(); t.remove(); return w; }; | |
| /* shorten a label so it fits in maxW px: first drop common prefixes, then cut with an ellipsis */ | |
| function fit(svg, s, maxW) { | |
| if (textW(svg, s) <= maxW) return s; | |
| const short = s.replace(/^Qwen3\.5-9B \+ /, '9B + ').replace(/ \(seed (\d+)\)$/, ' s$1').replace(/^Qwen2\.5-32B-Instruct$/, 'Qwen2.5-32B'); | |
| if (short !== s) return fit(svg, short, maxW); | |
| let lo = 1, hi = s.length; | |
| while (lo < hi) { const mid = (lo + hi + 1) >> 1; if (textW(svg, s.slice(0, mid) + '…') <= maxW) lo = mid; else hi = mid - 1; } | |
| return s.slice(0, lo) + '…'; | |
| } | |
| let lastPointer = 'mouse'; | |
| addEventListener('pointerdown', (e) => { lastPointer = e.pointerType || 'mouse'; }, true); | |
| /* ---------- overview heatmap, comparison chart, table ---------- */ | |
| (function () { | |
| const SIX = new Set(['GPT-4.1', 'GPT-4.1-mini', 'GPT-5', 'GPT-5-mini', 'Qwen3.5-27B', 'Qwen3.5-9B']); | |
| const BASE = new Set(['API models', 'Open-weight models']); | |
| const inGroup = (m, g) => g === 'all' || (g === 'six' ? SIX.has(m.model) : g === 'base' ? BASE.has(m.group) : m.group === g); | |
| const state = {sort: 'both_correct', dir: -1}; | |
| const STEPS = ['--seq0', '--seq1', '--seq2', '--seq3', '--seq4', '--seq5']; | |
| const BINS = [0.5, 0.6, 0.7, 0.8, 0.9]; | |
| const bin = (v) => d3.bisectRight(BINS, v); | |
| let models = []; | |
| const noteIdx = new Map(); | |
| document.querySelectorAll('#overview .chip').forEach((b) => b.addEventListener('click', () => site.setParams({group: b.dataset.g}))); | |
| document.getElementById('pick-a').addEventListener('change', (e) => site.setParams({a: e.target.value})); | |
| document.getElementById('pick-b').addEventListener('change', (e) => site.setParams({b: e.target.value})); | |
| document.getElementById('pick-m').addEventListener('change', (e) => site.setParams({metric: e.target.value})); | |
| document.querySelectorAll('#tbl th button').forEach((b) => b.addEventListener('click', () => { | |
| const k = b.dataset.k; state.dir = state.sort === k ? -state.dir : (k === 'model' || k === 'group' ? 1 : -1); state.sort = k; drawTable(); | |
| })); | |
| document.getElementById('copy-bib').addEventListener('click', (e) => { | |
| const btn = e.currentTarget, pre = document.getElementById('bib'); | |
| const done = (msg) => { btn.textContent = msg; setTimeout(() => { btn.textContent = 'Copy BibTeX'; }, 2000); }; | |
| const fallback = () => { const r = document.createRange(); r.selectNodeContents(pre); const s = getSelection(); s.removeAllRanges(); s.addRange(r); done('Selected: press Ctrl+C (⌘C)'); }; | |
| if (navigator.clipboard && navigator.clipboard.writeText) navigator.clipboard.writeText(pre.textContent).then(() => done('Copied'), fallback); else fallback(); | |
| }); | |
| const hl = document.getElementById('heat-legend'); | |
| { const r = document.createElement('span'); r.className = 'ramp'; r.setAttribute('aria-hidden', 'true'); STEPS.forEach((s) => { const c = document.createElement('span'); c.style.background = `var(${s})`; r.append(c); }); const l = document.createElement('span'); l.textContent = 'below 50%'; const h = document.createElement('span'); h.textContent = '90% and up (steps of 10 points)'; const no = document.createElement('span'); no.innerHTML = '<span class="sw" style="background:transparent;border:1px dashed var(--axis)"></span>reworded version not shown'; hl.append(l, r, h, no); } | |
| function drawTable() { | |
| const tb = document.querySelector('#tbl tbody'); | |
| const rows = models.slice().sort((x, y) => { const a = x[state.sort], b = y[state.sort]; if (a == null && b == null) return 0; if (a == null) return 1; if (b == null) return -1; return (typeof a === 'string' ? a.localeCompare(b) : a - b) * state.dir; }); | |
| document.querySelectorAll('#tbl th').forEach((th) => th.setAttribute('aria-sort', th.dataset.field === state.sort ? (state.dir > 0 ? 'ascending' : 'descending') : 'none')); | |
| tb.replaceChildren(...rows.map((m) => { | |
| const tr = document.createElement('tr'); | |
| const f = (v) => v == null ? '—' : pct(v); | |
| [m.model, m.group, f(m.both_correct), f(m.acc_original), f(m.acc_equivalent), f(m.agreement), f(m.no_answer_rate)] | |
| .forEach((c, i) => { const td = document.createElement('td'); td.textContent = c; if (!i && noteIdx.has(m.note)) { const s = document.createElement('sup'); s.textContent = ` ${noteIdx.get(m.note)}`; td.append(s); } if ([1, 4, 5, 6].includes(i)) td.className = 'hide-narrow'; tr.append(td); }); | |
| return tr; | |
| })); | |
| } | |
| function drawNotes() { | |
| noteIdx.clear(); const ol = document.getElementById('tbl-notes'); ol.replaceChildren(); | |
| models.forEach((m) => { if (m.note && !noteIdx.has(m.note)) { noteIdx.set(m.note, noteIdx.size + 1); const li = document.createElement('li'); li.textContent = m.note; ol.append(li); } }); | |
| } | |
| function drawHeat(el, per, g) { | |
| ready(el); el.replaceChildren(); | |
| const rows = models.filter((m) => inGroup(m, g)).sort((a, b) => (b.both_correct ?? -1) - (a.both_correct ?? -1) || (b.acc_original - a.acc_original)); | |
| if (!rows.length) { emptyBox(el, 'No models in this group.'); return; } | |
| const ns = [...new Set(per.map((r) => r.n))].sort((a, b) => a - b); | |
| const cell = new Map(per.map((r) => [`${r.model}|${r.n}`, r])); | |
| const W = el.clientWidth || 700, rowH = 22; | |
| const svg = d3.select(el).append('svg').attr('width', '100%').attr('role', 'img').attr('aria-label', 'Heatmap of the share of item pairs with both versions correct, by model and problem size. The same values are in the table below.'); | |
| const labW = d3.max(rows, (m) => textW(svg, m.model)) || 80; | |
| const ml = Math.min(labW + 12, W * 0.42), mr = 4, mt = 22, H = mt + rows.length * rowH + 4; | |
| svg.attr('viewBox', `0 0 ${W} ${H}`).attr('height', H); | |
| const x = d3.scaleBand(ns, [ml, W - mr]).paddingInner(0.06), y = d3.scaleBand(rows.map((m) => m.model), [mt, H - 4]).paddingInner(0.1); | |
| svg.append('g').selectAll('text').data(ns).join('text').attr('x', (n) => x(n) + x.bandwidth() / 2).attr('y', 12).attr('text-anchor', 'middle').text((n, i) => (W < 520 && i % 2) ? '' : n); | |
| svg.append('text').attr('x', ml - 8).attr('y', 12).attr('text-anchor', 'end').text('n ='); | |
| svg.append('g').selectAll('text').data(rows).join('text').attr('class', 'lbl').attr('x', ml - 8).attr('y', (m) => y(m.model) + y.bandwidth() / 2).attr('dy', '0.35em').attr('text-anchor', 'end') | |
| .text((m) => fit(svg, m.model, ml - 12)).append('title').text((m) => m.model); | |
| const cells = []; | |
| rows.forEach((m) => ns.forEach((n) => cells.push({m, n, r: cell.get(`${m.model}|${n}`)}))); | |
| const tip = document.createElement('div'); tip.className = 'tip'; tip.hidden = true; el.append(tip); | |
| svg.append('g').selectAll('rect').data(cells).join('rect') | |
| .attr('x', (c) => x(c.n)).attr('y', (c) => y(c.m.model)).attr('width', x.bandwidth()).attr('height', y.bandwidth()).attr('rx', 3) | |
| .attr('fill', (c) => c.r && c.r.both_correct != null ? `var(${STEPS[bin(c.r.both_correct)]})` : 'transparent') | |
| .attr('stroke', (c) => c.r && c.r.both_correct != null ? 'none' : 'var(--axis)').attr('stroke-dasharray', '3 2').style('cursor', 'pointer') | |
| .on('mousemove', (ev, c) => { | |
| const r = c.r; const [px, py] = d3.pointer(ev, el); | |
| tipLines(tip, r ? [`${c.m.model} · n = ${c.n} · ${r.pairs} pairs`, | |
| r.both_correct == null ? 'Reworded version not shown' : `Both correct ${pct(r.both_correct)}`, | |
| `Accuracy, original ${pct(r.acc_original)}`, r.acc_equivalent == null ? null : `Accuracy, reworded ${pct(r.acc_equivalent)}`, | |
| r.agreement == null ? null : `Same answer ${pct(r.agreement)}`, r.no_answer_rate > 0.005 ? `No answer ${pct(r.no_answer_rate)}` : null] : [`${c.m.model} · n = ${c.n}`, 'No data']); | |
| placeTip(tip, px, py + 14, W); | |
| }).on('mouseleave', () => { tip.hidden = true; }) | |
| .on('click', (ev, c) => { site.setParams({a: c.m.model}); if (lastPointer !== 'touch') document.getElementById('compare').scrollIntoView({behavior: 'smooth', block: 'start'}); }); | |
| } | |
| function drawCompare(el, per, p, a, b) { | |
| ready(el); el.replaceChildren(); | |
| const key = p.metric; | |
| const series = [a, b].map((name, i) => ({name, i, pts: per.filter((r) => r.model === name && r[key] != null).sort((u, v) => u.n - v.n)})); | |
| legend(document.getElementById('cmp-legend'), series.map((s) => [site.color(s.i), s.name])); | |
| const W = el.clientWidth || 600, H = 320, ml = 44, mr = 16, mt = 12, mb = 32; | |
| const svg = d3.select(el).append('svg').attr('width', '100%').attr('viewBox', `0 0 ${W} ${H}`).attr('height', H).attr('role', 'img').attr('aria-label', `Line chart comparing ${a} and ${b} by problem size`); | |
| const ns = [...new Set(per.map((r) => r.n))].sort((u, v) => u - v); | |
| const x = d3.scaleLog().base(2).domain([ns[0], ns[ns.length - 1]]).range([ml, W - mr]); | |
| const y = d3.scaleLinear().domain([0, 1]).range([H - mb, mt]); | |
| svg.append('g').selectAll('line').data([0, .25, .5, .75, 1]).join('line').attr('x1', ml).attr('x2', W - mr).attr('y1', y).attr('y2', y).attr('stroke', 'var(--grid)'); | |
| svg.append('g').attr('transform', `translate(${ml},0)`).call(d3.axisLeft(y).tickValues([0, .25, .5, .75, 1]).tickFormat(pct0).tickSize(0)).attr('font-size', null).attr('font-family', null).call((g) => g.select('.domain').remove()); | |
| svg.append('g').attr('transform', `translate(0,${H - mb})`).call(d3.axisBottom(x).tickValues(ns).tickFormat(d3.format('d')).tickSizeOuter(0)).attr('font-size', null).attr('font-family', null) | |
| .call((g) => g.selectAll('line,.domain').attr('stroke', 'var(--axis)')).call((g) => { if (W < 520) g.selectAll('.tick text').filter((d, i) => i % 2).remove(); }); | |
| const chanceLine = ['both_correct', 'acc_original', 'acc_equivalent'].includes(key); | |
| if (chanceLine) svg.append('line').attr('x1', ml).attr('x2', W - mr).attr('y1', y(.5)).attr('y2', y(.5)).attr('stroke', 'var(--ref)').attr('stroke-dasharray', '4 4'); | |
| const line = d3.line().x((r) => x(r.n)).y((r) => y(r[key])); | |
| series.forEach((s) => { | |
| svg.append('path').datum(s.pts).attr('d', line).attr('fill', 'none').attr('stroke', site.color(s.i)).attr('stroke-width', 2).attr('stroke-linejoin', 'round').attr('stroke-linecap', 'round'); | |
| svg.append('g').selectAll('circle').data(s.pts).join('circle').attr('cx', (r) => x(r.n)).attr('cy', (r) => y(r[key])).attr('r', 4).attr('fill', site.color(s.i)).attr('stroke', 'var(--panel)').attr('stroke-width', 2); | |
| }); | |
| const missing = series.filter((s) => !s.pts.length).map((s) => s.name); | |
| document.getElementById('cmp-note').textContent = missing.length | |
| ? `${missing.join(' and ')} ${missing.length > 1 ? 'have' : 'has'} no reworded results on this page, so this measure is not available.` | |
| : `Each point is one problem size (200 item pairs; 100 for Qwen3.5-27B thinking).${chanceLine ? ' The dashed line is what always answering yes (or always no) scores.' : ''}`; | |
| const tip = document.createElement('div'); tip.className = 'tip'; tip.hidden = true; el.append(tip); | |
| const rule = svg.append('line').attr('y1', mt).attr('y2', H - mb).attr('stroke', 'var(--axis)').style('display', 'none'); | |
| svg.append('rect').attr('x', ml).attr('y', mt).attr('width', W - ml - mr).attr('height', H - mt - mb).attr('fill', 'transparent') | |
| .on('mousemove', (ev) => { | |
| const [mx] = d3.pointer(ev); const n = ns[d3.minIndex(ns, (v) => Math.abs(x(v) - mx))]; | |
| rule.style('display', null).attr('x1', x(n)).attr('x2', x(n)); | |
| tipLines(tip, [`n = ${n}`, ...series.map((s) => { const r = s.pts.find((q) => q.n === n); return [site.color(s.i), `${s.name}: ${r ? pct(r[key]) : '—'}`]; })]); | |
| placeTip(tip, x(n), mt + 4, W); | |
| }).on('mouseleave', () => { tip.hidden = true; rule.style('display', 'none'); }); | |
| } | |
| site.onData(() => { | |
| const p = site.params(), dm = site.data('models'), dp = site.data('per_n'); | |
| document.querySelectorAll('#overview .chip').forEach((b) => b.setAttribute('aria-pressed', String(b.dataset.g === p.group))); | |
| const heat = document.getElementById('heat'), cmp = document.getElementById('cmp'), tb = document.querySelector('#tbl tbody'); | |
| if (dm.status !== 'ok') { | |
| failBox(heat, dm); failBox(cmp, dm); | |
| if (dm.status === 'error') { tb.innerHTML = '<tr><td colspan="7">Could not load the data file.</td></tr>'; ['t-models', 't-sizes', 't-pairs'].forEach((id) => { document.getElementById(id).textContent = 'n/a'; }); } | |
| return; | |
| } | |
| models = dm.data; | |
| const names = models.map((m) => m.model); | |
| const a = names.includes(p.a) ? p.a : names[0], b = names.includes(p.b) ? p.b : (names[1] || names[0]); | |
| document.getElementById('t-models').textContent = String(models.length); | |
| ['pick-a', 'pick-b'].forEach((id, i) => { const sel = document.getElementById(id); if (sel.options.length !== models.length) sel.replaceChildren(...models.map((m) => new Option(m.model, m.model))); sel.value = i ? b : a; }); | |
| document.getElementById('pick-m').value = p.metric; | |
| drawNotes(); drawTable(); | |
| if (dp.status !== 'ok') { failBox(heat, dp); failBox(cmp, dp); if (dp.status === 'error') ['t-sizes', 't-pairs'].forEach((id) => { document.getElementById(id).textContent = 'n/a'; }); return; } | |
| const ns = [...new Set(dp.data.map((r) => r.n))].sort((u, v) => u - v); | |
| document.getElementById('t-sizes').textContent = `${ns[0]}–${d3.format(',')(ns[ns.length - 1])}`; | |
| document.getElementById('t-pairs').textContent = String(d3.max(dp.data, (r) => r.pairs)); | |
| drawHeat(heat, dp.data, p.group); | |
| drawCompare(cmp, dp.data, p, a, b); | |
| }); | |
| })(); | |
| /* ---------- perturbations ---------- */ | |
| (function () { | |
| const FAM_ORDER = ['Rewording', 'Share of premises restated', 'Relation wording', 'Repeat control']; | |
| document.querySelectorAll('.pv').forEach((b) => b.addEventListener('click', () => site.setParams({pview: b.dataset.v}))); | |
| document.getElementById('pick-pm').addEventListener('change', (e) => site.setParams({pmodel: e.target.value})); | |
| document.getElementById('pick-pp').addEventListener('change', (e) => site.setParams({ppert: e.target.value, psel: e.target.value})); | |
| function drawRows(el, rows, labelOf, floorOf, selKey, onPick) { | |
| ready(el); el.replaceChildren(); | |
| const W = el.clientWidth || 700, rowH = 24, famH = 26; | |
| const svg = d3.select(el).append('svg').attr('width', '100%').attr('role', 'group').attr('aria-label', 'Accuracy and same-answer share per row; rows are selectable'); | |
| const labW = d3.max(rows, (r) => textW(svg, labelOf(r))) || 80; | |
| const ml = Math.min(labW + 14, W * 0.42), gap = 22, mr = 12, mt = 22, mb = 26; | |
| const colW = (W - ml - mr - gap) / 2; | |
| const xa = d3.scaleLinear().domain([0, 1]).range([ml, ml + colW]), xi = d3.scaleLinear().domain([0, 1]).range([ml + colW + gap, W - mr]); | |
| let yPos = mt; const items = []; let fam = null; | |
| rows.forEach((r) => { if (r.family !== fam) { fam = r.family; items.push({head: fam, y: yPos}); yPos += famH; } items.push({r, y: yPos}); yPos += rowH; }); | |
| const H = yPos + mb; svg.attr('viewBox', `0 0 ${W} ${H}`).attr('height', H); | |
| [[xa, 'Accuracy'], [xi, 'Same answer']].forEach(([x, t]) => { | |
| svg.append('g').selectAll('line').data([0, .25, .5, .75, 1]).join('line').attr('x1', x).attr('x2', x).attr('y1', mt - 4).attr('y2', H - mb).attr('stroke', 'var(--grid)'); | |
| svg.append('text').attr('x', x.range()[0]).attr('y', 12).text(t); | |
| svg.append('g').attr('transform', `translate(0,${H - mb})`).call(d3.axisBottom(x).tickValues([0, .5, 1]).tickFormat(pct0).tickSizeOuter(0)).attr('font-size', null).attr('font-family', null) | |
| .call((g) => g.selectAll('line,.domain').attr('stroke', 'var(--axis)')) | |
| .call((g) => g.selectAll('.tick text').attr('text-anchor', (d) => (x === xa && d === 1) ? 'end' : (x === xi && d === 0) ? 'start' : 'middle')); | |
| }); | |
| items.filter((it) => it.head).forEach((it) => svg.append('text').attr('class', 'lbl').attr('x', 0).attr('y', it.y + 16).attr('font-weight', 600).text(it.head)); | |
| const tip = document.createElement('div'); tip.className = 'tip'; tip.hidden = true; el.append(tip); | |
| const showTip = (it, px, py) => { | |
| const r = it.r, fl = floorOf(r); | |
| tipLines(tip, [`${r.label} · ${r.model}`, `Accuracy ${pct(r.acc_reference)} → ${pct(r.acc_perturbed)} (${sgn(r.acc_change)})`, | |
| r.agreement == null ? 'Same answer: not shown for relation wordings' : `Same answer ${pct(r.agreement)}${fl == null || r.perturbation === 'noise' ? '' : ` (repeat agreement ${pct(fl)})`}`, | |
| r.both_correct == null ? null : `Both correct ${pct(r.both_correct)}`]); | |
| placeTip(tip, px, py, W); | |
| }; | |
| const g = svg.append('g').selectAll('g').data(items.filter((it) => it.r)).join('g').attr('class', 'row').attr('transform', (it) => `translate(0,${it.y})`).style('cursor', 'pointer') | |
| .attr('tabindex', 0).attr('role', 'button').attr('aria-pressed', (it) => String(selKey(it.r))) | |
| .attr('aria-label', (it) => `${labelOf(it.r)}: accuracy ${pct(it.r.acc_reference)} to ${pct(it.r.acc_perturbed)}${it.r.agreement == null ? '' : `, same answer ${pct(it.r.agreement)}`}`) | |
| .on('click', (ev, it) => onPick(it.r)) | |
| .on('keydown', (ev, it) => { if (ev.key === 'Enter' || ev.key === ' ') { ev.preventDefault(); onPick(it.r); } }) | |
| .on('focus', (ev, it) => showTip(it, ml, it.y + rowH + 4)).on('blur', () => { tip.hidden = true; }); | |
| g.append('rect').attr('class', 'bg').attr('x', 0).attr('y', 1).attr('width', W).attr('height', rowH - 2).attr('rx', 4).attr('fill', (it) => selKey(it.r) ? 'var(--hl)' : 'transparent'); | |
| g.append('text').attr('class', 'lbl').attr('x', ml - 8).attr('y', rowH / 2).attr('dy', '0.35em').attr('text-anchor', 'end').text((it) => fit(svg, labelOf(it.r), ml - 12)); | |
| g.append('line').attr('x1', (it) => xa(it.r.acc_reference)).attr('x2', (it) => xa(it.r.acc_perturbed)).attr('y1', rowH / 2).attr('y2', rowH / 2) | |
| .attr('stroke', (it) => it.r.acc_change < -0.02 ? 'var(--critical)' : 'var(--muted-mark)').attr('stroke-width', 2); | |
| g.append('circle').attr('cx', (it) => xa(it.r.acc_reference)).attr('cy', rowH / 2).attr('r', 4).attr('fill', 'var(--panel)').attr('stroke', site.color(0)).attr('stroke-width', 2); | |
| g.append('circle').attr('cx', (it) => xa(it.r.acc_perturbed)).attr('cy', rowH / 2).attr('r', 4).attr('fill', site.color(0)); | |
| const withAgree = g.filter((it) => it.r.agreement != null); | |
| withAgree.append('rect').attr('x', xi(0)).attr('y', 6).attr('height', rowH - 12).attr('width', (it) => Math.max(1, xi(it.r.agreement) - xi(0))).attr('rx', 3).attr('fill', site.color(1)); | |
| withAgree.filter((it) => floorOf(it.r) != null && it.r.perturbation !== 'noise').append('line').attr('x1', (it) => xi(floorOf(it.r))).attr('x2', (it) => xi(floorOf(it.r))).attr('y1', 2).attr('y2', rowH - 2) | |
| .attr('stroke', 'var(--fg)').attr('stroke-width', 1.5).attr('stroke-dasharray', '3 2'); | |
| g.filter((it) => it.r.agreement == null).append('text').attr('x', xi(0)).attr('y', rowH / 2).attr('dy', '0.35em').text('—'); | |
| g.on('mousemove', (ev, it) => { const [px, py] = d3.pointer(ev, el); showTip(it, px, py + 14); }).on('mouseleave', () => { tip.hidden = true; }); | |
| } | |
| function drawByN(el, pts) { | |
| ready(el); el.replaceChildren(); | |
| if (!pts.length) { emptyBox(el, 'No per-size data for this selection.'); return; } | |
| const W = el.clientWidth || 600, narrow = W < 520, H = narrow ? 320 : 280, ml = 44, mr = 16, mt = narrow ? 76 : 36, mb = 32; | |
| const svg = d3.select(el).append('svg').attr('width', '100%').attr('viewBox', `0 0 ${W} ${H}`).attr('height', H).attr('role', 'img').attr('aria-label', 'Accuracy and same-answer share by problem size for the selected row'); | |
| const ns = pts.map((r) => r.n); | |
| const x = d3.scaleLog().base(2).domain([d3.min(ns), d3.max(ns)]).range([ml, W - mr]), y = d3.scaleLinear().domain([0, 1]).range([H - mb, mt]); | |
| svg.append('g').selectAll('line').data([0, .25, .5, .75, 1]).join('line').attr('x1', ml).attr('x2', W - mr).attr('y1', y).attr('y2', y).attr('stroke', 'var(--grid)'); | |
| svg.append('g').attr('transform', `translate(${ml},0)`).call(d3.axisLeft(y).tickValues([0, .25, .5, .75, 1]).tickFormat(pct0).tickSize(0)).attr('font-size', null).attr('font-family', null).call((g) => g.select('.domain').remove()); | |
| svg.append('g').attr('transform', `translate(0,${H - mb})`).call(d3.axisBottom(x).tickValues(ns).tickFormat(d3.format('d')).tickSizeOuter(0)).attr('font-size', null).attr('font-family', null) | |
| .call((g) => g.selectAll('line,.domain').attr('stroke', 'var(--axis)')).call((g) => { if (narrow) g.selectAll('.tick text').filter((d, i) => i % 2).remove(); }); | |
| svg.append('line').attr('x1', ml).attr('x2', W - mr).attr('y1', y(.5)).attr('y2', y(.5)).attr('stroke', 'var(--ref)').attr('stroke-dasharray', '4 4'); | |
| const S = [['acc_reference', 'Accuracy, original', site.color(0), '5 3'], ['acc_perturbed', 'Accuracy, perturbed', site.color(0), null], ['agreement', 'Same answer', site.color(1), null]] | |
| .filter(([k]) => pts.some((r) => r[k] != null)); | |
| S.forEach(([k, , c, dashA]) => { | |
| svg.append('path').datum(pts.filter((r) => r[k] != null)).attr('d', d3.line().x((r) => x(r.n)).y((r) => y(r[k]))).attr('fill', 'none').attr('stroke', c).attr('stroke-width', 2).attr('stroke-dasharray', dashA).attr('stroke-linejoin', 'round').attr('stroke-linecap', 'round'); | |
| svg.append('g').selectAll('circle').data(pts.filter((r) => r[k] != null)).join('circle').attr('cx', (r) => x(r.n)).attr('cy', (r) => y(r[k])).attr('r', 3).attr('fill', c); | |
| }); | |
| const leg = svg.append('g').attr('transform', `translate(${ml},10)`); | |
| let lx = 0, ly = 0; S.forEach(([, lab, c, dashA]) => { const gg = leg.append('g'); gg.append('line').attr('x2', 16).attr('y1', 6).attr('y2', 6).attr('stroke', c).attr('stroke-width', 2).attr('stroke-dasharray', dashA); const t = gg.append('text').attr('x', 20).attr('y', 6).attr('dy', '0.35em').text(lab); const w = 30 + t.node().getComputedTextLength(); if (lx > 0 && ml + lx + w > W - mr) { lx = 0; ly += 20; } gg.attr('transform', `translate(${lx},${ly})`); lx += w; }); | |
| const tip = document.createElement('div'); tip.className = 'tip'; tip.hidden = true; el.append(tip); | |
| svg.append('rect').attr('x', ml).attr('y', mt).attr('width', W - ml - mr).attr('height', H - mt - mb).attr('fill', 'transparent') | |
| .on('mousemove', (ev) => { const [mx] = d3.pointer(ev); const r = pts[d3.minIndex(pts, (q) => Math.abs(x(q.n) - mx))]; | |
| tipLines(tip, [`n = ${r.n} (${r.pairs} items)`, ...S.map(([k, lab, c]) => [c, `${lab}: ${pct(r[k])}`])]); placeTip(tip, x(r.n), mt + 4, W); }) | |
| .on('mouseleave', () => { tip.hidden = true; }); | |
| } | |
| site.onData(() => { | |
| const p = site.params(), ds = site.data('pert_summary'), dn = site.data('pert_per_n'); | |
| const chart = document.getElementById('pchart'), byn = document.getElementById('pn'); | |
| document.querySelectorAll('.pv').forEach((b) => b.setAttribute('aria-pressed', String(b.dataset.v === p.pview))); | |
| document.getElementById('pmw').hidden = p.pview !== 'model'; document.getElementById('ppw').hidden = p.pview !== 'pert'; | |
| if (ds.status !== 'ok') { failBox(chart, ds); failBox(byn, ds); return; } | |
| const S = ds.data, famRank = (f) => { const i = FAM_ORDER.indexOf(f); return i < 0 ? FAM_ORDER.length : i; }; | |
| if (!S.length) { emptyBox(chart, 'No perturbation data.'); emptyBox(byn, 'No perturbation data.'); return; } | |
| const floor = new Map(S.filter((r) => r.perturbation === 'noise').map((r) => [r.model, r.agreement])); | |
| const count = d3.rollup(S, (v) => v.length, (r) => r.model); | |
| const modelsWith = [...count.keys()].sort((a, b) => count.get(b) - count.get(a) || a.localeCompare(b)); | |
| const perts = []; S.forEach((r) => { if (!perts.find((q) => q.id === r.perturbation)) perts.push({id: r.perturbation, label: r.label, family: r.family}); }); | |
| perts.sort((a, b) => famRank(a.family) - famRank(b.family)); | |
| const pmodel = count.has(p.pmodel) ? p.pmodel : modelsWith[0]; | |
| const ppert = perts.find((q) => q.id === p.ppert) ? p.ppert : perts[0].id; | |
| const pm = document.getElementById('pick-pm'), pp = document.getElementById('pick-pp'); | |
| if (pm.options.length !== modelsWith.length) pm.replaceChildren(...modelsWith.map((m) => new Option(`${m} (${count.get(m)})`, m))); | |
| if (pp.options.length !== perts.length) pp.replaceChildren(...perts.map((q) => new Option(`${q.family}: ${q.label}`, q.id))); | |
| pm.value = pmodel; pp.value = ppert; | |
| let rows, labelOf, pick, focus; | |
| if (p.pview === 'model') { | |
| rows = S.filter((r) => r.model === pmodel).sort((a, b) => famRank(a.family) - famRank(b.family) || (a.family === 'Relation wording' ? a.acc_change - b.acc_change : 0)); | |
| labelOf = (r) => r.label; pick = (r) => site.setParams({psel: r.perturbation}); | |
| focus = rows.find((r) => r.perturbation === p.psel) || rows[0]; | |
| } else { | |
| rows = S.filter((r) => r.perturbation === ppert).map((r) => ({...r, family: 'Models'})).sort((a, b) => b.acc_perturbed - a.acc_perturbed); | |
| labelOf = (r) => r.model; pick = (r) => site.setParams({pmodel: r.model}); | |
| focus = rows.find((r) => r.model === pmodel) || rows[0]; | |
| } | |
| const selKey = (r) => !!focus && r.perturbation === focus.perturbation && r.model === focus.model; | |
| drawRows(chart, rows, labelOf, (r) => floor.get(r.model), selKey, pick); | |
| if (!focus) { document.getElementById('pn-title').textContent = 'By n'; document.getElementById('pn-desc').textContent = 'No per-size data for this selection.'; emptyBox(byn, 'No per-size data for this selection.'); return; } | |
| document.getElementById('pn-title').textContent = `${focus.label} · ${focus.model}, by n`; | |
| document.getElementById('pn-desc').textContent = focus.description; | |
| if (dn.status !== 'ok') { failBox(byn, dn); return; } | |
| drawByN(byn, dn.data.filter((r) => r.perturbation === focus.perturbation && r.model === focus.model).sort((a, b) => a.n - b.n)); | |
| }); | |
| })(); | |
| /* redraw only when the content width changes (not on mobile URL-bar height changes) */ | |
| (function () { | |
| let w = null, t; | |
| const ro = new ResizeObserver((entries) => { const nw = Math.round(entries[0].contentRect.width); if (w !== null && nw !== w) { clearTimeout(t); t = setTimeout(site.redraw, 120); } w = nw; }); | |
| ro.observe(document.querySelector('.cx')); | |
| })(); | |
| </script> | |
| </body> | |
| </html> | |