|
| 1 | +document.addEventListener('DOMContentLoaded', function() { |
| 2 | + // Ablation study: BF16 vs FP8 quantization |
| 3 | + const timingDataAblation = { |
| 4 | + "Sleep Mode (BF16)": [ |
| 5 | + { event: "A Model Load", duration: 32.56 }, |
| 6 | + { event: "A Model Warm Up", duration: 2.69 }, |
| 7 | + { event: "B Model Load", duration: 57.96 }, |
| 8 | + { event: "B Model Warm Up", duration: 5.92 }, |
| 9 | + { event: "A Model Wake up", duration: 0.28 }, |
| 10 | + { event: "A Model Prompt", duration: 0.41 }, |
| 11 | + { event: "A Model Sleep", duration: 0.09 }, |
| 12 | + { event: "B Model Wake Up", duration: 0.89 }, |
| 13 | + { event: "B Model Prompt", duration: 0.9 }, |
| 14 | + { event: "B Model Sleep", duration: 0.48 }, |
| 15 | + { event: "A Model Wake up", duration: 0.27 }, |
| 16 | + { event: "A Model Prompt", duration: 0.4 }, |
| 17 | + { event: "A Model Sleep", duration: 0.1 }, |
| 18 | + { event: "B Model Wake Up", duration: 0.93 }, |
| 19 | + { event: "B Model Prompt", duration: 0.74 }, |
| 20 | + { event: "B Model Sleep", duration: 0.5 }, |
| 21 | + { event: "A Model Wake up", duration: 0.27 }, |
| 22 | + { event: "A Model Prompt", duration: 0.41 }, |
| 23 | + { event: "A Model Sleep", duration: 0.1 }, |
| 24 | + { event: "B Model Wake Up", duration: 0.88 }, |
| 25 | + { event: "B Model Prompt", duration: 0.8 } |
| 26 | + ], |
| 27 | + "Sleep Mode (FP8)": [ |
| 28 | + { event: "A Model Load", duration: 37.71 }, |
| 29 | + { event: "A Model Warm Up", duration: 2.34 }, |
| 30 | + { event: "B Model Load", duration: 57.79 }, |
| 31 | + { event: "B Model Warm Up", duration: 6.37 }, |
| 32 | + { event: "A Model Wake up", duration: 0.18 }, |
| 33 | + { event: "A Model Prompt", duration: 0.43 }, |
| 34 | + { event: "A Model Sleep", duration: 0.06 }, |
| 35 | + { event: "B Model Wake Up", duration: 0.79 }, |
| 36 | + { event: "B Model Prompt", duration: 0.69 }, |
| 37 | + { event: "B Model Sleep", duration: 0.31 }, |
| 38 | + { event: "A Model Wake up", duration: 0.19 }, |
| 39 | + { event: "A Model Prompt", duration: 0.43 }, |
| 40 | + { event: "A Model Sleep", duration: 0.06 }, |
| 41 | + { event: "B Model Wake Up", duration: 0.77 }, |
| 42 | + { event: "B Model Prompt", duration: 0.59 }, |
| 43 | + { event: "B Model Sleep", duration: 0.31 }, |
| 44 | + { event: "A Model Wake up", duration: 0.16 }, |
| 45 | + { event: "A Model Prompt", duration: 0.45 }, |
| 46 | + { event: "A Model Sleep", duration: 0.07 }, |
| 47 | + { event: "B Model Wake Up", duration: 0.78 }, |
| 48 | + { event: "B Model Prompt", duration: 0.44 } |
| 49 | + ] |
| 50 | + }; |
| 51 | + |
| 52 | + // Convert to segment format |
| 53 | + function createSegmentsAblation(timingData) { |
| 54 | + const segments = []; |
| 55 | + |
| 56 | + Object.entries(timingData).forEach(([scenario, events]) => { |
| 57 | + let cumulativeTime = 0; |
| 58 | + |
| 59 | + events.forEach(({ event, duration }) => { |
| 60 | + const [who, ...stageParts] = event.split(' '); |
| 61 | + const stage = stageParts.join(' '); |
| 62 | + |
| 63 | + let action, category; |
| 64 | + if (stage.includes('Load')) { |
| 65 | + action = 'Load'; |
| 66 | + category = `${who} Load`; |
| 67 | + } else if (stage.includes('Wake')) { |
| 68 | + action = 'Wake'; |
| 69 | + category = `${who} Wake`; |
| 70 | + } else if (stage.includes('Prompt')) { |
| 71 | + action = 'Prompt'; |
| 72 | + category = `${who} Prompt`; |
| 73 | + } else if (stage.includes('Sleep')) { |
| 74 | + action = 'Sleep'; |
| 75 | + category = `${who} Sleep`; |
| 76 | + } else if (stage.includes('Warm')) { |
| 77 | + action = 'Load'; |
| 78 | + category = `${who} Load`; |
| 79 | + } |
| 80 | + |
| 81 | + segments.push({ |
| 82 | + scenario, |
| 83 | + who, |
| 84 | + stage, |
| 85 | + action, |
| 86 | + start: cumulativeTime, |
| 87 | + end: cumulativeTime + duration, |
| 88 | + duration, |
| 89 | + category |
| 90 | + }); |
| 91 | + |
| 92 | + cumulativeTime += duration; |
| 93 | + }); |
| 94 | + }); |
| 95 | + |
| 96 | + return segments; |
| 97 | + } |
| 98 | + |
| 99 | + const segmentsAblation = createSegmentsAblation(timingDataAblation); |
| 100 | + const colorMapAblation = {"A Load": "#1f77b4", "B Load": "#ff7f0e", "A Wake": "#2ca02c", "B Wake": "#17becf", "A Sleep": "#9467bd", "B Sleep": "#8c564b", "A Prompt": "#e377c2", "B Prompt": "#7f7f7f"}; |
| 101 | + const categoriesAblation = Object.keys(colorMapAblation); |
| 102 | + |
| 103 | + const xAblation = segmentsAblation.map(d => d.duration); |
| 104 | + const baseAblation = segmentsAblation.map(d => d.start); |
| 105 | + const yAblation = segmentsAblation.map(d => d.scenario); |
| 106 | + const colorsAblation = segmentsAblation.map(d => colorMapAblation[d.category]); |
| 107 | + const customAblation = segmentsAblation.map(d => [d.scenario, d.category, d.stage, d.start, d.end]); |
| 108 | + |
| 109 | + const barsAblation = { |
| 110 | + type: "bar", |
| 111 | + orientation: "h", |
| 112 | + x: xAblation, base: baseAblation, y: yAblation, |
| 113 | + marker: { color: colorsAblation, line: {width:1, color:"rgba(0,0,0,0.35)"} }, |
| 114 | + hovertemplate: |
| 115 | + "<b>%{customdata[0]}</b><br>%{customdata[1]} — %{customdata[2]}<br>"+ |
| 116 | + "Start %{customdata[3]:.2f}s → End %{customdata[4]:.2f}s<br>"+ |
| 117 | + "<b>%{x:.2f}s</b><extra></extra>", |
| 118 | + customdata: customAblation, |
| 119 | + showlegend: false |
| 120 | + }; |
| 121 | + |
| 122 | + const legendTracesAblation = categoriesAblation.map(name => ({ |
| 123 | + type: "scatter", mode: "markers", x:[null], y:[null], |
| 124 | + name, marker: {color: colorMapAblation[name], size: 10}, |
| 125 | + hoverinfo:"skip", showlegend:true |
| 126 | + })); |
| 127 | + |
| 128 | + Plotly.newPlot("plotly-ablation-quant", [barsAblation, ...legendTracesAblation], { |
| 129 | + barmode: "overlay", |
| 130 | + bargap: 0.05, |
| 131 | + margin: {l: 140, r: 30, t: 20, b: 40}, |
| 132 | + xaxis: { title: "Time (seconds)", range: [0, 115] }, |
| 133 | + yaxis: { |
| 134 | + categoryorder: "array", |
| 135 | + categoryarray: ["Sleep Mode (FP8)", "Sleep Mode (BF16)"] |
| 136 | + }, |
| 137 | + hovermode: "closest", |
| 138 | + dragmode: "pan" |
| 139 | + }, {displayModeBar: true, responsive: true}); |
| 140 | +}); |
0 commit comments