feat: minimalist grayscale booktabs redesign
Browse files2 unmodified lines345678910111213141516171819202122233 unmodified lines272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722734 unmodified lines2782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793802 unmodified lines3833843853863873883893903913923933943953963973983994004014024034044054064074084094104114123 unmodified lines4164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226233 unmodified lines6276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018022 unmodified lines<head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>COAST: Embedding Post-Processing & Compression Explorer</title><style>:root {--bg: #f8fafc;--surface: #ffffff;--border: #e2e8f0;--border-strong: #cbd5e1;--text: #0f172a;--text-muted: #475569;--accent: #1e293b;--accent-soft: #f1f5f9;--coast-bg: #f0f9ff;--coast-border: #0284c7;--font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;--mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;}* {3 unmodified lines}body {font-family: var(--font);background: var(--bg);color: var(--text);line-height: 1.45;padding: 20px 24px 40px;}.container {max-width: 1480px;margin: 0 auto;}header {margin-bottom: 16px;padding-bottom: 12px;border-bottom: 1px solid var(--border);display: flex;justify-content: space-between;align-items: flex-end;flex-wrap: wrap;gap: 12px;}h1 {font-size: 1.25rem;font-weight: 650;letter-spacing: -0.015em;color: var(--text);}.subtitle {font-size: 0.84rem;color: var(--text-muted);margin-top: 2px;}.btn-export {background: var(--accent);color: #fff;border: none;border-radius: 6px;padding: 7px 13px;font-size: 0.8rem;font-weight: 500;cursor: pointer;transition: opacity 0.15s;}.btn-export:hover {opacity: 0.88;}.controls-grid {display: grid;grid-template-columns: repeat(12, 1fr);gap: 10px;margin-bottom: 12px;}.panel {background: var(--surface);border: 1px solid var(--border);border-radius: 8px;padding: 10px 12px;}.col-3 { grid-column: span 3; }.col-4 { grid-column: span 4; }.col-6 { grid-column: span 6; }.col-8 { grid-column: span 8; }.col-12 { grid-column: span 12; }@media (max-width: 1024px) {.col-3, .col-4, .col-6, .col-8 { grid-column: span 12; }}.panel-header {display: flex;justify-content: space-between;align-items: center;margin-bottom: 7px;}.panel-label {font-size: 0.73rem;font-weight: 600;text-transform: uppercase;letter-spacing: 0.04em;color: var(--text-muted);}.quick-actions {display: flex;gap: 6px;}.quick-btn {background: none;border: none;font-size: 0.72rem;color: var(--text-muted);cursor: pointer;text-decoration: underline;}.quick-btn:hover {color: var(--text);}.pill-group {display: flex;flex-wrap: wrap;gap: 6px;}.pill {display: inline-flex;align-items: center;gap: 5px;padding: 4px 10px;font-size: 0.8rem;border: 1px solid var(--border-strong);border-radius: 5px;background: var(--surface);color: var(--text);cursor: pointer;user-select: none;transition: all 0.1s ease;}.pill:hover {background: var(--accent-soft);}.pill.active {background: var(--accent);color: #ffffff;border-color: var(--accent);font-weight: 500;}select {width: 100%;padding: 6px 10px;font-size: 0.82rem;font-family: var(--font);border: 1px solid var(--border-strong);border-radius: 5px;background: var(--surface);color: var(--text);outline: none;}.status-bar {display: flex;justify-content: space-between;align-items: center;padding: 8px 12px;background: var(--surface);border: 1px solid var(--border);border-bottom: none;border-radius: 8px 8px 0 0;font-size: 0.8rem;color: var(--text-muted);}.status-bar strong {color: var(--text);}.table-wrap {background: var(--surface);border: 1px solid var(--border);border-radius: 0 0 8px 8px;overflow-x: auto;max-height: 72vh;overflow-y: auto;}table {width: 100%;border-collapse: collapse;font-size: 0.81rem;white-space: nowrap;}thead th {position: sticky;top: 0;background: #f1f5f9;color: var(--text);font-weight: 600;text-align: right;padding: 8px 11px;border-bottom: 2px solid var(--border-strong);z-index: 2;}thead th.left {text-align: left;}tbody tr {border-bottom: 1px solid var(--border);}tbody tr:hover {background: #f8fafc;}tbody tr.coast-row {background: var(--coast-bg);}tbody tr.group-divider td {border-top: 2px solid var(--border-strong);}td {padding: 6px 11px;text-align: right;font-family: var(--mono);font-size: 0.79rem;}td.left {text-align: left;font-family: var(--font);font-size: 0.81rem;}td.method-coast {font-weight: 650;color: #0369a1;}td.best-cell {font-weight: 700;color: #0f172a;text-decoration: underline;text-underline-offset: 2px;}.hidden {4 unmodified lines<body><div class="container"><header><div><h1>COAST: Text Embedding Post-Processing & Compression Explorer</h1><div class="subtitle">Interactive evaluation across 4 transformer backbones, 2 pooling strategies, 6 MTEB v2 benchmarks, 14 main operators, and 16 component ablations (18,630 evaluated cells).</div></div><button class="btn-export" id="exportCsvBtn">Download Current Table (CSV)</button></header><!-- Row 1: Primary Scope --><div class="controls-grid"><div class="panel col-4"><div class="panel-header"><span class="panel-label">1. Evaluation View</span></div><div class="pill-group" id="evalViewGroup"></div></div><div class="panel col-3" id="trackPanel"><div class="panel-header"><span class="panel-label">2. Task Track</span></div><div class="pill-group" id="trackGroup"></div></div><div class="panel col-3" id="metricPanel"><div class="panel-header"><span class="panel-label" id="metricLabelTitle">3. Metric</span></div><select id="metricSelect"></select></div><div class="panel col-2" id="dimModePanel"><div class="panel-header"><span class="panel-label">4. Dimension Mode</span></div><div class="pill-group" id="dimModeGroup"></div></div></div><!-- Row 2: Compression Options (Shown only in Compression mode) --><div class="controls-grid hidden" id="compOptionsRow"><div class="panel col-6" id="kPanel"><div class="panel-header"><span class="panel-label">Target Dimensions (k)</span><div class="quick-actions"><button class="quick-btn" id="kAllBtn">All</button></div></div><div class="pill-group" id="kGroup"></div></div><div class="panel col-6" id="compDisplayPanel"><div class="panel-header"><span class="panel-label">Compression Cell Format</span></div><div class="pill-group" id="compDisplayGroup"></div></div></div><!-- Row 3: Benchmarks, Method Group, and Displayed Columns --><div class="controls-grid"><div class="panel col-4"><div class="panel-header"><span class="panel-label">Benchmarks</span><div class="quick-actions"><button class="quick-btn" id="dsAllBtn">All</button></div></div><div class="pill-group" id="datasetGroup"></div></div><div class="panel col-3" id="methodGroupPanel"><div class="panel-header"><span class="panel-label">Method Set</span></div><div class="pill-group" id="methodGroup"></div></div><div class="panel col-5" id="colsPanel"><div class="panel-header"><span class="panel-label">Displayed Models & Category Means</span><div class="quick-actions"><button class="quick-btn" id="colsAllBtn">All</button><button class="quick-btn" id="colsModelsBtn">Models Only</button><button class="quick-btn" id="colsMeansBtn">Category Means Only</button></div></div><div class="pill-group" id="colsGroup"></div></div></div><!-- Row 4: Specific Methods Filter --><div class="controls-grid" id="methodsFilterRow"><div class="panel col-12"><div class="panel-header"><span class="panel-label">Methods / Operators</span><div class="quick-actions"><button class="quick-btn" id="methodsAllBtn">Select All</button></div></div><div class="pill-group" id="methodsGroup"></div></div></div><!-- Output Table --><div class="status-bar" id="statusBar">Loading data...</div><div class="table-wrap"><table id="resultsTable"><thead id="tableHead"></thead><tbody id="tableBody"></tbody></table>2 unmodified lines<script>let DATA = null;let currentRows = [];let currentColumns = [];const state = {evalView: "Task Performance",track: "Retrieval (IR)",metric: "nDCG@10",dimMode: "Full (k = d)",selectedK: new Set(["512", "256", "128", "64"]),compDisplay: "Score (Retention %)",datasets: new Set(),methodSet: "Main Methods",selectedMethods: new Set(),selectedCols: new Set(),};function getActiveDatasetPool() {if (state.evalView === "Task Performance") {return state.track === "Retrieval (IR)" ? DATA.ir_datasets : DATA.sts_datasets;}return DATA.all_datasets;}function getActiveMetricPool() {if (state.evalView === "Task Performance") {return state.track === "Retrieval (IR)" ? DATA.ir_metrics : DATA.sts_metrics;}3 unmodified linesreturn DATA.param_options;}function getActiveMethodPool() {const isFull = state.dimMode === "Full (k = d)";const mainList = isFull ? DATA.full_main_methods : DATA.comp_main_methods;const ablList = isFull ? DATA.full_ablation_methods : DATA.comp_ablation_methods;if (state.methodSet === "Main Methods") return mainList;if (state.methodSet === "Component Ablations") return ablList;return [...mainList, ...ablList];}function syncDependentState(resetDatasets = false, resetMethods = false) {const metricPool = getActiveMetricPool();if (!metricPool.includes(state.metric)) {state.metric = metricPool[0];}const dsPool = getActiveDatasetPool();if (resetDatasets) {state.datasets = new Set(dsPool);} else {const filtered = [...state.datasets].filter(d => dsPool.includes(d));state.datasets = new Set(filtered.length ? filtered : dsPool);}const methodPool = getActiveMethodPool();if (resetMethods) {state.selectedMethods = new Set(methodPool);} else {const filteredM = [...state.selectedMethods].filter(m => methodPool.includes(m));state.selectedMethods = new Set(filteredM.length ? filteredM : methodPool);}}function renderRadioPills(containerId, options, activeVal, onSelect) {const el = document.getElementById(containerId);el.innerHTML = "";options.forEach(opt => {const btn = document.createElement("button");btn.className = "pill" + (opt === activeVal ? " active" : "");btn.textContent = opt;btn.onclick = () => onSelect(opt);el.appendChild(btn);});}function renderMultiPills(containerId, options, activeSet, onToggle) {const el = document.getElementById(containerId);el.innerHTML = "";options.forEach(opt => {const btn = document.createElement("button");btn.className = "pill" + (activeSet.has(opt) ? " active" : "");btn.textContent = opt;btn.onclick = () => onToggle(opt);el.appendChild(btn);});}function renderControls() {const isTask = state.evalView === "Task Performance";const isGeom = state.evalView === "Intrinsic Geometry";const isParam = state.evalView === "Spectral Parameters";const isComp = state.dimMode === "Compression";renderRadioPills("evalViewGroup",["Task Performance", "Intrinsic Geometry", "Spectral Parameters"],state.evalView,val => {state.evalView = val;syncDependentState(true, false);renderAll();});const trackPanel = document.getElementById("trackPanel");trackPanel.classList.toggle("hidden", !isTask);renderRadioPills("trackGroup",["Retrieval (IR)", "Similarity (STS)"],state.track,val => {state.track = val;syncDependentState(true, false);renderAll();});document.getElementById("metricLabelTitle").textContent = isParam? "2. Parameter Table": isGeom? "2. Geometry Metric": "3. Task Metric";const metricSelect = document.getElementById("metricSelect");const metricPool = getActiveMetricPool();metricSelect.innerHTML = "";metricPool.forEach(m => {const opt = document.createElement("option");opt.value = m;opt.textContent = m;if (m === state.metric) opt.selected = true;metricSelect.appendChild(opt);});metricSelect.onchange = e => {state.metric = e.target.value;renderTableOnly();};const dimModePanel = document.getElementById("dimModePanel");dimModePanel.classList.toggle("hidden", isParam);renderRadioPills("dimModeGroup",["Full (k = d)", "Compression"],state.dimMode,val => {state.dimMode = val;syncDependentState(false, true);renderAll();});const compOptionsRow = document.getElementById("compOptionsRow");compOptionsRow.classList.toggle("hidden", isParam || !isComp);document.getElementById("compDisplayPanel").classList.toggle("hidden", !isTask || !isComp);renderMultiPills("kGroup", ["512", "256", "128", "64"], state.selectedK, val => {if (state.selectedK.has(val) && state.selectedK.size > 1) {state.selectedK.delete(val);} else {state.selectedK.add(val);}renderAll();});renderRadioPills("compDisplayGroup",["Score (Retention %)", "Absolute Score", "Retention %"],state.compDisplay,val => {state.compDisplay = val;renderAll();});const dsPool = getActiveDatasetPool();renderMultiPills("datasetGroup", dsPool, state.datasets, val => {if (state.datasets.has(val) && state.datasets.size > 1) {state.datasets.delete(val);} else {state.datasets.add(val);}renderAll();});document.getElementById("methodGroupPanel").classList.toggle("hidden", isParam);renderRadioPills("methodGroup",["Main Methods", "Component Ablations", "All"],state.methodSet,val => {state.methodSet = val;syncDependentState(false, true);renderAll();});const colPool =isParam || (isGeom && state.metric === "All 5 Geometry Metrics")? DATA.model_cols: DATA.all_display_cols;const activeColsSet = new Set([...state.selectedCols].filter(c => colPool.includes(c)));if (activeColsSet.size === 0) {colPool.forEach(c => state.selectedCols.add(c));}renderMultiPills("colsGroup", colPool, state.selectedCols, val => {if (state.selectedCols.has(val) && state.selectedCols.size > 1) {state.selectedCols.delete(val);} else {state.selectedCols.add(val);}renderAll();});const methodsFilterRow = document.getElementById("methodsFilterRow");methodsFilterRow.classList.toggle("hidden", isParam);const methodPool = getActiveMethodPool();renderMultiPills("methodsGroup", methodPool, state.selectedMethods, val => {if (state.selectedMethods.has(val) && state.selectedMethods.size > 1) {state.selectedMethods.delete(val);} else {state.selectedMethods.add(val);}renderAll();});}function parseLeadingFloat(cellVal) {if (cellVal === undefined || cellVal === null) return NaN;const m = String(cellVal).match(/^[-+]?\d*\.?\d+/);return m ? parseFloat(m[0]) : NaN;}function renderTableOnly() {const isTask = state.evalView === "Task Performance";const isGeom = state.evalView === "Intrinsic Geometry";const isParam = state.evalView === "Spectral Parameters";3 unmodified linesif (isTask) {key = isFull? `task_full::${state.track}::${state.metric}`: `task_comp::${state.track}::${state.metric}::${state.compDisplay}`;} else if (isGeom) {key = isFull ? `geom_full::${state.metric}` : `geom_comp::${state.metric}`;} else {key = `param::${state.metric}`;}const rawTable = DATA.tables[key] || [];const filteredRows = rawTable.filter(row => {if (row.Dataset && !state.datasets.has(row.Dataset)) return false;if (!isParam && !isFull && row.k && !state.selectedK.has(String(row.k))) return false;if (!isParam && row.Method && !state.selectedMethods.has(row.Method)) return false;if ((isParam || (isGeom && state.metric === "All 5 Geometry Metrics")) && row.Model) {if (!state.selectedCols.has(row.Model)) return false;}return true;});let cols = [];if (isParam) {cols = rawTable.length ? Object.keys(rawTable[0]) : [];} else if (isGeom && state.metric === "All 5 Geometry Metrics") {cols = ["Dataset", "k", "Model", "Method", "||μ||₂", "AvgCos", "MEV", "NID", "IsoScore"];} else {const activeDisplayCols = DATA.all_display_cols.filter(c => state.selectedCols.has(c));cols = ["Dataset", "k", "Method", ...activeDisplayCols];}currentRows = filteredRows;currentColumns = cols;// Determine best value per (Dataset, k, numeric column) group for Task & single-metric tablesconst bestMap = {};if (isTask || (isGeom && state.metric !== "All 5 Geometry Metrics")) {const lowerIsBetter =isGeom &&(state.metric === "Centroid Norm ||μ||₂" ||state.metric === "Average Cosine" ||state.metric === "MEV (Top-1)");const numCols = cols.slice(3);filteredRows.forEach(r => {const gKey = `${r.Dataset}||${r.k}`;if (!bestMap[gKey]) bestMap[gKey] = {};numCols.forEach(c => {const v = parseLeadingFloat(r[c]);if (!isNaN(v)) {if (bestMap[gKey][c] === undefined ||(lowerIsBetter ? v < bestMap[gKey][c] : v > bestMap[gKey][c])) {bestMap[gKey][c] = v;}}});});}const thead = document.getElementById("tableHead");const leftCols = new Set(["Dataset", "k", "Model", "Method"]);thead.innerHTML ="<tr>" +cols.map(c => `<th class="${leftCols.has(c) ? "left" : ""}">${c}</th>`).join("") +"</tr>";const tbody = document.getElementById("tableBody");let prevGroup = null;const htmlRows = filteredRows.map(r => {const groupId = `${r.Dataset}||${r.k || ""}||${r.Model || ""}`;const isNewGroup = prevGroup !== null && prevGroup !== groupId;prevGroup = groupId;const isCoast = r.Method === "COAST (Ours)";const trClasses = [];if (isCoast) trClasses.push("coast-row");if (isNewGroup) trClasses.push("group-divider");const gKey = `${r.Dataset}||${r.k}`;const tds = cols.map(c => {const val = r[c] !== undefined ? r[c] : "";const classes = [];if (leftCols.has(c)) classes.push("left");if (c === "Method" && isCoast) classes.push("method-coast");if (!leftCols.has(c) && bestMap[gKey] && bestMap[gKey][c] !== undefined) {const numVal = parseLeadingFloat(val);if (!isNaN(numVal) && Math.abs(numVal - bestMap[gKey][c]) < 1e-6) {classes.push("best-cell");}}return `<td class="${classes.join(" ")}">${val}</td>`;}).join("");return `<tr class="${trClasses.join(" ")}">${tds}</tr>`;});tbody.innerHTML = htmlRows.join("");const statusBar = document.getElementById("statusBar");statusBar.innerHTML = `<div><strong>View:</strong> ${state.evalView}${isTask ? ` | <strong>Track:</strong> ${state.track}` : ""} | <strong>Metric:</strong> ${state.metric}${!isParam ? ` | <strong>Dimension:</strong> ${state.dimMode}` : ""}</div><div><strong>${filteredRows.length}</strong> rows × <strong>${cols.length}</strong> columns</div>`;}function renderAll() {renderControls();renderTableOnly();}// Quick-select buttonsdocument.getElementById("kAllBtn").onclick = () => {state.selectedK = new Set(["512", "256", "128", "64"]);renderAll();};document.getElementById("dsAllBtn").onclick = () => {state.datasets = new Set(getActiveDatasetPool());renderAll();};document.getElementById("colsAllBtn").onclick = () => {state.selectedCols = new Set(DATA.all_display_cols);renderAll();};document.getElementById("colsModelsBtn").onclick = () => {state.selectedCols = new Set(DATA.model_cols);renderAll();};document.getElementById("colsMeansBtn").onclick = () => {state.selectedCols = new Set(DATA.cat_cols);renderAll();};document.getElementById("methodsAllBtn").onclick = () => {state.selectedMethods = new Set(getActiveMethodPool());renderAll();};document.getElementById("exportCsvBtn").onclick = () => {if (!currentRows.length || !currentColumns.length) return;const escapeCsv = v => {const s = String(v ?? "");return s.includes(",") || s.includes('"') ? `"${s.replace(/"/g, '""')}"` : s;};const lines = [currentColumns.map(escapeCsv).join(","),...currentRows.map(r => currentColumns.map(c => escapeCsv(r[c])).join(",")),];const blob = new Blob([lines.join("\n")], { type: "text/csv;charset=utf-8;" });const url = URL.createObjectURL(blob);const a = document.createElement("a");a.href = url;a.download = `coast_${state.evalView.toLowerCase().replace(/\s+/g, "_")}.csv`;a.click();URL.revokeObjectURL(url);};fetch("data.json").then(r => r.json()).then(d => {DATA = d;state.datasets = new Set(DATA.ir_datasets);state.selectedMethods = new Set(DATA.full_main_methods);state.selectedCols = new Set(DATA.all_display_cols);renderAll();});</script></body>2 unmodified lines34567891011121314151617181920213 unmodified lines2526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143154 unmodified lines3203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194202 unmodified lines4234244254264274284294304314324334344354364374384394404414424434444454464474484494504513 unmodified lines4554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665673 unmodified lines5715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238242 unmodified lines<head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>COAST — Representation Post-Processing & Compression</title><style>:root {--bg: #ffffff;--bg-subtle: #fbfbfb;--border: #e4e4e7;--border-dark: #18181b;--text: #18181b;--text-muted: #71717a;--text-faint: #a1a1aa;--row-highlight: #f4f4f5;--font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;}* {3 unmodified lines}body {font-family: var(--font-sans);background: var(--bg);color: var(--text);-webkit-font-smoothing: antialiased;line-height: 1.4;padding: 28px 32px 48px;}.container {max-width: 1440px;margin: 0 auto;}/* Header */header {display: flex;justify-content: space-between;align-items: baseline;padding-bottom: 18px;border-bottom: 1px solid var(--border);margin-bottom: 20px;gap: 16px;flex-wrap: wrap;}.title-group {display: flex;align-items: baseline;gap: 12px;flex-wrap: wrap;}h1 {font-size: 1.15rem;font-weight: 600;letter-spacing: -0.01em;color: var(--text);}.subtitle {font-size: 0.85rem;color: var(--text-muted);}.btn-export {background: var(--text);color: #ffffff;border: 1px solid var(--text);border-radius: 4px;padding: 5px 12px;font-size: 0.78rem;font-weight: 500;cursor: pointer;transition: background 0.1s ease;letter-spacing: 0.01em;}.btn-export:hover {background: #27272a;}/* Single-Line Minimal Toolbar */.toolbar {display: flex;flex-wrap: wrap;align-items: center;gap: 12px;padding: 10px 14px;background: var(--bg-subtle);border: 1px solid var(--border);border-radius: 6px;margin-bottom: 14px;}.toolbar-group {display: inline-flex;align-items: center;gap: 6px;}.toolbar-label {font-size: 0.72rem;text-transform: uppercase;letter-spacing: 0.05em;color: var(--text-muted);font-weight: 600;margin-right: 2px;}.divider {width: 1px;height: 20px;background: var(--border);margin: 0 4px;}/* Segmented Controls */.segmented {display: inline-flex;background: #f4f4f5;border-radius: 4px;padding: 2px;border: 1px solid var(--border);}.segmented button {background: transparent;border: none;padding: 4px 10px;font-size: 0.78rem;font-weight: 500;color: var(--text-muted);border-radius: 3px;cursor: pointer;transition: all 0.1s ease;}.segmented button.active {background: var(--text);color: #ffffff;}/* Minimal Dropdown */select {background: var(--bg);border: 1px solid var(--border);border-radius: 4px;padding: 4px 10px;font-size: 0.78rem;color: var(--text);font-family: inherit;cursor: pointer;outline: none;}select:focus {border-color: var(--text);}/* Filter Chips Row */.filters-row {display: flex;align-items: center;gap: 16px;margin-bottom: 16px;font-size: 0.78rem;color: var(--text-muted);flex-wrap: wrap;}.chip-group {display: inline-flex;align-items: center;gap: 4px;flex-wrap: wrap;}.chip {background: transparent;border: 1px solid var(--border);border-radius: 3px;padding: 2px 8px;font-size: 0.75rem;color: var(--text-muted);cursor: pointer;transition: all 0.1s;}.chip.active {background: #f4f4f5;color: var(--text);border-color: var(--text-faint);font-weight: 500;}.chip:hover {border-color: var(--text-faint);}/* Status Text */.status-summary {display: flex;justify-content: space-between;align-items: center;font-size: 0.75rem;color: var(--text-muted);margin-bottom: 8px;padding: 0 2px;}.status-summary strong {color: var(--text);font-weight: 600;}/* Academic Booktabs Table */.table-container {border-top: 2px solid var(--border-dark);border-bottom: 2px solid var(--border-dark);overflow-x: auto;max-height: 74vh;background: #ffffff;}table {width: 100%;border-collapse: collapse;font-size: 0.8rem;white-space: nowrap;}thead {position: sticky;top: 0;background: #ffffff;z-index: 2;}thead tr.super-header th {font-size: 0.7rem;text-transform: uppercase;letter-spacing: 0.05em;color: var(--text-muted);font-weight: 600;padding: 6px 12px 4px;border-bottom: 1px solid var(--border);text-align: center;}thead tr.sub-header th {font-size: 0.72rem;text-transform: uppercase;letter-spacing: 0.05em;color: var(--text);font-weight: 600;padding: 6px 12px 8px;border-bottom: 1px solid var(--border-dark);text-align: right;}thead tr.sub-header th.left,thead tr.super-header th.left {text-align: left;}tbody tr {border-bottom: 1px solid #f4f4f5;}tbody tr:hover {background: #fafafa;}tbody tr.coast-row {background: var(--row-highlight);}tbody tr.group-boundary td {border-top: 1px solid #d4d4d8;}td {padding: 5px 12px;text-align: right;font-family: var(--font-mono);font-size: 0.78rem;font-variant-numeric: tabular-nums;color: #27272a;}td.left {text-align: left;font-family: var(--font-sans);font-size: 0.79rem;color: var(--text);}td.method-coast {font-weight: 600;color: var(--text);}td.best-score {font-weight: 700;color: #000000;}.hidden {4 unmodified lines<body><div class="container"><header><div class="title-group"><h1>COAST</h1><div class="subtitle">Representation Post-Processing & Compression Benchmark</div></div><button class="btn-export" id="exportBtn">Export CSV</button></header><!-- Toolbar: Clean Segmented Controls in One Row --><div class="toolbar"><div class="toolbar-group"><span class="toolbar-label">View</span><div class="segmented" id="segEvalView"><button class="active" data-val="Task Performance">Task Performance</button><button data-val="Intrinsic Geometry">Geometry</button><button data-val="Spectral Parameters">Parameters</button></div></div><div class="divider" id="divTrack"></div><div class="toolbar-group" id="groupTrack"><span class="toolbar-label">Track</span><div class="segmented" id="segTrack"><button class="active" data-val="Retrieval (IR)">Retrieval (IR)</button><button data-val="Similarity (STS)">Similarity (STS)</button></div></div><div class="divider" id="divMetric"></div><div class="toolbar-group" id="groupMetric"><span class="toolbar-label" id="labelMetric">Metric</span><select id="selectMetric"></select></div><div class="divider" id="divDim"></div><div class="toolbar-group" id="groupDim"><span class="toolbar-label">Dim</span><div class="segmented" id="segDim"><button class="active" data-val="Full (k = d)">Full (k = d)</button><button data-val="Compression">Compressed</button></div></div><div class="divider" id="divMethodSet"></div><div class="toolbar-group" id="groupMethodSet"><span class="toolbar-label">Methods</span><div class="segmented" id="segMethodSet"><button class="active" data-val="Main Methods">Main (9)</button><button data-val="Component Ablations">Ablations (8)</button><button data-val="All">All (17)</button></div></div><div class="divider hidden" id="divFormat"></div><div class="toolbar-group hidden" id="groupFormat"><span class="toolbar-label">Format</span><div class="segmented" id="segFormat"><button class="active" data-val="Score (Retention %)">Score (Ret%)</button><button data-val="Absolute Score">Score</button><button data-val="Retention %">Ret%</button></div></div></div><!-- Secondary Filters Row: Datasets, Dimensions, Columns --><div class="filters-row"><div class="chip-group" id="chipsDataset"><span class="toolbar-label">Benchmarks:</span></div><div class="chip-group hidden" id="chipsK"><span class="toolbar-label">k:</span></div><div class="chip-group" id="chipsCols"><span class="toolbar-label">Cols:</span><button class="chip active" id="chipColsAll">All Models + Means</button><button class="chip" id="chipColsModels">Models Only</button><button class="chip" id="chipColsMeans">Means Only</button></div></div><!-- Summary Bar --><div class="status-summary"><div id="statusInfo">Loading data...</div><div id="statusDims"></div></div><!-- Table --><div class="table-container"><table id="dataTable"><thead id="tableHead"></thead><tbody id="tableBody"></tbody></table>2 unmodified lines<script>let DATA = null;let exportRows = [];let exportCols = [];const state = {evalView: "Task Performance",track: "Retrieval (IR)",metric: "nDCG@10",dimMode: "Full (k = d)",methodSet: "Main Methods",compFormat: "Score (Retention %)",activeDatasets: new Set(),activeK: new Set(["512", "256", "128", "64"]),colMode: "all", // "all", "models", "means"};function getDatasetPool() {if (state.evalView === "Task Performance") {return state.track === "Retrieval (IR)" ? DATA.ir_datasets : DATA.sts_datasets;}return DATA.all_datasets;}function getMetricPool() {if (state.evalView === "Task Performance") {return state.track === "Retrieval (IR)" ? DATA.ir_metrics : DATA.sts_metrics;}3 unmodified linesreturn DATA.param_options;}function syncState() {const metrics = getMetricPool();if (!metrics.includes(state.metric)) {state.metric = metrics[0];}const dsPool = getDatasetPool();const valid = [...state.activeDatasets].filter(d => dsPool.includes(d));state.activeDatasets = new Set(valid.length ? valid : dsPool);}function renderToolbarControls() {const isTask = state.evalView === "Task Performance";const isGeom = state.evalView === "Intrinsic Geometry";const isParam = state.evalView === "Spectral Parameters";const isComp = state.dimMode === "Compression";// Track paneldocument.getElementById("divTrack").classList.toggle("hidden", !isTask);document.getElementById("groupTrack").classList.toggle("hidden", !isTask);// Dim paneldocument.getElementById("divDim").classList.toggle("hidden", isParam);document.getElementById("groupDim").classList.toggle("hidden", isParam);// Method Set paneldocument.getElementById("divMethodSet").classList.toggle("hidden", isParam);document.getElementById("groupMethodSet").classList.toggle("hidden", isParam);// Format paneldocument.getElementById("divFormat").classList.toggle("hidden", !isTask || !isComp);document.getElementById("groupFormat").classList.toggle("hidden", !isTask || !isComp);// Metric dropdowndocument.getElementById("labelMetric").textContent = isParam ? "Table" : "Metric";const selMetric = document.getElementById("selectMetric");selMetric.innerHTML = "";getMetricPool().forEach(m => {const opt = document.createElement("option");opt.value = m;opt.textContent = m;if (m === state.metric) opt.selected = true;selMetric.appendChild(opt);});// Dataset chipsconst chipsDs = document.getElementById("chipsDataset");chipsDs.innerHTML = '<span class="toolbar-label">Benchmarks:</span>';getDatasetPool().forEach(ds => {const btn = document.createElement("button");btn.className = "chip" + (state.activeDatasets.has(ds) ? " active" : "");btn.textContent = ds;btn.onclick = () => {if (state.activeDatasets.has(ds) && state.activeDatasets.size > 1) {state.activeDatasets.delete(ds);} else {state.activeDatasets.add(ds);}renderChips();renderTable();};chipsDs.appendChild(btn);});// K chips (compression only)const chipsK = document.getElementById("chipsK");chipsK.classList.toggle("hidden", isParam || !isComp);chipsK.innerHTML = '<span class="toolbar-label">k:</span>';["512", "256", "128", "64"].forEach(k => {const btn = document.createElement("button");btn.className = "chip" + (state.activeK.has(k) ? " active" : "");btn.textContent = k;btn.onclick = () => {if (state.activeK.has(k) && state.activeK.size > 1) {state.activeK.delete(k);} else {state.activeK.add(k);}renderChips();renderTable();};chipsK.appendChild(btn);});// Column chips (hidden for parameters)document.getElementById("chipsCols").classList.toggle("hidden", isParam);}function renderChips() {// Re-render active states on chipsdocument.querySelectorAll("#chipsDataset .chip").forEach(btn => {btn.classList.toggle("active", state.activeDatasets.has(btn.textContent));});document.querySelectorAll("#chipsK .chip").forEach(btn => {btn.classList.toggle("active", state.activeK.has(btn.textContent));});document.getElementById("chipColsAll").classList.toggle("active", state.colMode === "all");document.getElementById("chipColsModels").classList.toggle("active", state.colMode === "models");document.getElementById("chipColsMeans").classList.toggle("active", state.colMode === "means");}function parseNumeric(val) {if (val === undefined || val === null) return NaN;const m = String(val).match(/^[-+]?\d*\.?\d+/);return m ? parseFloat(m[0]) : NaN;}function renderTable() {const isTask = state.evalView === "Task Performance";const isGeom = state.evalView === "Intrinsic Geometry";const isParam = state.evalView === "Spectral Parameters";3 unmodified linesif (isTask) {key = isFull? `task_full::${state.track}::${state.metric}`: `task_comp::${state.track}::${state.metric}::${state.compFormat}`;} else if (isGeom) {key = isFull ? `geom_full::${state.metric}` : `geom_comp::${state.metric}`;} else {key = `param::${state.metric}`;}const raw = DATA.tables[key] || [];// Determine methods filterlet allowedMethods = null;if (!isParam) {const main = isFull ? DATA.full_main_methods : DATA.comp_main_methods;const abl = isFull ? DATA.full_ablation_methods : DATA.comp_ablation_methods;if (state.methodSet === "Main Methods") allowedMethods = new Set(main);else if (state.methodSet === "Component Ablations") allowedMethods = new Set(abl);else allowedMethods = new Set([...main, ...abl]);}// Filter rowsconst rows = raw.filter(r => {if (r.Dataset && !state.activeDatasets.has(r.Dataset)) return false;if (!isParam && !isFull && r.k && !state.activeK.has(String(r.k))) return false;if (allowedMethods && r.Method && !allowedMethods.has(r.Method)) return false;return true;});// Filter columns based on colModelet cols = [];if (isParam) {cols = raw.length ? Object.keys(raw[0]) : [];} else if (isGeom && state.metric === "All 5 Geometry Metrics") {cols = ["Dataset", "k", "Model", "Method", "||μ||₂", "AvgCos", "MEV", "NID", "IsoScore"];} else {const baseCols = ["Dataset", "k", "Method"];let metricCols = [];if (state.colMode === "all") metricCols = DATA.all_display_cols;else if (state.colMode === "models") metricCols = DATA.model_cols;else metricCols = DATA.cat_cols;cols = [...baseCols, ...metricCols];}exportRows = rows;exportCols = cols;// Find best cell per (Dataset, k) group for boldingconst bestMap = {};if (isTask || (isGeom && state.metric !== "All 5 Geometry Metrics")) {const lowerIsBetter = isGeom && ["Centroid Norm ||μ||₂", "Average Cosine", "MEV (Top-1)"].includes(state.metric);const dataCols = cols.slice(3);rows.forEach(r => {const gKey = `${r.Dataset}||${r.k}`;if (!bestMap[gKey]) bestMap[gKey] = {};dataCols.forEach(c => {const num = parseNumeric(r[c]);if (!isNaN(num)) {if (bestMap[gKey][c] === undefined || (lowerIsBetter ? num < bestMap[gKey][c] : num > bestMap[gKey][c])) {bestMap[gKey][c] = num;}}});});}// Build Headersconst thead = document.getElementById("tableHead");const leftCols = new Set(["Dataset", "k", "Model", "Method"]);if (isTask || (isGeom && state.metric !== "All 5 Geometry Metrics")) {// Double-decker academic header with column groupslet superHtml = '<tr class="super-header"><th colspan="3" class="left">Specification</th>';if (state.colMode === "all") {superHtml += '<th colspan="2">Dedicated Encoders</th><th colspan="2">Gemma-3-1B-pt</th><th colspan="2">Qwen3.5-0.8B-Base</th><th colspan="3">Category Means</th>';} else if (state.colMode === "models") {superHtml += '<th colspan="2">Dedicated Encoders</th><th colspan="2">Gemma-3-1B-pt</th><th colspan="2">Qwen3.5-0.8B-Base</th>';} else {superHtml += '<th colspan="3">Category Means</th>';}superHtml += '</tr>';let subHtml = '<tr class="sub-header">';cols.forEach(c => {let label = c;if (c === "Gemma3-Mean" || c === "Qwen3.5-Mean") label = "Mean";if (c === "Gemma3-Last" || c === "Qwen3.5-Last") label = "Last";if (c === "Dedicated Mean") label = "Ded.";if (c === "Base-Mean") label = "Base-M";if (c === "Base-Last") label = "Base-L";subHtml += `<th class="${leftCols.has(c) ? 'left' : ''}">${label}</th>`;});subHtml += '</tr>';thead.innerHTML = superHtml + subHtml;} else {let subHtml = '<tr class="sub-header">';cols.forEach(c => {subHtml += `<th class="${leftCols.has(c) ? 'left' : ''}">${c}</th>`;});subHtml += '</tr>';thead.innerHTML = subHtml;}// Build Bodyconst tbody = document.getElementById("tableBody");let prevGroup = null;const htmlRows = rows.map(r => {const groupId = `${r.Dataset}||${r.k || ""}||${r.Model || ""}`;const isBoundary = prevGroup !== null && prevGroup !== groupId;prevGroup = groupId;const isCoast = r.Method === "COAST (Ours)";const trCls = [];if (isCoast) trCls.push("coast-row");if (isBoundary) trCls.push("group-boundary");const gKey = `${r.Dataset}||${r.k}`;const tds = cols.map(c => {const val = r[c] !== undefined ? r[c] : "";const cls = [];if (leftCols.has(c)) cls.push("left");if (c === "Method" && isCoast) cls.push("method-coast");if (!leftCols.has(c) && bestMap[gKey] && bestMap[gKey][c] !== undefined) {const num = parseNumeric(val);if (!isNaN(num) && Math.abs(num - bestMap[gKey][c]) < 1e-6) {cls.push("best-score");}}return `<td class="${cls.join(' ')}">${val}</td>`;}).join("");return `<tr class="${trCls.join(' ')}">${tds}</tr>`;});tbody.innerHTML = htmlRows.join("");// Status textdocument.getElementById("statusInfo").innerHTML = `<strong>${state.evalView}</strong> — ${isTask ? `${state.track} | ` : ""}${state.metric}${!isParam ? ` | ${state.dimMode}` : ""}`;document.getElementById("statusDims").textContent = `${rows.length} rows × ${cols.length} cols`;}function initEvents() {// Segmented control bindsdocument.querySelectorAll("#segEvalView button").forEach(btn => {btn.onclick = () => {document.querySelectorAll("#segEvalView button").forEach(b => b.classList.remove("active"));btn.classList.add("active");state.evalView = btn.dataset.val;syncState();renderToolbarControls();renderChips();renderTable();};});document.querySelectorAll("#segTrack button").forEach(btn => {btn.onclick = () => {document.querySelectorAll("#segTrack button").forEach(b => b.classList.remove("active"));btn.classList.add("active");state.track = btn.dataset.val;syncState();renderToolbarControls();renderChips();renderTable();};});document.getElementById("selectMetric").onchange = e => {state.metric = e.target.value;renderTable();};document.querySelectorAll("#segDim button").forEach(btn => {btn.onclick = () => {document.querySelectorAll("#segDim button").forEach(b => b.classList.remove("active"));btn.classList.add("active");state.dimMode = btn.dataset.val;renderToolbarControls();renderChips();renderTable();};});document.querySelectorAll("#segMethodSet button").forEach(btn => {btn.onclick = () => {document.querySelectorAll("#segMethodSet button").forEach(b => b.classList.remove("active"));btn.classList.add("active");state.methodSet = btn.dataset.val;renderTable();};});document.querySelectorAll("#segFormat button").forEach(btn => {btn.onclick = () => {document.querySelectorAll("#segFormat button").forEach(b => b.classList.remove("active"));btn.classList.add("active");state.compFormat = btn.dataset.val;renderTable();};});document.getElementById("chipColsAll").onclick = () => {state.colMode = "all";renderChips();renderTable();};document.getElementById("chipColsModels").onclick = () => {state.colMode = "models";renderChips();renderTable();};document.getElementById("chipColsMeans").onclick = () => {state.colMode = "means";renderChips();renderTable();};document.getElementById("exportBtn").onclick = () => {if (!exportRows.length || !exportCols.length) return;const esc = v => {const s = String(v ?? "");return s.includes(",") || s.includes('"') ? `"${s.replace(/"/g, '""')}"` : s;};const lines = [exportCols.map(esc).join(","),...exportRows.map(r => exportCols.map(c => esc(r[c])).join(",")),];const blob = new Blob([lines.join("\n")], { type: "text/csv;charset=utf-8;" });const url = URL.createObjectURL(blob);const a = document.createElement("a");a.href = url;a.download = `coast_${state.evalView.toLowerCase().replace(/[^a-z0-9]/g, "_")}.csv`;a.click();URL.revokeObjectURL(url);};}fetch("data.json").then(r => r.json()).then(d => {DATA = d;state.activeDatasets = new Set(DATA.ir_datasets);initEvents();syncState();renderToolbarControls();renderChips();renderTable();});</script></body>
index.html+533-511