AndreP-git commited on
Commit ·
2beb185
1
Parent(s): 71c72cf
Update SIMPLE hf
Browse files- app.js +5 -4
- index.html +40 -15
app.js
CHANGED
|
@@ -315,7 +315,7 @@ function draw()
|
|
| 315 |
function drawComponents(d,L,nq,nkv,nin)
|
| 316 |
{
|
| 317 |
|
| 318 |
-
let nout = logspace2(1,
|
| 319 |
|
| 320 |
|
| 321 |
let components =
|
|
@@ -379,8 +379,9 @@ function drawComponents(d,L,nq,nkv,nin)
|
|
| 379 |
});
|
| 380 |
|
| 381 |
|
|
|
|
| 382 |
let ticks=[];
|
| 383 |
-
for(let e=0;e<=
|
| 384 |
|
| 385 |
|
| 386 |
let layout={
|
|
@@ -393,7 +394,7 @@ function drawComponents(d,L,nq,nkv,nin)
|
|
| 393 |
title:
|
| 394 |
`Output Tokens τ<sub>out</sub> (τ<sub>in</sub>=${nin}) [log<sub>2</sub>]`,
|
| 395 |
type:"log",
|
| 396 |
-
range:[0,Math.log10(
|
| 397 |
tickmode:"array",
|
| 398 |
tickvals:ticks,
|
| 399 |
ticktext:ticks.map(String),
|
|
@@ -592,7 +593,7 @@ function drawContour(d,L,nq,nkv,nin)
|
|
| 592 |
|
| 593 |
|
| 594 |
let layout={
|
| 595 |
-
height:
|
| 596 |
font:{
|
| 597 |
family:"sans-serif",
|
| 598 |
size:13
|
|
|
|
| 315 |
function drawComponents(d,L,nq,nkv,nin)
|
| 316 |
{
|
| 317 |
|
| 318 |
+
let nout = logspace2(1,16384,400);
|
| 319 |
|
| 320 |
|
| 321 |
let components =
|
|
|
|
| 379 |
});
|
| 380 |
|
| 381 |
|
| 382 |
+
// Every other power of two, so the ticks fit the narrower panel
|
| 383 |
let ticks=[];
|
| 384 |
+
for(let e=0;e<=14;e+=2) ticks.push(2**e);
|
| 385 |
|
| 386 |
|
| 387 |
let layout={
|
|
|
|
| 394 |
title:
|
| 395 |
`Output Tokens τ<sub>out</sub> (τ<sub>in</sub>=${nin}) [log<sub>2</sub>]`,
|
| 396 |
type:"log",
|
| 397 |
+
range:[0,Math.log10(16384)],
|
| 398 |
tickmode:"array",
|
| 399 |
tickvals:ticks,
|
| 400 |
ticktext:ticks.map(String),
|
|
|
|
| 593 |
|
| 594 |
|
| 595 |
let layout={
|
| 596 |
+
height:450,
|
| 597 |
font:{
|
| 598 |
family:"sans-serif",
|
| 599 |
size:13
|
index.html
CHANGED
|
@@ -13,7 +13,7 @@
|
|
| 13 |
<style>
|
| 14 |
body {
|
| 15 |
font-family: sans-serif;
|
| 16 |
-
max-width:
|
| 17 |
margin: auto;
|
| 18 |
padding: 20px;
|
| 19 |
}
|
|
@@ -58,6 +58,24 @@
|
|
| 58 |
margin-top: 3px;
|
| 59 |
}
|
| 60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
#formula {
|
| 62 |
overflow-x: auto;
|
| 63 |
overflow-y: hidden;
|
|
@@ -169,16 +187,16 @@ placeholder="tiiuae/falcon-rw-7b"
|
|
| 169 |
<input
|
| 170 |
id="ninSlider"
|
| 171 |
type="range"
|
| 172 |
-
min="
|
| 173 |
-
max="
|
| 174 |
step="0.01"
|
| 175 |
value="6"
|
| 176 |
oninput="updateNin(this.value)"
|
| 177 |
>
|
| 178 |
|
| 179 |
<div id="ninLabels">
|
| 180 |
-
<span>
|
| 181 |
-
<span>
|
| 182 |
</div>
|
| 183 |
|
| 184 |
<!-- Actual token count used by app.js -->
|
|
@@ -186,25 +204,32 @@ placeholder="tiiuae/falcon-rw-7b"
|
|
| 186 |
|
| 187 |
</div>
|
| 188 |
|
| 189 |
-
<div id="
|
| 190 |
|
| 191 |
-
<
|
| 192 |
-
|
| 193 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 194 |
|
| 195 |
<p>
|
| 196 |
-
|
| 197 |
-
|
| 198 |
</p>
|
| 199 |
|
| 200 |
-
<div id="contour"></div>
|
| 201 |
-
|
| 202 |
<script>
|
| 203 |
-
const
|
|
|
|
| 204 |
|
| 205 |
function updateNin(exponent) {
|
| 206 |
const value = Math.round(Math.pow(2, parseFloat(exponent)));
|
| 207 |
-
const clamped = Math.min(MAX_TOKENS, Math.max(
|
| 208 |
|
| 209 |
document.getElementById('nin').value = clamped;
|
| 210 |
document.getElementById('ninValue').textContent = clamped;
|
|
|
|
| 13 |
<style>
|
| 14 |
body {
|
| 15 |
font-family: sans-serif;
|
| 16 |
+
max-width: 1400px;
|
| 17 |
margin: auto;
|
| 18 |
padding: 20px;
|
| 19 |
}
|
|
|
|
| 58 |
margin-top: 3px;
|
| 59 |
}
|
| 60 |
|
| 61 |
+
/* Plots side by side; the component plot is the narrower one */
|
| 62 |
+
#plots {
|
| 63 |
+
display: flex;
|
| 64 |
+
gap: 20px;
|
| 65 |
+
flex-wrap: wrap;
|
| 66 |
+
margin-top: 20px;
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
#plotPanel {
|
| 70 |
+
flex: 2 1 380px;
|
| 71 |
+
min-width: 0;
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
#contourPanel {
|
| 75 |
+
flex: 3 1 520px;
|
| 76 |
+
min-width: 0;
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
#formula {
|
| 80 |
overflow-x: auto;
|
| 81 |
overflow-y: hidden;
|
|
|
|
| 187 |
<input
|
| 188 |
id="ninSlider"
|
| 189 |
type="range"
|
| 190 |
+
min="4"
|
| 191 |
+
max="16"
|
| 192 |
step="0.01"
|
| 193 |
value="6"
|
| 194 |
oninput="updateNin(this.value)"
|
| 195 |
>
|
| 196 |
|
| 197 |
<div id="ninLabels">
|
| 198 |
+
<span>16</span>
|
| 199 |
+
<span>65536</span>
|
| 200 |
</div>
|
| 201 |
|
| 202 |
<!-- Actual token count used by app.js -->
|
|
|
|
| 204 |
|
| 205 |
</div>
|
| 206 |
|
| 207 |
+
<div id="plots">
|
| 208 |
|
| 209 |
+
<div id="plotPanel">
|
| 210 |
+
<h4>Component breakdown at the selected τ<sub>in</sub></h4>
|
| 211 |
+
<div id="plot"></div>
|
| 212 |
+
</div>
|
| 213 |
+
|
| 214 |
+
<div id="contourPanel">
|
| 215 |
+
<h4>E<sub>tok</sub> over input and output tokens</h4>
|
| 216 |
+
<div id="contour"></div>
|
| 217 |
+
</div>
|
| 218 |
+
|
| 219 |
+
</div>
|
| 220 |
|
| 221 |
<p>
|
| 222 |
+
The contour map shows the total energy per token for the current architecture;
|
| 223 |
+
the dashed line marks the selected τ<sub>in</sub>.
|
| 224 |
</p>
|
| 225 |
|
|
|
|
|
|
|
| 226 |
<script>
|
| 227 |
+
const MIN_TOKENS = 16;
|
| 228 |
+
const MAX_TOKENS = 65536;
|
| 229 |
|
| 230 |
function updateNin(exponent) {
|
| 231 |
const value = Math.round(Math.pow(2, parseFloat(exponent)));
|
| 232 |
+
const clamped = Math.min(MAX_TOKENS, Math.max(MIN_TOKENS, value));
|
| 233 |
|
| 234 |
document.getElementById('nin').value = clamped;
|
| 235 |
document.getElementById('ninValue').textContent = clamped;
|