-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsparkcache-prefix-explainer.html
More file actions
807 lines (756 loc) · 61.9 KB
/
Copy pathsparkcache-prefix-explainer.html
File metadata and controls
807 lines (756 loc) · 61.9 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
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="An interactive explanation of SparkCache verified prefix discovery, copy-on-write publication, shared trunks, and bounded GPU-prefix reuse.">
<title>SparkCache · Prefix reuse explorer</title>
<style>
:root {
color-scheme: dark;
--ink: #f4f8fb;
--muted: #9fb0c2;
--faint: #718398;
--bg: #06111c;
--panel: #0b1b2b;
--panel-2: #0e2235;
--line: #1c3a52;
--cyan: #30dfc4;
--cyan-dim: #123f45;
--blue: #6cb5ff;
--amber: #ffc369;
--amber-dim: #49371d;
--red: #ff6f78;
--red-dim: #4b222b;
--green: #8ce49c;
--shadow: 0 22px 70px rgba(0, 0, 0, .28);
--radius: 18px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
margin: 0;
min-width: 320px;
color: var(--ink);
background:
radial-gradient(circle at 12% 0%, rgba(39, 113, 167, .23), transparent 32rem),
radial-gradient(circle at 95% 22%, rgba(24, 159, 143, .10), transparent 28rem),
var(--bg);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
line-height: 1.55;
}
button, input { font: inherit; }
button { color: inherit; }
a { color: var(--blue); }
a:hover { color: #a9d5ff; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }
code, .mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
code { color: #c7e7ff; overflow-wrap: anywhere; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 62px 0 80px; }
.eyebrow {
display: inline-flex;
align-items: center;
gap: 9px;
color: var(--cyan);
font-size: .75rem;
font-weight: 800;
letter-spacing: .15em;
text-transform: uppercase;
}
.eyebrow::before { content: ""; width: 24px; height: 2px; background: currentColor; }
.hero { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr); gap: 42px; align-items: end; }
h1 { margin: 12px 0 16px; max-width: 820px; font-size: clamp(2.45rem, 6vw, 5.4rem); line-height: .98; letter-spacing: -.055em; }
h1 em { color: var(--cyan); font-style: normal; }
.lede { max-width: 760px; margin: 0; color: #bfd0de; font-size: clamp(1.02rem, 2vw, 1.26rem); }
.hero-note { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(11, 27, 43, .78); box-shadow: var(--shadow); }
.hero-note strong { display: block; margin-bottom: 6px; color: var(--amber); font-size: .76rem; letter-spacing: .1em; text-transform: uppercase; }
.hero-note p { margin: 0; color: var(--muted); font-size: .91rem; }
.status-strip { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 36px 0 64px; }
.status-pill { min-height: 82px; padding: 15px 16px; border: 1px solid var(--line); border-radius: 14px; background: rgba(7, 21, 34, .72); }
.status-pill .value { display: block; color: var(--ink); font-size: 1.05rem; font-weight: 800; }
.status-pill .label { color: var(--faint); font-size: .78rem; }
.status-tag { display: inline-block; margin-bottom: 5px; padding: 2px 7px; border: 1px solid #267365; border-radius: 999px; color: var(--cyan); font: 800 .62rem "SFMono-Regular", Consolas, monospace; letter-spacing: .05em; text-transform: uppercase; }
.status-tag.limited { border-color: #7a5a2d; color: var(--amber); }
section { margin-top: 30px; padding: clamp(20px, 4vw, 36px); border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, rgba(14, 34, 53, .94), rgba(8, 24, 39, .96)); box-shadow: var(--shadow); }
.section-head { display: flex; justify-content: space-between; gap: 30px; align-items: end; margin-bottom: 24px; }
.section-head h2 { margin: 0; font-size: clamp(1.45rem, 3vw, 2.2rem); letter-spacing: -.035em; }
.section-head p { max-width: 570px; margin: 0; color: var(--muted); font-size: .94rem; }
.num { color: var(--cyan); font-family: "SFMono-Regular", Consolas, monospace; font-size: .78em; }
.token-row { display: flex; gap: 7px; margin: 18px 0; }
.token {
display: grid;
flex: 1;
min-width: 0;
min-height: 58px;
place-items: center;
border: 1px solid #346480;
border-radius: 9px;
background: #11334a;
color: #d8efff;
font-weight: 900;
box-shadow: inset 0 -12px 20px rgba(3, 14, 24, .22);
}
.token small { display: block; color: #89a7bb; font-size: .6rem; font-weight: 600; }
.token.new { border-color: #86602f; background: #3a2e1c; color: var(--amber); }
.token.live { flex: .23; border-style: dashed; color: var(--faint); background: transparent; }
.context-example { display: grid; grid-template-columns: minmax(245px, .7fr) minmax(0, 1.3fr); gap: 18px; }
.messages, .serialized { padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: rgba(3, 14, 24, .55); }
.messages h3, .serialized h3 { margin: 0 0 4px; font-size: 1rem; }
.messages > p, .serialized > p { margin: 0 0 16px; color: var(--faint); font-size: .78rem; }
.message { display: grid; grid-template-columns: 70px 1fr auto; gap: 10px; align-items: center; margin-top: 7px; padding: 10px 11px; border: 1px solid #29465a; border-radius: 9px; background: #081a28; }
.message-role { color: var(--blue); font: 800 .68rem "SFMono-Regular", Consolas, monospace; text-transform: uppercase; }
.message:nth-of-type(3) .message-role { color: var(--amber); }
.message:nth-of-type(4) .message-role { color: var(--cyan); }
.message:nth-of-type(5) .message-role { color: #cf9cff; }
.message-text { overflow: hidden; color: #c5d2dc; font-size: .75rem; text-overflow: ellipsis; white-space: nowrap; }
.message-count { color: var(--faint); font: .65rem "SFMono-Regular", Consolas, monospace; white-space: nowrap; }
.context-track { position: relative; display: grid; grid-template-columns: 384fr 148fr 430fr 385fr; height: 76px; overflow: hidden; border: 1px solid #31536a; border-radius: 10px; background: #061522; }
.message-segment { display: grid; min-width: 0; place-items: center; border-right: 1px solid rgba(255,255,255,.12); color: white; font: 800 .68rem "SFMono-Regular", Consolas, monospace; text-align: center; }
.message-segment small { display: block; opacity: .65; font-size: .58rem; font-weight: 600; }
.message-segment.system { background: #18466a; }
.message-segment.user-one { background: #765323; }
.message-segment.assistant { background: #176a5c; }
.message-segment.user-two { background: #624378; }
.boundary-line { position: absolute; top: 0; bottom: 0; z-index: 2; width: 1px; background: rgba(255,255,255,.72); box-shadow: 0 0 0 1px rgba(0,0,0,.2); }
.boundary-line::after { content: attr(data-at); position: absolute; top: 3px; left: 4px; color: rgba(255,255,255,.78); font: .55rem "SFMono-Regular", Consolas, monospace; }
.chunk-grid { display: grid; grid-template-columns: repeat(5, 256fr) 67fr; gap: 4px; margin-top: 8px; }
.chunk-cell { min-width: 0; padding: 8px 2px; border: 1px solid #2c5d70; border-radius: 6px; background: #0c2c3e; color: #cae8f6; text-align: center; font: 800 .65rem "SFMono-Regular", Consolas, monospace; }
.chunk-cell small { display: block; margin-top: 2px; color: var(--faint); font-size: .52rem; font-weight: 600; }
.chunk-cell.remainder { border-style: dashed; border-color: #685276; background: #211b2b; color: #cf9cff; }
.span-summary { display: grid; grid-template-columns: 1280fr 67fr; gap: 4px; margin-top: 9px; }
.safe-span, .remainder-span { padding: 6px; border-radius: 5px; text-align: center; font-size: .62rem; }
.safe-span { border: 1px solid #267365; background: var(--cyan-dim); color: var(--cyan); }
.remainder-span { border: 1px dashed #685276; color: #cf9cff; }
.context-note { margin: 16px 0 0; padding: 11px 13px; border-left: 3px solid var(--cyan); background: rgba(18, 63, 69, .35); color: var(--muted); font-size: .79rem; }
.lab { padding: 0; overflow: hidden; }
.lab-head { padding: clamp(20px, 4vw, 34px); border-bottom: 1px solid var(--line); background: rgba(6, 17, 28, .45); }
.scenario-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.scenario-tab, .step-button {
border: 1px solid #2a506b;
border-radius: 9px;
background: #102b41;
cursor: pointer;
font-size: .8rem;
font-weight: 760;
transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.scenario-tab { padding: 8px 12px; }
.scenario-tab:hover, .step-button:hover { transform: translateY(-1px); border-color: var(--cyan); }
.scenario-tab[aria-selected="true"] { border-color: var(--cyan); background: var(--cyan); color: #03201e; }
.controls { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; padding: 16px clamp(20px, 4vw, 34px); border-bottom: 1px solid var(--line); }
.button-group { display: flex; gap: 8px; }
.step-button { min-width: 42px; padding: 8px 11px; }
.step-button:disabled { cursor: default; opacity: .35; transform: none; }
.step-button.playing { border-color: var(--cyan); color: var(--cyan); }
.slider-wrap { display: flex; gap: 12px; align-items: center; color: var(--muted); font-size: .8rem; }
input[type="range"] { width: 100%; accent-color: var(--cyan); }
.step-count { min-width: 94px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #061522; color: var(--cyan); text-align: center; font: 800 .78rem "SFMono-Regular", Consolas, monospace; }
.lab-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(290px, .75fr); }
.stage { min-height: 470px; padding: clamp(20px, 4vw, 34px); border-right: 1px solid var(--line); }
.stage-label { color: var(--cyan); font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.stage h3 { margin: 6px 0 7px; font-size: 1.35rem; }
.stage-copy { min-height: 46px; margin: 0 0 22px; color: var(--muted); font-size: .9rem; }
.prompt-viz { margin-bottom: 24px; }
.prompt-viz .token { transition: opacity .25s ease, border-color .25s ease, background .25s ease, transform .25s ease; }
.token.inactive { opacity: .26; }
.token.chosen { border-color: var(--cyan); background: #10493f; color: #bffff2; transform: translateY(-3px); }
.token.compute { border-color: var(--amber); background: var(--amber-dim); color: var(--amber); transform: translateY(-3px); }
.token.fail { border-color: var(--red); background: var(--red-dim); color: #ffd8dc; }
.candidate-layout { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 15px; align-items: start; }
.candidate-list { display: grid; gap: 6px; }
.candidate { display: flex; justify-content: space-between; align-items: center; min-height: 34px; padding: 7px 9px; border: 1px solid #223f55; border-radius: 7px; background: #071725; color: var(--faint); font: .73rem "SFMono-Regular", Consolas, monospace; transition: .2s ease; }
.candidate::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #355066; }
.candidate.checked { border-color: #506777; color: #c3d1da; }
.candidate.selected { border-color: var(--cyan); background: var(--cyan-dim); color: var(--cyan); transform: translateX(4px); }
.candidate.selected::after { background: var(--cyan); box-shadow: 0 0 0 4px rgba(48, 223, 196, .12); }
.candidate.failed { border-color: var(--red); color: var(--red); }
.candidate.failed::after { background: var(--red); }
.quorum { display: grid; grid-template-columns: 48px repeat(5, 1fr); gap: 5px; text-align: center; }
.q-head { color: var(--faint); font: .67rem "SFMono-Regular", Consolas, monospace; }
.rank-label { display: flex; align-items: center; color: #b7c7d3; font: .71rem "SFMono-Regular", Consolas, monospace; }
.q-cell { min-height: 31px; border: 1px solid #263f52; border-radius: 6px; background: #091927; position: relative; }
.q-cell.hit::after, .q-cell.alias::after, .q-cell.miss::after, .q-cell.corrupt::after { position: absolute; inset: 0; display: grid; place-items: center; font-size: .72rem; font-weight: 900; }
.q-cell.hit { border-color: #246a61; background: #10382f; }
.q-cell.hit::after { content: "✓"; color: var(--cyan); }
.q-cell.alias { border-color: #446fa3; background: #102d4c; }
.q-cell.alias::after { content: "A"; color: var(--blue); }
.q-cell.miss::after { content: "—"; color: #4b6476; }
.q-cell.corrupt { border-color: var(--red); background: var(--red-dim); }
.q-cell.corrupt::after { content: "!"; color: var(--red); }
.q-cell.focus { outline: 2px solid var(--amber); outline-offset: 1px; }
.matrix-note { grid-column: 2 / -1; margin-top: 5px; color: var(--faint); font-size: .71rem; text-align: left; }
.result { padding: clamp(20px, 4vw, 30px); background: rgba(4, 16, 26, .46); }
.result-kicker { color: var(--faint); font-size: .7rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.result-value { margin: 4px 0 0; font-size: clamp(2.4rem, 6vw, 4.6rem); font-weight: 900; line-height: 1; letter-spacing: -.06em; }
.result-value span { color: var(--cyan); }
.result-unit { color: var(--muted); font-size: .78rem; }
.meter { height: 11px; margin: 22px 0 8px; overflow: hidden; border-radius: 999px; background: #1c2934; }
.meter-fill { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #1ba991, var(--cyan)); transition: width .35s ease; }
.meter.fail .meter-fill { background: var(--red); }
.result-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 18px 0; }
.stat { padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: #071725; }
.stat b { display: block; font: 800 1.08rem "SFMono-Regular", Consolas, monospace; }
.stat small { color: var(--faint); font-size: .7rem; }
.verdict { margin-top: 16px; padding: 12px; border: 1px solid #235e58; border-radius: 9px; background: var(--cyan-dim); color: #bffff2; font-size: .8rem; }
.verdict.fail { border-color: #74333c; background: var(--red-dim); color: #ffd3d7; }
.alias-visual { display: grid; grid-template-columns: .8fr 1.2fr; gap: 18px; }
.payload-bank, .aliases { padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: rgba(4, 16, 26, .5); }
.payload-bank h3, .aliases h3 { margin: 0 0 4px; font-size: 1rem; }
.mini-copy { margin: 0 0 18px; color: var(--faint); font-size: .8rem; }
.file-row { display: flex; gap: 7px; }
.file { flex: 1; padding: 22px 4px 9px; border: 1px solid #2b6279; border-radius: 7px; background: #0c2d40; text-align: center; font: 800 .74rem "SFMono-Regular", Consolas, monospace; }
.file small { display: block; margin-top: 4px; color: var(--faint); font-size: .58rem; }
.descriptor-map { display: grid; grid-template-columns: minmax(110px, .7fr) auto minmax(180px, 1.3fr); gap: 8px; align-items: center; margin-top: 13px; }
.descriptor-node { padding: 10px; border: 1px solid #315a75; border-radius: 8px; background: #0b2639; color: #c5dbea; font: 700 .66rem "SFMono-Regular", Consolas, monospace; text-align: center; }
.descriptor-node.alias-node { border-color: #39749b; color: var(--blue); }
.descriptor-node.payload-node { border-color: #267365; color: var(--cyan); }
.descriptor-arrow { color: var(--cyan); font-weight: 900; text-align: center; }
.alias-row { display: grid; grid-template-columns: 92px 1fr; gap: 8px; align-items: center; margin-top: 7px; }
.alias-name { color: var(--cyan); font: .7rem "SFMono-Regular", Consolas, monospace; }
.refs { display: flex; gap: 4px; }
.ref { flex: 1; height: 24px; border: 1px solid #36556a; border-radius: 5px; background: #102c3e; color: #aac1d1; text-align: center; font: 700 .64rem/22px "SFMono-Regular", Consolas, monospace; }
.alias-caption { margin: 17px 0 0; padding-top: 13px; border-top: 1px solid var(--line); color: var(--muted); font-size: .83rem; }
.publication-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.publication-card { padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: rgba(4, 16, 26, .52); }
.publication-card h3 { margin: 0 0 6px; font-size: 1rem; }
.publication-card > p { margin: 0; color: var(--muted); font-size: .8rem; }
.publication-flow { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; gap: 7px; align-items: center; margin: 18px 0 14px; }
.publication-node { min-height: 62px; padding: 9px 6px; border: 1px solid #315a75; border-radius: 8px; background: #0a2537; color: #c9deea; text-align: center; font: 750 .64rem "SFMono-Regular", Consolas, monospace; }
.publication-node.base { border-color: #39749b; color: var(--blue); }
.publication-node.delta { border-color: #7a5a2d; color: var(--amber); }
.publication-node.result { border-color: #267365; color: var(--cyan); }
.publication-arrow { color: var(--cyan); font-weight: 900; text-align: center; }
.status-pair { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.flow { display: grid; grid-template-columns: 1fr auto 1.15fr auto 1fr; gap: 12px; align-items: stretch; }
.flow-card { padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: rgba(4, 16, 26, .52); }
.flow-card .icon { display: grid; width: 34px; height: 34px; margin-bottom: 12px; place-items: center; border-radius: 9px; background: var(--cyan-dim); color: var(--cyan); font-weight: 900; }
.flow-card h3 { margin: 0 0 4px; font-size: .95rem; }
.flow-card p { margin: 0; color: var(--muted); font-size: .78rem; }
.arrow { align-self: center; color: var(--cyan); font-size: 1.25rem; }
.ranks { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 12px; }
.rank { padding: 7px; border: 1px solid #2c5c70; border-radius: 6px; color: #b9d4e5; background: #0b2a3c; font: .68rem "SFMono-Regular", Consolas, monospace; text-align: center; }
.safety-grid, .evidence-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.safety-card, .evidence-card { padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: rgba(4, 16, 26, .52); }
.safety-card strong, .evidence-card strong { display: block; margin-bottom: 6px; color: var(--cyan); font-size: .87rem; }
.safety-card p, .evidence-card p { margin: 0; color: var(--muted); font-size: .8rem; }
.evidence-card strong { color: var(--amber); }
.share-layout { display: grid; grid-template-columns: minmax(250px, .7fr) minmax(0, 1.3fr); gap: 18px; }
.share-controls, .share-stage { padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: rgba(4, 16, 26, .52); }
.share-controls h3, .share-stage h3 { margin: 0 0 6px; font-size: 1rem; }
.share-controls p, .share-stage > p { margin: 0; color: var(--muted); font-size: .8rem; }
.concurrency-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 18px 0; }
.concurrency-button { padding: 9px; border: 1px solid #2a506b; border-radius: 8px; background: #102b41; cursor: pointer; font-weight: 850; }
.concurrency-button[aria-pressed="true"] { border-color: var(--cyan); background: var(--cyan); color: #03201e; }
.share-metrics { display: grid; gap: 8px; }
.share-metric { padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: #071725; }
.share-metric b { display: block; color: var(--cyan); font: 850 1rem "SFMono-Regular", Consolas, monospace; }
.share-metric small { color: var(--faint); font-size: .7rem; }
.lease-flow { display: grid; grid-template-columns: minmax(105px, .7fr) auto minmax(150px, 1fr) auto minmax(160px, 1.25fr); gap: 9px; align-items: center; margin: 20px 0; }
.lease-node { min-height: 86px; padding: 12px; border: 1px solid #315a75; border-radius: 10px; background: #0a2234; text-align: center; }
.lease-node b { display: block; margin-bottom: 5px; color: var(--cyan); font-size: .8rem; }
.lease-node small { color: var(--faint); font-size: .66rem; }
.lease-node.verified { border-color: #267365; background: #10382f; }
.lease-arrow { color: var(--cyan); font-size: 1.2rem; font-weight: 900; }
.request-fan { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.request-card { min-height: 48px; padding: 6px 3px; border: 1px solid #34556b; border-radius: 6px; background: #0c2638; text-align: center; }
.request-card b { display: block; color: #d7ebf7; font: 750 .61rem "SFMono-Regular", Consolas, monospace; }
.request-card small { color: var(--amber); font-size: .55rem; }
.request-card.leader { border-color: var(--cyan); }
.rank-band { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 12px; }
.rank-band span { padding: 7px 4px; border: 1px solid #28556a; border-radius: 6px; color: #b9d4e5; background: #0b2a3c; font: .64rem "SFMono-Regular", Consolas, monospace; text-align: center; }
.share-note { margin-top: 14px; padding: 11px 12px; border-left: 3px solid var(--amber); background: rgba(73, 55, 29, .44); color: #dfc89f; font-size: .76rem; }
.trunk-share { margin-top: 18px; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: rgba(4, 16, 26, .52); }
.trunk-share h3 { margin: 0 0 6px; font-size: 1rem; }
.trunk-share > p { margin: 0; color: var(--muted); font-size: .8rem; }
.trunk-visual { display: grid; grid-template-columns: minmax(180px, .75fr) auto minmax(0, 1.25fr); gap: 10px; align-items: center; margin: 18px 0 12px; }
.trunk-node { padding: 18px 12px; border: 1px solid #267365; border-radius: 10px; background: #10382f; color: var(--cyan); text-align: center; font: 800 .72rem "SFMono-Regular", Consolas, monospace; }
.root-fan { display: grid; gap: 7px; }
.root-row { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.root-prefix, .root-tail { padding: 9px 7px; border: 1px solid #39749b; border-radius: 7px; background: #102d4c; color: var(--blue); text-align: center; font: 700 .66rem "SFMono-Regular", Consolas, monospace; }
.root-tail { border-color: #7a5a2d; background: #302719; color: var(--amber); }
.evidence-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.evidence-table { width: 100%; border-collapse: collapse; min-width: 700px; background: rgba(4, 16, 26, .52); }
.evidence-table th, .evidence-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.evidence-table th { color: var(--faint); font: 800 .67rem "SFMono-Regular", Consolas, monospace; letter-spacing: .05em; text-transform: uppercase; }
.evidence-table td { color: #c7d5df; font-size: .78rem; }
.evidence-table tr:last-child td { border-bottom: 0; }
.evidence-table strong { color: var(--cyan); }
footer { display: flex; justify-content: space-between; gap: 24px; margin-top: 34px; padding: 18px 4px; color: var(--faint); font-size: .76rem; }
footer p { margin: 0; }
.source-links { display: flex; flex-wrap: wrap; gap: 12px; }
@media (max-width: 850px) {
.hero, .lab-grid, .alias-visual, .context-example, .share-layout, .publication-grid { grid-template-columns: 1fr; }
.status-strip { grid-template-columns: 1fr 1fr; }
.stage { min-height: 0; border-right: 0; border-bottom: 1px solid var(--line); }
.flow { grid-template-columns: 1fr; }
.arrow { transform: rotate(90deg); justify-self: center; }
.safety-grid, .evidence-grid { grid-template-columns: 1fr; }
.lease-flow { grid-template-columns: 1fr; }
.lease-arrow { transform: rotate(90deg); justify-self: center; }
.publication-flow, .trunk-visual { grid-template-columns: 1fr; }
.publication-arrow { transform: rotate(90deg); }
.section-head { display: block; }
.section-head p { margin-top: 8px; }
}
@media (max-width: 620px) {
.shell { width: min(100% - 18px, 1180px); padding-top: 34px; }
.status-strip { grid-template-columns: 1fr; }
.controls { grid-template-columns: 1fr; }
.button-group { justify-content: center; }
.candidate-layout { grid-template-columns: 1fr; }
.candidate-list { grid-template-columns: repeat(5, 1fr); }
.candidate { display: grid; min-width: 0; padding: 6px 2px; text-align: center; }
.candidate::after { display: none; }
.alias-row { grid-template-columns: 76px 1fr; }
.descriptor-map { grid-template-columns: 1fr; }
.descriptor-arrow { transform: rotate(90deg); }
.request-fan { grid-template-columns: repeat(2, 1fr); }
footer { display: block; }
.source-links { margin-top: 10px; }
}
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
</style>
</head>
<body>
<main class="shell">
<header class="hero">
<div>
<span class="eyebrow">Persistent context for vLLM</span>
<h1>Reuse the longest <em>verified prefix</em></h1>
<p class="lede">SparkCache finds the longest stored prompt boundary available on every physical rank. It can publish only a conversation extension, share authenticated row segments, coalesce identical opaque-page base reads, and attach concurrent requests to verified GPU blocks.</p>
</div>
<aside class="hero-note">
<strong>Mechanism illustration</strong>
<p>The diagrams use four illustrative physical ranks. SparkCache's deployment profile defines the real rank count, model layout, and supported topology.</p>
</aside>
</header>
<div class="status-strip" aria-label="Request summary">
<div class="status-pill"><span class="status-tag">Implemented</span><span class="value">256 tokens</span><span class="label">logical identity and admission boundary</span></div>
<div class="status-pill"><span class="status-tag">Implemented</span><span class="value">Longest exact</span><span class="label">stored boundary advertised by every rank</span></div>
<div class="status-pill"><span class="status-tag">Implemented</span><span class="value">Row aliases</span><span class="label">sparse authenticated metadata over durable row chunks</span></div>
<div class="status-pill"><span class="status-tag">Implemented</span><span class="value">Copy-on-write</span><span class="label">immutable row tails and page deltas</span></div>
<div class="status-pill"><span class="status-tag">Implemented</span><span class="value">Bounded sharing</span><span class="label">shared bases and verified GPU prefixes</span></div>
</div>
<section aria-labelledby="problem-title">
<div class="section-head">
<h2 id="problem-title"><span class="num">01</span> Messages become one token stream</h2>
<p>Role boundaries and cache boundaries are independent. After chat templating and tokenization, SparkCache sees one ordered sequence of token IDs.</p>
</div>
<div class="context-example">
<article class="messages">
<h3>Example conversation</h3>
<p>Illustrative text; token counts show the serialized size.</p>
<div class="message"><span class="message-role">system</span><span class="message-text">You are an operations assistant. Use the attached runbook…</span><span class="message-count">384</span></div>
<div class="message"><span class="message-role">user</span><span class="message-text">Summarize the incident timeline and identify the first fault…</span><span class="message-count">148</span></div>
<div class="message"><span class="message-role">assistant</span><span class="message-text">The first observable fault occurs at 09:14 when rank 2…</span><span class="message-count">430</span></div>
<div class="message"><span class="message-role">user</span><span class="message-text">Now compare that result with the deployment logs from Friday…</span><span class="message-count">385</span></div>
</article>
<article class="serialized">
<h3>Serialized prompt · 1,347 tokens</h3>
<p>White lines mark real 256-token logical boundaries.</p>
<div class="context-track" aria-label="Messages crossing five complete logical cache intervals and one remainder">
<div class="message-segment system">system<small>384</small></div>
<div class="message-segment user-one">user<small>148</small></div>
<div class="message-segment assistant">assistant<small>430</small></div>
<div class="message-segment user-two">new user<small>385</small></div>
<span class="boundary-line" data-at="256" style="left:19.01%"></span>
<span class="boundary-line" data-at="512" style="left:38.01%"></span>
<span class="boundary-line" data-at="768" style="left:57.02%"></span>
<span class="boundary-line" data-at="1024" style="left:76.02%"></span>
<span class="boundary-line" data-at="1280" style="left:95.03%"></span>
</div>
<div class="chunk-grid" aria-label="Logical cache intervals"><div class="chunk-cell">A<small>0–256</small></div><div class="chunk-cell">B<small>256–512</small></div><div class="chunk-cell">C<small>512–768</small></div><div class="chunk-cell">D<small>768–1024</small></div><div class="chunk-cell">E<small>1024–1280</small></div><div class="chunk-cell remainder">+67</div></div>
<div class="span-summary"><div class="safe-span">five complete logical intervals · 1,280 tokens</div><div class="remainder-span" aria-label="67-token remainder"></div></div>
<p class="context-note"><strong>Important:</strong> these 256-token intervals are real for hashing, alignment, manifest positions, and admission. For <code>block_pages_v1</code>, they do not imply independently reusable physical page objects.</p>
</article>
</div>
</section>
<section class="lab" aria-labelledby="lab-title">
<div class="lab-head">
<div class="section-head" style="margin-bottom:0">
<h2 id="lab-title"><span class="num">02</span> Longest stored-prefix restore</h2>
<p><span class="status-tag">Implemented</span> Choose a scenario, then inspect hashing, exact or row-alias discovery, all-rank availability, byte verification, restore, and private tail prefill.</p>
</div>
<div class="scenario-tabs" role="tablist" aria-label="Reusable-prefix scenarios">
<button class="scenario-tab" type="button" id="scenario-exact" role="tab" aria-controls="prefix-panel" aria-selected="true" tabindex="0" data-scenario="exact">Exact 1,024 on every rank</button>
<button class="scenario-tab" type="button" id="scenario-alias" role="tab" aria-controls="prefix-panel" aria-selected="false" tabindex="-1" data-scenario="alias">Row alias at 768</button>
<button class="scenario-tab" type="button" id="scenario-missing" role="tab" aria-controls="prefix-panel" aria-selected="false" tabindex="-1" data-scenario="missing">1,024 absent on rank 3</button>
<button class="scenario-tab" type="button" id="scenario-corrupt" role="tab" aria-controls="prefix-panel" aria-selected="false" tabindex="-1" data-scenario="corrupt">Rank 2 object fails verification</button>
<button class="scenario-tab" type="button" id="scenario-cold" role="tab" aria-controls="prefix-panel" aria-selected="false" tabindex="-1" data-scenario="cold">No stored boundary</button>
</div>
</div>
<div class="controls">
<div class="button-group">
<button class="step-button" type="button" id="reset" aria-label="Start over">↺</button>
<button class="step-button" type="button" id="previous" aria-label="Previous step">←</button>
<button class="step-button" type="button" id="next" aria-label="Next step">→</button>
</div>
<label class="slider-wrap">Step <input id="step-range" type="range" min="0" max="5" value="0" aria-label="Request step"></label>
<div class="step-count" id="step-count">1 / 6</div>
</div>
<div class="lab-grid" id="prefix-panel" role="tabpanel" aria-labelledby="scenario-exact">
<div class="stage">
<span class="stage-label" id="stage-label">Step 1 · boundary</span>
<h3 id="stage-title">Align to complete logical intervals</h3>
<p class="stage-copy" id="stage-copy">The prompt has 1,347 tokens. SparkCache excludes the live token and rounds down to five complete 256-token intervals: 1,280 potentially reusable tokens.</p>
<div class="prompt-viz">
<div class="token-row" id="prompt-row" aria-label="Prompt chunk state"></div>
</div>
<div class="candidate-layout">
<div class="candidate-list" id="candidate-list" aria-label="Prefix candidates"></div>
<div class="quorum" id="quorum" aria-label="All-rank reusable-prefix availability matrix"></div>
</div>
</div>
<aside class="result" aria-live="polite">
<span class="result-kicker">Reusable target context</span>
<div class="result-value"><span id="restored-value">0</span></div>
<div class="result-unit">tokens admitted for external restore</div>
<div class="meter" id="meter"><div class="meter-fill" id="meter-fill"></div></div>
<div class="result-unit" id="meter-label">0% of the 1,280-token safe span</div>
<div class="result-stats">
<div class="stat"><b id="prefill-value">1,280</b><small>target tokens to prefill</small></div>
<div class="stat"><b id="disk-reads">0</b><small>candidate disk probes</small></div>
</div>
<div class="verdict" id="verdict">No prefix is selected at the alignment step. If no reusable entry qualifies, vLLM computes the prompt normally.</div>
</aside>
</div>
</section>
<section aria-labelledby="alias-title">
<div class="section-head">
<h2 id="alias-title"><span class="num">03</span> One boundary, two physical meanings</h2>
<p>Both storage modes use 256-token logical boundaries. Only row-oriented payloads can describe an earlier prefix by selecting an authenticated leading subset of stored chunks.</p>
</div>
<div class="alias-visual">
<article class="payload-bank">
<h3><span class="status-tag">Implemented</span> <code>per_token_rows</code></h3>
<p class="mini-copy">Each encoded chunk contains the rank-owned tensor rows for one logical token interval.</p>
<div class="file-row"><div class="file">rows A<small>0–256</small></div><div class="file">rows B<small>256–512</small></div><div class="file">rows C<small>512–768</small></div><div class="file">rows D<small>768–1024</small></div></div>
<div class="descriptor-map" aria-label="A 768-token alias selects three authenticated row chunks">
<div class="descriptor-node alias-node">alias · 768 tokens</div><div class="descriptor-arrow" aria-hidden="true">→</div><div class="descriptor-node payload-node">authenticated descriptors → rows A + B + C</div>
</div>
<p class="alias-caption">An authenticated descriptor segment contains at most 16 chunk descriptors. By default, <code>sparkcache-prefix-alias/v1</code> selects 4,096-token boundaries plus the source boundary and retains at most 64 aliases. The aliases reference durable chunks without copying payload bytes.</p>
</article>
<article class="aliases">
<h3><span class="status-tag">Implemented</span> <code>block_pages_v1</code></h3>
<p class="mini-copy">SparkCache encodes one opaque hybrid-memory-allocator (HMA) page snapshot for an exact boundary. Flat v2 roots use <code>sparkcache-page-snapshot-manifest/v2</code> and content-addressed objects of at most 64 MiB.</p>
<div class="alias-row"><span class="alias-name">snapshot</span><div class="refs"><span class="ref">header</span><span class="ref">all layer pages</span><span class="ref">all groups</span></div></div>
<div class="alias-row"><span class="alias-name">flat root</span><div class="refs"><span class="ref">64 MiB #1</span><span class="ref">64 MiB #2</span><span class="ref">…</span><span class="ref">bounded tail</span></div></div>
<p class="alias-caption">Macro objects avoid one physical file per logical token interval. Legacy flat manifests remain readable. <strong>Opaque-page prefix aliases are unsupported:</strong> truncating a byte-partitioned snapshot cannot create an earlier semantic prefix.</p>
</article>
</div>
</section>
<section aria-labelledby="publication-title">
<div class="section-head">
<h2 id="publication-title"><span class="num">04</span> Publish immutable conversation extensions</h2>
<p>Persistent copy-on-write publication reuses a verified base and writes immutable extension data. It is distinct from request-private GPU blocks used during inference.</p>
</div>
<div class="publication-grid">
<article class="publication-card">
<div class="status-pair"><span class="status-tag">Implemented</span></div>
<h3>Row-oriented tail publication</h3>
<p>The opt-in <code>tail-cow-v1</code> publication identity writes only rows after the selected all-rank boundary. A partial terminal chunk becomes an immutable replacement object; durable trunk chunks are never modified.</p>
<div class="publication-flow" aria-label="Verified row trunk, immutable replacement tail, and extended row root">
<div class="publication-node base">verified row trunk</div><div class="publication-arrow" aria-hidden="true">→</div><div class="publication-node delta">replacement + extension rows</div><div class="publication-arrow" aria-hidden="true">→</div><div class="publication-node result">authenticated tail root</div>
</div>
<p><code>sparkcache-tail-manifest/v1</code> binds the base boundary and descriptor chains. GPU-free regressions cover extension, corruption rejection, capacity accounting, and reconstruction. No live serving qualification exists for row tails.</p>
</article>
<article class="publication-card">
<div class="status-pair"><span class="status-tag">Implemented · page-delta/v2</span></div>
<h3>Opaque-page delta publication</h3>
<p><code>sparkcache-hybrid-page-delta/v1</code> binds an exact base snapshot, layout, block counts, and recurrent or sliding boundary. <code>sparkcache-page-delta-manifest/v2</code> groups changed bytes into authenticated objects of at most 64 MiB.</p>
<div class="publication-flow" aria-label="Verified page snapshot, authenticated page delta, and reconstructed complete snapshot">
<div class="publication-node base">verified page snapshot</div><div class="publication-arrow" aria-hidden="true">→</div><div class="publication-node delta">authenticated page delta</div><div class="publication-arrow" aria-hidden="true">→</div><div class="publication-node result">verified full snapshot</div>
</div>
<p>Restore authenticates the complete base-plus-delta graph before placement. A graph admits at most two deltas; another extension publishes a flat snapshot. Deployment profiles record model-specific qualification.</p>
</article>
</div>
<p class="context-note">Selecting <code>tail-cow-v1</code> uses distinct row-tail and page-delta cache identities. Existing <code>snapshot-v1</code> entries keep their namespace and full-snapshot publication behavior.</p>
</section>
<section aria-labelledby="flow-title">
<div class="section-head">
<h2 id="flow-title"><span class="num">05</span> Scheduler selection and rank verification</h2>
<p><span class="status-tag">Implemented</span> When enabled, SparkCache CUDA restore owns verified reconstruction and device transfer. Every rank reads its local shard; SparkCache sends no KV payload through a cache transport.</p>
</div>
<div class="flow">
<article class="flow-card"><div class="icon">1</div><h3>Scheduler</h3><p>Hashes tokens once, records the wire-compatible digest at each eligible boundary, and scans longest-first. A candidate is an exact manifest or a permitted row-prefix alias.</p></article>
<div class="arrow" aria-hidden="true">→</div>
<article class="flow-card"><div class="icon">∀</div><h3>All-rank availability</h3><p>A digest is eligible only when every expected physical TP rank advertises a compatible reusable entry from the same worker-process generation.</p><div class="ranks"><span class="rank">rank 0</span><span class="rank">rank 1</span><span class="rank">…</span><span class="rank">rank n</span></div></article>
<div class="arrow" aria-hidden="true">→</div>
<article class="flow-card"><div class="icon">✓</div><h3>Verification and placement</h3><p>Each rank verifies the selected root and referenced objects. The SparkCache CUDA placement component submits verified page bytes to destination GPU blocks; coordinated success makes the restored prefix usable.</p></article>
</div>
</section>
<section aria-labelledby="safety-title">
<div class="section-head">
<h2 id="safety-title"><span class="num">06</span> Verified-or-recompute restore</h2>
<p>Context is restored only after identity, quorum, compatibility, and chunk integrity checks pass.</p>
</div>
<div class="safety-grid">
<article class="safety-card"><strong>Verified state or recomputation</strong><p>A missing rank, malformed manifest, incompatible identity, or bad chunk hash becomes a miss. The request recomputes instead of consuming unverified KV state.</p></article>
<article class="safety-card"><strong>Identity stays topology-bound</strong><p>Checkpoint digests, layout, TP/DCP, physical rank, chunk geometry, record schema, draft policy, and the prefix-key format remain part of the namespace.</p></article>
<article class="safety-card"><strong>Optional work cannot stall serving</strong><p>An incomplete worker inventory or a full restore backlog makes the request compute normally. Unrelated inference does not wait for optional cache work.</p></article>
</div>
</section>
<section aria-labelledby="shared-title">
<div class="section-head">
<h2 id="shared-title"><span class="num">07</span> Bounded sharing mechanisms</h2>
<p><span class="status-tag">Implemented</span> One verified exact-prefix restore may attach request-private GPU tails to a bounded cohort. Different result roots may also share an authenticated persistent base read.</p>
</div>
<div class="share-layout">
<aside class="share-controls">
<h3>Requests sharing one prefix</h3>
<p>Choose an illustrative cohort size. The controls show the implementation bound, not a qualified workload.</p>
<div class="concurrency-buttons" role="group" aria-label="Concurrent request count">
<button class="concurrency-button" type="button" data-concurrency="1" aria-pressed="false">C1</button>
<button class="concurrency-button" type="button" data-concurrency="8" aria-pressed="false">C8</button>
<button class="concurrency-button" type="button" data-concurrency="16" aria-pressed="true">C16</button>
</div>
<div class="share-metrics" aria-live="polite">
<div class="share-metric"><b id="restore-count">1 per rank</b><small>persistent restores with sharing</small></div>
<div class="share-metric"><b id="avoided-count">15 per rank</b><small>duplicate restores avoided</small></div>
<div class="share-metric"><b id="follower-count">15 followers</b><small>requests attached to verified blocks</small></div>
</div>
<p class="share-note">An in-progress restore accepts at most 16 waiting followers. At most two completed leases remain retained, each for 15 seconds.</p>
</aside>
<div class="share-stage">
<h3>One local copy per rank; ordinary references per request</h3>
<p>A leader receives verified persistent state. vLLM retains that multi-group block table only after every worker finishes and every partial-page copy completes.</p>
<div class="lease-flow" aria-label="Persistent snapshot to leader, verified lease, and request-owned tails">
<div class="lease-node"><b>rank-local NVMe</b><small>authenticated snapshot</small></div>
<div class="lease-arrow" aria-hidden="true">→</div>
<div class="lease-node"><b>leader restore</b><small>private destination blocks</small></div>
<div class="lease-arrow" aria-hidden="true">→</div>
<div class="lease-node verified"><b>verified GPU prefix</b><div class="request-fan" id="request-fan"></div></div>
</div>
<div class="rank-band" aria-label="Independent rank-local restores"><span>rank 0 · one shard</span><span>rank 1 · one shard</span><span>…</span><span>rank n · one shard</span></div>
<div class="share-note">Each request owns ordinary block references and computes a request-private GPU tail. A partial physical page is copied into a dedicated immutable block before follower attachment. These GPU blocks are separate from persistent copy-on-write tail objects on NVMe.</div>
</div>
</div>
<div class="trunk-share">
<div class="status-pair"><span class="status-tag">Implemented · GPU-free tested</span></div>
<h3>Different row roots may coalesce one authenticated trunk restore</h3>
<p>For <code>per_token_rows</code>, requests with different selected roots may name the same verified descriptor prefix. SparkCache restores that common segment once while each request retains its own root identity and computes its private tail.</p>
<div class="trunk-visual" aria-label="Shared row trunk feeding distinct request tails">
<div class="trunk-node">authenticated row trunk<br><small>one segment flight per rank</small></div>
<div class="lease-arrow" aria-hidden="true">→</div>
<div class="root-fan">
<div class="root-row"><div class="root-prefix">root A reference</div><div class="root-tail">private tail A</div></div>
<div class="root-row"><div class="root-prefix">root B reference</div><div class="root-tail">private tail B</div></div>
<div class="root-row"><div class="root-prefix">other roots</div><div class="root-tail">private tails</div></div>
</div>
</div>
<p>Every physical rank must agree on the shared descriptor sequence. A disagreement rejects shared-segment attachment and recomputes the affected request. Different-root row-segment sharing is implemented and GPU-free tested; no live model artifact qualifies it.</p>
</div>
<div class="trunk-share">
<div class="status-pair"><span class="status-tag">Implemented · GPU-free tested</span></div>
<h3>Different page-delta results may coalesce one authenticated base read</h3>
<p>For <code>block_pages_v1</code>, independently authenticated result roots may name identical base evidence. One rank-local reader publishes immutable base bytes to the request cohort; every request still authenticates its private delta, reconstructs its own result, and performs request-private placement.</p>
<div class="trunk-visual" aria-label="One authenticated opaque-page base read feeding private result deltas">
<div class="trunk-node">authenticated base snapshot<br><small>one physical read per rank</small></div>
<div class="lease-arrow" aria-hidden="true">→</div>
<div class="root-fan">
<div class="root-row"><div class="root-prefix">result A base</div><div class="root-tail">private delta A</div></div>
<div class="root-row"><div class="root-prefix">result B base</div><div class="root-tail">private delta B</div></div>
<div class="root-row"><div class="root-prefix">bounded cohort</div><div class="root-tail">private placement</div></div>
</div>
</div>
<p>Cohorts admit at most two flights, 16 cumulative participants, 1 GiB per flight, and 2 GiB peak reservations. Followers stay outside load lanes while the base is pending. The immutable buffer is released after every member acquires or abandons it.</p>
</div>
</section>
<section aria-labelledby="limits-title">
<div class="section-head">
<h2 id="limits-title"><span class="num">08</span> Storage-mode boundaries</h2>
<p>Implemented prefix reuse depends on payload semantics. Logical 256-token geometry alone does not make every stored object independently reusable.</p>
</div>
<div class="safety-grid">
<article class="safety-card"><strong><span class="status-tag">Implemented</span> Exact stored boundaries</strong><p>Every supported storage mode may reuse an exact snapshot published for an earlier aligned request boundary when all ranks advertise it.</p></article>
<article class="safety-card"><strong><span class="status-tag">Implemented</span> Sparse row-prefix aliases</strong><p>A row source manifest produces bounded descriptor chains and selected earlier-prefix aliases. GPU-free regressions pass; live model-serving qualification remains absent.</p></article>
<article class="safety-card"><strong><span class="status-tag limited">Unsupported</span> Opaque-page prefix aliases</strong><p>An HMA snapshot cannot be shortened by truncating byte-partitioned chunk files. Page deltas support extensions from an exact base; they do not create arbitrary earlier-prefix aliases.</p></article>
</div>
</section>
<section aria-labelledby="deployment-title">
<div class="section-head">
<h2 id="deployment-title"><span class="num">09</span> Implementation and qualification are separate</h2>
<p>This page explains repository behavior. A deployment profile identifies the model layout, runtime, checkpoint, topology, artifact, workload, measurements, and supported limits used for live qualification.</p>
</div>
<div class="safety-grid">
<article class="safety-card"><strong><span class="status-tag">Implemented</span> Repository behavior</strong><p>GPU-free tests establish hashing, metadata authentication, reconstruction, bounds, cancellation, and verified-or-recompute behavior.</p></article>
<article class="safety-card"><strong><span class="status-tag limited">Qualified</span> Exact deployment</strong><p>Live evidence applies only to the named profile and immutable artifacts under <code>deploy/</code>.</p></article>
<article class="safety-card"><strong><span class="status-tag limited">Unsupported</span> Unregistered layout</strong><p>A model or topology without an explicit state-ownership and identity contract cannot use opaque-page or CUDA placement paths.</p></article>
</div>
</section>
<footer>
<p>Implemented behavior, qualification boundaries, research work, and unsupported storage modes.</p>
<div class="source-links">
<a href="https://github.com/FujitsuPolycom/sparkcache/tree/main">main</a>
<a href="../ROADMAP.md">research roadmap</a>
<a href="../README.md#deployment-profiles">deployment profiles</a>
</div>
</footer>
</main>
<script>
(() => {
const steps = [
{ label: "Step 1 · boundary", title: "Align to complete logical intervals", copy: "The prompt has 1,347 tokens. SparkCache excludes the live token and rounds down to five complete 256-token intervals: 1,280 potentially reusable tokens." },
{ label: "Step 2 · hashing", title: "Generate exact prefix digests in one pass", copy: "One incremental SHA-256 pass copies the exact wire-compatible digest at 256, 512, 768, 1,024, and 1,280 tokens. Extending the prompt does not change an earlier boundary's digest." },
{ label: "Step 3 · availability", title: "Find the longest advertised root", copy: "The scheduler scans boundary digests longest-first. It selects the first exact manifest or permitted row alias advertised by every expected physical rank." },
{ label: "Step 4 · verification", title: "Read and verify the selected root", copy: "Workers open only the selected root, verify identity and record compatibility, and authenticate every referenced object before restored blocks can be released." },
{ label: "Step 5 · coordinated outcome", title: "Restore together or recompute together", copy: "All ranks commit to the same outcome. If one shard cannot be verified, the external restore is cancelled everywhere; no rank continues with partially trusted KV state." },
{ label: "Step 6 · continuation", title: "Prefill the uncached tail", copy: "After a successful restore, vLLM computes the aligned tail plus the live remainder. The default snapshot-v1 identity may publish a complete snapshot; opt-in tail-cow-v1 publication writes an authenticated immutable extension over the selected base." }
];
const scenarios = {
exact: {
entries: [{1024:"exact"}, {1024:"exact"}, {1024:"exact"}, {1024:"exact"}], candidate: 1024, kind: "exact", corruptRank: null,
verdict: "All four ranks verify the exact 1,024-token snapshot. That snapshot restores from rank-local NVMe; logical interval E is the aligned tail to prefill."
},
alias: {
entries: [{768:"alias"}, {768:"alias"}, {768:"alias"}, {768:"alias"}], candidate: 768, kind: "alias", corruptRank: null,
verdict: "All four ranks verify the authenticated 768-token row alias. Its descriptor chain resolves to durable row chunks A–C; intervals D–E are private tail prefill."
},
missing: {
entries: [{1024:"exact",768:"exact"}, {1024:"exact",768:"exact"}, {1024:"exact",768:"exact"}, {768:"exact"}], candidate: 768, kind: "exact", corruptRank: null,
verdict: "Rank 3 does not advertise the exact 1,024-token snapshot, so selection falls back to an exact 768-token snapshot present everywhere. Logical intervals D–E are prefilled by the model."
},
corrupt: {
entries: [{1024:"exact"}, {1024:"exact"}, {1024:"exact"}, {1024:"exact"}], candidate: 1024, kind: "exact", corruptRank: 2,
verdict: "Rank 2 advertises the exact 1,024-token snapshot but its object does not pass byte verification. Every rank abandons the restore and the full safe span recomputes."
},
cold: {
entries: [{}, {}, {}, {}], candidate: 0, kind: null, corruptRank: null,
verdict: "No all-rank candidate exists. SparkCache returns a normal cache miss and vLLM prefills the full safe span."
}
};
const boundaries = [1280, 1024, 768, 512, 256];
const letters = ["A", "B", "C", "D", "E"];
let scenarioName = "exact";
let step = 0;
const $ = (id) => document.getElementById(id);
const promptRow = $("prompt-row");
const candidates = $("candidate-list");
const quorum = $("quorum");
const range = $("step-range");
function buildStatic() {
promptRow.innerHTML = letters.map((letter, index) => `<div class="token" data-chunk="${index}">${letter}<small>boundary</small></div>`).join("") + '<div class="token live">+67<small>live</small></div>';
candidates.innerHTML = boundaries.map(n => `<div class="candidate" data-prefix="${n}"><span>prefix</span><b>${n}</b></div>`).join("");
}
function buildQuorum(scenario, focusPrefix) {
const headers = '<span></span>' + boundaries.map(n => `<span class="q-head">${n}</span>`).join("");
const rows = scenario.entries.map((entries, rank) => {
const cells = boundaries.map((boundary) => {
let kind = entries[boundary] || "miss";
if (scenario.corruptRank === rank && boundary === scenario.candidate && step >= 3) kind = "corrupt";
const focus = focusPrefix === boundary ? " focus" : "";
const meaning = {exact:"exact manifest", alias:"row alias", miss:"absent", corrupt:"object failed verification"}[kind];
return `<span class="q-cell ${kind}${focus}" aria-label="rank ${rank}, ${boundary}-token prefix, ${meaning}"></span>`;
}).join("");
return `<span class="rank-label">rank ${rank}</span>${cells}`;
}).join("");
quorum.innerHTML = headers + rows + '<span class="matrix-note">✓ exact manifest · A authenticated row alias · — absent · ! object failed verification</span>';
}
function admittedTokens(scenario) {
if (step < 4 || scenario.corruptRank !== null) return 0;
return scenario.candidate;
}
function update() {
const scenario = scenarios[scenarioName];
const admitted = admittedTokens(scenario);
const focusPrefix = step >= 2 && scenario.candidate ? scenario.candidate : null;
$("stage-label").textContent = steps[step].label;
$("stage-title").textContent = steps[step].title;
$("stage-copy").textContent = steps[step].copy;
$("step-count").textContent = `${step + 1} / ${steps.length}`;
range.value = step;
$("previous").disabled = step === 0;
$("next").disabled = step === steps.length - 1;
document.querySelectorAll("#prompt-row .token[data-chunk]").forEach((node, index) => {
node.className = "token";
if (step === 0 && index === 4) node.classList.add("inactive");
if (step >= 4) {
if (scenario.corruptRank !== null) node.classList.add("fail");
else if (index < admitted / 256) node.classList.add("chosen");
else node.classList.add("compute");
}
node.querySelector("small").textContent = step >= 4 ? (scenario.corruptRank !== null ? "recompute" : index < admitted / 256 ? "restore" : "prefill") : "boundary";
});
document.querySelectorAll(".candidate").forEach((node) => {
const value = Number(node.dataset.prefix);
node.className = "candidate";
if (step >= 2 && value > scenario.candidate) node.classList.add("checked");
if (step >= 2 && value === scenario.candidate && scenario.candidate) node.classList.add("selected");
if (step >= 3 && scenario.corruptRank !== null && value === scenario.candidate) node.classList.add("failed");
});
buildQuorum(scenario, focusPrefix);
$("restored-value").textContent = admitted.toLocaleString();
$("prefill-value").textContent = (1280 - admitted).toLocaleString();
$("disk-reads").textContent = step >= 3 && scenario.candidate ? "1" : "0";
const percent = Math.round(admitted / 1280 * 100);
$("meter-fill").style.width = `${percent}%`;
$("meter-label").textContent = `${percent}% of the 1,280-token safe span`;
$("meter").classList.toggle("fail", scenario.corruptRank !== null && step >= 3);
$("verdict").classList.toggle("fail", scenario.corruptRank !== null && step >= 3);
$("verdict").textContent = step < 2
? "No prefix is selected yet. If no reusable entry qualifies, vLLM computes the prompt normally."
: step < 4
? scenario.candidate ? `The ${scenario.candidate.toLocaleString()}-token ${scenario.kind === "alias" ? "row alias" : "exact snapshot"} is being checked; no KV state is usable yet.` : scenario.verdict
: scenario.verdict;
}
function setStep(value) {
step = Math.max(0, Math.min(steps.length - 1, value));
update();
}
const scenarioTabs = [...document.querySelectorAll(".scenario-tab")];
function selectScenario(button, moveFocus = false) {
scenarioName = button.dataset.scenario;
scenarioTabs.forEach(tab => {
const active = tab === button;
tab.setAttribute("aria-selected", String(active));
tab.tabIndex = active ? 0 : -1;
});
$("prefix-panel").setAttribute("aria-labelledby", button.id);
setStep(0);
if (moveFocus) button.focus();
}
scenarioTabs.forEach((button, buttonIndex) => {
button.addEventListener("click", () => {
selectScenario(button);
});
button.addEventListener("keydown", event => {
let targetIndex = null;
if (event.key === "ArrowRight") targetIndex = (buttonIndex + 1) % scenarioTabs.length;
if (event.key === "ArrowLeft") targetIndex = (buttonIndex - 1 + scenarioTabs.length) % scenarioTabs.length;
if (event.key === "Home") targetIndex = 0;
if (event.key === "End") targetIndex = scenarioTabs.length - 1;
if (targetIndex !== null) {
event.preventDefault();
selectScenario(scenarioTabs[targetIndex], true);
}
});
});
$("reset").addEventListener("click", () => setStep(0));
$("previous").addEventListener("click", () => setStep(step - 1));
$("next").addEventListener("click", () => setStep(step + 1));
range.addEventListener("input", () => setStep(Number(range.value)));
function updateConcurrency(value) {
const requests = Number(value);
$("restore-count").textContent = "1 per rank";
$("avoided-count").textContent = `${Math.max(0, requests - 1)} per rank`;
$("follower-count").textContent = `${Math.max(0, requests - 1)} followers`;
$("request-fan").innerHTML = Array.from({length: requests}, (_, index) =>
`<div class="request-card ${index === 0 ? "leader" : ""}"><b>request ${index + 1}</b><small>${index === 0 ? "leader + tail" : "ref + tail"}</small></div>`
).join("");
document.querySelectorAll(".concurrency-button").forEach(button => {
button.setAttribute("aria-pressed", String(Number(button.dataset.concurrency) === requests));
});
}
document.querySelectorAll(".concurrency-button").forEach(button => {
button.addEventListener("click", () => updateConcurrency(button.dataset.concurrency));
});
buildStatic();
update();
updateConcurrency(16);
})();
</script>
</body>
</html>