File size: 16,685 Bytes
d06ea3c
 
 
 
 
 
 
 
 
 
 
 
134a886
 
 
 
d06ea3c
 
 
 
 
134a886
d06ea3c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7a26229
d06ea3c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134a886
d06ea3c
 
7c48b76
d06ea3c
 
 
134a886
 
d06ea3c
134a886
d06ea3c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134a886
 
d06ea3c
 
 
 
 
 
 
 
 
 
134a886
d06ea3c
 
 
 
 
7c48b76
 
 
d06ea3c
 
 
7c48b76
d06ea3c
 
 
 
 
134a886
d06ea3c
134a886
d06ea3c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7a26229
d06ea3c
 
7a26229
d06ea3c
 
 
 
 
7a26229
d06ea3c
 
 
7a26229
d06ea3c
 
 
134a886
 
 
 
 
 
d06ea3c
134a886
d06ea3c
 
 
 
134a886
 
d06ea3c
 
 
 
 
 
 
 
 
 
 
 
134a886
 
d06ea3c
134a886
 
d06ea3c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134a886
d06ea3c
 
134a886
7c48b76
d06ea3c
134a886
 
7c48b76
7a26229
 
7c48b76
134a886
d06ea3c
 
 
 
134a886
 
 
 
 
 
 
 
 
 
 
 
 
 
7a26229
d06ea3c
 
 
 
 
 
134a886
d06ea3c
134a886
 
 
 
d06ea3c
 
 
 
 
134a886
d06ea3c
134a886
 
 
 
d06ea3c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
<div class="base-model-performance"></div>

<style>
    .base-model-performance {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
        max-width: 900px;
        margin: 0 auto;
    }

    .base-model-performance .chart-container {
        position: relative;
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        aspect-ratio: 1.5 / 1;
    }

    .base-model-performance svg {
        width: 100%;
        height: 100%;
        display: block;
    }

    .base-model-performance .axis-line {
        stroke: var(--border-color);
        stroke-width: 2;
    }

    .base-model-performance .axis-label {
        fill: var(--text-color);
        font-size: 16px;
        font-weight: 600;
    }

    .base-model-performance .axis-sublabel {
        fill: var(--muted-color);
        font-size: 13px;
    }

    .base-model-performance .tick-line {
        stroke: var(--border-color);
        stroke-width: 1;
        opacity: 0.3;
    }

    .base-model-performance .tick-label {
        fill: var(--muted-color);
        font-size: 12px;
    }

    .base-model-performance .pareto-zone {
        fill: var(--text-color);
        opacity: 0.08;
    }

    .base-model-performance .pareto-border {
        stroke: var(--border-color);
        stroke-width: 2;
        fill: none;
        stroke-dasharray: 5, 5;
    }


    .base-model-performance .model-circle {
        /* stroke is set dynamically in JavaScript */
    }

    .base-model-performance .model-icon {
        font-size: 32px;
    }

    .base-model-performance .model-label {
        fill: var(--text-color);
        font-size: 14px;
        font-weight: 600;
        text-anchor: middle;
        pointer-events: none;
    }

    .base-model-performance .model-sublabel {
        fill: var(--muted-color);
        font-size: 12px;
        text-anchor: middle;
        pointer-events: none;
    }

    .base-model-performance .arrow {
        stroke: var(--muted-color);
        stroke-width: 2.5;
        fill: none;
        marker-end: url(#arrowhead);
        opacity: 0.4;
    }

    .base-model-performance .arrow-label {
        fill: var(--text-color);
        font-size: 14px;
        font-weight: 600;
        letter-spacing: 0.3px;
    }


    .base-model-performance .legend {
        margin-top: 20px;
        display: flex;
        flex-wrap: wrap;
        gap: 16px;
        justify-content: center;
    }

    .base-model-performance .legend-item {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 13px;
        color: var(--muted-color);
    }

    .base-model-performance .legend-icon {
        font-size: 20px;
    }

    @media (max-width: 768px) {
        .base-model-performance .chart-container {
            height: 500px;
        }

        .base-model-performance .axis-label {
            font-size: 14px;
        }

        .base-model-performance .model-label {
            font-size: 12px;
        }

        .base-model-performance .arrow-label {
            font-size: 14px;
        }
    }
</style>

<script>
    (() => {
        const bootstrap = () => {
            const scriptEl = document.currentScript;
            let container = scriptEl ? scriptEl.previousElementSibling : null;
            if (!(container && container.classList && container.classList.contains('base-model-performance'))) {
                const candidates = Array.from(document.querySelectorAll('.base-model-performance'))
                    .filter((el) => !(el.dataset && el.dataset.mounted === 'true'));
                container = candidates[candidates.length - 1] || null;
            }
            if (!container) return;
            if (container.dataset) {
                if (container.dataset.mounted === 'true') return;
                container.dataset.mounted = 'true';
            }

            // Data for models
            const models = [
                { name: 'Qwen3 1.7B Base', size: 1.7, winRate: 2.1, logo: 'qwen', color: '#8B5CF6' },
                { name: 'Qwen2.5 3B', size: 3.1, winRate: 3.1, logo: 'qwen', color: '#8B5CF6' },
                { name: 'SmolLM3 3B Base', size: 3.0, winRate: 4.0, logo: 'hf', color: '#FFD43B' },
                { name: 'Llama3.2 3B', size: 3.2, winRate: 2.3, logo: 'meta', color: '#4299E1' },
                { name: 'Qwen3 4B Base', size: 4.0, winRate: 4.9, logo: 'qwen', color: '#8B5CF6' },
                { name: 'Gemma3 4B Base', size: 4.3, winRate: 4.5, logo: 'google', color: '#EA4335' }
            ];

            // Chart dimensions
            const padding = 20;
            const margin = { top: 20 + padding, right: 20 + padding, bottom: 80 + padding, left: 100 + padding };
            const width = 900 - margin.left - margin.right;
            const height = 600 - margin.top - margin.bottom;

            // Scales
            const xScale = (value) => margin.left + ((value - 1.5) / (4.5 - 1.5)) * width;
            const yScale = (value) => height + margin.top - ((value - 1.8) / (5.2 - 1.8)) * height;

            // Create SVG
            const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
            svg.setAttribute('viewBox', `0 0 ${width + margin.left + margin.right} ${height + margin.top + margin.bottom}`);
            svg.setAttribute('preserveAspectRatio', 'xMidYMid meet');

            // Define arrowhead marker
            const defs = document.createElementNS('http://www.w3.org/2000/svg', 'defs');
            const marker = document.createElementNS('http://www.w3.org/2000/svg', 'marker');
            marker.setAttribute('id', 'arrowhead');
            marker.setAttribute('markerWidth', '6');
            marker.setAttribute('markerHeight', '6');
            marker.setAttribute('refX', '5');
            marker.setAttribute('refY', '3');
            marker.setAttribute('orient', 'auto');
            const polygon = document.createElementNS('http://www.w3.org/2000/svg', 'polygon');
            polygon.setAttribute('points', '0 0, 6 3, 0 6');
            polygon.setAttribute('fill', 'var(--muted-color)');
            marker.appendChild(polygon);
            defs.appendChild(marker);
            svg.appendChild(defs);

            // Draw Pareto border - straight diagonal
            const paretoBorder = document.createElementNS('http://www.w3.org/2000/svg', 'path');
            const borderD = `M ${xScale(1.5)} ${yScale(1.8)} L ${xScale(4.5)} ${yScale(5.2)}`;
            paretoBorder.setAttribute('d', borderD);
            paretoBorder.setAttribute('class', 'pareto-border');
            svg.appendChild(paretoBorder);

            // Draw X-axis
            const xAxis = document.createElementNS('http://www.w3.org/2000/svg', 'line');
            xAxis.setAttribute('x1', margin.left);
            xAxis.setAttribute('y1', height + margin.top);
            xAxis.setAttribute('x2', width + margin.left);
            xAxis.setAttribute('y2', height + margin.top);
            xAxis.setAttribute('class', 'axis-line');
            svg.appendChild(xAxis);

            // Draw Y-axis
            const yAxis = document.createElementNS('http://www.w3.org/2000/svg', 'line');
            yAxis.setAttribute('x1', margin.left);
            yAxis.setAttribute('y1', margin.top);
            yAxis.setAttribute('x2', margin.left);
            yAxis.setAttribute('y2', height + margin.top);
            yAxis.setAttribute('class', 'axis-line');
            svg.appendChild(yAxis);

            // X-axis ticks and labels
            for (let i = 2.0; i <= 4.5; i += 0.5) {
                const x = xScale(i);
                const tick = document.createElementNS('http://www.w3.org/2000/svg', 'line');
                tick.setAttribute('x1', x);
                tick.setAttribute('y1', margin.top);
                tick.setAttribute('x2', x);
                tick.setAttribute('y2', height + margin.top);
                tick.setAttribute('class', 'tick-line');
                svg.appendChild(tick);

                const label = document.createElementNS('http://www.w3.org/2000/svg', 'text');
                label.setAttribute('x', x);
                label.setAttribute('y', height + margin.top + 25);
                label.setAttribute('text-anchor', 'middle');
                label.setAttribute('class', 'tick-label');
                label.textContent = i.toFixed(1);
                svg.appendChild(label);
            }

            // Y-axis ticks and labels
            for (let i = 2.0; i <= 5.0; i += 0.5) {
                const y = yScale(i);
                const tick = document.createElementNS('http://www.w3.org/2000/svg', 'line');
                tick.setAttribute('x1', margin.left);
                tick.setAttribute('y1', y);
                tick.setAttribute('x2', width + margin.left);
                tick.setAttribute('y2', y);
                tick.setAttribute('class', 'tick-line');
                svg.appendChild(tick);

                const label = document.createElementNS('http://www.w3.org/2000/svg', 'text');
                label.setAttribute('x', margin.left - 15);
                label.setAttribute('y', y + 5);
                label.setAttribute('text-anchor', 'end');
                label.setAttribute('class', 'tick-label');
                label.textContent = i.toFixed(1);
                svg.appendChild(label);
            }

            // X-axis label
            const xLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text');
            xLabel.setAttribute('x', margin.left + width / 2);
            xLabel.setAttribute('y', height + margin.top + 65);
            xLabel.setAttribute('text-anchor', 'middle');
            xLabel.setAttribute('class', 'axis-label');
            xLabel.innerHTML = '<tspan font-weight="700">Model Size</tspan><tspan font-weight="400"> (Billion parameters)</tspan>';
            svg.appendChild(xLabel);

            // Y-axis label
            const yLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text');
            yLabel.setAttribute('x', -(height / 2 + margin.top));
            yLabel.setAttribute('y', 55);
            yLabel.setAttribute('text-anchor', 'middle');
            yLabel.setAttribute('transform', 'rotate(-90)');
            yLabel.setAttribute('class', 'axis-label');
            yLabel.innerHTML = '<tspan font-weight="700">Win Rate (%)</tspan><tspan font-weight="400"> - 12 popular LLM Benchmarks</tspan>';
            svg.appendChild(yLabel);

            // Draw arrows
            // "faster/cheaper" arrow (shorter, aligned to left)
            const arrow1StartX = margin.left + 80;
            const arrow1Length = 170;
            const arrow1EndX = arrow1StartX + arrow1Length;
            const arrow1Y = yScale(4.8);

            const arrow1 = document.createElementNS('http://www.w3.org/2000/svg', 'path');
            arrow1.setAttribute('d', `M ${arrow1EndX} ${arrow1Y} L ${arrow1StartX} ${arrow1Y}`);
            arrow1.setAttribute('class', 'arrow');
            svg.appendChild(arrow1);

            const arrow1Label = document.createElementNS('http://www.w3.org/2000/svg', 'text');
            arrow1Label.setAttribute('x', (arrow1StartX + arrow1EndX) / 2);
            arrow1Label.setAttribute('y', arrow1Y - 10);
            arrow1Label.setAttribute('text-anchor', 'middle');
            arrow1Label.setAttribute('class', 'arrow-label');
            arrow1Label.textContent = 'faster / cheaper';
            svg.appendChild(arrow1Label);

            // "better" arrow (pointing up)
            const arrow2 = document.createElementNS('http://www.w3.org/2000/svg', 'path');
            arrow2.setAttribute('d', `M ${xScale(1.75)} ${yScale(3.5)} L ${xScale(1.75)} ${yScale(4.5)}`);
            arrow2.setAttribute('class', 'arrow');
            svg.appendChild(arrow2);

            const arrow2Label = document.createElementNS('http://www.w3.org/2000/svg', 'text');
            arrow2Label.setAttribute('x', xScale(1.75) - 50);
            arrow2Label.setAttribute('y', yScale(4.0) + 35);
            arrow2Label.setAttribute('text-anchor', 'middle');
            arrow2Label.setAttribute('dominant-baseline', 'middle');
            arrow2Label.setAttribute('transform', `rotate(-90 ${xScale(1.75) - 50} ${yScale(4.0)})`);
            arrow2Label.setAttribute('class', 'arrow-label');
            arrow2Label.textContent = 'better';
            svg.appendChild(arrow2Label);


            // Draw model points
            models.forEach(model => {
                const g = document.createElementNS('http://www.w3.org/2000/svg', 'g');
                g.setAttribute('class', 'model-point');

                const x = xScale(model.size);
                const y = yScale(model.winRate);

                // Circle background
                const circle = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
                const isHighlight = model.name.includes('SmolLM3');
                circle.setAttribute('cx', x);
                circle.setAttribute('cy', y);
                circle.setAttribute('r', isHighlight ? 35 : 28);
                circle.setAttribute('fill', 'rgba(255, 255, 255, 0.3)');
                circle.setAttribute('class', 'model-circle');
                if (isHighlight) {
                    circle.setAttribute('stroke', model.color);
                    circle.setAttribute('stroke-width', '2');
                } else {
                    circle.setAttribute('stroke', 'rgba(0, 0, 0, 0.25)');
                    circle.setAttribute('stroke-width', '1');
                }
                g.appendChild(circle);

                // Logo as foreignObject
                const foreignObject = document.createElementNS('http://www.w3.org/2000/svg', 'foreignObject');
                const isSmolLM3 = isHighlight;
                const logoOffset = isSmolLM3 ? 26 : 22;
                foreignObject.setAttribute('x', x - logoOffset);
                foreignObject.setAttribute('y', isSmolLM3 ? y - 28 : y - 22);
                foreignObject.setAttribute('width', isSmolLM3 ? 54 : 44);
                foreignObject.setAttribute('height', isSmolLM3 ? 54 : 44);
                let logoSize;
                if (model.logo === 'qwen' || model.logo === 'hf') {
                    logoSize = isSmolLM3 ? 52 : 44;
                } else if (model.logo === 'meta') {
                    logoSize = 32;
                } else {
                    logoSize = 36;
                }
                foreignObject.innerHTML = `<div xmlns="http://www.w3.org/1999/xhtml" style="width: ${isSmolLM3 ? 54 : 44}px; height: ${isSmolLM3 ? 54 : 44}px; display: flex; align-items: center; justify-content: center;"><img src="/data/${model.logo}-logo.svg" style="width: ${logoSize}px; height: auto; max-height: ${logoSize}px;" /></div>`;
                g.appendChild(foreignObject);

                // Label below
                const nameParts = model.name.split(' ');
                const label1 = document.createElementNS('http://www.w3.org/2000/svg', 'text');
                label1.setAttribute('x', x);
                label1.setAttribute('y', isSmolLM3 ? y + 55 : y + 50);
                label1.setAttribute('class', 'model-label');
                if (isHighlight) {
                    label1.setAttribute('font-weight', '800');
                    label1.setAttribute('font-size', '16px');
                }
                label1.textContent = nameParts.slice(0, -1).join(' ');
                g.appendChild(label1);

                const label2 = document.createElementNS('http://www.w3.org/2000/svg', 'text');
                label2.setAttribute('x', x);
                label2.setAttribute('y', isSmolLM3 ? y + 73 : y + 66);
                label2.setAttribute('class', 'model-sublabel');
                if (isHighlight) {
                    label2.setAttribute('font-weight', '800');
                    label2.setAttribute('font-size', '14px');
                }
                label2.textContent = nameParts[nameParts.length - 1];
                g.appendChild(label2);


                svg.appendChild(g);
            });

            // Create chart container and add SVG
            const chartContainer = document.createElement('div');
            chartContainer.className = 'chart-container';
            chartContainer.appendChild(svg);
            container.appendChild(chartContainer);
        };

        if (document.readyState === 'loading') {
            document.addEventListener('DOMContentLoaded', bootstrap, { once: true });
        } else {
            bootstrap();
        }
    })();
</script>