(() => { 'use strict'; const data = window.AML_HF_CYCLE2; const tracks = { textual: 'Textual Memory', multimodal: 'Multimodal Memory', coding: 'Coding Memory' }; const divisions = { academic: 'Open-source Methods', closed: 'Closed-source Methods', commercial: 'Commercial Products' }; const boardPrefixes = {academic:'academic',closed:'closed',commercial:'industry'}; const overall = { label: 'Overall', metrics: null }; const textAxes = ['A', 'B', 'C', 'D', 'E', 'G', 'H']; const firstCycleLabels = { Q: 'Fact Recall', R: 'Composition', S: 'Temporal', T: 'Governance', U: 'Personalization', V: 'Execution', W: 'Safety', X: 'Streaming' }; const node = (tag, cls, text) => { const element = document.createElement(tag); if (cls) element.className = cls; if (text !== undefined) element.textContent = text; return element; }; const safeUrl = value => { try { const u = new URL(value); return ['https:', 'http:'].includes(u.protocol) && !u.username && !u.password ? u.href : ''; } catch { return ''; } }; const isGitHub = url => /^https?:\/\/(?:www\.)?github\.com\//i.test(url); const board = () => data.boards[boardPrefixes[state.division]+'-'+state.track]; const stripMarker = label => label.replace(/^[A-H]\s*·\s*/, ''); function identity(entry, division) { const system = node('span', 'system-cell'); system.title = entry.name; system.append(node('strong', '', entry.name)); const meta = node('span', 'system-meta'); if (division === 'academic') { const repo = safeUrl(entry.repo); if (isGitHub(repo)) meta.append(renderGithubIconLink(repo, entry.name)); if (entry.version) { const badge = node('small', 'system-version', entry.version); badge.dataset.tooltip = entry.version; badge.tabIndex = 0; badge.setAttribute('aria-label', 'Version ' + entry.version); attachBadgeTooltip(badge); meta.append(badge); } } else { if (entry.organization) { const org = node('small', 'system-cate', entry.organization); org.title = entry.organization; meta.append(org); } const url = safeUrl(entry.product_url); if (url) { const link = isGitHub(url) ? renderGithubIconLink(url, entry.name) : node('a', 'github-icon-link', '↗'); link.href = url; link.target = '_blank'; link.rel = 'noopener noreferrer'; link.title = 'Product page'; link.setAttribute('aria-label', 'Open ' + entry.name + ' product page'); meta.append(link); } } if (meta.childElementCount) system.append(meta); return system; } function statusCell(entry, column) { const value = entry.tiers[column.metricId]; let cell; if (column.tierFamily === 'returnSize') { cell = renderStatusCell(({ low: 'Compact', medium: 'Balanced', high: 'Verbose' })[value], 'volume'); } else if (column.tierFamily === 'time') { cell = renderStatusCell(({ fast: 'Fast', moderate: 'Medium', slow: 'Slow' })[value], 'speed'); } else { cell = renderStatusCell(({ low: 'Fast', medium: 'Medium', high: 'Slow' })[value], 'speed'); cell.querySelector('.speed-inline span:last-child').textContent = ({ low: 'Low', medium: 'Medium', high: 'High' })[value] ?? '--'; } return cell; } function overviewMetric(b, c) { let label = b.track === 'textual' ? (firstCycleLabels[c.id] || c.label) : stripMarker(c.label); if (c.kind === 'tier' && /^(?:Input|Output) Tokens\b/.test(label)) { label = label.replace(/(?: \(est\.\))?$/, ' (est.)'); } if (b.track === 'coding' && c.kind !== 'tier') { label = label.replace(/^(Relevant|Noisy) · Overall Resolved \(%\)$/, '$1 · Task Solve (%)') .replace(/^(.* · (?:New Feature|Bug Fix)) \(%\)$/, '$1'); } return { ...c, label, value: row => row.scores[c.id] }; } function categories(b) { const efficiency = b.columns.filter(c => c.kind === 'tier').map(c => overviewMetric(b,c)); if (b.track === 'coding') { return [overall, ...['newFeature', 'bugFix'].map((metric, index) => ({ label: leaderboardConfig.coding.categories[index+1][0], description: leaderboardConfig.coding.categories[index+1][1], targets: ['relevant.' + metric, 'noisy.' + metric], metrics: b.columns.filter(c => c.id.endsWith('.' + metric)).map(c => overviewMetric(b,c)).concat(efficiency), }))]; } return [overall, ...b.dimensions.map((dimension, index) => { const label = b.track === 'textual' ? leaderboardConfig.textual.categories[index+1][0] : dimension.label; if (b.track === 'textual' && textAxes[index] !== dimension.id) throw new Error('Unexpected textual category order'); const primary = { id: 'category', kind: 'score', label, value: row => row.capabilities[dimension.id] }; return { label, description: b.track === 'textual' ? leaderboardConfig.textual.categories[index+1][1] : '', targets: [b.columns[index+1].id], rankByCategory: true, metrics: [primary, ...dimension.leaves.map(leaf => ({ id: leaf.id, kind: 'score', label: leaf.label, value: row => row.leaves[leaf.id], })), ...efficiency], }; })]; } function jumpTo(index) { state.category = index; renderLeaderboard(); document.getElementById('leaderboard-table').scrollIntoView({ behavior: 'smooth', block: 'start' }); } function renderTable(b, category, allCategories) { const metrics = category.metrics || b.columns.map(c => overviewMetric(b,c)); const header = document.getElementById('table-header'); const table = document.getElementById('leaderboard-table'); header.style.setProperty('--metric-count', metrics.length); table.style.setProperty('--metric-count', metrics.length); header.replaceChildren(node('span', '', 'Rank'), node('span', '', 'System')); for (const metric of metrics) { const target = metric.id === 'D' || metric.id === 'category' ? 0 : allCategories.findIndex(c => c.targets?.includes(metric.id)); let cell; if (target >= 0) { cell = node('button', 'header-link', metric.label); cell.type = 'button'; cell.addEventListener('click', () => jumpTo(target)); } else { cell = node('span', '', metric.label); } cell.dataset.metric = metric.id; header.append(cell); } const rows = category.rankByCategory ? [...b.rows].sort((x,y) => (metrics[0].value(y) ?? -Infinity) - (metrics[0].value(x) ?? -Infinity) || x.rank-y.rank) : b.rows; const tiers = metrics.map(c => c.kind === 'tier' ? [] : getColumnTiers(rows.map(row => ({ value: c.value(row) })), 'value')); table.replaceChildren(); rows.forEach(entry => { const rank = entry.rank; const row = node('article', rank <= 3 ? 'leaderboard-row is-podium-row' : 'leaderboard-row'); row.dataset.rowId = entry.id; const number = node('span', rank <= 3 ? 'rank-cell rank-medal rank-medal-' + rank : 'rank-cell', ({1:'🥇',2:'🥈',3:'🥉'})[rank] || String(rank).padStart(2, '0')); number.setAttribute('aria-label', 'Rank ' + rank); row.append(number, identity(entry,b.division)); metrics.forEach((metric, i) => { const value = metric.value(entry); const cell = metric.kind === 'tier' ? statusCell(entry,metric) : renderScoreCell(value, getScoreTier(value,tiers[i])); cell.dataset.metric = metric.id; row.append(cell); }); table.append(row); }); } const featuredOrganizations = [ ['Shopee', ['Shopee'], 'shopee.svg', true], ['Alibaba Cloud', ['Alibaba Cloud DMS Team'], 'alibabacloud.svg', true], ['OceanBase', ['OceanBase'], 'cycle2-oceanbase.jpg', true], ['OPPO', ['OPPO'], 'oppo.svg'], ['Lenovo', ['联想天禧', '联想'], 'lenovo.svg'], ['KT', ['KT'], 'kt.svg'], ['海致星图', ['海致星图']], ['MemoraX', ['深圳忆纪元科技有限公司'], 'partner-memorax.svg'], ]; function renderAcknowledgements(b) { const section = document.getElementById('commercial-ack'); section.hidden = b.division !== 'commercial'; if (section.hidden || section.dataset.track === b.track) return; const registered = new Set(b.rows.map(row => row.organization)); const matches = featuredOrganizations.filter(([, names]) => names.some(name => registered.has(name))); const rail = section.querySelector('.commercial-logo-track'); rail.replaceChildren(); if (!matches.length) { section.hidden = true; return; } section.dataset.track = b.track; // Fill wide displays even for tracks with only a few featured organizations. const repeats = Math.ceil(8 / matches.length); for (let pass = 0; pass < 3 * repeats; pass++) { for (const [label, , file, withText] of matches) { const tile = node('span', 'logo-tile' + (withText ? ' logo-tile-with-label' : '')); if (pass) tile.setAttribute('aria-hidden', 'true'); if (file) { const image = node('img', withText ? '' : 'ack-wordmark'); image.alt = withText || pass ? '' : label; image.src = 'assets/partners/' + file; tile.append(image); } if (withText || !file) tile.append(node('span', 'ack-org-name', label)); rail.append(tile); } } } renderLeaderboard = () => { const b = board(); const all = categories(b); if (!all[state.category]) state.category = 0; const category = all[state.category]; document.getElementById('result-kicker').textContent = tracks[b.track] + ' · ' + divisions[b.division]; document.getElementById('result-title').textContent = state.category ? category.label : 'Overall'; document.getElementById('result-description').textContent = category.description || ''; renderAcknowledgements(b); const tabs = document.getElementById('category-tabs'); tabs.replaceChildren(); all.forEach((item, index) => { const button = node('button', index === state.category ? 'is-active' : '', item.label); button.type = 'button'; button.role = 'tab'; button.setAttribute('aria-selected', String(index === state.category)); button.addEventListener('click', () => { state.category = index; renderLeaderboard(); }); tabs.append(button); }); renderTable(b,category,all); }; window.AML_HF_PREVIEW = { board, render: renderLeaderboard, data }; renderLeaderboard(); setView(state.view, false); })();