-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimple_config_explorer.html
More file actions
606 lines (555 loc) · 41.4 KB
/
simple_config_explorer.html
File metadata and controls
606 lines (555 loc) · 41.4 KB
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
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>zembed-1 — pick a configuration</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');
*{box-sizing:border-box;margin:0;padding:0}
body{font-family:'Inter',system-ui,sans-serif;background:#fafafa;color:#111;-webkit-font-smoothing:antialiased;line-height:1.5}
.page{max-width:860px;margin:0 auto;padding:48px 24px 96px}
body.embedded{padding:0;margin:0;background:transparent}
body.embedded .page{max-width:100%;padding:16px 20px 32px}
.wizard-zone{overflow:hidden;transition:max-height .5s cubic-bezier(.4,0,.2,1),opacity .3s ease-out,margin .5s cubic-bezier(.4,0,.2,1)}
.wizard-zone.collapsing{opacity:0}
.wizard-zone.collapsed{max-height:0 !important;margin:0;opacity:0;pointer-events:none}
.trail{min-height:18px;margin-bottom:20px;display:flex;gap:0;align-items:center;flex-wrap:wrap}
.crumb{font-size:12px;font-weight:500;color:#999;cursor:pointer;transition:color .15s}
.crumb:hover{color:#4f46e5}
.crumb.frozen{cursor:default;pointer-events:none}
.crumb.frozen:hover{color:#999}
.crumb-sep{font-size:9px;color:#ccc;margin:0 8px}
.crumb-val{font-weight:600;color:#555}
.step-container{position:relative;overflow:hidden;min-height:140px}
.step{position:absolute;top:0;left:0;right:0;opacity:0;transform:translateX(48px);transition:opacity .28s ease-out,transform .28s ease-out;pointer-events:none}
.step.active{position:relative;opacity:1;transform:translateX(0);pointer-events:auto}
.step.exiting{opacity:0;transform:translateX(-48px)}
.step-q{font-size:18px;font-weight:700;color:#111;margin-bottom:6px;letter-spacing:-.02em}
.step-detail{font-size:13px;color:#777;margin-bottom:18px;max-width:620px;line-height:1.6}
.pills{display:flex;gap:8px;flex-wrap:wrap}
.pill{padding:9px 22px;border:1.5px solid #ddd;border-radius:7px;font-size:13px;font-weight:500;font-family:inherit;background:#fff;color:#333;cursor:pointer;transition:border-color .12s,background .12s,color .12s,box-shadow .12s;line-height:1.4;user-select:none;text-align:left}
.pill:hover{border-color:#aaa;background:#f7f7f7}
.pill.selected{border-color:#4f46e5;background:#4f46e5;color:#fff;box-shadow:0 2px 8px rgba(79,70,229,.25)}
.pill .pill-sub{display:block;font-size:11px;font-weight:400;opacity:.55;margin-top:2px}
.pill.selected .pill-sub{opacity:.7}
.callout{margin:20px 0 4px;padding:16px 20px;background:#f8f7ff;border-left:3px solid #4f46e5;border-radius:0 8px 8px 0;font-size:13px;color:#444;line-height:1.55;opacity:0;transform:translateY(6px);transition:opacity .3s ease-out,transform .3s ease-out;max-height:0;overflow:hidden}
.callout.visible{opacity:1;transform:translateY(0);max-height:200px}
.callout .callout-num{font-family:'JetBrains Mono',monospace;font-weight:600;color:#4f46e5}
.callout .callout-dim{color:#999}
.reco{display:none;padding:28px 0 24px;border-top:1px solid #e5e5e5;opacity:0;transform:translateY(10px);transition:opacity .4s ease-out,transform .4s ease-out}
.reco.visible{display:block;opacity:1;transform:translateY(0)}
.reco-header{display:flex;align-items:baseline;gap:16px;margin-bottom:10px;flex-wrap:wrap}
.reco-eyebrow{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.08em;color:#4f46e5}
.reco-restart{font-size:11px;color:#bbb;cursor:pointer;border:none;background:none;font-family:inherit;font-weight:500;padding:0;transition:color .15s}
.reco-restart:hover{color:#4f46e5}
.reco-name{font-size:26px;font-weight:800;letter-spacing:-.03em;color:#4f46e5;margin-bottom:3px}
.reco-desc{font-size:13px;color:#666;margin-bottom:22px;line-height:1.55}
.reco-grid{display:flex;gap:36px;flex-wrap:wrap}
.reco-stat .rv{font-size:22px;font-weight:700;font-family:'JetBrains Mono',monospace;letter-spacing:-.02em;color:#111}
.reco-stat .rv .delta{font-size:13px;font-weight:600;margin-left:4px}
.reco-stat .rv .delta.saving{color:#059669}
.reco-stat .rv .delta.loss{color:#dc2626}
.reco-stat .rv .delta.baseline{color:#059669}
.reco-stat .rl{font-size:11px;color:#999;font-weight:500;letter-spacing:.02em;margin-top:1px}
.gpu-section{margin-top:24px;margin-bottom:12px}
.gpu-header{font-size:12px;font-weight:600;color:#999;text-transform:uppercase;letter-spacing:.06em;margin-bottom:10px}
.gpu-note{font-size:12px;color:#999;margin-top:8px;line-height:1.5}
.gpu-tbl{width:100%;border-collapse:collapse}
.gpu-tbl th{text-align:left;padding:6px 10px;font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.06em;color:#aaa;border-bottom:1px solid #eee}
.gpu-tbl th.r{text-align:right}
.gpu-tbl td{padding:9px 10px;font-size:13px;border-bottom:1px solid #f0f0f0}
.gpu-tbl td.r{text-align:right;font-family:'JetBrains Mono',monospace;font-size:12px;font-variant-numeric:tabular-nums}
.gpu-tbl tr{transition:background .15s}
.gpu-tbl tr:hover{background:#f5f5f5}
.gpu-tbl tr.gpu-match{background:#f5f3ff}
.gpu-tbl tr.gpu-match:hover{background:#eeebff}
.gpu-tbl .gpu-tag{font-size:10px;font-weight:600;color:#4f46e5;margin-left:6px}
.results-zone{display:none}
.results-zone.visible{display:block}
.results{margin-top:36px;opacity:0;transform:translateY(12px);transition:opacity .4s ease-out .12s,transform .4s ease-out .12s}
.results.visible{opacity:1;transform:translateY(0)}
.results-hdr{font-size:13px;font-weight:600;color:#999;margin-bottom:14px}
.scatter-row{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin-bottom:22px}
.scatter-wrap{height:250px;background:#fff;border:1px solid #eee;border-radius:8px;padding:12px}
.scatter-wrap canvas{max-height:226px}
.tbl{width:100%;border-collapse:collapse}
.tbl thead th{text-align:left;padding:8px 10px;font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.06em;color:#aaa;border-bottom:1px solid #e5e5e5;cursor:pointer;user-select:none;white-space:nowrap}
.tbl thead th:hover{color:#4f46e5}
.tbl thead th.r{text-align:right}
.tbl tbody td{padding:10px 10px;font-size:13px;border-bottom:1px solid #f0f0f0}
.tbl tbody td.r{text-align:right;font-family:'JetBrains Mono',monospace;font-size:12px;font-variant-numeric:tabular-nums}
.tbl tbody tr{transition:background .15s}
.tbl tbody tr:hover{background:#f5f5f5}
.tbl tbody tr.is-reco{background:#f5f3ff;border-left:3px solid #4f46e5}
.tbl tbody tr.is-reco:hover{background:#eeebff}
.tbl .bytes-sub{color:#aaa;font-size:11px;margin-left:4px}
.tbl .d-save{font-size:11px;color:#059669;font-weight:500}
.tbl .d-loss{font-size:11px;color:#dc2626;font-weight:500}
.tbl .d-base{font-size:11px;color:#059669;font-weight:500}
.pareto-note{font-size:12px;color:#999;margin-top:12px;line-height:1.55;max-width:600px}
.collapse-row{margin-top:24px;text-align:center;display:none}
.collapse-row.visible{display:block}
.collapse-btn{font-size:13px;color:#aaa;cursor:pointer;border:none;background:none;font-family:inherit;font-weight:500;padding:7px 20px;transition:color .15s}
.collapse-btn:hover{color:#4f46e5}
.vs{font-size:10px;font-weight:400;color:#bbb;margin-left:3px;letter-spacing:0}
@media(max-width:640px){
.scatter-row{display:none}
.reco-grid{gap:20px}
.reco-name{font-size:22px}
}
</style>
</head>
<body>
<div class="page">
<div class="wizard-zone" id="wizardZone">
<div class="trail" id="trail"></div>
<div class="step-container" id="stepContainer"></div>
<div class="callout" id="callout"></div>
</div>
<div class="reco" id="reco">
<div class="reco-header">
<div class="reco-eyebrow">Recommended configuration</div>
<button class="reco-restart" onclick="doReset()">start over</button>
</div>
<div class="reco-name" id="recoName"></div>
<div class="reco-desc" id="recoDesc"></div>
<div class="reco-grid" id="recoGrid"></div>
</div>
<div class="results-zone" id="resultsZone">
<div id="gpuMount"></div>
<div class="results" id="results">
<div class="results-hdr">All configurations at your constraints</div>
<div class="scatter-row">
<div class="scatter-wrap"><canvas id="sc1"></canvas></div>
<div class="scatter-wrap"><canvas id="sc2"></canvas></div>
</div>
<table class="tbl" id="tbl">
<thead><tr>
<th data-col="name">Configuration</th>
<th data-col="quantization">Quant</th>
<th data-col="dims" class="r">Dims</th>
<th data-col="bytesPerVec" class="r">Bytes / vector</th>
<th data-col="storageDelta" class="r">Storage vs full</th>
<th data-col="accuracy" class="r">Recall@10</th>
<th data-col="accDelta" class="r">Recall vs full</th>
</tr></thead>
<tbody id="tbody"></tbody>
</table>
<div class="pareto-note" id="paretoNote"></div>
</div>
</div>
<div class="collapse-row" id="collapseRow">
<button class="collapse-btn" id="collapseBtn" onclick="toggleDetails()">Hide details</button>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.7/dist/chart.umd.min.js"></script>
<script>
const IS_EMBEDDED = new URLSearchParams(window.location.search).get('embed') === '1';
if (IS_EMBEDDED) document.body.classList.add('embedded');
const CONFIGS = [{"id": "api-f32-2560", "name": "zembed-1 (2560d)", "deployment": "api", "quantization": "float32", "dims": 2560, "bits_per_dim": 16, "latency_ms": 280, "price_per_m_tokens": 0.06, "accuracy_override": 0.4664, "needs_quant_storage": false}, {"id": "api-int8-2560", "name": "zembed-1 (2560d, int8)", "deployment": "api", "quantization": "int8", "dims": 2560, "bits_per_dim": 8, "latency_ms": 280, "price_per_m_tokens": 0.06, "accuracy_override": 0.4641, "needs_quant_storage": true}, {"id": "api-bin-2560", "name": "zembed-1 (2560d, binary)", "deployment": "api", "quantization": "binary", "dims": 2560, "bits_per_dim": 1, "latency_ms": 280, "price_per_m_tokens": 0.06, "accuracy_override": 0.4132, "needs_quant_storage": true}, {"id": "api-f32-1280", "name": "zembed-1 (1280d)", "deployment": "api", "quantization": "float32", "dims": 1280, "bits_per_dim": 16, "latency_ms": 280, "price_per_m_tokens": 0.06, "accuracy_override": 0.4447, "needs_quant_storage": false}, {"id": "api-int8-1280", "name": "zembed-1 (1280d, int8)", "deployment": "api", "quantization": "int8", "dims": 1280, "bits_per_dim": 8, "latency_ms": 280, "price_per_m_tokens": 0.06, "accuracy_override": 0.4429, "needs_quant_storage": true}, {"id": "api-bin-1280", "name": "zembed-1 (1280d, binary)", "deployment": "api", "quantization": "binary", "dims": 1280, "bits_per_dim": 1, "latency_ms": 280, "price_per_m_tokens": 0.06, "accuracy_override": 0.3617, "needs_quant_storage": true}, {"id": "api-f32-640", "name": "zembed-1 (640d)", "deployment": "api", "quantization": "float32", "dims": 640, "bits_per_dim": 16, "latency_ms": 280, "price_per_m_tokens": 0.06, "accuracy_override": 0.3806, "needs_quant_storage": false}, {"id": "api-int8-640", "name": "zembed-1 (640d, int8)", "deployment": "api", "quantization": "int8", "dims": 640, "bits_per_dim": 8, "latency_ms": 280, "price_per_m_tokens": 0.06, "accuracy_override": 0.3749, "needs_quant_storage": true}, {"id": "api-bin-640", "name": "zembed-1 (640d, binary)", "deployment": "api", "quantization": "binary", "dims": 640, "bits_per_dim": 1, "latency_ms": 280, "price_per_m_tokens": 0.06, "accuracy_override": 0.2697, "needs_quant_storage": true}, {"id": "api-f32-320", "name": "zembed-1 (320d)", "deployment": "api", "quantization": "float32", "dims": 320, "bits_per_dim": 16, "latency_ms": 280, "price_per_m_tokens": 0.06, "accuracy_override": 0.2627, "needs_quant_storage": false}, {"id": "api-int8-320", "name": "zembed-1 (320d, int8)", "deployment": "api", "quantization": "int8", "dims": 320, "bits_per_dim": 8, "latency_ms": 280, "price_per_m_tokens": 0.06, "accuracy_override": 0.2547, "needs_quant_storage": true}, {"id": "api-bin-320", "name": "zembed-1 (320d, binary)", "deployment": "api", "quantization": "binary", "dims": 320, "bits_per_dim": 1, "latency_ms": 280, "price_per_m_tokens": 0.06, "accuracy_override": 0.153, "needs_quant_storage": true}, {"id": "api-f32-160", "name": "zembed-1 (160d)", "deployment": "api", "quantization": "float32", "dims": 160, "bits_per_dim": 16, "latency_ms": 280, "price_per_m_tokens": 0.06, "accuracy_override": 0.1693, "needs_quant_storage": false}, {"id": "api-int8-160", "name": "zembed-1 (160d, int8)", "deployment": "api", "quantization": "int8", "dims": 160, "bits_per_dim": 8, "latency_ms": 280, "price_per_m_tokens": 0.06, "accuracy_override": 0.163, "needs_quant_storage": true}, {"id": "api-bin-160", "name": "zembed-1 (160d, binary)", "deployment": "api", "quantization": "binary", "dims": 160, "bits_per_dim": 1, "latency_ms": 280, "price_per_m_tokens": 0.06, "accuracy_override": 0.0933, "needs_quant_storage": true}, {"id": "api-f32-80", "name": "zembed-1 (80d)", "deployment": "api", "quantization": "float32", "dims": 80, "bits_per_dim": 16, "latency_ms": 280, "price_per_m_tokens": 0.06, "accuracy_override": 0.0956, "needs_quant_storage": false}, {"id": "api-int8-80", "name": "zembed-1 (80d, int8)", "deployment": "api", "quantization": "int8", "dims": 80, "bits_per_dim": 8, "latency_ms": 280, "price_per_m_tokens": 0.06, "accuracy_override": 0.093, "needs_quant_storage": true}, {"id": "api-bin-80", "name": "zembed-1 (80d, binary)", "deployment": "api", "quantization": "binary", "dims": 80, "bits_per_dim": 1, "latency_ms": 280, "price_per_m_tokens": 0.06, "accuracy_override": 0.0514, "needs_quant_storage": true}, {"id": "api-f32-40", "name": "zembed-1 (40d)", "deployment": "api", "quantization": "float32", "dims": 40, "bits_per_dim": 16, "latency_ms": 280, "price_per_m_tokens": 0.06, "accuracy_override": 0.0621, "needs_quant_storage": false}, {"id": "api-int8-40", "name": "zembed-1 (40d, int8)", "deployment": "api", "quantization": "int8", "dims": 40, "bits_per_dim": 8, "latency_ms": 280, "price_per_m_tokens": 0.06, "accuracy_override": 0.0582, "needs_quant_storage": true}, {"id": "api-bin-40", "name": "zembed-1 (40d, binary)", "deployment": "api", "quantization": "binary", "dims": 40, "bits_per_dim": 1, "latency_ms": 280, "price_per_m_tokens": 0.06, "accuracy_override": 0.0309, "needs_quant_storage": true}, {"id": "vpc-f32-2560", "name": "zembed-1 (2560d)", "deployment": "vpc", "quantization": "float32", "dims": 2560, "bits_per_dim": 16, "accuracy_override": 0.4664, "needs_quant_storage": false}, {"id": "vpc-int8-2560", "name": "zembed-1 (2560d, int8)", "deployment": "vpc", "quantization": "int8", "dims": 2560, "bits_per_dim": 8, "accuracy_override": 0.4641, "needs_quant_storage": true}, {"id": "vpc-bin-2560", "name": "zembed-1 (2560d, binary)", "deployment": "vpc", "quantization": "binary", "dims": 2560, "bits_per_dim": 1, "accuracy_override": 0.4132, "needs_quant_storage": true}, {"id": "vpc-f32-1280", "name": "zembed-1 (1280d)", "deployment": "vpc", "quantization": "float32", "dims": 1280, "bits_per_dim": 16, "accuracy_override": 0.4447, "needs_quant_storage": false}, {"id": "vpc-int8-1280", "name": "zembed-1 (1280d, int8)", "deployment": "vpc", "quantization": "int8", "dims": 1280, "bits_per_dim": 8, "accuracy_override": 0.4429, "needs_quant_storage": true}, {"id": "vpc-bin-1280", "name": "zembed-1 (1280d, binary)", "deployment": "vpc", "quantization": "binary", "dims": 1280, "bits_per_dim": 1, "accuracy_override": 0.3617, "needs_quant_storage": true}, {"id": "vpc-f32-640", "name": "zembed-1 (640d)", "deployment": "vpc", "quantization": "float32", "dims": 640, "bits_per_dim": 16, "accuracy_override": 0.3806, "needs_quant_storage": false}, {"id": "vpc-int8-640", "name": "zembed-1 (640d, int8)", "deployment": "vpc", "quantization": "int8", "dims": 640, "bits_per_dim": 8, "accuracy_override": 0.3749, "needs_quant_storage": true}, {"id": "vpc-bin-640", "name": "zembed-1 (640d, binary)", "deployment": "vpc", "quantization": "binary", "dims": 640, "bits_per_dim": 1, "accuracy_override": 0.2697, "needs_quant_storage": true}, {"id": "vpc-f32-320", "name": "zembed-1 (320d)", "deployment": "vpc", "quantization": "float32", "dims": 320, "bits_per_dim": 16, "accuracy_override": 0.2627, "needs_quant_storage": false}, {"id": "vpc-int8-320", "name": "zembed-1 (320d, int8)", "deployment": "vpc", "quantization": "int8", "dims": 320, "bits_per_dim": 8, "accuracy_override": 0.2547, "needs_quant_storage": true}, {"id": "vpc-bin-320", "name": "zembed-1 (320d, binary)", "deployment": "vpc", "quantization": "binary", "dims": 320, "bits_per_dim": 1, "accuracy_override": 0.153, "needs_quant_storage": true}, {"id": "vpc-f32-160", "name": "zembed-1 (160d)", "deployment": "vpc", "quantization": "float32", "dims": 160, "bits_per_dim": 16, "accuracy_override": 0.1693, "needs_quant_storage": false}, {"id": "vpc-int8-160", "name": "zembed-1 (160d, int8)", "deployment": "vpc", "quantization": "int8", "dims": 160, "bits_per_dim": 8, "accuracy_override": 0.163, "needs_quant_storage": true}, {"id": "vpc-bin-160", "name": "zembed-1 (160d, binary)", "deployment": "vpc", "quantization": "binary", "dims": 160, "bits_per_dim": 1, "accuracy_override": 0.0933, "needs_quant_storage": true}, {"id": "vpc-f32-80", "name": "zembed-1 (80d)", "deployment": "vpc", "quantization": "float32", "dims": 80, "bits_per_dim": 16, "accuracy_override": 0.0956, "needs_quant_storage": false}, {"id": "vpc-int8-80", "name": "zembed-1 (80d, int8)", "deployment": "vpc", "quantization": "int8", "dims": 80, "bits_per_dim": 8, "accuracy_override": 0.093, "needs_quant_storage": true}, {"id": "vpc-bin-80", "name": "zembed-1 (80d, binary)", "deployment": "vpc", "quantization": "binary", "dims": 80, "bits_per_dim": 1, "accuracy_override": 0.0514, "needs_quant_storage": true}, {"id": "vpc-f32-40", "name": "zembed-1 (40d)", "deployment": "vpc", "quantization": "float32", "dims": 40, "bits_per_dim": 16, "accuracy_override": 0.0621, "needs_quant_storage": false}, {"id": "vpc-int8-40", "name": "zembed-1 (40d, int8)", "deployment": "vpc", "quantization": "int8", "dims": 40, "bits_per_dim": 8, "accuracy_override": 0.0582, "needs_quant_storage": true}, {"id": "vpc-bin-40", "name": "zembed-1 (40d, binary)", "deployment": "vpc", "quantization": "binary", "dims": 40, "bits_per_dim": 1, "accuracy_override": 0.0309, "needs_quant_storage": true}];
const CURVES = {"zembed-4b-v0.3.0-mix-v3.0/epoch-001-step-8450": [0.07432, 0.11991, 0.1569, 0.19005, 0.21845, 0.24193, 0.26247, 0.28404, 0.30216, 0.31819, 0.33332, 0.34752, 0.36052, 0.37331, 0.38536, 0.39702, 0.40796, 0.41847, 0.42833, 0.4374, 0.4479, 0.45637, 0.46471, 0.47143, 0.47803, 0.48402, 0.49008, 0.49667, 0.50337, 0.50871, 0.51507, 0.52131, 0.52687, 0.53186, 0.53832, 0.54176, 0.54536, 0.55015, 0.55422, 0.55769, 0.56234, 0.56601, 0.56899, 0.57305, 0.57638, 0.57968, 0.58341, 0.58704, 0.59036, 0.59458, 0.59732, 0.60027, 0.60448, 0.60725, 0.61031, 0.61334, 0.61672, 0.62019, 0.62271, 0.62524, 0.62819, 0.63077, 0.63301, 0.63549, 0.63795, 0.64024, 0.64206, 0.6436, 0.64531, 0.64818, 0.65018, 0.65234, 0.65427, 0.65595, 0.65747, 0.65979, 0.66166, 0.66461, 0.66738, 0.66866, 0.67068, 0.67294, 0.67469, 0.6771, 0.67861, 0.68072, 0.68259, 0.68388, 0.68593, 0.68765, 0.68891, 0.69072, 0.69256, 0.69438, 0.69589, 0.69717, 0.69945, 0.70065, 0.70205, 0.70387], "aimodel-embed/modal/voyage-4.zeroentropy.dev": [0.06552, 0.11047, 0.14713, 0.18214, 0.20847, 0.23352, 0.25545, 0.2778, 0.29755, 0.31541, 0.32955, 0.34344, 0.35488, 0.36702, 0.37848, 0.39, 0.40018, 0.40934, 0.41965, 0.42886, 0.43897, 0.44618, 0.45463, 0.46125, 0.46798, 0.47533, 0.48293, 0.48993, 0.49608, 0.50216, 0.50766, 0.51377, 0.52007, 0.52517, 0.53137, 0.53619, 0.54022, 0.54494, 0.54906, 0.5528, 0.55736, 0.5612, 0.56616, 0.5701, 0.57319, 0.57766, 0.58194, 0.58574, 0.59177, 0.59533, 0.59867, 0.60195, 0.60465, 0.60751, 0.61154, 0.61501, 0.61792, 0.62049, 0.62411, 0.6268, 0.6292, 0.63243, 0.63432, 0.6368, 0.63982, 0.64254, 0.64516, 0.64723, 0.64925, 0.65141, 0.65371, 0.656, 0.65809, 0.65968, 0.66295, 0.66578, 0.66791, 0.66902, 0.67123, 0.67341, 0.67512, 0.67726, 0.68011, 0.68163, 0.68394, 0.68651, 0.68814, 0.69062, 0.69271, 0.69406, 0.69685, 0.69851, 0.69988, 0.70073, 0.7023, 0.70358, 0.70509, 0.70688, 0.7086, 0.70976], "aimodel-embed/modal/zeroentropy--voyage-4-nano-model-endpoint.modal.run": [0.05638, 0.09675, 0.13112, 0.16021, 0.18599, 0.20369, 0.22397, 0.24121, 0.26075, 0.27791, 0.29193, 0.30417, 0.31532, 0.32813, 0.33751, 0.34837, 0.35963, 0.3692, 0.38091, 0.38854, 0.39687, 0.40569, 0.41239, 0.41897, 0.42692, 0.43429, 0.44101, 0.44728, 0.45281, 0.45875, 0.46393, 0.46922, 0.47464, 0.47979, 0.48357, 0.48772, 0.49389, 0.498, 0.50268, 0.50669, 0.51034, 0.51408, 0.51922, 0.52304, 0.52699, 0.53137, 0.53465, 0.53838, 0.54269, 0.54611, 0.5487, 0.55218, 0.55426, 0.55698, 0.55997, 0.56265, 0.5655, 0.56886, 0.57079, 0.57336, 0.5768, 0.57969, 0.58215, 0.58493, 0.58872, 0.59067, 0.59376, 0.59665, 0.59907, 0.60187, 0.60401, 0.60618, 0.60878, 0.61073, 0.61288, 0.615, 0.61718, 0.62007, 0.62258, 0.62486, 0.62695, 0.62867, 0.63128, 0.63338, 0.63581, 0.63738, 0.63931, 0.64115, 0.64202, 0.64346, 0.64533, 0.64695, 0.64859, 0.65007, 0.65156, 0.65318, 0.65467, 0.6567, 0.65802, 0.65975], "aimodel-embed/openai/text-embedding-3-large": [0.05532, 0.09518, 0.129, 0.15517, 0.1812, 0.20393, 0.22331, 0.24021, 0.25679, 0.27221, 0.2849, 0.29719, 0.31016, 0.32124, 0.33188, 0.34084, 0.35038, 0.36152, 0.37167, 0.38108, 0.38965, 0.39687, 0.40391, 0.41159, 0.41788, 0.42556, 0.432, 0.43706, 0.44259, 0.44823, 0.45396, 0.46013, 0.46462, 0.47109, 0.47491, 0.48086, 0.48476, 0.48911, 0.49337, 0.49779, 0.50228, 0.50722, 0.51235, 0.5163, 0.5192, 0.52309, 0.52665, 0.53082, 0.53506, 0.5378, 0.54171, 0.54441, 0.54807, 0.55063, 0.55318, 0.55619, 0.5592, 0.56154, 0.56499, 0.5676, 0.57099, 0.57377, 0.57674, 0.57922, 0.58205, 0.58475, 0.58774, 0.5903, 0.59217, 0.59511, 0.59705, 0.5992, 0.60046, 0.60352, 0.60581, 0.6074, 0.60917, 0.61086, 0.61327, 0.61494, 0.61659, 0.61822, 0.62041, 0.62221, 0.62411, 0.62659, 0.62851, 0.63038, 0.63262, 0.63453, 0.63577, 0.63698, 0.6384, 0.64056, 0.64211, 0.64338, 0.64418, 0.64555, 0.64762, 0.64892], "aimodel-embed/openai/text-embedding-3-small": [0.05151, 0.08477, 0.11496, 0.13818, 0.15794, 0.17541, 0.19028, 0.2078, 0.22551, 0.23862, 0.25051, 0.26262, 0.27486, 0.28456, 0.29497, 0.30403, 0.31223, 0.32165, 0.33063, 0.33895, 0.34642, 0.35292, 0.36058, 0.36648, 0.37338, 0.3785, 0.38443, 0.38978, 0.39519, 0.40102, 0.40625, 0.4118, 0.41791, 0.42192, 0.4269, 0.43143, 0.43509, 0.44027, 0.44571, 0.44948, 0.4536, 0.45679, 0.46053, 0.46442, 0.46803, 0.47084, 0.47447, 0.47794, 0.48129, 0.48477, 0.48774, 0.49114, 0.49541, 0.49827, 0.50135, 0.50404, 0.50718, 0.50942, 0.51144, 0.51341, 0.51588, 0.51775, 0.51942, 0.52245, 0.52522, 0.52687, 0.52903, 0.53198, 0.53416, 0.5364, 0.53918, 0.54167, 0.54366, 0.54623, 0.54847, 0.5503, 0.55218, 0.55402, 0.5554, 0.55704, 0.55932, 0.56151, 0.56352, 0.56528, 0.56747, 0.56988, 0.57274, 0.57414, 0.57644, 0.57815, 0.57944, 0.58158, 0.5836, 0.58476, 0.58689, 0.58874, 0.59046, 0.59338, 0.59558, 0.59779]};
const GPUS = [{"gpu": "L4", "price_per_hour": 0.8, "latency_ms": 42, "tok_per_sec": 35000}, {"gpu": "A10G", "price_per_hour": 1.5, "latency_ms": 35, "tok_per_sec": 50000}, {"gpu": "A100", "price_per_hour": 3.2, "latency_ms": 20, "tok_per_sec": 120000}, {"gpu": "H100", "price_per_hour": 4.5, "latency_ms": 15, "tok_per_sec": 200000}];
const RK = 10;
let answers = {};
let flow = [];
let flowIdx = 0;
let sortCol = 'accuracy', sortAsc = false;
let c1 = null, c2 = null;
let recoId = null;
let resolved = false;
let detailsCollapsed = false;
/* ── Post height to parent for iframe auto-resize ── */
let _lastH = 0;
function postHeight() {
if (window.parent === window) return;
requestAnimationFrame(() => {
const page = document.querySelector('.page');
const h = page.offsetHeight;
if (h > 0 && h !== _lastH) {
_lastH = h;
window.parent.postMessage({ type: 'iframeResize', height: h }, '*');
}
});
}
/* ResizeObserver on .page — catches any layout change we might miss */
const _ro = new ResizeObserver(() => postHeight());
_ro.observe(document.querySelector('.page'));
/* transitionend catches wizard collapse/expand animations */
document.addEventListener('transitionend', () => postHeight());
function acc(c) {
if (c.accuracy_override !== undefined) return c.accuracy_override;
if (c.checkpoint && CURVES[c.checkpoint]) return Math.max(0, CURVES[c.checkpoint][RK-1]-(c.accuracy_penalty||0));
return 0;
}
function baselineConfig() {
const deploy = answers.deploy || 'api';
return CONFIGS.find(c => c.deployment === deploy && c.quantization === 'float32' && c.dims === 2560);
}
function baselineBytes() { const b = baselineConfig(); return b ? bpv(b) : 5120; }
function baselineAcc() { const b = baselineConfig(); return b ? acc(b) : 0; }
function bpv(c) { return c.dims * c.bits_per_dim / 8; }
function fmtB(b) { return b >= 1024 ? (b/1024).toFixed(1)+' KB' : b+' B'; }
function fmtBig(b) {
const gb = b/1073741824;
return gb>=1000?(gb/1000).toFixed(1)+' TB':gb>=1?gb.toFixed(1)+' GB':(gb*1024).toFixed(0)+' MB';
}
function fmtTok(t) { return t>=1e6?(t/1e6).toFixed(0)+'M tok/s':t>=1000?(t/1000).toFixed(0)+'k tok/s':t+' tok/s'; }
function storageDeltaHtml(bytes, baseBytes) {
if (baseBytes === 0) return '';
const pct = ((bytes - baseBytes) / baseBytes) * 100;
if (Math.abs(pct) < 0.5) return '<span class="delta baseline">baseline</span>';
return '<span class="delta saving">' + pct.toFixed(0) + '% <span class="vs">vs full</span></span>';
}
function accDeltaHtml(val, base) {
if (base === 0) return '';
const pp = (val - base) * 100;
if (Math.abs(pp) < 0.05) return '<span class="delta baseline">baseline</span>';
return '<span class="delta loss">' + pp.toFixed(1) + '% <span class="vs">vs full</span></span>';
}
function storageDeltaCell(bytes, baseBytes) {
if (baseBytes === 0) return '';
const pct = ((bytes - baseBytes) / baseBytes) * 100;
if (Math.abs(pct) < 0.5) return '<span class="d-base">baseline</span>';
return '<span class="d-save">' + pct.toFixed(0) + '%</span>';
}
function accDeltaCell(val, base) {
if (base === 0) return '';
const pct = ((val - base) / base) * 100;
if (Math.abs(pct) < 0.05) return '<span class="d-base">baseline</span>';
return '<span class="d-loss">' + pct.toFixed(1) + '%</span>';
}
function buildFlow() {
flow = ['deploy'];
if (answers.deploy === 'vpc') flow.push('latency');
flow.push('vectordb', 'budget');
}
function getStepDef(key) {
if (key === 'deploy') return {
q: 'How will you deploy?',
detail: 'Our API handles hosting, scaling, and availability out of the box. Self-hosted VPC runs on your infrastructure behind a private endpoint\u2009\u2014\u2009your data never leaves your network.',
choices: [
{val:'api', label:'ZeroEntropy API', sub:'serverless, pay per token'},
{val:'vpc', label:'Self-hosted VPC', sub:'your cloud, your network'},
],
};
if (key === 'latency') return {
q: 'What\u2019s your latency budget?',
detail: 'Embedding compute time, not including network round-trip. Lower latency requires a faster GPU.',
choices: GPUS.map(g => ({
val: String(g.latency_ms),
label: '\u2264 '+g.latency_ms+' ms',
sub: g.gpu+' \u00b7 $'+g.price_per_hour.toFixed(2)+'/hr \u00b7 '+fmtTok(g.tok_per_sec),
})),
};
if (key === 'vectordb') return {
q: 'Does your vector database support quantized storage?',
detail: 'If your DB stores int8 or binary vectors natively, quantization gives strictly better accuracy per byte than dimension reduction. If it only stores float32, you\u2019re limited to matryoshka truncation.',
choices: [
{val:'yes', label:'Yes', sub:'Qdrant, Milvus, pgvector, self-hosted'},
{val:'no', label:'No / not sure', sub:'Pinecone, Turbopuffer, Weaviate'},
],
};
if (key === 'budget') {
const pool = getPool();
const sizes = [...new Set(pool.map(c=>bpv(c)))].sort((a,b)=>b-a);
return {
q: 'How much storage per vector can you afford?',
detail: 'Each vector is stored per document. At 10M documents, '+fmtB(sizes[0])+'/vector = '+fmtBig(sizes[0]*1e7)+'. At '+fmtB(sizes[sizes.length-1])+'/vector = '+fmtBig(sizes[sizes.length-1]*1e7)+'.',
choices: [
{val:'max', label:'No limit', sub:fmtB(sizes[0])+'/vec \u00b7 max accuracy'},
{val:'medium', label:'Moderate', sub:'balanced accuracy and storage'},
{val:'min', label:'Minimize', sub:fmtB(sizes[sizes.length-1])+'/vec \u00b7 smallest footprint'},
],
};
}
return {q:'',detail:'',choices:[]};
}
function getPool() {
const deploy = answers.deploy || 'api';
const quantOk = answers.vectordb === 'yes';
return CONFIGS
.filter(c => c.deployment === deploy)
.filter(c => quantOk || !c.needs_quant_storage)
.map(c => ({...c, accuracy:acc(c), bytesPerVec:bpv(c)}));
}
function pickBest() {
const pool = getPool();
if (pool.length === 0) return pool;
const sorted = [...pool].sort((a,b) => b.accuracy - a.accuracy);
const minBytes = sorted[sorted.length-1].bytesPerVec;
const midBytes = sorted[Math.floor(sorted.length/2)].bytesPerVec;
let budgetBytes;
if (answers.budget === 'max') budgetBytes = Infinity;
else if (answers.budget === 'min') budgetBytes = minBytes;
else budgetBytes = midBytes;
const eligible = sorted.filter(c => c.bytesPerVec <= budgetBytes);
return (eligible.length > 0 ? eligible : sorted).sort((a,b) => b.accuracy - a.accuracy);
}
function renderTrail() {
const el = document.getElementById('trail');
const frozen = resolved;
let html = '';
for (let i = 0; i < flowIdx; i++) {
const key = flow[i];
const step = getStepDef(key);
const ch = step.choices.find(c => c.val === answers[key]);
if (i > 0) html += '<span class="crumb-sep">\u00b7</span>';
html += '<span class="crumb'+(frozen?' frozen':'')+'"'+(frozen?'':' onclick="backTo('+i+')"')+'><span class="crumb-val">'+(ch?ch.label:'')+'</span></span>';
}
el.innerHTML = html;
}
function backTo(idx) {
if (resolved) return;
for (let i = idx; i < flow.length; i++) delete answers[flow[i]];
flowIdx = idx;
hideAll();
expandWizard();
renderTrail();
buildFlow();
renderStep();
}
function collapseWizard() {
const zone = document.getElementById('wizardZone');
zone.style.maxHeight = zone.scrollHeight + 'px';
zone.classList.add('collapsing');
requestAnimationFrame(() => { zone.style.maxHeight = '0px'; });
zone.addEventListener('transitionend', function handler(e) {
if (e.propertyName !== 'max-height') return;
zone.classList.add('collapsed');
zone.classList.remove('collapsing');
zone.style.maxHeight = '';
zone.removeEventListener('transitionend', handler);
postHeight();
});
}
function expandWizard() {
const zone = document.getElementById('wizardZone');
zone.classList.remove('collapsed','collapsing');
zone.style.maxHeight = '0px';
requestAnimationFrame(() => {
zone.style.maxHeight = zone.scrollHeight + 'px';
zone.addEventListener('transitionend', function handler(e) {
if (e.propertyName !== 'max-height') return;
zone.style.maxHeight = '';
zone.removeEventListener('transitionend', handler);
postHeight();
});
});
}
function renderStep() {
const container = document.getElementById('stepContainer');
const prev = container.querySelector('.step.active');
if (flowIdx >= flow.length) {
if (prev) { prev.classList.add('exiting'); prev.classList.remove('active'); setTimeout(()=>prev.remove(),300); }
resolve();
return;
}
const key = flow[flowIdx];
const step = getStepDef(key);
const div = document.createElement('div');
div.className = 'step';
let html = '<div class="step-q">'+step.q+'</div>';
if (step.detail) html += '<div class="step-detail">'+step.detail+'</div>';
html += '<div class="pills">';
for (const ch of step.choices) {
html += '<button class="pill" data-key="'+key+'" data-val="'+ch.val+'">'
+ch.label+(ch.sub?'<span class="pill-sub">'+ch.sub+'</span>':'')+'</button>';
}
html += '</div>';
div.innerHTML = html;
container.appendChild(div);
div.querySelectorAll('.pill').forEach(btn => {
btn.addEventListener('click', () => {
answers[btn.dataset.key] = btn.dataset.val;
btn.parentElement.querySelectorAll('.pill').forEach(p => p.classList.remove('selected'));
btn.classList.add('selected');
setTimeout(() => {
buildFlow();
flowIdx = flow.indexOf(btn.dataset.key)+1;
if (btn.dataset.key === 'deploy' && btn.dataset.val === 'api') {
showCallout('Your endpoint latency is <span class="callout-num">280 ms</span> p50. <span class="callout-dim">At 1 QPS, Cohere Embed 4 is ~ 650ms. OpenAI v3 is ~1000 ms. Voyage 4 is ~650 ms.</span>');
} else { hideCallout(); }
renderTrail();
renderStep();
}, 180);
});
});
if (prev) { prev.classList.add('exiting'); prev.classList.remove('active'); setTimeout(()=>prev.remove(),300); }
requestAnimationFrame(()=>requestAnimationFrame(()=>div.classList.add('active')));
}
function showCallout(html) {
const el = document.getElementById('callout');
el.innerHTML = html;
requestAnimationFrame(()=>el.classList.add('visible'));
}
function hideCallout() { document.getElementById('callout').classList.remove('visible'); }
function removeGpuSection() {
const existing = document.getElementById('gpuSection');
if (existing) existing.remove();
}
function insertGpuSection() {
removeGpuSection();
const latBudget = parseInt(answers.latency);
const matchGpus = GPUS.filter(g => g.latency_ms <= latBudget);
let gh = '';
for (const g of GPUS) {
const match = g.latency_ms <= latBudget;
gh += '<tr class="'+(match?'gpu-match':'')+'">'
+'<td>'+g.gpu+(match?' <span class="gpu-tag">meets budget</span>':'')+'</td>'
+'<td class="r">$'+g.price_per_hour.toFixed(2)+'/hr</td>'
+'<td class="r">'+g.latency_ms+' ms</td>'
+'<td class="r">'+fmtTok(g.tok_per_sec)+'</td></tr>';
}
let noteText = '';
if (matchGpus.length > 0) {
const cheapest = matchGpus.sort((a,b) => a.price_per_hour - b.price_per_hour)[0];
noteText = 'Cheapest option meeting your budget: '+cheapest.gpu+' at $'+cheapest.price_per_hour.toFixed(2)+'/hr.';
}
const section = document.createElement('div');
section.className = 'gpu-section';
section.id = 'gpuSection';
section.innerHTML =
'<div class="gpu-header">Available GPUs</div>'
+'<table class="gpu-tbl"><thead><tr><th>GPU</th><th class="r">Cost</th><th class="r">p50 latency</th><th class="r">Throughput</th></tr></thead>'
+'<tbody>'+gh+'</tbody></table>'
+(noteText ? '<div class="gpu-note">'+noteText+'</div>' : '');
document.getElementById('gpuMount').appendChild(section);
}
function resolve() {
resolved = true;
const ranked = pickBest();
const best = ranked[0];
recoId = best.id;
const allPool = getPool();
const baseAcc = baselineAcc();
const baseB = baselineBytes();
const qLabel = best.quantization==='float32'?'float32':best.quantization==='int8'?'int8':'binary';
document.getElementById('recoName').textContent = best.name;
document.getElementById('recoDesc').textContent = best.dims+'-dim '+qLabel+' \u00b7 '+fmtB(best.bytesPerVec)+' per vector';
const latVal = answers.deploy === 'api' ? '280 ms' : '\u2264 '+answers.latency+' ms';
document.getElementById('recoGrid').innerHTML =
'<div class="reco-stat"><div class="rv">'+fmtB(best.bytesPerVec)+' '+storageDeltaHtml(best.bytesPerVec, baseB)+'</div><div class="rl">Bytes / vector</div></div>'
+'<div class="reco-stat"><div class="rv">'+(best.accuracy*100).toFixed(1)+'% '+accDeltaHtml(best.accuracy, baseAcc)+'</div><div class="rl">Recall@10</div></div>'
+'<div class="reco-stat"><div class="rv">'+latVal+'</div><div class="rl">Latency</div></div>'
+'<div class="reco-stat"><div class="rv">'+best.dims+'</div><div class="rl">Dimensions</div></div>';
removeGpuSection();
if (answers.deploy === 'vpc') insertGpuSection();
const floatOnly = !answers.vectordb || answers.vectordb === 'no';
document.getElementById('paretoNote').textContent = floatOnly
? 'Your vector DB only stores float32, so we\u2019re comparing matryoshka truncation options. With quantized storage, int8 and binary give strictly better accuracy at the same byte budget.'
: 'With quantized storage, int8 at full dimensions outperforms float32 at reduced dimensions for the same bytes. Binary goes further: 32\u00d7 less storage for a small accuracy penalty.';
renderTrail();
/* Show everything FIRST so scrollHeight includes it all, then measure */
document.getElementById('reco').classList.add('visible');
document.getElementById('resultsZone').classList.add('visible');
document.getElementById('results').classList.add('visible');
document.getElementById('collapseRow').classList.add('visible');
renderTable(allPool);
renderScatter(allPool);
/* Measure now that DOM has all the content visible */
postHeight();
setTimeout(collapseWizard, 600);
}
function hideAll() {
resolved = false;
detailsCollapsed = false;
hideCallout();
removeGpuSection();
document.getElementById('resultsZone').classList.remove('visible');
document.getElementById('collapseBtn').textContent = 'Hide details';
for (const id of ['reco','results','collapseRow']) document.getElementById(id).classList.remove('visible');
postHeight();
}
function renderTable(rows) {
const baseAcc = baselineAcc();
const baseB = baselineBytes();
const sorted = [...rows].sort((a,b) => {
let va=a[sortCol],vb=b[sortCol];
if (sortCol === 'storageDelta') { va = a.bytesPerVec; vb = b.bytesPerVec; }
if (sortCol === 'accDelta') { va = a.accuracy; vb = b.accuracy; }
if (typeof va==='string'){va=va.toLowerCase();vb=vb.toLowerCase();}
return sortAsc?(va<vb?-1:1):(va>vb?-1:1);
});
const ri = sorted.findIndex(r => r.id===recoId);
if (ri>0){const[r]=sorted.splice(ri,1);sorted.unshift(r);}
let html='';
for (const r of sorted) {
const cls = r.id===recoId?'is-reco':'';
const per10m = fmtBig(r.bytesPerVec*1e7);
html+='<tr class="'+cls+'">'
+'<td>'+r.name+'</td>'
+'<td>'+r.quantization+'</td>'
+'<td class="r">'+r.dims+'</td>'
+'<td class="r">'+fmtB(r.bytesPerVec)+'<span class="bytes-sub">'+per10m+' @ 10M</span></td>'
+'<td class="r">'+storageDeltaCell(r.bytesPerVec, baseB)+'</td>'
+'<td class="r">'+(r.accuracy*100).toFixed(1)+'%</td>'
+'<td class="r">'+accDeltaCell(r.accuracy, baseAcc)+'</td>'
+'</tr>';
}
document.getElementById('tbody').innerHTML=html;
}
function renderScatter(rows) {
const GRAY='#ccc',ACCENT='#4f46e5';
const pts=rows.map(r=>({xb:r.bytesPerVec,xd:r.dims,y:r.accuracy,
label:r.name+' ('+r.quantization+')',
color:r.id===recoId?ACCENT:GRAY,r:r.id===recoId?8:4.5,
bw:r.id===recoId?2.5:0,bc:r.id===recoId?'#fff':'transparent'}));
const mkOpts=(xLabel)=>({
responsive:true,maintainAspectRatio:false,
animation:{duration:350,easing:'easeOutCubic'},
plugins:{legend:{display:false},tooltip:{callbacks:{
label:i=>{const p=pts[i.dataIndex];return p.label+': '+(p.y*100).toFixed(1)+'%';}
}}},
scales:{
x:{title:{display:true,text:xLabel,font:{size:11,family:'Inter'}},grid:{color:'#f0f0f0'}},
y:{title:{display:true,text:'Recall@10',font:{size:11,family:'Inter'}},min:0.1,max:0.6,grid:{color:'#f0f0f0'}},
},
});
const mkDs=(xfn)=>[{data:pts.map(p=>({x:xfn(p),y:p.y})),backgroundColor:pts.map(p=>p.color),
pointRadius:pts.map(p=>p.r),pointBorderColor:pts.map(p=>p.bc),pointBorderWidth:pts.map(p=>p.bw)}];
if(c1){c1.data.datasets=mkDs(p=>p.xb);c1.options=mkOpts('Bytes per vector');c1.update();}
else c1=new Chart(document.getElementById('sc1'),{type:'scatter',data:{datasets:mkDs(p=>p.xb)},options:mkOpts('Bytes per vector')});
if(c2){c2.data.datasets=mkDs(p=>p.xd);c2.options=mkOpts('Dimensions');c2.update();}
else c2=new Chart(document.getElementById('sc2'),{type:'scatter',data:{datasets:mkDs(p=>p.xd)},options:mkOpts('Dimensions')});
}
function toggleDetails() {
const zone = document.getElementById('resultsZone');
const btn = document.getElementById('collapseBtn');
if (!detailsCollapsed) {
detailsCollapsed = true;
btn.textContent = 'Show details';
zone.classList.remove('visible');
} else {
detailsCollapsed = false;
btn.textContent = 'Hide details';
zone.classList.add('visible');
}
postHeight();
}
function doReset() {
answers={};flowIdx=0;recoId=null;
hideAll();
expandWizard();
document.getElementById('trail').innerHTML='';
const container=document.getElementById('stepContainer');
const prev=container.querySelector('.step');
if(prev){prev.classList.add('exiting');prev.classList.remove('active');setTimeout(()=>prev.remove(),300);}
buildFlow();
setTimeout(renderStep,150);
postHeight();
}
document.querySelectorAll('#tbl thead th').forEach(th=>{
th.addEventListener('click',()=>{
const col=th.dataset.col;
if(sortCol===col)sortAsc=!sortAsc;
else{sortCol=col;sortAsc=col==='name'||col==='quantization';}
if(recoId)renderTable(getPool());
});
});
buildFlow();
renderStep();
postHeight();
</script>
</body>
</html>