Spaces:
Running

File size: 167,355 Bytes
93755b7
 
 
 
 
 
1e32bef
93755b7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1e32bef
3b46808
 
93755b7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88f597d
 
 
 
 
 
 
 
 
 
 
93755b7
 
 
88f597d
93755b7
 
 
 
 
 
 
 
 
88f597d
93755b7
 
 
 
 
 
 
 
 
c90ff7f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93755b7
 
 
 
c90ff7f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93755b7
 
 
 
 
 
 
 
 
 
 
 
 
88f597d
6873b7e
88f597d
93755b7
 
1e32bef
93755b7
 
 
 
 
 
 
 
 
 
 
88f597d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93755b7
 
 
 
 
 
 
6873b7e
93755b7
 
 
 
 
 
 
6873b7e
93755b7
1bb9e3f
93755b7
 
 
1bb9e3f
93755b7
 
 
1bb9e3f
1e32bef
93755b7
 
88f597d
93755b7
88f597d
 
93755b7
 
6873b7e
88f597d
93755b7
 
 
 
 
 
 
 
 
 
 
07b5d22
88f597d
 
93755b7
 
 
 
88f597d
93755b7
6873b7e
07b5d22
88f597d
 
 
49f6913
93755b7
 
 
 
6873b7e
 
 
 
 
 
 
 
 
 
93755b7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88f597d
 
93755b7
 
 
 
 
 
 
 
 
 
 
 
49f6913
 
88f597d
 
93755b7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88f597d
93755b7
 
88f597d
93755b7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88f597d
 
 
93755b7
1bb9e3f
88f597d
3b46808
1bb9e3f
93755b7
 
 
c90ff7f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93755b7
9fdc747
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
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<title>Leviathan β€” Local AI on your own GPU</title>
<meta name="description" content="Local AI models running directly on your graphics card: NVIDIA, AMD or Intel. No server, no cloud, no account. Persistent memory, knowledge routing, and sovereign on-device privacy.">
<meta property="og:type" content="website">
<meta property="og:title" content="Leviathan β€” Local AI on your own GPU">
<meta property="og:description" content="No server, no cloud, no account. A local model with a memory that survives, knowledge it can be taught, and a bridge your own programs can use.">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Cinzel:wght@500;600;700&family=Manrope:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap">
<style>
  :root{
    color-scheme: dark;
    --abyss:#060a12;
    --deep:#0b111d;
    --panel:#0f1725;
    --line:#1d2a3f;
    --ink:#e9f0f9;
    --mist:#9fb2c9;
    --faint:#67788f;
    --cyan:#46e0d0;
    --cyan-soft:#7ff5e8;
    --cyan-deep:#2a9d94;
    --gold:#f0b45a;
    --violet:#8b7ff0;
    --maxw:1080px;
    --r:16px;
    --serif:"Cinzel",Georgia,serif;
    --sans:"Manrope",system-ui,-apple-system,"Segoe UI",sans-serif;
    --mono:"JetBrains Mono",ui-monospace,"Cascadia Code",monospace;
  }
  *{box-sizing:border-box}
  html{-webkit-text-size-adjust:100%}
  body{
    margin:0;
    background:
      radial-gradient(1200px 620px at 50% -8%, rgba(70,224,208,.12), transparent 60%),
      radial-gradient(900px 500px at 88% 12%, rgba(139,127,240,.10), transparent 55%),
      var(--abyss);
    color:var(--ink);
    font-family:var(--sans);
    line-height:1.6;
    -webkit-font-smoothing:antialiased;
  }
  img{max-width:100%}
  .wrap{max-width:var(--maxw);margin:0 auto;padding-inline:20px}
  a{color:var(--cyan);text-decoration:none}
  a:hover{color:var(--cyan-soft)}
  h1,h2,h3{text-wrap:balance;margin:0}
  section{padding-block:clamp(48px,7vw,96px)}
  .eyebrow{
    font-family:var(--serif);font-size:13px;font-weight:600;letter-spacing:.22em;
    text-transform:uppercase;color:var(--cyan);margin:0 0 14px;
  }
  .lead{color:var(--mist);font-size:clamp(16px,2.1vw,18px);max-width:62ch}

  /* Hero */
  .hero{text-align:center;padding-top:clamp(40px,8vw,84px);padding-bottom:clamp(36px,5vw,64px)}
  .emblem{width:clamp(150px,26vw,240px);height:auto;display:block;margin:0 auto 26px;
    filter:drop-shadow(0 0 30px rgba(70,224,208,.40));animation:breathe 5.5s ease-in-out infinite}
  @keyframes breathe{0%,100%{opacity:.9}50%{opacity:1}}
  .emblem g{animation:breathe 5.5s ease-in-out infinite}
  .wordmark{
    font-family:var(--serif);font-weight:700;
    font-size:clamp(44px,10vw,104px);line-height:.98;letter-spacing:.06em;
    margin:0;background:linear-gradient(180deg,#f2f8ff,#b9d4e6 62%,var(--cyan-deep));
    -webkit-background-clip:text;background-clip:text;color:transparent;
  }
  .tagline{font-size:clamp(17px,2.6vw,22px);color:var(--ink);font-weight:600;
    margin:20px auto 8px;max-width:30ch}
  .subtag{color:var(--mist);max-width:56ch;margin:0 auto 30px}
  .cta{display:flex;gap:12px;justify-content:center;flex-wrap:wrap}
  .btn{display:inline-flex;align-items:center;gap:8px;font-weight:700;font-size:15px;
    padding:12px 22px;border-radius:999px;border:1px solid transparent;transition:.18s;cursor:pointer}
  .btn.primary{background:linear-gradient(135deg,var(--cyan-soft),var(--cyan-deep));color:#04120f}
  .btn.primary:hover{filter:brightness(1.08);transform:translateY(-1px)}
  .btn.ghost{border-color:var(--line);color:var(--ink);background:rgba(255,255,255,.02)}
  .btn.ghost:hover{border-color:var(--cyan);color:var(--cyan-soft)}
  .req{margin-top:22px;font-family:var(--mono);font-size:12.5px;color:var(--faint);letter-spacing:.02em}
  /* Vulkan (2026-11-10; shipping in 1.1.0): the logo beside its line; .hero .vk img outranks the narrow-screen .hero img rule */
  .hero .vk{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:6px 12px;margin-top:10px}
  .hero .vk img{height:22px;width:auto;max-width:none;margin:0;display:block}

  /* Manifesto */
  .manifesto{border-top:1px solid var(--line);border-bottom:1px solid var(--line);
    background:linear-gradient(180deg,rgba(70,224,208,.04),transparent)}
  .quote{font-family:var(--serif);font-size:clamp(22px,3.6vw,34px);font-weight:600;
    line-height:1.3;text-align:center;max-width:20ch;margin:0 auto 18px}
  .quote .g{color:var(--gold)}
  .quote .c{color:var(--cyan)}

  /* Stats */
  .stats{display:grid;grid-template-columns:repeat(4,1fr);gap:14px}
  .stat{background:var(--panel);border:1px solid var(--line);border-radius:var(--r);
    padding:22px 18px;text-align:center}
  .stat b{display:block;font-family:var(--serif);font-weight:700;font-size:clamp(26px,4vw,40px);
    color:var(--cyan);font-variant-numeric:tabular-nums;line-height:1}
  .stat span{display:block;margin-top:8px;font-size:13px;color:var(--mist)}

  /* File types */
  .files{display:grid;grid-template-columns:repeat(2,1fr);gap:16px;margin-top:34px}
  .file{position:relative;background:var(--panel);border:1px solid var(--line);
    border-radius:var(--r);padding:24px;overflow:hidden}
  .file::before{content:"";position:absolute;top:0;bottom:0;left:0;width:3px;background:var(--accent,var(--cyan))}
  .file .ext{font-family:var(--mono);font-weight:600;font-size:20px;color:var(--accent,var(--cyan))}
  .file .role{font-size:12px;text-transform:uppercase;letter-spacing:.16em;color:var(--faint);
    margin:4px 0 12px}
  .file h3{font-size:17px;margin-bottom:8px}
  .file p{margin:0;color:var(--mist);font-size:14.5px}
  .file code{font-family:var(--mono);font-size:.9em;color:var(--cyan-soft)}

  /* Systems */
  .grid3{display:grid;grid-template-columns:repeat(3,1fr);gap:16px;margin-top:34px}
  .card{background:var(--panel);border:1px solid var(--line);border-radius:var(--r);
    padding:22px;transition:.18s}
  .card:hover{border-color:var(--cyan-deep);transform:translateY(-2px)}
  .card .ic{font-size:20px;line-height:1}
  .card h3{font-size:16px;margin:12px 0 8px}
  .card p{margin:0;color:var(--mist);font-size:14px}
  .card em{color:var(--ink);font-style:normal;font-weight:600}

  /* Security membrane β€” layered defence */
  .membrane{border-top:1px solid var(--line);border-bottom:1px solid var(--line);
    background:linear-gradient(180deg,rgba(70,224,208,.05),transparent 60%)}
  .sec-count{font-family:var(--serif);font-weight:700;color:var(--cyan);line-height:.9;
    font-variant-numeric:tabular-nums;font-size:clamp(30px,4vw,44px)}
  .layers{display:grid;grid-template-columns:repeat(2,1fr);gap:12px;margin-top:30px}
  .layer{display:flex;gap:14px;align-items:flex-start;background:var(--panel);
    border:1px solid var(--line);border-radius:12px;padding:15px 18px;transition:.18s}
  .layer:hover{border-color:var(--cyan-deep);transform:translateY(-1px)}
  .layer .n{font-family:var(--mono);font-size:13px;font-weight:600;color:var(--cyan-deep);
    flex:none;margin-top:1px;min-width:2.4ch}
  .layer h4{margin:0 0 3px;font-size:14.5px;color:var(--ink)}
  .layer p{margin:0;color:var(--mist);font-size:13.5px;line-height:1.5}
  .seal{color:var(--faint);font-size:14px;margin-top:26px;max-width:64ch}

  /* Runaway-model / host-holds-the-leash callout (inside the security band) */
  .hostline{margin-top:26px;border:1px solid var(--line);border-left:3px solid var(--cyan);
    background:linear-gradient(180deg,rgba(70,224,208,.06),transparent);
    border-radius:var(--r);padding:22px 24px}
  .hostline .kick{font-family:var(--serif);font-weight:600;
    font-size:clamp(18px,2.6vw,24px);color:var(--ink);margin:0 0 8px}
  .hostline p{margin:0;color:var(--mist);font-size:15px;max-width:66ch}

  /* Inline Studio β€” dual-model governance band */
  .studio{border-top:1px solid var(--line);border-bottom:1px solid var(--line);
    background:linear-gradient(180deg,rgba(139,127,240,.06),transparent 60%)}
  .studio .lead b{color:var(--ink)}
  .govern{margin-top:30px;font-family:var(--serif);font-weight:600;
    font-size:clamp(18px,2.8vw,26px);color:var(--ink);max-width:26ch}
  .govern .c{color:var(--cyan)}
  .govern .v{color:var(--violet)}

  /* Bridge / code */
  .code{font-family:var(--mono);font-size:13.5px;background:#050a12;border:1px solid var(--line);
    border-radius:12px;padding:16px 18px;color:var(--cyan-soft);overflow-x:auto;margin-top:18px}
  .two{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin-top:22px}
  .mini h3{font-size:15px;margin:0 0 6px;color:var(--ink)}
  .mini p{margin:0;color:var(--mist);font-size:14px}
  .mini code{font-family:var(--mono);color:var(--cyan-soft)}

  /* Floor */
  .floor{border:1px solid var(--line);border-left:3px solid var(--gold);
    background:linear-gradient(180deg,rgba(240,180,90,.05),transparent);
    border-radius:var(--r);padding:24px 26px}
  .floor .hard{color:var(--gold);font-weight:700}

  /* Footer */
  footer{border-top:1px solid var(--line);padding-block:44px;text-align:center;color:var(--faint)}
  footer .links{display:flex;gap:18px;justify-content:center;flex-wrap:wrap;margin:14px 0}
  footer .fine{font-size:12.5px;max-width:52ch;margin:8px auto 0}

  /* See it running β€” real screenshots (2026-10-17) */
  .shot{margin:0;background:var(--panel);border:1px solid var(--line);border-radius:var(--r);overflow:hidden}
  .shot a{display:block}
  .shot img{display:block;width:100%;height:auto}
  .shot figcaption{padding:11px 15px;color:var(--mist);font-size:14px}
  .shot figcaption b{color:var(--ink)}
  .shot.wide{margin-top:30px}
  .shots{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin-top:16px}
  /* one shape for every grid picture: a shot trimmed of its empty bottom sits at the top on the app's own background */
  .shots .shot img{aspect-ratio:16/9;object-fit:contain;object-position:top;background:#0d1420}

  @media (max-width:820px){
    .stats{grid-template-columns:repeat(2,1fr)}
    .grid3{grid-template-columns:1fr 1fr}
    .grid3 > .card:last-child:nth-child(odd){grid-column:1 / -1}  /* no lone card in a 2-col row */
    .two{grid-template-columns:1fr}
	.hero img {
	max-width: 180px;
	height: auto;
	display: block;
	margin: 0 auto 1rem;
}
  }
  @media (max-width:520px){
    .shots{grid-template-columns:1fr}
    .files{grid-template-columns:1fr}
    .grid3{grid-template-columns:1fr}
    .stats{grid-template-columns:1fr 1fr}
    .layers{grid-template-columns:1fr}
  }
  @media (prefers-reduced-motion:reduce){
    .emblem,.emblem g{animation:none}
    .btn:hover,.card:hover{transform:none}
  }

  /* Leviathan, measured (2026-11-18): the benchmark dashboard at the top of the page. Its own classes (.lm-*) and
     tokens, set on its section only; the page's `section` padding is undone for the dashboard's inner sections. */
  /* Layout: one reading column; a figure row of four tiles, then sections, each a heading, a short paragraph, a chart
     and its table view. Every colour comes from the dashboard's own tokens, so both themes follow. */
  .lm { display: flex; flex-direction: column; gap: var(--cds-gap-xl); max-width: 980px; }
  .lm-lede { font-size: var(--cds-font-size-heading); line-height: 1.45; margin: 0; max-width: 62ch; text-wrap: pretty; }
  .lm-lede b { font-weight: var(--cds-font-weight-medium); }
  .lm-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: var(--cds-gap-md); }
  .lm-tile { background: var(--color-panel); border: 1px solid var(--color-border-line); border-radius: var(--cds-radius);
    padding: var(--cds-pad-lg); display: flex; flex-direction: column; gap: var(--cds-gap-xs); }
  .lm-tile-label { font-size: var(--cds-font-size-caption); color: var(--color-fg-muted); }
  .lm-tile-value { font-family: var(--font-anthropic-serif); font-weight: 400; font-size: 34px; line-height: 1.1; }
  .lm-tile-unit { font-size: var(--cds-font-size-body); color: var(--color-fg-muted); margin-left: 4px; }
  .lm-tile-vs { font-size: var(--cds-font-size-caption); color: var(--color-fg-muted); }
  .lm-good { color: var(--color-ok); font-weight: var(--cds-font-weight-medium); }
  .lm-section { display: flex; flex-direction: column; gap: var(--cds-gap-md); }
  .lm-section h2 { font-size: var(--cds-font-size-title); font-weight: var(--cds-font-weight-medium); margin: 0;
    text-wrap: balance; }
  .lm-section p { margin: 0; max-width: 70ch; line-height: 1.55; color: var(--color-fg); }
  .lm-note { font-size: var(--cds-font-size-caption); color: var(--color-fg-muted); max-width: 70ch; line-height: 1.5; }
  .lm-chart { position: relative; width: 100%; min-height: 160px; }
  .lm-chart svg { display: block; overflow: visible; }
  .lm-chart text { fill: var(--cds-text-secondary); font-size: var(--cds-font-size-caption); font-family: var(--font-anthropic-sans); }
  .lm-chart .lm-strong { fill: var(--color-fg); font-weight: var(--cds-font-weight-medium); }
  .lm-chart .tick line, .lm-chart .domain { stroke: var(--cds-chart-axis); }
  .lm-chart .lm-grid line { stroke: var(--cds-chart-grid); }
  .lm-chart .lm-grid .domain { display: none; }
  .lm-ref { stroke: var(--cds-chart-reference); stroke-width: 1; }
  .lm-hit { fill: transparent; cursor: default; }
  .lm-hit:focus { outline: none; }
  .lm-hit:focus-visible { stroke: var(--color-fg); stroke-width: 1; }
  .lm-tip { position: absolute; pointer-events: none; z-index: 2; background: var(--cds-surface-popover);
    border: 1px solid var(--cds-border); box-shadow: var(--cds-shadow-popover); border-radius: var(--cds-radius);
    padding: var(--cds-pad-sm) var(--cds-pad-md); font-size: var(--cds-font-size-caption); max-width: 280px; }
  .lm-tip-v { font-weight: var(--cds-font-weight-medium); color: var(--color-fg); font-size: var(--cds-font-size-body); }
  .lm-tip-k { color: var(--cds-text-secondary); }
  .lm-legend { display: flex; flex-wrap: wrap; gap: var(--cds-gap-md); font-size: var(--cds-font-size-caption);
    color: var(--color-fg-muted); }
  .lm-legend span { display: inline-flex; align-items: center; gap: 6px; }
  .lm-sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
  .lm-sw-dot { border-radius: 50%; }
  .lm-sw-0 { background: var(--lm-c0); } .lm-sw-1 { background: var(--lm-c1); }
  .lm-sw-2 { background: var(--lm-c2); } .lm-sw-3 { background: var(--lm-c3); }
  .lm-multi { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--cds-gap-lg); }
  .lm-multi h3 { font-size: var(--cds-font-size-body); font-weight: var(--cds-font-weight-medium); margin: 0 0 4px 0; }
  .lm-table-wrap { overflow-x: auto; }
  .lm-table { border-collapse: collapse; width: 100%; font-size: var(--cds-font-size-caption);
    font-variant-numeric: tabular-nums; }
  .lm-table th, .lm-table td { text-align: left; padding: 6px 10px 6px 0; border-bottom: 1px solid var(--color-border-line);
    vertical-align: top; }
  .lm-table th { color: var(--color-fg-muted); font-weight: var(--cds-font-weight-medium); }
  .lm-table td.lm-num, .lm-table th.lm-num { text-align: right; }
  .lm-details summary { cursor: pointer; font-size: var(--cds-font-size-caption); color: var(--color-fg-muted); }
  .lm-details[open] summary { margin-bottom: var(--cds-gap-sm); }
  .lm-pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: var(--cds-font-size-caption);
    border: 1px solid var(--color-border-line); }
  .lm-pill-ok { color: var(--color-ok); border-color: var(--color-ok); }
  .lm-pill-bad { color: var(--color-bad); border-color: var(--color-bad); }
  .lm-method { display: flex; flex-direction: column; gap: var(--cds-gap-sm); font-size: var(--cds-font-size-caption);
    line-height: 1.55; color: var(--color-fg-muted); max-width: 75ch; }
  .lm-method p { margin: 0; }
  .lm-credit { font-size: var(--cds-font-size-caption); color: var(--color-fg-muted); margin: 0; }
  .lm-section > h3 { font-size: var(--cds-font-size-body); font-weight: var(--cds-font-weight-medium);
    margin: var(--cds-gap-sm) 0 0 0; }
  .lm-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: var(--cds-gap-lg); }
  .lm-pair > div { display: flex; flex-direction: column; gap: var(--cds-gap-sm); min-width: 0; }
  .lm-pair h3 { font-size: var(--cds-font-size-body); font-weight: var(--cds-font-weight-medium); margin: 0; }
  .lm-chart.lm-chart-sm { min-height: 96px; }
  .lm-sw-m { background: var(--cds-chart-muted); }
  .lm-table td.lm-num, .lm-table td.lm-nowrap { white-space: nowrap; }
  [data-dash-source-state=refreshing] { opacity: .5; }
  .lm-measured{
    --cds-gap-xs:4px;--cds-gap-sm:8px;--cds-gap-md:12px;--cds-gap-lg:20px;--cds-gap-xl:40px;
    --cds-font-size-heading:21px;--cds-font-size-title:20px;--cds-font-size-body:15px;--cds-font-size-caption:13px;
    --cds-font-weight-medium:600;--cds-radius:12px;--cds-pad-sm:6px;--cds-pad-md:10px;--cds-pad-lg:18px;
    --font-anthropic-serif:var(--serif);--font-anthropic-sans:var(--sans);
    --color-bg:var(--abyss);--color-fg:var(--ink);--color-fg-muted:var(--mist);--color-panel:var(--panel);
    --color-border-line:var(--line);--color-ok:var(--cyan);--color-bad:#ff7b72;
    --cds-text-secondary:var(--mist);--cds-chart-axis:var(--line);--cds-chart-grid:#142033;
    --cds-chart-reference:var(--faint);--cds-chart-muted:#5a6b82;--cds-surface-popover:var(--panel);
    --cds-border:var(--line);--cds-shadow-popover:0 8px 24px rgba(0,0,0,.55);
    border-bottom:1px solid var(--line);
    background:linear-gradient(180deg,rgba(70,224,208,.04),transparent 30%);
  }
  .lm-measured section.lm-section{padding-block:0}
  .lm-measured .lm{max-width:none}
  .lm-measured .lm-top{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;
    gap:8px 20px;margin-bottom:12px}
  .lm-measured .lm-h1{font-family:var(--serif);font-weight:600;font-size:clamp(30px,5vw,46px);line-height:1.1;
    letter-spacing:.02em;color:var(--ink)}
  .lm-measured .lm-links{display:flex;flex-wrap:wrap;gap:6px 18px;font-size:13px}
  .lm-measured .lm-hint{margin:0 0 26px;font-size:13px;color:var(--faint)}
  .lm-measured .lm-tile-value{font-weight:600}
  .lm-measured code{font-family:var(--mono);font-size:.88em;color:var(--cyan-soft)}
  .lm-measured .lm-tiles{grid-template-columns:repeat(auto-fit,minmax(min(100%,300px),1fr))}
  .lm-measured .lm-sources dl{margin:6px 0 0}
  .lm-measured .lm-sources dt{font-weight:600;margin-top:14px;font-size:13px;color:var(--ink)}
  .lm-measured .lm-sources dd{margin:2px 0 0;color:var(--mist);font-size:13px;line-height:1.5;max-width:75ch}
  .lm-measured .lm-sources ul{margin:4px 0 0;padding-left:18px}
</style>
</head>
<body>

<!-- Leviathan, measured (added 2026-11-18): the benchmark page, first on this page. Its charts are drawn in the
     browser from the data at the end of this file, so it adds no image files. The same page as
     https://claude.ai/artifact/NBQbfsfgfHfhop9KcNNUMB -->
<section class="lm-measured" id="dash-root" aria-labelledby="lm-title">
  <div class="wrap">
    <p class="eyebrow">Benchmarks Β· one RTX 4080</p>
    <header class="lm-top">
      <h1 class="lm-h1" id="lm-title">Leviathan, measured</h1>
      <nav class="lm-links" aria-label="Benchmark links">
        <a href="https://github.com/CuppaTea1983/Leviathan" target="_blank" rel="noopener">Leviathan on GitHub</a>
        <a href="https://github.com/CuppaTea1983/Sovereign" target="_blank" rel="noopener">Sovereign</a>
      </nav>
    </header>
    <p class="lm-hint">Hover or tap a bar or a dot for its numbers; every chart has its table under it, and the
      datasets are listed at the end of this section.</p>
    <p class="lm-note" id="lm-nod3" hidden>The charts need JavaScript and the d3 library from cdnjs.cloudflare.com.</p>
    <div class="lm">
      <p class="lm-lede" id="lede" data-read lang="en">
        On one RTX 4080, Leviathan runs a 61 GB mixture-of-experts model at
        <b data-draw="lede-moe" data-source="moe" data-field="decode_tok_s" data-row="0">β€”</b> tokens a second, where
        llama.cpp reaches
        <b data-draw="lede-moe-ll" data-source="moe" data-field="decode_tok_s_low" data-row="2">β€”</b>–<b data-draw="lede-moe-lh" data-source="moe" data-field="decode_tok_s" data-row="2">β€”</b>,
        and its own .shn5 format stores that model in
        <b data-draw="lede-shn5" data-source="shn5_files" data-field="size_gb" data-row="1">β€”</b> GB without losing a bit, or
        <b data-draw="lede-shn5-q6" data-source="shn5_files" data-field="size_gb" data-row="2">β€”</b> GB at
        <b data-draw="lede-shn5-bits" data-source="shn5_files" data-field="bits_per_weight" data-row="2">β€”</b> bits a weight.
        A separate video engine with its own kernels denoises a 1280Β Γ—Β 736 LTX-2.3 shot
        <b data-draw="lede-dit-x" data-source="dit_speedup" data-field="ratio" data-row="0">β€”</b> as fast as Lightricks' PyTorch
        pipeline, each step landing <b data-draw="lede-dit-word" data-source="dit_closer">β€”</b> an FP32 run than PyTorch's.
        Every Leviathan build is checked, model by model, against a stored reference before it ships.
      </p>

      <div class="lm-tiles" id="headline">
        <div class="lm-tile" id="tile-moe-decode">
          <div class="lm-tile-label">MoE decode, a 61 GB model on a 16 GB card</div>
          <div><span class="lm-tile-value" data-draw="t-moe-decode" data-source="moe" data-field="decode_tok_s" data-row="0">β€”</span><span class="lm-tile-unit">tok/s</span></div>
          <div class="lm-tile-vs">llama.cpp <span data-draw="t-moe-decode-ll" data-source="moe" data-field="decode_tok_s_low" data-row="2">β€”</span>–<span data-draw="t-moe-decode-lh" data-source="moe" data-field="decode_tok_s" data-row="2">β€”</span> Β·
            <span class="lm-good" data-draw="t-moe-decode-x" data-source="moe_vs_llama" data-field="ratio" data-row="0">β€”</span></div>
        </div>
        <div class="lm-tile" id="tile-shn5">
          <div class="lm-tile-label">The same 61 GB model as a lossless .shn5</div>
          <div><span class="lm-tile-value" data-draw="t-shn5" data-source="shn5_files" data-field="size_gb" data-row="1">β€”</span><span class="lm-tile-unit">GB</span></div>
          <div class="lm-tile-vs">BF16 GGUF <span data-draw="t-shn5-src" data-source="shn5_files" data-field="size_gb" data-row="0">β€”</span> GB Β·
            <span class="lm-good"><span data-draw="t-shn5-x" data-source="shn5_ratio" data-field="smaller_pct" data-row="1">β€”</span> % smaller</span></div>
        </div>
        <div class="lm-tile" id="tile-dit">
          <div class="lm-tile-label">Video: denoising one 1280Β Γ—Β 736 LTX-2.3 shot</div>
          <div><span class="lm-tile-value" data-draw="t-dit" data-source="dit_speedup" data-field="today_s" data-row="0">β€”</span><span class="lm-tile-unit">s</span></div>
          <div class="lm-tile-vs">PyTorch <span data-draw="t-dit-pt" data-source="dit_speedup" data-field="pytorch_s" data-row="0">β€”</span> s Β·
            <span class="lm-good" data-draw="t-dit-x" data-source="dit_speedup" data-field="ratio" data-row="0">β€”</span></div>
        </div>
        <div class="lm-tile" id="tile-moe-prompt">
          <div class="lm-tile-label">MoE 700-token prompt</div>
          <div><span class="lm-tile-value" data-draw="t-moe-prompt" data-source="moe" data-field="prompt700_tok_s" data-row="0">β€”</span><span class="lm-tile-unit">tok/s</span></div>
          <div class="lm-tile-vs">llama.cpp at its fastest settings <span data-draw="t-moe-prompt-ll" data-source="moe" data-field="prompt700_tok_s" data-row="3">β€”</span> Β·
            <span class="lm-good" data-draw="t-moe-prompt-x" data-source="moe_vs_llama" data-field="ratio" data-row="1">β€”</span></div>
        </div>
        <div class="lm-tile" id="tile-dense-decode">
          <div class="lm-tile-label">7B decode, 128-token context</div>
          <div><span class="lm-tile-value" data-draw="t-dense" data-source="decode7b" data-field="tok_s" data-where="engine=Leviathan&amp;context=128">β€”</span><span class="lm-tile-unit">tok/s</span></div>
          <div class="lm-tile-vs">llama.cpp <span data-draw="t-dense-ll" data-source="decode7b" data-field="tok_s" data-where="engine=llama.cpp&amp;context=128">β€”</span>, same session Β·
            <span data-draw="t-dense-x" data-source="dense_vs_llama" data-field="ratio" data-row="0">β€”</span></div>
        </div>
        <div class="lm-tile" id="tile-reference">
          <div class="lm-tile-label">Models inside the reference bar</div>
          <div><span class="lm-tile-value" data-draw="t-ref" data-source="ref_summary" data-field="passed" data-row="0">β€”</span><span class="lm-tile-unit">of <span data-draw="t-ref-n" data-source="ref_summary" data-field="total" data-row="0">β€”</span></span></div>
          <div class="lm-tile-vs">worst KL among the dense models <span data-draw="t-ref-worst" data-source="ref_summary" data-field="worst_dense_kl" data-row="0">β€”</span></div>
        </div>
      </div>

      <section class="lm-section" id="moe-section">
        <h2>A model bigger than the card</h2>
        <p data-read lang="en">Qwen3-30B-A3B in BF16 is 61 GB; the RTX 4080 holds 16. Leviathan keeps the always-used weights
          on the card, streams each layer's experts in from RAM as the router picks them, and runs the whole prompt in one
          fp32 pass so each expert crosses PCIe once. llama.cpp runs the same model with its experts on the CPU
          (<code>--cpu-moe</code>). Higher is better.</p>
        <div class="lm-multi">
          <div>
            <h3>Decode, tokens a second</h3>
            <div class="lm-chart" id="chart-moe-decode" data-draw="moe-decode" data-source="moe"></div>
          </div>
          <div>
            <h3>700-token prompt, tokens a second</h3>
            <div class="lm-chart" id="chart-moe-prompt" data-draw="moe-prompt" data-source="moe"></div>
          </div>
        </div>
        <p class="lm-note">Measured by the test harness, the same 700 token ids for both engines, llama.cpp timed by its own
          clock: Leviathan's decode and 700-token figures on 2026-11-14, its 2,048-token figure and every llama.cpp figure on
          2026-11-13. Where llama.cpp shows a range, the bar is its best run and the table lists both. Its fastest settings
          were <code>-b 2048 -ub 2048 --no-mmap -fa on</code>. At 2,048 tokens: Leviathan
          <span data-draw="moe-2048" data-source="moe" data-field="prompt2048_tok_s" data-row="0">β€”</span>, llama.cpp
          <span data-draw="moe-2048-ll" data-source="moe" data-field="prompt2048_tok_s" data-row="3">β€”</span> tok/s. In fp32 the prompt
          pass comes within 6.5e-5 nats of a float64 reference built from the model's own weights.</p>
        <details class="lm-details">
          <summary>Table</summary>
          <div class="lm-table-wrap">
            <table class="lm-table" data-source="moe" data-row-key="engine">
              <thead><tr><th data-field="engine">Engine</th><th data-field="vram_gib" class="lm-num">VRAM, GiB</th><th data-field="decode_tok_s_low" class="lm-num">Decode low</th><th data-field="decode_tok_s" class="lm-num">Decode</th><th data-field="prompt700_tok_s_low" class="lm-num">700 prompt low</th><th data-field="prompt700_tok_s" class="lm-num">700 prompt</th><th data-field="prompt2048_tok_s" class="lm-num">2,048 prompt</th><th data-field="settings">Settings</th></tr></thead>
              <tbody data-draw="moe-table"></tbody>
            </table>
          </div>
        </details>
      </section>

      <section class="lm-section" id="shn5">
        <h2>The same model in fewer bytes</h2>
        <p data-read lang="en">Leviathan's own file format, .shn5, stores BF16 weights without loss: the exponents are
          entropy-coded, the sign and mantissa kept as they are. A mixture-of-experts model's experts stay compressed in RAM,
          and the card decodes each one as it streams in, checking every 4,096-weight tile. Stage 10, the lossy level,
          quantises each matrix around a per-row and per-column scale grid before the same coding; the norms, the router,
          the embeddings and the output head stay lossless. Stage 10 came after the 1.1.0 release. Smaller is better.</p>
        <div class="lm-chart lm-chart-sm" id="chart-shn5-sizes" data-draw="shn5-sizes" data-source="shn5_files"></div>
        <p class="lm-note">Qwen3-30B-A3B: the lossless file is
          <span data-draw="shn5-ll-pct" data-source="shn5_ratio" data-field="smaller_pct" data-row="1">β€”</span> % smaller than
          the BF16 GGUF and decodes to its exact bytes, checked tensor by tensor; at q6, Stage 10 is
          <span data-draw="shn5-q6-pct" data-source="shn5_ratio" data-field="smaller_pct" data-row="2">β€”</span> % smaller.</p>
        <div class="lm-pair">
          <div>
            <h3>Decode, tokens a second</h3>
            <div class="lm-chart lm-chart-sm" id="chart-shn5-decode" data-draw="shn5-decode" data-source="shn5_speed"></div>
          </div>
          <div>
            <h3>2,048-token prompt, tokens a second</h3>
            <div class="lm-chart lm-chart-sm" id="chart-shn5-prompt" data-draw="shn5-prompt" data-source="shn5_speed"></div>
          </div>
        </div>
        <p class="lm-note">Higher is better. Fewer bytes to stream make the lossy file faster as well: decode
          +<span data-draw="shn5-gain-decode" data-source="shn5_q6_gain" data-field="change_pct" data-row="0">β€”</span> % and a
          2,048-token prompt
          +<span data-draw="shn5-gain-prompt" data-source="shn5_q6_gain" data-field="change_pct" data-row="1">β€”</span> %, with
          <span data-draw="shn5-ram-q6" data-source="shn5_speed" data-field="pinned_ram_gb" data-row="1">β€”</span> GB of RAM held
          for the experts instead of
          <span data-draw="shn5-ram-ll" data-source="shn5_speed" data-field="pinned_ram_gb" data-row="0">β€”</span>, and a load of
          <span data-draw="shn5-load-q6" data-source="shn5_speed" data-field="load_s" data-row="1">β€”</span> s instead of
          <span data-draw="shn5-load-ll" data-source="shn5_speed" data-field="load_s" data-row="0">β€”</span>. Measured on
          2026-11-16 in one session, the two files alternated, 16 expert slots a layer. The card's clock varies by session,
          which is why the lossless file decodes at
          <span data-draw="shn5-ll-decode" data-source="shn5_speed" data-field="decode_tok_s" data-row="0">β€”</span> tok/s here
          and at <span data-draw="shn5-ll-decode-then" data-source="moe" data-field="decode_tok_s" data-row="0">β€”</span> in the
          section above (2026-11-14).</p>
        <h3>What Stage 10 costs, beside llama.cpp's Q6_K</h3>
        <div class="lm-legend" aria-hidden="true">
          <span><i class="lm-sw lm-sw-dot lm-sw-1"></i>.shn5 Stage 10, q6</span><span><i class="lm-sw lm-sw-dot lm-sw-2"></i>Q6_K GGUF</span>
        </div>
        <div class="lm-chart lm-chart-sm" id="chart-shn5-quality" data-draw="shn5-quality" data-source="shn5_quality"></div>
        <p class="lm-note">KL divergence from each model's reference, in nats; lower is closer. On TinyLlama 1.1B, where the
          q6 level was set, Stage 10 lands as close as Q6_K with
          <span data-draw="q6-fewer-tiny" data-source="q6_vs_q6k_bits" data-field="fewer_bits_pct" data-row="1">β€”</span> %
          fewer bits a weight. On the 30B it uses
          <span data-draw="q6-fewer-30b" data-source="q6_vs_q6k_bits" data-field="fewer_bits_pct" data-row="0">β€”</span> % fewer
          bits and lands a little further from its reference
          (<span data-draw="q6-kl-30b" data-source="q6_vs_q6k_bits" data-field="stage10_kl" data-row="0">β€”</span> against
          <span data-draw="q6k-kl-30b" data-source="q6_vs_q6k_bits" data-field="q6k_kl" data-row="0">β€”</span>), with the same
          top token at every position checked: the level needs setting for each model, which is the next step.</p>
        <details class="lm-details">
          <summary>Tables</summary>
          <div class="lm-table-wrap">
            <table class="lm-table" data-source="shn5_files" data-row-key="file">
              <thead><tr><th data-field="file">File</th><th data-field="size_gb" class="lm-num">Size, GB</th><th data-field="bits_per_weight" class="lm-num">Bits a weight</th><th data-field="lossless">Lossless</th></tr></thead>
              <tbody data-draw="shn5-files-table"></tbody>
            </table>
          </div>
          <div class="lm-table-wrap">
            <table class="lm-table" data-source="shn5_speed" data-row-key="file">
              <thead><tr><th data-field="file">File</th><th data-field="decode_tok_s" class="lm-num">Decode, tok/s</th><th data-field="prompt2048_tok_s" class="lm-num">2,048 prompt, tok/s</th><th data-field="pinned_ram_gb" class="lm-num">RAM for the experts, GB</th><th data-field="load_s" class="lm-num">Load, s</th></tr></thead>
              <tbody data-draw="shn5-speed-table"></tbody>
            </table>
          </div>
          <div class="lm-table-wrap">
            <table class="lm-table" data-source="shn5_quality" data-row-key="model,file">
              <thead><tr><th data-field="model">Model</th><th data-field="file">File</th><th data-field="bits_per_weight" class="lm-num">Bits a weight</th><th data-field="kl" class="lm-num">KL</th><th data-field="reference">Against</th><th data-field="note">Note</th></tr></thead>
              <tbody data-draw="shn5-quality-table"></tbody>
            </table>
          </div>
        </details>
      </section>

      <section class="lm-section" id="dit">
        <h2>A video model on the same card</h2>
        <p data-read lang="en">LTX-2.3 is a 22-billion-parameter diffusion transformer that makes picture and sound
          together. This is a community FP8 checkpoint of it, too big for the 16 GB card, so its weights stream in from RAM
          at every step. Through Lightricks' own PyTorch pipeline, one 1280Β Γ—Β 736 shot of 113 frames takes
          <span data-draw="dit-pt" data-source="dit_ladder" data-field="seconds" data-row="0">β€”</span> s to denoise.
          Leviathan's video engine runs the same checkpoint on its own kernels, with the four guidance passes of each step
          batched into one call; each bar below adds one change to the bar above it. Lower is better.</p>
        <div class="lm-chart" id="chart-dit-ladder" data-draw="dit-ladder" data-source="dit_ladder"></div>
        <p class="lm-note">With exact f32 sums the engine already takes
          <span data-draw="dit-exact" data-source="dit_speedup" data-field="exact_s" data-row="0">β€”</span> s,
          <span data-draw="dit-exact-x" data-source="dit_speedup" data-field="ratio_exact" data-row="0">β€”</span> PyTorch's
          speed; the rest comes from cheaper arithmetic, and the charts below show what that costs. The times are the
          denoising alone, from each render's own record (2026-11-17); the text encoder, the decode and writing the file
          come on top. The video engine is a research build, separate from the Leviathan app, which runs text models.</p>
        <div class="lm-pair">
          <div>
            <h3>One step against FP32</h3>
            <div class="lm-legend" aria-hidden="true">
              <span><i class="lm-sw lm-sw-dot lm-sw-0"></i>Video engine</span><span><i class="lm-sw lm-sw-dot lm-sw-m"></i>PyTorch, bf16</span>
            </div>
            <div class="lm-chart" id="chart-dit-accuracy" data-draw="dit-accuracy" data-source="dit_accuracy"></div>
            <p class="lm-note">Relative error of one real denoising step's outputs (768Β Γ—Β 512, 89 frames, picture and sound
              made from a prompt) from Lightricks' own blocks run in FP32 on the same inputs; lower is closer. The engine's
              default lands
              <span data-draw="dit-closer-pic" data-source="dit_closer" data-field="ratio" data-row="0">β€”</span>Γ— closer than
              PyTorch's bf16 for the picture and
              <span data-draw="dit-closer-snd" data-source="dit_closer" data-field="ratio" data-row="2">β€”</span>Γ— for the sound,
              in the conditioned pass (2026-11-18).</p>
          </div>
          <div>
            <h3>The same video? Frames against the exact engine</h3>
            <div class="lm-chart" id="chart-dit-psnr" data-draw="dit-psnr" data-source="dit_psnr"></div>
            <p class="lm-note">PSNR of every decoded frame of the 1280Β Γ—Β 736 shot against the exact engine's render at the
              same seed; higher is closer. Another seed, a different video, sits at
              <span data-draw="dit-psnr-control" data-source="dit_psnr" data-field="psnr_db" data-row="4">β€”</span> dB. Today's
              default sits at
              <span data-draw="dit-psnr-now" data-source="dit_psnr" data-field="psnr_db" data-row="3">β€”</span> dB, a little
              further than PyTorch's own bf16 at
              <span data-draw="dit-psnr-pt" data-source="dit_psnr" data-field="psnr_db" data-row="1">β€”</span>: a diffusion
              model carries the last bit of any arithmetic through its steps, so no two maths paths match pixel for pixel,
              and here the frames show the same scene, character and motion.</p>
          </div>
        </div>
        <div class="lm-pair">
          <div>
            <h3>Where a step's time goes</h3>
            <div class="lm-chart" id="chart-dit-profile" data-draw="dit-profile" data-source="dit_profile"></div>
            <p class="lm-note">GPU time of one denoising step at 1280Β Γ—Β 736, four guidance passes:
              <span data-draw="dit-step-total" data-source="dit_step_total" data-field="seconds" data-row="0">β€”</span> s in all,
              from a profiler trace taken before the last change on the ladder, which then took about 0.35 s a step off the
              matrix products.</p>
          </div>
          <div>
            <h3>A prompt in, picture and sound out</h3>
            <p class="lm-note">LTX-2.3 also makes its own sound, 48 kHz stereo. On the engine's default, with Lightricks'
              2.3 guidance for both, from the prompt to the MP4 written (2026-11-18); the whole run includes building the
              engine, and the prompt's text encoding was cached.</p>
            <div class="lm-table-wrap">
              <table class="lm-table" data-source="dit_t2av" data-row-key="size">
                <thead><tr><th data-field="size">Size</th><th data-field="clip_s" class="lm-num">Clip, s</th><th data-field="dit_s" class="lm-num">Denoising, s</th><th data-field="decode_s" class="lm-num">Decode, s</th><th data-field="total_s" class="lm-num">Whole run, s</th></tr></thead>
                <tbody data-draw="dit-t2av-table"></tbody>
              </table>
            </div>
          </div>
        </div>
        <details class="lm-details">
          <summary>Tables</summary>
          <div class="lm-table-wrap">
            <table class="lm-table" data-source="dit_ladder" data-row-key="step">
              <thead><tr><th data-field="step">Step</th><th data-field="change">Change</th><th data-field="seconds" class="lm-num">Denoising, s</th></tr></thead>
              <tbody data-draw="dit-ladder-table"></tbody>
            </table>
          </div>
          <div class="lm-table-wrap">
            <table class="lm-table" data-source="dit_accuracy" data-row-key="stream,pass">
              <thead><tr><th data-field="stream">Output</th><th data-field="pass">Pass</th><th data-field="leviathan" class="lm-num">Video engine</th><th data-field="pytorch" class="lm-num">PyTorch</th></tr></thead>
              <tbody data-draw="dit-accuracy-table"></tbody>
            </table>
          </div>
          <div class="lm-table-wrap">
            <table class="lm-table" data-source="dit_psnr" data-row-key="render">
              <thead><tr><th data-field="render">Render</th><th data-field="psnr_db" class="lm-num">PSNR, dB</th><th data-field="seconds" class="lm-num">Denoising, s</th></tr></thead>
              <tbody data-draw="dit-psnr-table"></tbody>
            </table>
          </div>
          <div class="lm-table-wrap">
            <table class="lm-table" data-source="dit_profile" data-row-key="part">
              <thead><tr><th data-field="part">Part</th><th data-field="seconds" class="lm-num">GPU seconds a step</th></tr></thead>
              <tbody data-draw="dit-profile-table"></tbody>
            </table>
          </div>
        </details>
      </section>

      <section class="lm-section" id="dense-decode">
        <h2>Decoding a 7B model that fits the card</h2>
        <p data-read lang="en">Qwen 2.5 Coder 7B at Q8_0, one token at a time after a prompt of 128, 2,048 or 4,096 tokens.
          Both engines ran back to back in the same session, in two interleaved rounds; each bar is that engine's faster
          round.
          Leviathan keeps the activations and the attention cache in fp32; llama.cpp rounds the activations to int8
          before each matrix product and keeps its cache in fp16. Higher is better.</p>
        <div class="lm-legend" aria-hidden="true">
          <span><i class="lm-sw lm-sw-0"></i>Leviathan</span><span><i class="lm-sw lm-sw-1"></i>llama.cpp</span>
        </div>
        <div class="lm-chart" id="chart-dense-decode" data-draw="dense-decode" data-source="decode7b"></div>
        <p class="lm-note">From a 128- to a 4,096-token context, Leviathan's token takes
          <span data-draw="depth-lev" data-source="depth_cost" data-field="extra_ms" data-where="engine=Leviathan">β€”</span> ms
          longer and llama.cpp's
          <span data-draw="depth-ll" data-source="depth_cost" data-field="extra_ms" data-where="engine=llama.cpp">β€”</span> ms.
          Leviathan keeps the attention cache in fp32, twice llama.cpp's fp16 bytes: at 4,096 tokens each token reads
          <span data-draw="kv-mb" data-source="hood" data-field="kv_mb" data-row="5">β€”</span> MB of keys and values, which its
          attention streams at <span data-draw="attn-gbs" data-source="hood" data-field="gb_s" data-row="5">β€”</span> GB/s
          (<span data-draw="attn-pct" data-source="hood" data-field="pct_ceiling" data-row="5">β€”</span> % of the card's read
          ceiling, Nsight Systems). Half those bytes at that speed would save about
          <span data-draw="fp16-save" data-source="fp16_estimate" data-field="fp16_saving_ms" data-row="0">β€”</span> ms a token,
          about the whole <span data-draw="fp16-diff" data-source="fp16_estimate" data-field="difference_ms" data-row="0">β€”</span> ms
          difference. An fp16 cache is not built; it would be an opt-in, at llama.cpp's precision.</p>
        <details class="lm-details">
          <summary>Table</summary>
          <div class="lm-table-wrap">
            <table class="lm-table" data-source="decode7b" data-row-key="engine,context">
              <thead><tr><th data-field="engine">Engine</th><th data-field="context" class="lm-num">Context</th><th data-field="tok_s" class="lm-num">tok/s</th><th data-field="ms" class="lm-num">ms a token</th><th data-field="round1_tok_s" class="lm-num">Round 1</th><th data-field="round2_tok_s" class="lm-num">Round 2</th></tr></thead>
              <tbody data-draw="decode-table"></tbody>
            </table>
          </div>
        </details>
      </section>

      <section class="lm-section" id="dense-prompt">
        <h2>Prompts on the same 7B model: llama.cpp still leads by default</h2>
        <p data-read lang="en">A prompt runs as matrix multiplications on the tensor cores. Leviathan's default feeds them
          fp16; llama.cpp feeds int8, which this card runs four times as fast. Leviathan's two opt-in switches trade
          precision for speed and are off unless the user turns them on. Higher is better.</p>
        <div class="lm-legend" aria-hidden="true">
          <span><i class="lm-sw lm-sw-0"></i>Leviathan default</span><span><i class="lm-sw lm-sw-1"></i>+ tensor-core attention (opt-in)</span>
          <span><i class="lm-sw lm-sw-2"></i>+ int8 matrices (opt-in)</span><span><i class="lm-sw lm-sw-3"></i>llama.cpp</span>
        </div>
        <div class="lm-multi" id="prompt-multiples">
          <div><h3>512-token prompt</h3><div class="lm-chart" id="chart-pp512" data-draw="pp-512" data-source="prompt7b"></div></div>
          <div><h3>2,048-token prompt</h3><div class="lm-chart" id="chart-pp2048" data-draw="pp-2048" data-source="prompt7b"></div></div>
          <div><h3>4,096-token prompt</h3><div class="lm-chart" id="chart-pp4096" data-draw="pp-4096" data-source="prompt7b"></div></div>
        </div>
        <p class="lm-note">With both switches on, the matrix inputs are int8 like llama.cpp's, and Leviathan's prompts run at
          <span data-draw="i8x-512" data-source="int8_vs_llama" data-field="ratio" data-where="prompt=512">β€”</span>,
          <span data-draw="i8x-2048" data-source="int8_vs_llama" data-field="ratio" data-where="prompt=2048">β€”</span> and
          <span data-draw="i8x-4096" data-source="int8_vs_llama" data-field="ratio" data-where="prompt=4096">β€”</span>
          llama.cpp's speed at 512, 2,048 and 4,096 tokens.</p>
        <p class="lm-note">What each arm costs, on the 2,048-token prompt's last position against Leviathan's exact path
          (fp32 matrix-vector products, no tensor cores): default KL
          <span data-draw="kl-default" data-source="prompt7b" data-field="kl_vs_exact" data-where="arm_key=default&amp;prompt=2048">β€”</span>,
          tensor-core attention
          <span data-draw="kl-tc" data-source="prompt7b" data-field="kl_vs_exact" data-where="arm_key=tc&amp;prompt=2048">β€”</span>,
          int8 matrices
          <span data-draw="kl-int8" data-source="prompt7b" data-field="kl_vs_exact" data-where="arm_key=int8tc&amp;prompt=2048">β€”</span>
          (KL in nats, lower is closer to exact; one position, where the reference check below takes the worst of 100).</p>
        <details class="lm-details">
          <summary>Table</summary>
          <div class="lm-table-wrap">
            <table class="lm-table" data-source="prompt7b" data-row-key="arm_key,prompt">
              <thead><tr><th data-field="arm">Arm</th><th data-field="prompt" class="lm-num">Prompt</th><th data-field="tok_s" class="lm-num">tok/s</th><th data-field="kl_vs_exact" class="lm-num">KL vs exact</th><th data-field="precision">Matrix inputs</th></tr></thead>
              <tbody data-draw="prompt-table"></tbody>
            </table>
          </div>
        </details>
      </section>

      <section class="lm-section" id="reference">
        <h2>Every model, checked against a stored reference</h2>
        <p data-read lang="en">Before a build ships, each model is run teacher-forced over four prompts, 25 positions each,
          and compared position by position with the RTX 4080's recorded output. A model passes when the top token matches
          (or the top two are tied within 0.01 nats) and the KL divergence stays under its bar everywhere; the same
          comparison one step out of line must fail, and does, for every model. The chart is the CUDA engine now live; the
          Vulkan engine passed the same check on this card and on an AMD integrated GPU (2026-11-14). Lower is better; the
          line marks each model's bar.</p>
        <div class="lm-chart" id="chart-reference" data-draw="ref-dots" data-source="refkl"></div>
        <details class="lm-details">
          <summary>Table</summary>
          <div class="lm-table-wrap">
            <table class="lm-table" data-source="refkl" data-row-key="model">
              <thead><tr><th data-field="model">Model</th><th data-field="weights">Weights</th><th data-field="kl_max" class="lm-num">Worst KL</th><th data-field="bar" class="lm-num">Bar</th><th data-field="decode_path">Decode path</th></tr></thead>
              <tbody data-draw="ref-table"></tbody>
            </table>
          </div>
        </details>
      </section>

      <section class="lm-section" id="opt-in-cost">
        <h2>What the two opt-in switches cost</h2>
        <p data-read lang="en">The same check with each switch on. Tensor-core attention stays far inside the bar on every
          model it applies to. int8 matrices, llama.cpp's own precision for prompts, cross it on every Q8_0 model, and on the
          Gemma 4 fine-tune they change the top token twice: that is why both stay off by default. Lower is better.</p>
        <div class="lm-legend" aria-hidden="true">
          <span><i class="lm-sw lm-sw-dot lm-sw-0"></i>Tensor-core attention</span><span><i class="lm-sw lm-sw-dot lm-sw-2"></i>int8 matrices</span>
        </div>
        <div class="lm-chart" id="chart-optin" data-draw="optin-dots" data-source="optin"></div>
        <details class="lm-details">
          <summary>Table</summary>
          <div class="lm-table-wrap">
            <table class="lm-table" data-source="optin" data-row-key="model">
              <thead><tr><th data-field="model">Model</th><th data-field="weights">Weights</th><th data-field="kl_tc_attention" class="lm-num">Tensor-core attention</th><th data-field="kl_int8_gemm" class="lm-num">int8 matrices</th></tr></thead>
              <tbody data-draw="optin-table"></tbody>
            </table>
          </div>
        </details>
      </section>

      <section class="lm-section" id="hood">
        <h2>Under the hood of a decode step</h2>
        <p data-read lang="en">A decode step reads every weight once, so it is bound by how fast memory streams. Leviathan's
          matrix-vector products now take about as long as llama.cpp's while keeping fp32 activations, and the step runs as
          fewer, larger kernels, replayed as one CUDA graph a token as llama.cpp's is.</p>
        <div class="lm-multi">
          <div>
            <h3>Kernels a decode token</h3>
            <div class="lm-chart" id="chart-launches" data-draw="launches" data-source="hood"></div>
          </div>
          <div>
            <h3>How fast each weight streams, of the card's 670 GB/s ceiling</h3>
            <div class="lm-chart" id="chart-bandwidth" data-draw="bandwidth" data-source="bandwidth"></div>
          </div>
        </div>
        <p class="lm-note">Matrix-vector time a token, Nsight Systems, the two engines traced back to back: Leviathan
          <span data-draw="mv-lev" data-source="hood" data-field="value" data-row="4">β€”</span> ms, llama.cpp
          <span data-draw="mv-ll" data-source="hood" data-field="value" data-row="3">β€”</span> ms. The ceiling is the fastest a bare
          streaming-read kernel reached on this card; the paper figure is 716.8 GB/s.</p>
      </section>

      <section class="lm-section" id="since">
        <h2>Since 1.1.0: the raw formats decode faster</h2>
        <p data-read lang="en">Leviathan computes on a GGUF file's quantised blocks as they are. After the 1.1.0 release,
          the kernels that read those blocks while decoding moved to two rows a warp, and a decode token now takes less time
          on every format measured, with the same output: a KL of at most 4.2e-12 against the old kernels and the same top
          token on every row. Higher is better.</p>
        <h3>Less time a decode token</h3>
        <div class="lm-chart" id="chart-raw-formats" data-draw="raw-formats" data-source="raw_formats"></div>
        <p class="lm-note">Qwen3-30B-A3B at Q3_K_S, whole on the card: a decode token took
          <span data-draw="raw-before" data-source="raw_formats" data-field="before_ms" data-row="0">β€”</span> ms before and
          <span data-draw="raw-after" data-source="raw_formats" data-field="after_ms" data-row="0">β€”</span> ms after, in the same
          session (2026-11-15).</p>
        <details class="lm-details">
          <summary>Table</summary>
          <div class="lm-table-wrap">
            <table class="lm-table" data-source="raw_formats" data-row-key="model,format">
              <thead><tr><th data-field="model">Model</th><th data-field="format">Format</th><th data-field="before_ms" class="lm-num">Before, ms</th><th data-field="after_ms" class="lm-num">After, ms</th><th data-field="change_pct" class="lm-num">Change, %</th></tr></thead>
              <tbody data-draw="raw-table"></tbody>
            </table>
          </div>
        </details>
      </section>

      <section class="lm-section" id="gates">
        <h2>The tests behind these numbers</h2>
        <p data-read lang="en">Each test runs through the real engine on the card. A speed change that alters a single byte
          of output has to say so and pass the reference check above.</p>
        <h3>The gate the engine passed on 2026-11-14</h3>
        <div class="lm-table-wrap">
          <table class="lm-table" data-source="gates" data-row-key="test">
            <thead><tr><th data-field="test">Test</th><th data-field="proves">What it checks</th><th data-field="checks" class="lm-num">Passed</th></tr></thead>
            <tbody data-draw="gates-table"></tbody>
          </table>
        </div>
        <h3>Since then</h3>
        <div class="lm-table-wrap">
          <table class="lm-table" data-source="tests_since" data-row-key="test">
            <thead><tr><th data-field="test">Test</th><th data-field="area">Area</th><th data-field="proves">What it checks</th><th data-field="checks" class="lm-num">Passed</th><th data-field="date">Date</th></tr></thead>
            <tbody data-draw="since-table"></tbody>
          </table>
        </div>
      </section>

      <details class="lm-details" id="method">
        <summary>Method, hardware and flags</summary>
        <div class="lm-method">
          <p>Card: NVIDIA GeForce RTX 4080, 16 GB, stock clocks; Ryzen 9 7950X; 128 GB DDR5 at 3,600 MT/s; Windows 11. The
            card's clock varies by hour, so a comparison counts only when both engines ran in the same session.</p>
          <p>llama.cpp: its own llama-bench, build 983ca8992, <code>-ngl 99 -fa 1</code> (all layers on the card, flash
            attention on; every other setting at its default, such as 512-token micro-batches), 3 repetitions, its mean.
            Decode is <code>tg64</code> at the given depth; prompts are <code>pp512 / pp2048 / pp4096</code>.</p>
          <p>Leviathan: the same model as a .lev file, loaded the way the app loads it. A prompt is one pass from position 0,
            the mean of three; decode is 64 steps after the prompt, the logits copied to the host each step and no
            sampling, as llama-bench does, the mean of two runs. Both engines ran in two interleaved rounds (llama.cpp,
            Leviathan, Leviathan, llama.cpp); each engine's faster round is shown, and the tables list both. The app's
            chat sends a prompt the same way, in one pass.</p>
          <p>KL divergence: how far one next-token distribution is from another, in nats; 0 means identical. For scale,
            Leviathan's own two prompt paths (row by row, and on the tensor cores) differ by under 5e-5 on these models,
            except on Gemma 4's long document (9.5e-4).</p>
          <p>.shn5: sizes are the files on disk, GB = 10⁹ bytes. The speeds are Qwen3-30B-A3B with its experts streamed
            from pinned RAM, 16 expert slots a layer on the card, the lossless and Stage 10 files alternated in one session.
            Quality: KL from a float64 reference built from the 30B's BF16 weights, with the embeddings and output head BF16
            in both of its files; TinyLlama against its F16 model, teacher-forced.</p>
          <p>Video: LTX-2.3 22B, a community FP8 checkpoint, its text encoded by Gemma 3; 1280Β Γ—Β 736, 113 frames (4.7 s at
            24 fps), 8 denoising steps, Lightricks' 2.3 guidance (four passes a step), one reference image for the
            character, a given soundtrack (audio to video), seed 4242. PyTorch is Lightricks' own pipeline in bf16, its
            weights streamed from RAM. The engine's INT8 matrix products quantise both weights and activations to int8
            after a per-row and per-column scale grid and a Hadamard rotation, with a rank-32 correction in fp16.</p>
        </div>
      </details>

      <details class="lm-details lm-sources" id="sources">
        <summary>Sources: the 18 datasets behind this page</summary>
        <dl>
          <dt>MoE model bigger than the card</dt><dd>Qwen3-30B-A3B BF16 on the 16 GB RTX 4080: Leviathan&#x27;s expert streaming against llama.cpp with its experts on the CPU, decode and prompt speed.<ul><li><b>Model:</b> Qwen3-30B-A3B-Instruct-2507, BF16 weights (61 GB as GGUF, 40.5 GB as Leviathan&#x27;s lossless .shn5): larger than the 16 GB card, so experts are streamed</li><li><b>Card:</b> NVIDIA GeForce RTX 4080 16 GB, PCIe 4.0 x16; Ryzen 9 7950X, 128 GB DDR5</li><li><b>Measured:</b> Leviathan&#x27;s decode and 700-token figures: 2026-11-14 ~03:00, after the shortened .shn5 decode chain (the engine DLL of that day; card clock sampled, 2,910 MHz median). Its 2,048-token figure and every llama.cpp figure: 2026-11-13 morning. Harness tests/engine/test_qwen3moe_real.py --arm; the same 700 token ids for both engines.</li><li><b>Where a range:</b> llama.cpp&#x27;s figures are the low and high of its repeated runs: the low is kept beside the high (the _low fields)</li><li><b>Accuracy:</b> Leviathan&#x27;s fp32 prompt pass comes within 6.5e-5 nats of a float64 reference built from the model&#x27;s own weights (worst case over the top-5 log-probs, a 700-token document)</li><li><b>Not shown:</b> short prompts (~20 tokens) are bounded by PCIe: ~30 tok/s against llama.cpp&#x27;s 23-27</li></ul></dd>
          <dt>.shn5 file sizes</dt><dd>Qwen3-30B-A3B as its BF16 GGUF, as a lossless .shn5 and as a Stage 10 q6 .shn5: the size on disk and bits a weight.<ul><li><b>Model:</b> Qwen3-30B-A3B-Instruct-2507: 128 experts x 48 layers, 8 used a token; the BF16 GGUF is 61.1 GB</li><li><b>Lossless:</b> every decoded byte equals the GGUF&#x27;s (checked tensor by tensor); exponents entropy-coded with rANS, sign + mantissa kept raw; 4,096-weight tiles, each with a checksum (2026-11-13)</li><li><b>Stage 10 (lossy):</b> entropy-coded scalar quantisation: a per-row x per-column scale grid around one uniform step, then the same entropy coding; norms, router, embeddings and output head stay lossless; level q6 (2026-11-16)</li><li><b>Units:</b> GB = 10^9 bytes; bits a weight averaged over the quantised matrices</li></ul></dd>
          <dt>.shn5 lossless and Stage 10, speed</dt><dd>Qwen3-30B-A3B with its experts streamed from RAM, 16 slots a layer: decode, a 2,048-token prompt, the RAM held for the experts and the load time, both files in one session (2026-11-16).<ul><li><b>Model:</b> Qwen3-30B-A3B-Instruct-2507, experts streamed from pinned RAM, 16 expert slots a layer on the card</li><li><b>Measured:</b> 2026-11-16, one session, the two files alternated (A/B): the card&#x27;s clock varies by session, so compare within it. The 16.2 tok/s lossless figure above is an earlier session (2026-11-14)</li><li><b>Card:</b> NVIDIA GeForce RTX 4080 16 GB (stock), Ryzen 9 7950X, 128 GB DDR5, Windows 11</li></ul></dd>
          <dt>Stage 10 and Q6_K, quality</dt><dd>Bits a weight and KL divergence from each model&#x27;s reference for Stage 10 q6 and llama.cpp&#x27;s Q6_K, on Qwen3-30B-A3B and TinyLlama 1.1B (2026-11-16).<ul><li><b>KL:</b> how far each file&#x27;s next-token distribution is from the reference, in nats; lower is closer</li><li><b>Calibration:</b> the q6 level is set to Q6_K&#x27;s weight error on TinyLlama; on the 30B it lands a little further from the reference than Q6_K at 6.8 % fewer bits: a per-model calibration is the next step</li><li><b>Measured:</b> 2026-11-16; Leviathan&#x27;s own engine loading each file the way the app does</li></ul></dd>
          <dt>Video engine, one change at a time</dt><dd>Seconds to denoise one 1280 Γ— 736, 113-frame LTX-2.3 shot: Lightricks&#x27; PyTorch pipeline, then Leviathan&#x27;s video engine with each change added (2026-11-17).<ul><li><b>Model:</b> LTX-2.3, a 22-billion-parameter audio-video diffusion transformer (a community FP8 checkpoint), 48 blocks, the text encoder Gemma 3</li><li><b>Shot:</b> 1280 x 736, 113 frames (4.7 s at 24 fps), 8 denoising steps, Lightricks&#x27; 2.3 guidance (4 passes a step), one reference image guiding the character, seed 4242, the music track frozen</li><li><b>Timing:</b> seconds of DiT (the denoising), from each render&#x27;s own recipe file, 2026-11-17; the whole render adds the text encoder, the decode and writing the file</li><li><b>Card:</b> NVIDIA GeForce RTX 4080 16 GB (stock), Ryzen 9 7950X, 128 GB DDR5, Windows 11</li></ul></dd>
          <dt>Video engine against FP32, one step</dt><dd>Relative error of one denoising step&#x27;s picture and sound outputs from Lightricks&#x27; blocks run in FP32: the video engine&#x27;s default and PyTorch&#x27;s bf16 (2026-11-18).<ul><li><b>What:</b> one real denoising step, picture AND sound made from text (no track), 768 x 512 x 89 frames: each output&#x27;s relative RMS error from Lightricks&#x27; blocks run in FP32 (weights x scale in float64) on the same inputs. Lower is closer</li><li><b>Leviathan:</b> the engine&#x27;s default (fp16 sums, fp16 attention, INT8 matrix products, the fused normalisation)</li><li><b>PyTorch:</b> Lightricks&#x27; own bf16 pipeline on the same inputs</li><li><b>Measured:</b> 2026-11-18, the engine&#x27;s test suite (its text-to-audio-video section): 16 of 16 checks</li></ul></dd>
          <dt>Same video: PSNR against the exact engine</dt><dd>PSNR of each render&#x27;s frames against the exact engine&#x27;s render of the same shot and seed, with another seed as the control (2026-11-17).<ul><li><b>What:</b> PSNR of every decoded frame against the exact engine&#x27;s render of the same shot and seed: the same video sits in the 20s; a different seed (a different video) sits near 14.5. Higher is closer</li><li><b>Why not bit for bit:</b> a diffusion model amplifies the last bit of any arithmetic over its steps, so no two maths paths match pixel for pixel; the frames show the same scene, man and motion</li><li><b>Measured:</b> 2026-11-17, the 1280 x 736 shot above</li></ul></dd>
          <dt>One denoising step by part</dt><dd>GPU time of one denoising step at 1280 Γ— 736, by part, from a profiler trace (2026-11-17).<ul><li><b>What:</b> GPU kernel time of one denoising step (4 guidance passes) at 1280 x 736, 113 frames: 8.60 s, from a profiler trace</li><li><b>When:</b> 2026-11-17, before the L2 prefetch, which then took about 0.35 s a step off the matrix products</li></ul></dd>
          <dt>Picture and sound from a prompt</dt><dd>From a prompt to an MP4 with LTX-2.3&#x27;s own sound on the video engine: clip length, denoising, decode and the whole run (2026-11-18).<ul><li><b>What:</b> a prompt in, picture AND sound out (LTX-2.3 makes its own audio, 48 kHz stereo), on the engine&#x27;s default, Lightricks&#x27; 2.3 guidance for both the picture and the sound</li><li><b>Total:</b> the whole run: the prompt read (cached), the engine built, the denoising, the decode and writing the MP4</li><li><b>Measured:</b> 2026-11-18, NVIDIA GeForce RTX 4080 16 GB (stock), Ryzen 9 7950X, 128 GB DDR5, Windows 11</li></ul></dd>
          <dt>7B decode vs llama.cpp</dt><dd>Qwen 2.5 Coder 7B Q8_0 decode speed at three context lengths, both engines in one session over two interleaved rounds.<ul><li><b>Model:</b> Qwen 2.5 Coder 7B Instruct, Q8_0 (the same GGUF for llama.cpp; Leviathan&#x27;s .lev made from it)</li><li><b>Card:</b> NVIDIA GeForce RTX 4080 16 GB, driver 617.42, stock clocks</li><li><b>llama.cpp:</b> llama-bench, build 983ca8992 (CUDA), -ngl 99 -fa 1 (all layers on the card, flash attention on), every other setting at its default; 3 repetitions, their mean</li><li><b>Leviathan:</b> engine DLL 61ca4057 (sha-256 prefix; live since 2026-11-14 15:52), loaded as the app loads it; prompts: one pass from position 0, the mean of 3; decode: 64 steps after the prompt, the logits copied to the host each step, no sampling, the mean of 2 runs</li><li><b>Rounds:</b> two interleaved rounds (llama.cpp, Leviathan, Leviathan, llama.cpp) in one session; tok_s = the engine&#x27;s faster round, both rounds listed</li><li><b>Measured:</b> 2026-11-14 15:57-16:00, one session, no other test or benchmark running</li><li><b>Log:</b> tests/_output/proof/compare.log (scripts final_compare.sh / final_compare.py)</li><li><b>Decode path:</b> fp32 activations and fp32 KV cache; the step ran as a CUDA graph (389 graph steps in round 1), each running the grouped decode attention (Nsight Systems shows its kernel in every token: tests/_output/proof/prof_live.log)</li></ul></dd>
          <dt>7B prompt speed by setting</dt><dd>Prompt speed at 512, 2,048 and 4,096 tokens: Leviathan&#x27;s default and its two opt-in switches against llama.cpp, with each Leviathan setting&#x27;s KL from its exact path.<ul><li><b>Model:</b> Qwen 2.5 Coder 7B Instruct, Q8_0 (the same GGUF for llama.cpp; Leviathan&#x27;s .lev made from it)</li><li><b>Card:</b> NVIDIA GeForce RTX 4080 16 GB, driver 617.42, stock clocks</li><li><b>llama.cpp:</b> llama-bench, build 983ca8992 (CUDA), -ngl 99 -fa 1 (all layers on the card, flash attention on), every other setting at its default; 3 repetitions, their mean</li><li><b>Leviathan:</b> engine DLL 61ca4057 (sha-256 prefix; live since 2026-11-14 15:52), loaded as the app loads it; prompts: one pass from position 0, the mean of 3; decode: 64 steps after the prompt, the logits copied to the host each step, no sampling, the mean of 2 runs</li><li><b>Rounds:</b> two interleaved rounds (llama.cpp, Leviathan, Leviathan, llama.cpp) in one session; tok_s = the engine&#x27;s faster round, both rounds listed</li><li><b>Measured:</b> 2026-11-14 15:57-16:00, one session, no other test or benchmark running</li><li><b>Log:</b> tests/_output/proof/compare.log (scripts final_compare.sh / final_compare.py)</li><li><b>KL vs exact:</b> the 2,048-token prompt&#x27;s last position in each Leviathan arm against the exact path (LEVIATHAN_TC_GEMM=0: fp32 matrix-vector products a row at a time): KL(exact || arm) in nats</li></ul></dd>
          <dt>Reference check per model</dt><dd>Each model&#x27;s worst KL from the RTX 4080&#x27;s recorded output over 4 prompts x 25 teacher-forced positions, with its bar.<ul><li><b>What this is:</b> tests/engine/test_cuda_reference.py: each model&#x27;s output from today&#x27;s engine, teacher-forced over 4 prompts x 25 positions (one prompt ~700 tokens, sent in the app&#x27;s 256-token pieces), against the 4080&#x27;s own CUDA output recorded on 2026-11-10. kl_max = the worst KL divergence of any position. A model passes when the top token matches and KL stays under its bar at every position; a CONTROL (the same logits one step out of line) must fail, and did, 4 of 4, for every model.</li><li><b>What it is not:</b> Not accuracy against an exact answer: the record was itself the fast path&#x27;s output. It proves today&#x27;s engine gives what the recorded one gave, across every engine change since and on every backend (Vulkan and an AMD iGPU pass the same check). Exactness is shown separately.</li><li><b>Bars:</b> 1e-4, or twice CUDA&#x27;s own spread between its fast and per-row paths where that is wider: only Gemma 4&#x27;s long document (1.9e-3).</li><li><b>DeepSeek:</b> 8.9e-5 comes from one near-tie row (margin 0.076 nats) in the code prompt; the cause is the attention&#x27;s F16 copy of one weight (attn_kv_b), not the prompt path. Top-1 matches everywhere.</li><li><b>Measured:</b> 2026-11-14, engine DLL 61ca4057 (live since 15:52): three runs in its gate before the swap (15:06-15:12) and once on the live file after it (15:52), the same worst KL for every model each time (tests/_output/cand2/gate.log).</li></ul></dd>
          <dt>Cost of the opt-in switches</dt><dd>Each model&#x27;s worst KL from the stored reference with tensor-core attention or int8 matrices switched on.<ul><li><b>What this is:</b> The price of Leviathan&#x27;s two OPT-IN speed switches, per model: the worst KL divergence from the stored CUDA reference over 4 prompts x 25 teacher-forced positions. The bar a model must pass is 1e-4.</li><li><b>tc attention:</b> LEVIATHAN_ATTN_TC=1: the prompt&#x27;s attention on fp16 tensor cores (fp32 sums). Measured 2026-11-14 on the sm_89 test build lev_ws6 (tests/_output/attn_tc/ref_tc_ws6.log). Gemma 4 and DeepSeek run their own attention, so it does not apply to them (null).</li><li><b>int8 GEMM:</b> LEVIATHAN_INT8_GEMM=1: Q8_0 weights times activations rounded to int8 per 32 values (llama.cpp&#x27;s own precision class for prompts). Measured 2026-11-14 (tests/_output/int8/ref_int8.log). It only changes Q8_0 models; the others show their default figure (int8_applies false). Gemma 4 flips two top-1 tokens: never use it there.</li><li><b>Default:</b> Neither switch is on by default: accuracy first (his call, 2026-11-14).</li><li><b>Models:</b> Base architectures from the engine&#x27;s blueprint of each file. DeepSeek-Coder-V2-Lite (Q6_K, MoE + MLA) is in the reference set too; neither switch applies to it.</li></ul></dd>
          <dt>Decode step under the hood</dt><dd>Kernels a decode token, matrix-vector time and attention time, from Nsight Systems traces of both engines.<ul><li><b>Model and context:</b> Qwen 2.5 Coder 7B Q8_0 on the RTX 4080; decode at a 128-token context, the attention row at 4,096 tokens</li><li><b>Tool:</b> NVIDIA Nsight Systems 2025.6.3, CUDA trace with --cuda-graph-trace=node for both engines (both replay their decode as CUDA graphs, which a plain trace collapses). Node tracing adds a little to every kernel, the same way for both.</li><li><b>Measured:</b> 2026-11-14 16:04-16:05 back to back: llama-bench tg64 at d128 (-ngl 99 -fa 1), then Leviathan&#x27;s live DLL 61ca4057, then llama-bench again (tests/_output/proof/prof_pair.log). The attention row: 16:00, 32 decode steps after a 4,096-token prompt (prof_live.log). Leviathan 1.1.0&#x27;s kernel count: 2026-11-14 ~12:40, before the launch fusion.</li><li><b>Attention bytes:</b> 28 layers x keys and values x 4 KV heads x 128 dims x 4 bytes x ~4,120 positions = 472.5 MB a token; 382 GB/s = 57 % of the card&#x27;s 670 GB/s read ceiling</li></ul></dd>
          <dt>Weight streaming speed</dt><dd>How fast each weight of a decode step streams from video memory, against the card&#x27;s measured read ceiling.<ul><li><b>What this is:</b> How fast each weight of a decode step streams from video memory: its bytes over its kernel&#x27;s time (Nsight Systems), Qwen 2.5 Coder 7B Q8_0 at a 128-token context.</li><li><b>The ceiling:</b> 670 GB/s = the fastest a bare streaming-read kernel reached on this card (1 GiB, every block shape tried, best of 20; the RTX 4080&#x27;s paper figure is 716.8). No matrix-vector product can stream faster than its weights load.</li><li><b>llama.cpp:</b> Only the two weights whose llama.cpp launch could be told apart by its grid are listed for it. Its figures are its launches made outside CUDA graphs (its first tokens), traced exactly as Leviathan&#x27;s were (Nsight Systems&#x27; plain CUDA trace). Its in-graph launches, traced node by node (which adds overhead per kernel), read 622 GB/s (gate + up) and 632 GB/s (LM head).</li><li><b>Measured:</b> 2026-11-14 ~13:20 (tests/_output/dense_speed/prof/, the bw_ceiling probe), Leviathan on its test build lev_ws7: the same matrix-vector kernels as the live DLL 61ca4057 (whose traces at 16:00 and 16:04 put gate + up at 642 and 614 GB/s: the spread from one run to the next)</li></ul></dd>
          <dt>Raw-format decode kernels since 1.1.0</dt><dd>Time a decode token takes before and after the raw-format matrix-vector kernels moved to two rows a warp (2026-11-15).<ul><li><b>What:</b> time a decode token takes, before and after the raw-format matrix-vector kernels moved to two rows a warp (2026-11-15), same session</li><li><b>Same output:</b> KL &lt;= 4.2e-12 against the old kernels and the same top token on every row</li><li><b>Card:</b> NVIDIA GeForce RTX 4080 16 GB (stock), Ryzen 9 7950X, 128 GB DDR5, Windows 11</li></ul></dd>
          <dt>Tests the live engine passed</dt><dd>Each test in the gate the live engine DLL passed, what it checks, and how many of its checks passed.<ul><li><b>What this is:</b> The gate the live engine DLL (61ca4057) passed before it replaced the previous one, each test through the real engine on the RTX 4080 with the candidate picked by LEVIATHAN_DLL; then the canary on the live file after the swap (the rows marked so).</li><li><b>Log:</b> tests/_output/cand2/gate.log (2026-11-14)</li><li><b>Left out:</b> three old tests whose model file (a DeepSeek .lev in a folder since removed) no longer exists; they fail the same way on every build and are being repointed</li></ul></dd>
          <dt>Tests since the 2026-11-14 gate</dt><dd>Each test run since the 2026-11-14 gate: what it checks and how many of its checks passed.<ul><li><b>What:</b> the tests run since the build in the table above (2026-11-14), each through the real engine on the card</li></ul></dd>
        </dl>
      </details>

      <p class="lm-credit">Built with Claude Code by Michael Ricky Neal and Claude (Anthropic).</p>
    </div>
  </div>
</section>

<div class="wrap">
  <!-- Hero -->
  <header class="hero">
    <!-- Logo: drop your dragon image in beside this file as "leviathan-dragon.png"
         (a transparent-background PNG reads best against the dark page). If the file
         isn't present the slot hides itself cleanly and the wordmark stands alone. -->
    <img class="emblem" src="https://archive.org/download/leviathan_202609/Leviathan.png"
         alt="Leviathan" decoding="async" onerror="this.style.display='none'">

    <h1 class="wordmark">LEVIATHAN</h1>
    <p class="tagline">Local AI, running on your own graphics card.</p>
    <p class="subtag">No server. No cloud. No account. No subscription. You open the app, pick a model, and type β€” and nothing you say leaves your machine.</p>
    <div class="cta">
      <a class="btn ghost" href="https://github.com/CuppaTea1983/Leviathan" target="_blank" rel="noopener">View the source</a>
      <a class="btn primary" href="https://huggingface.co/spaces/Omega-Dev/Leviathan-Guide" target="_blank" rel="noopener">How it works</a>
      <a class="btn ghost" href="https://zenodo.org/records/23428074" target="_blank" rel="noopener">Read the whitepapers</a>
    </div>
    <p class="req">WINDOWS Β· NVIDIA GTX 16 / RTX 20 OR NEWER Β· NO PYTHON, NO CUDA TOOLKIT, NO DOCKER</p>
    <p class="req vk"><img src="https://raw.githubusercontent.com/CuppaTea1983/Leviathan/main/screenshots/vulkan-logo.png" alt="Vulkan" width="77" height="22" decoding="async"><span>AMD &amp; INTEL GRAPHICS CARDS THROUGH VULKAN Β· NEW IN 1.1.0</span></p>
  </header>
</div>

<!-- Manifesto -->
<section class="manifesto">
  <div class="wrap">
    <p class="quote">Leviathan is the <span class="c">host</span>. The model is the <span class="g">guest</span>.</p>
    <p class="lead" style="text-align:center;margin:0 auto">Plenty of tools run a model locally. What sets Leviathan apart is everything it builds <em>around</em> the model: a memory that survives closing the app, a way to teach it without retraining, and a way for your own programs to use the models it runs.</p>
  </div>
</section>

<!-- See it running: real screenshots, real model (2026-10-17). The images are read from the GitHub repo
     (CuppaTea1983/Leviathan, screenshots/): a Space won't take binary files. -->
<section>
  <div class="wrap">
    <p class="eyebrow">See it running</p>
    <h2 style="font-size:clamp(26px,4vw,38px)">The real app, a real model, one graphics card</h2>
    <p class="lead">Nothing here is mocked up. Every picture is the real app on a single RTX 4080, and the model at work is Qwen 2.5 Coder 7B. Tap one to see it full size.</p>
    <figure class="shot wide"><a href="https://raw.githubusercontent.com/CuppaTea1983/Leviathan/main/screenshots/chat.gif" target="_blank" rel="noopener"><img src="https://raw.githubusercontent.com/CuppaTea1983/Leviathan/main/screenshots/chat.gif" alt="Chatting with Qwen 2.5 Coder 7B in Leviathan, in real time" loading="lazy"></a>
      <figcaption><b>Chat</b> β€” real time on an RTX 4080, nothing edited. How fast depends on your card β€” mostly its memory bandwidth.</figcaption></figure>
    <div class="shots">
      <figure class="shot"><a href="https://raw.githubusercontent.com/CuppaTea1983/Leviathan/main/screenshots/inline-studio.png" target="_blank" rel="noopener"><img src="https://raw.githubusercontent.com/CuppaTea1983/Leviathan/main/screenshots/inline-studio.png" alt="Inline Studio after the model wrote roman.py" loading="lazy"></a>
        <figcaption><b>Inline Studio</b> β€” one line of task; the model wrote <code>roman.py</code> and the execute-gate ran it.</figcaption></figure>
      <figure class="shot"><a href="https://raw.githubusercontent.com/CuppaTea1983/Leviathan/main/screenshots/inline-studio-part.png" target="_blank" rel="noopener"><img src="https://raw.githubusercontent.com/CuppaTea1983/Leviathan/main/screenshots/inline-studio-part.png" alt="Inline Studio with the model's phone-stand CAD script and the 3D part" loading="lazy"></a>
        <figcaption><b>Shape tasks</b> β€” the model writes a CAD script against Leviathan's own library; the part updates beside it.</figcaption></figure>
      <figure class="shot"><a href="https://raw.githubusercontent.com/CuppaTea1983/Leviathan/main/screenshots/graph.png" target="_blank" rel="noopener"><img src="https://raw.githubusercontent.com/CuppaTea1983/Leviathan/main/screenshots/graph.png" alt="The phone-stand script as shape nodes in the Graph" loading="lazy"></a>
        <figcaption><b>Graph</b> β€” that script as 9 shape nodes and 9 parameters, checked to make exactly the same part.</figcaption></figure>
      <figure class="shot"><a href="https://raw.githubusercontent.com/CuppaTea1983/Leviathan/main/screenshots/planner.gif" target="_blank" rel="noopener"><img src="https://raw.githubusercontent.com/CuppaTea1983/Leviathan/main/screenshots/planner.gif" alt="The base's top face clicked in the Planner, and the model drilling a screw hole through it" loading="lazy"></a>
        <figcaption><b>Planner</b> β€” click the base, ask for "a 5 mm screw hole straight down through the middle of this face" in plain words: the model's edit lands as one undoable step.</figcaption></figure>
      <figure class="shot"><a href="https://raw.githubusercontent.com/CuppaTea1983/Leviathan/main/screenshots/fabricator.png" target="_blank" rel="noopener"><img src="https://raw.githubusercontent.com/CuppaTea1983/Leviathan/main/screenshots/fabricator.png" alt="The Fabricator's printability checks passing" loading="lazy"></a>
        <figcaption><b>Fabricator</b> β€” watertight, fits the bed, no overhangs, walls thick enough: ready for your slicer.</figcaption></figure>
      <figure class="shot"><a href="https://raw.githubusercontent.com/CuppaTea1983/Leviathan/main/screenshots/settings.png" target="_blank" rel="noopener"><img src="https://raw.githubusercontent.com/CuppaTea1983/Leviathan/main/screenshots/settings.png" alt="Settings with the security membrane switched on" loading="lazy"></a>
        <figcaption><b>Settings</b> β€” the security membrane, on by default and checking every message.</figcaption></figure>
      <figure class="shot"><a href="https://raw.githubusercontent.com/CuppaTea1983/Leviathan/main/screenshots/studio-merge.png" target="_blank" rel="noopener"><img src="https://raw.githubusercontent.com/CuppaTea1983/Leviathan/main/screenshots/studio-merge.png" alt="Studio's Merge GGUF with four models, each with its own weight, checked for a Linear merge" loading="lazy"></a>
        <figcaption><b>Studio Β· Merge</b> β€” mergekit's core methods (Linear, SLERP, TIES, DARE, Add difference) straight on GGUF files at any quantization, up to four models at once. Here four, each with its own weight, checked for a Linear merge.</figcaption></figure>
      <figure class="shot"><a href="https://raw.githubusercontent.com/CuppaTea1983/Leviathan/main/screenshots/studio-scan.png" target="_blank" rel="noopener"><img src="https://raw.githubusercontent.com/CuppaTea1983/Leviathan/main/screenshots/studio-scan.png" alt="Studio's Tensor Scan listing Qwen 2.5 Coder 7B's 339 tensors" loading="lazy"></a>
        <figcaption><b>Studio Β· Tensor Scan</b> β€” every tensor in a model, with its shape, type and statistics, exportable as a blueprint.</figcaption></figure>
      <figure class="shot"><a href="https://raw.githubusercontent.com/CuppaTea1983/Leviathan/main/screenshots/studio-join.png" target="_blank" rel="noopener"><img src="https://raw.githubusercontent.com/CuppaTea1983/Leviathan/main/screenshots/studio-join.png" alt="Studio's Join SafeTensors checking a two-piece download" loading="lazy"></a>
        <figcaption><b>Studio Β· Join SafeTensors</b> β€” a Hugging Face model's pieces joined into one file, byte for byte.</figcaption></figure>
      <figure class="shot"><a href="https://raw.githubusercontent.com/CuppaTea1983/Leviathan/main/screenshots/studio-memory.png" target="_blank" rel="noopener"><img src="https://raw.githubusercontent.com/CuppaTea1983/Leviathan/main/screenshots/studio-memory.png" alt="Studio's Inspect memory: a model's memory, what it reads back, and every line" loading="lazy"></a>
        <figcaption><b>Studio Β· Inspect memory</b> β€” look inside a model's memory: every line, what it reads back before your next message, nothing hidden.</figcaption></figure>
    </div>
  </div>
</section>

<!-- Stats -->
<section>
  <div class="wrap">
    <div class="stats">
      <div class="stat"><b>&lt;1s</b><span>from prompt to a wall of text β€” the model runs in-process, no server between you and it</span></div>
      <div class="stat"><b>0</b><span>bytes leave your machine on the local path</span></div>
      <div class="stat"><b>~1ms</b><span>input security scan, on by default</span></div>
      <div class="stat"><b>2</b><span>file types that give a model a mind</span></div>
    </div>
  </div>
</section>

<!-- File types -->
<section>
  <div class="wrap">
    <p class="eyebrow">The two file types</p>
    <h2 style="font-size:clamp(26px,4vw,38px)">A model given a mind</h2>
    <p class="lead">If the model is a person: <b>.lev</b> (or its compressed twin, <b>.shn5</b>) is their brain and <b>.mem</b> is their memory of your conversations. Two different jobs, not alternatives to one another. Knowledge is a third thing β€” but it is not a file format; it is text, and it gets its own note below.</p>

    <div class="files">
      <div class="file" style="--accent:#46e0d0">
        <div class="ext">.lev Β· .shn5</div>
        <div class="role">The model</div>
        <h3>The brain, shaped for your GPU</h3>
        <p>A model converted into the exact byte layout the graphics card wants, so it goes from disk to VRAM with no reshuffling. Convert a <code>.gguf</code> once, then load it straight onto the card. No server starts, nothing listens on a port.</p>
        <p style="margin-top:10px">Or keep it as a <code>.shn5</code>: the same model, compressed without losing a bit, about 1.5Γ— smaller for full-precision (F16 / BF16) models and unpacked on the graphics card as it loads. Leviathan runs it with exactly the same numbers as the <code>.lev</code>, and checks every piece as it unpacks.</p>
        <p style="margin-top:10px">A mixture-of-experts model can be far bigger than your card: its experts wait in your computer's memory, and only the ones each word needs come to the card. Qwen3-30B-A3B in BF16 (61 GB) runs on a 16 GB RTX 4080 at 16 tokens a second and reads a 700-token prompt at 683 a second, faster than llama.cpp on the same card (about 10 tokens a second, and 365 for that prompt at the fastest settings we found for it), with the same answers as if it all fitted.</p>
      </div>
      <div class="file" style="--accent:#8b7ff0">
        <div class="ext">.mem</div>
        <div class="role">The memory</div>
        <h3>What it remembers, kept as text</h3>
        <p>Close a normal chat and the model forgets you. A <code>.mem</code> keeps your conversations with that model as plain text, and before it answers the model reads back the newest of them, so the conversation genuinely continues. It saves itself as you talk, takes no graphics memory, and every word is yours to read.</p>
      </div>
    </div>

    <p class="lead" style="margin-top:26px"><b>Knowledge is text, not a weight file.</b> A <b>knowledge bank</b> is a body of knowledge you give a model without retraining it β€” drained from a model before you retire it, absorbed from your own code and datasets, or built by hand. It is kept as plain text and handed to the model by <em>meaning</em> when a question calls for it, so it crosses between models regardless of architecture or size, and it is tiny where the old weight approach cost gigabytes. Banks are backed up automatically as <code>.jsonl</code> in your knowledge vault's backup folder, so your distilled knowledge is never trapped in one file.</p>
  </div>
</section>

<!-- Systems -->
<section style="background:var(--deep);border-top:1px solid var(--line);border-bottom:1px solid var(--line)">
  <div class="wrap">
    <p class="eyebrow">The systems</p>
    <h2 style="font-size:clamp(26px,4vw,38px)">What runs underneath</h2>
    <p class="lead">The tabs are surfaces. These are the things working beneath them, each one built to be measured rather than taken on trust.</p>

    <div class="grid3">
      <div class="card"><div class="ic">🧠</div><h3>Persistent memory</h3><p>The model resumes instead of restarting. You never re-introduce yourself: it reads back what the two of you said, as text, and keeps it on disk rather than in graphics memory.</p></div>
      <div class="card"><div class="ic">πŸ”€</div><h3>Knowledge routing (ANI)</h3><p>Every bank β€” hand-built, drained from a model, or absorbed from your own code β€” lands in one shared space. Ask a question and the knowledge that fits is found by meaning, not spelling. The strongest bank wins.</p></div>
      <div class="card"><div class="ic">πŸ“₯</div><h3>Absorb, locally β€” and vetted</h3><p>Fill a bank from a model <em>drained</em> of what it knows, or from your own <em>code</em> β€” source files and datasets, every function compiled and run before it is kept. Loose documents, recordings and chat logs are deliberately <em>not</em> absorbed: the shared knowledge takes only what can be verified, so nothing unvetted can poison what your models read. Opt-in, and it never leaves the machine.</p></div>
      <div class="card"><div class="ic">🧩</div><h3>Reasoning layer</h3><p>Before answering, the model is handed the shape of how a frontier model worked through problems like yours. One pass, no extra cost.</p></div>
      <div class="card"><div class="ic">πŸ”¬</div><h3>Forensic Grid</h3><p>Structural vision for a model with no eyes. It reads an image's shape (blob, ridge, layered, diffuse) and narrates it in plain language.</p></div>
      <div class="card"><div class="ic">πŸ”Ž</div><h3>Surface Sight</h3><p>Actual recognition, run as an external tool on your CPU. It tells the model what a picture depicts, and how sure it is.</p></div>
      <div class="card"><div class="ic">♻️</div><h3>Recycling cloud answers</h3><p>Ask a hosted model on your own key and Leviathan keeps the substance, so your local models can draw on it later. Nothing pre-loaded.</p></div>
      <div class="card"><div class="ic">πŸ’­</div><h3>Episodic memory</h3><p>Each model remembers your conversations β€” its own, across sessions, linked so "remember Pepper the dog?" pulls the whole thread back. Kept strictly per model: it never bleeds into another, and never folds into the shared banks.</p></div>
      <div class="card"><div class="ic">πŸ”</div><h3>Second-opinion fact-check</h3><p>After a factual answer, the model is quietly re-asked. Agree with itself and it stands; wander between retellings and it is flagged.</p></div>
      <div class="card"><div class="ic">πŸ“˜</div><h3>Code that lifts itself</h3><p>Leviathan builds a bank of <em>verified</em> code patterns β€” every function compiled and run before it is kept β€” and the coding loop fetches the right one and repairs from the interpreter's own error. A small model codes well above its weight, borrowing a proven pattern instead of guessing.</p></div>
      <div class="card"><div class="ic">🧭</div><h3>Tab-scoped memory</h3><p>Switch from coding to chatting and the model doesn't drag its last task along. Each tab keeps its own working memory, while your chats with the model stay in its memory, there when you come back to Chat.</p></div>
      <div class="card"><div class="ic">πŸ”—</div><h3>Graph β€” nodes, or a model</h3><p>Eighty-seven of Leviathan's own nodes β€” maths, logic, text, lists, data, thirty shape nodes, measuring a part, your own model and ANI β€” found by a search, not a scroll. Wire shapes, numbers, expressions and code into a graph that computes a result. A model, or ANI, can read and build the graph alongside you, handed the real nodes and ports instead of guessing. Only you run it; the host keeps the trigger.</p></div>
      <div class="card"><div class="ic">🧊</div><h3>Planner β€” a real CAD engine</h3><p>A parametric, watertight 3D modeller in true millimetres, built in-house: sketch, extrude, cut, push a face β€” the whole part a replayable history. A graph becomes a solid part. Import any 3D file at its real size. Ask your model β€” or ANI β€” to change it in plain words; it's handed the real part and edits it as one undoable step. One click forwards it to the Fabricator.</p></div>
      <div class="card"><div class="ic">πŸ–¨οΈ</div><h3>Fabricator β€” idea to object</h3><p>Proves a part printable before a gram of filament goes in: on your printer's real bed, it checks watertight, fit, overhangs, wall thickness and bed contact, tints the problem faces, turns the part for the least support, then hands your slicer the <em>3MF</em>/<em>STL</em>. Opens STL, 3MF, OBJ, PLY, glTF and FBX by their blueprint β€” units and up axis read, or weighed and said how sure β€” so a file arrives at its real size. Type it, a model builds it, you make it real.</p></div>
      <div class="card"><div class="ic">πŸ›‘οΈ</div><h3>Security membrane</h3><p>Guards what comes <em>in</em> β€” and the reply on the way <em>out</em>: hijacked models, poisoned documents, hidden characters, a slow steering attack across a whole conversation. It trusts you; it watches everything pretending to be you.</p></div>
    </div>
  </div>
</section>

<!-- What ANI is β€” the thesis -->
<section class="manifesto">
  <div class="wrap">
    <p class="eyebrow" style="text-align:center">What ANI is</p>
    <h2 style="font-size:clamp(26px,4vw,38px);text-align:center;max-width:18ch;margin:0 auto 20px">A frozen model, given a living memory.</h2>
    <p class="lead" style="text-align:center;margin:0 auto 16px">A language model is frozen the day it ships β€” correct it today and it forgets by tomorrow, because there is nowhere for the correction to live. <b>ANI is that missing place:</b> the layer around the model where knowledge is held, routed by <em>meaning</em>, corrected, and remembered β€” so the whole system keeps learning while the model's weights never move. Not retraining. Adaptation <em>without</em> it. <b>Learn, adapt, recall</b> β€” a complete loop, on hardware you own.</p>
    <p class="lead" style="text-align:center;margin:0 auto">And every piece of it stays on your machine β€” privacy by <em>design</em>, not promise, because there is no cloud in the loop to trust. The membrane keeps it safe by governing what comes <em>in</em>, never policing what you do. <b>A model that learns and grows with you, keeps everything it learns yours alone, and stays lawful without a corporation deciding what you may know.</b></p>
  </div>
</section>

<!-- Inline Studio -->
<section class="studio">
  <div class="wrap">
    <p class="eyebrow">Inline Studio</p>
    <h2 style="font-size:clamp(26px,4vw,38px)">Two models. One writes, one talks. <span style="color:var(--violet)">You decide.</span></h2>
    <p class="lead">Local models can write and refine whole files on their own β€” but in Leviathan you hold the controls. Give one model the <b>Worker</b> role and it writes the code; give another the <b>Chat</b> role and it talks with you about the work while the first keeps going. Set the roles once on the model, and every session just knows who does what.</p>

    <div class="grid3">
      <div class="card"><div class="ic">🎭</div><h3>Roles you assign</h3><p>Worker writes, Chat talks with you, or Both. Saved on the model and carried into every run β€” no wiring, no scripts.</p></div>
      <div class="card"><div class="ic">πŸ’¬</div><h3>Talk while it works</h3><p>Flip Converse and the turn-timer freezes. Ask the chat model anything, steer the work mid-flight, and the worker picks up your direction on its next turn.</p></div>
      <div class="card"><div class="ic">⏸</div><h3>Halt and resume</h3><p>Pause the worker at any point to revise the code yourself, then let it carry on. Nothing runs on without you.</p></div>
    </div>

    <p class="govern">You choose <span class="v">who works</span>, <span class="v">who talks</span>, and <span class="c">when it stops</span>. The models take turns; you hold the leash.</p>
  </div>
</section>

<!-- Security membrane -->
<section class="membrane">
  <div class="wrap">
    <p class="eyebrow">The security membrane</p>
    <h2 style="font-size:clamp(26px,4vw,38px)">Your machine is sovereign territory. <span style="color:var(--cyan)">Fourteen layers</span> keep it that way.</h2>
    <p class="lead">Sovereignty is more than nothing leaving your machine β€” it means nothing gets <em>in</em> that you didn't invite, and nothing goes <em>out</em> that would hijack the screen or clipboard it lands on. Not a weaponised model, not a poisoned document, not a web page reaching through your browser for your GPU, not an instruction hidden in characters you can't see. The membrane trusts <em>you</em> completely and distrusts everything pretending to be you or trying to slip past you. Most local-AI tools ship none of this. Leviathan ships <span class="sec-count">14</span> measured layers β€” each one built to be tested, not taken on faith.</p>

    <div class="layers">
      <div class="layer"><span class="n">01</span><div><h4>Intent scan</h4><p>Catches a jailbreak or roleplay trick in what's typed, before the model reads it as a command.</p></div></div>
      <div class="layer"><span class="n">02</span><div><h4>Content safety</h4><p>Screens generated output against a harm taxonomy β€” the genuinely dangerous, not the merely awkward.</p></div></div>
      <div class="layer"><span class="n">03</span><div><h4>Structured-data guard</h4><p>Injection, unicode trickery and payload bombs hidden inside JSON a program feeds in.</p></div></div>
      <div class="layer"><span class="n">04</span><div><h4>Document guard</h4><p>Hostile PDFs β€” embedded scripts, invisible text, font exploits β€” read for traps before they're ingested.</p></div></div>
      <div class="layer"><span class="n">05</span><div><h4>Interaction integrity</h4><p>Tells a person apart from a script flooding the input to farm or slowly steer the model.</p></div></div>
      <div class="layer"><span class="n">06</span><div><h4>Workspace scan</h4><p>Ghost scripts that quietly appear in your project folder, surfaced on demand.</p></div></div>
      <div class="layer"><span class="n">07</span><div><h4>Model-file integrity</h4><p>A weaponised or tampered model refused before a single byte reaches your GPU.</p></div></div>
      <div class="layer"><span class="n">08</span><div><h4>Knowledge guard</h4><p>A poisoned knowledge bank trying to plant a standing instruction that fires every session β€” quarantined, then fenced as data.</p></div></div>
      <div class="layer"><span class="n">09</span><div><h4>Network-door guard</h4><p>A web page you visit trying to reach through your browser to the model on your card β€” turned away at the door.</p></div></div>
      <div class="layer"><span class="n">10</span><div><h4>Vision-input guard</h4><p>Malformed images and decompression bombs stopped at the picture path, before anything is decoded.</p></div></div>
      <div class="layer"><span class="n">11</span><div><h4>Invisible-character guard</h4><p>An instruction hidden in zero-width or tag-block Unicode β€” invisible to you, read by the model β€” reassembled and caught on the way in, stripped from any reply on the way out.</p></div></div>
      <div class="layer"><span class="n">12</span><div><h4>Output sanitizer</h4><p>Terminal-control codes in a reply built to rewrite your screen or hijack your clipboard, stripped before the answer reaches you β€” without blocking the answer itself.</p></div></div>
      <div class="layer"><span class="n">13</span><div><h4>Hidden-pixel guard</h4><p>A payload hidden <em>in</em> an image β€” in bits too fine for any eye to see, or a pattern tuned to steer the model while looking like nothing to you β€” erased by bounding the picture to what a human could actually perceive. The model sees only your surface; whatever was painted beneath it is gone.</p></div></div>
      <div class="layer"><span class="n">14</span><div><h4>Machine-code guard</h4><p>A QR or barcode a model can read but you can't β€” carrying an instruction straight past you, the way a sticker could hijack a robot. Caught by its <em>structure</em>, not its format (which an attacker would just change), and blanked before the model decodes it. Proven to defeat a real QR decoder.</p></div></div>
    </div>

    <div class="hostline">
      <p class="kick">And the model is a guest. It has no hands.</p>
      <p>The other fear β€” a model that runs away with itself β€” can't happen here, and it isn't clever, it's architecture. A model in Leviathan produces text; it cannot loop itself, reach the internet, spawn a process, or touch your machine. Every action β€” running the server, saving memory, anything at all β€” is the <em>host's</em> decision: bounded, governed, and interruptible at any moment. Leviathan is the host, the model is only ever the guest, and a guest is never handed the keys.</p>
    </div>

    <p class="seal">Every layer runs on your own computer β€” nothing uploaded, nothing reported β€” and every one is documented and independently tested. That combination, this many layers, all local, all measured, is something almost nothing else in local AI ships. What you can switch off, and the one line that never bends, is spelled out below.</p>
  </div>
</section>

<!-- Bridge -->
<section style="background:var(--deep);border-top:1px solid var(--line);border-bottom:1px solid var(--line)">
  <div class="wrap">
    <p class="eyebrow">From your own programs</p>
    <h2 style="font-size:clamp(24px,3.6vw,34px)">One model, many programs</h2>
    <p class="lead">A game engine, a script, a tool you wrote: any of them can talk to a model Leviathan runs, over a local endpoint on your own machine. One running instance answers any number of programs at once.</p>
    <p class="lead" style="margin-top:6px">No terminal, no command to remember β€” flip the server on or off in the app's <strong>Settings</strong>. It listens on <code>127.0.0.1:8080</code>.</p>
    <div class="two">
      <div class="card mini"><h3>OpenAI-compatible</h3><p>Speaks the same API as OpenAI's chat endpoint. Most existing tools work by changing one URL to <code>127.0.0.1:8080</code>.</p></div>
      <div class="card mini"><h3>Leviathan-native</h3><p>A richer set of endpoints: load and unload models, cancel a reply mid-answer, list knowledge banks. Both stream; your program keeps its own conversation and sends it each time.</p></div>
    </div>
  </div>
</section>

<!-- Floor -->
<section>
  <div class="wrap">
    <p class="eyebrow">Your machine, your rules</p>
    <div class="floor">
      <p style="margin:0 0 12px;color:var(--ink);font-weight:600">Every guard in Leviathan has an off switch, because it is your hardware and that is not up for debate. The security membrane runs entirely on your computer: nothing uploaded, nothing reported, no telemetry, ever.</p>
      <p style="margin:0;color:var(--mist)">There is exactly one line with no switch. <span class="hard">Child sexual abuse material is refused</span> whether security is on or off, in the app and over the bridge. User sovereignty is a principle worth defending, and so is that floor. Only one of the two ever bends.</p>
    </div>
  </div>
</section>

<!-- Footer -->
<footer>
  <div class="wrap">
    <p style="font-family:var(--serif);letter-spacing:.14em;color:var(--mist);font-size:15px">LEVIATHAN</p>
    <div class="links">
      <a href="https://github.com/CuppaTea1983/Leviathan" target="_blank" rel="noopener">GitHub</a>
      <a href="https://zenodo.org/records/23428074" target="_blank" rel="noopener">Zenodo whitepapers</a>
      <a href="https://spdx.org/licenses/MIT.html" target="_blank" rel="noopener">MIT License</a>
    </div>
    <p class="fine">Built with Claude Code by Michael Ricky Neal and Claude, Anthropic&rsquo;s AI, working together: Michael is the imagination, Claude the logic. Two sides of the same coin.</p>
    <p class="fine">Michael Ricky Neal &middot; &copy; 2026 &middot; Released under the MIT License. Free to use, modify, share and sell, as long as the copyright and licence notice travel with it.</p>
    <p class="fine">Vulkan and the Vulkan logo are registered trademarks of the Khronos Group Inc.</p>
    <p class="fine">Claude and Claude Code are trademarks of Anthropic PBC.</p>
  </div>
</footer>


<!-- Leviathan, measured: its data and drawing code (d3 7.9.0 from cdnjs draws the charts) -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/7.9.0/d3.min.js"></script>
<script>window.LM_DATA = {"moe":[{"engine":"Leviathan, 16 expert slots","vram_gib":10.3,"decode_tok_s":16.2,"prompt700_tok_s":683,"prompt2048_tok_s":1234,"settings":"expert streaming from pinned RAM, 16 slots a layer, full fp32 prompt pass"},{"engine":"Leviathan, 8 expert slots","vram_gib":6.9,"decode_tok_s":14.3,"prompt700_tok_s":608,"prompt2048_tok_s":null,"settings":"expert streaming from pinned RAM, 8 slots a layer"},{"engine":"llama.cpp, default settings","vram_gib":null,"decode_tok_s_low":9.5,"decode_tok_s":10.4,"prompt700_tok_s_low":116,"prompt700_tok_s":138,"prompt2048_tok_s":null,"settings":"CUDA build, --cpu-moe (experts in RAM), its own timer"},{"engine":"llama.cpp, fastest settings found","vram_gib":null,"decode_tok_s":null,"prompt700_tok_s_low":247,"prompt700_tok_s":365,"prompt2048_tok_s":801,"settings":"CUDA build, --cpu-moe -b 2048 -ub 2048 --no-mmap -fa on, f16 KV cache"}],"shn5_files":[{"file":"BF16 GGUF (the source)","kind":"source","size_gb":61.1,"bits_per_weight":16.0,"lossless":true},{"file":".shn5, lossless","kind":"lossless","size_gb":40.46,"bits_per_weight":null,"lossless":true},{"file":".shn5 Stage 10, q6 (lossy)","kind":"lossy","size_gb":23.69,"bits_per_weight":6.113,"lossless":false}],"shn5_speed":[{"file":".shn5, lossless","decode_tok_s":18.7,"prompt2048_tok_s":1107,"pinned_ram_gb":35.8,"load_s":14.4},{"file":".shn5 Stage 10, q6","decode_tok_s":20.6,"prompt2048_tok_s":1275,"pinned_ram_gb":20.6,"load_s":8.2}],"shn5_quality":[{"model":"Qwen3-30B-A3B","file":".shn5 Stage 10 q6","bits_per_weight":6.113,"kl":0.00026,"reference":"float64 reference of the BF16 model","note":"top-1 36 of 36"},{"model":"Qwen3-30B-A3B","file":"Q6_K GGUF","bits_per_weight":6.5625,"kl":0.00016,"reference":"float64 reference of the BF16 model","note":"embeddings and output head BF16 in both"},{"model":"TinyLlama 1.1B","file":".shn5 Stage 10 q6","bits_per_weight":6.096,"kl":0.00181,"reference":"the F16 model, teacher-forced","note":"weight error 1.81 %, Q6_K's"},{"model":"TinyLlama 1.1B","file":"Q6_K GGUF","bits_per_weight":6.5625,"kl":0.0019,"reference":"the F16 model, teacher-forced","note":""}],"dit_ladder":[{"step":1,"change":"Lightricks' own PyTorch pipeline (bf16, weights streamed)","seconds":232.0,"engine":"PyTorch"},{"step":2,"change":"Leviathan DiT engine, exact (f32 sums; the 4 guidance passes in one call)","seconds":145.9,"engine":"Leviathan"},{"step":3,"change":"+ fp16-accumulate matrix products","seconds":117.3,"engine":"Leviathan"},{"step":4,"change":"+ fp16 attention","seconds":105.4,"engine":"Leviathan"},{"step":5,"change":"+ the widest layer summed in fp16 chains","seconds":99.4,"engine":"Leviathan"},{"step":6,"change":"+ a leaner attention loop (same bits)","seconds":95.4,"engine":"Leviathan"},{"step":7,"change":"+ INT8 matrix products (W8A8: scale grid, Hadamard rotation, rank-32 correction)","seconds":80.9,"engine":"Leviathan"},{"step":8,"change":"+ the widest layer in INT8 too","seconds":72.1,"engine":"Leviathan"},{"step":9,"change":"+ the normalisation fused into the INT8 step","seconds":70.0,"engine":"Leviathan"},{"step":10,"change":"+ the residual prefetched into L2 (same bits)","seconds":68.3,"engine":"Leviathan"}],"dit_accuracy":[{"stream":"picture","pass":"conditioned","leviathan":0.009211,"pytorch":0.02446},{"stream":"picture","pass":"unconditioned","leviathan":0.01414,"pytorch":0.0418},{"stream":"sound","pass":"conditioned","leviathan":0.002368,"pytorch":0.01472},{"stream":"sound","pass":"unconditioned","leviathan":0.002072,"pytorch":0.01314}],"dit_psnr":[{"render":"Leviathan, fp16 sums + attention","seconds":95.4,"psnr_db":26.7,"control":false},{"render":"Lightricks' PyTorch, bf16","seconds":232.0,"psnr_db":24.1,"control":false},{"render":"Leviathan, INT8","seconds":80.9,"psnr_db":23.5,"control":false},{"render":"Leviathan, today's default","seconds":68.3,"psnr_db":23.2,"control":false},{"render":"Control: the exact engine, another seed","seconds":145.0,"psnr_db":14.5,"control":true}],"dit_profile":[{"part":"INT8 matrix products","seconds":3.98},{"part":"Attention","seconds":3.34},{"part":"INT8 activations (normalisation fused in)","seconds":0.75},{"part":"q / k normalisation + RoPE","seconds":0.39},{"part":"Everything else","seconds":0.14}],"dit_t2av":[{"size":"768 x 512","frames":73,"clip_s":3.04,"dit_s":19.8,"decode_s":2.8,"total_s":38.5},{"size":"1280 x 736","frames":121,"clip_s":5.04,"dit_s":77.6,"decode_s":7.8,"total_s":86.2}],"decode7b":[{"engine":"Leviathan","context":128,"tok_s":81.17,"ms":12.32,"round1_tok_s":81.07,"round2_tok_s":81.17},{"engine":"llama.cpp","context":128,"tok_s":81.56,"ms":12.261,"round1_tok_s":81.56,"round2_tok_s":81.31},{"engine":"Leviathan","context":2048,"tok_s":76.94,"ms":12.997,"round1_tok_s":76.14,"round2_tok_s":76.94},{"engine":"llama.cpp","context":2048,"tok_s":79.8,"ms":12.531,"round1_tok_s":79.43,"round2_tok_s":79.8},{"engine":"Leviathan","context":4096,"tok_s":74.57,"ms":13.41,"round1_tok_s":72.03,"round2_tok_s":74.57},{"engine":"llama.cpp","context":4096,"tok_s":78.26,"ms":12.778,"round1_tok_s":78.24,"round2_tok_s":78.26}],"prompt7b":[{"arm":"Leviathan default","arm_key":"default","arm_short":"Leviathan default","prompt":512,"tok_s":4122.8,"round1_tok_s":4122.8,"round2_tok_s":4111.2,"kl_vs_exact":null,"precision":"fp16 inputs, fp32 sums; attention fp32"},{"arm":"Leviathan default","arm_key":"default","arm_short":"Leviathan default","prompt":2048,"tok_s":3843.7,"round1_tok_s":3843.7,"round2_tok_s":3834.8,"kl_vs_exact":1.7247476890095548e-07,"precision":"fp16 inputs, fp32 sums; attention fp32"},{"arm":"Leviathan default","arm_key":"default","arm_short":"Leviathan default","prompt":4096,"tok_s":3483.1,"round1_tok_s":3483.1,"round2_tok_s":3471.5,"kl_vs_exact":null,"precision":"fp16 inputs, fp32 sums; attention fp32"},{"arm":"Leviathan + tensor-core attention (opt-in)","arm_key":"tc","arm_short":"+ tc attention","prompt":512,"tok_s":4227.2,"round1_tok_s":4227.2,"round2_tok_s":4221.3,"kl_vs_exact":null,"precision":"fp16 inputs, fp32 sums; attention fp16 inputs"},{"arm":"Leviathan + tensor-core attention (opt-in)","arm_key":"tc","arm_short":"+ tc attention","prompt":2048,"tok_s":4163.7,"round1_tok_s":4163.7,"round2_tok_s":4154.8,"kl_vs_exact":4.4687566608716937e-07,"precision":"fp16 inputs, fp32 sums; attention fp16 inputs"},{"arm":"Leviathan + tensor-core attention (opt-in)","arm_key":"tc","arm_short":"+ tc attention","prompt":4096,"tok_s":4042.2,"round1_tok_s":4042.2,"round2_tok_s":4011.7,"kl_vs_exact":null,"precision":"fp16 inputs, fp32 sums; attention fp16 inputs"},{"arm":"Leviathan + int8 matrices + tc attention (opt-in)","arm_key":"int8tc","arm_short":"+ int8 matrices","prompt":512,"tok_s":9643.1,"round1_tok_s":9635.6,"round2_tok_s":9643.1,"kl_vs_exact":null,"precision":"int8 activations per 32 with exact Q8_0 weights; attention fp16 inputs"},{"arm":"Leviathan + int8 matrices + tc attention (opt-in)","arm_key":"int8tc","arm_short":"+ int8 matrices","prompt":2048,"tok_s":9257.8,"round1_tok_s":9257.8,"round2_tok_s":9164.5,"kl_vs_exact":8.373501830356618e-05,"precision":"int8 activations per 32 with exact Q8_0 weights; attention fp16 inputs"},{"arm":"Leviathan + int8 matrices + tc attention (opt-in)","arm_key":"int8tc","arm_short":"+ int8 matrices","prompt":4096,"tok_s":8724.1,"round1_tok_s":8724.1,"round2_tok_s":8700.3,"kl_vs_exact":null,"precision":"int8 activations per 32 with exact Q8_0 weights; attention fp16 inputs"},{"arm":"llama.cpp (flash attention on)","arm_key":"llama","arm_short":"llama.cpp","prompt":512,"tok_s":7953.85,"round1_tok_s":7892.02,"round2_tok_s":7953.85,"kl_vs_exact":null,"precision":"int8 activations per 32 (its MMQ kernels); flash attention f16"},{"arm":"llama.cpp (flash attention on)","arm_key":"llama","arm_short":"llama.cpp","prompt":2048,"tok_s":8717.0,"round1_tok_s":8699.62,"round2_tok_s":8717.0,"kl_vs_exact":null,"precision":"int8 activations per 32 (its MMQ kernels); flash attention f16"},{"arm":"llama.cpp (flash attention on)","arm_key":"llama","arm_short":"llama.cpp","prompt":4096,"tok_s":8481.26,"round1_tok_s":8472.68,"round2_tok_s":8481.26,"kl_vs_exact":null,"precision":"int8 activations per 32 (its MMQ kernels); flash attention f16"}],"refkl":[{"model":"Llama 3.2 1B Instruct","weights":"Q6_K","kl_max":1e-06,"bar":0.0001,"passed":true,"decode_path":"graph + grouped attention"},{"model":"Bill (Llama 3.2 3B)","weights":"F16","kl_max":2.8e-06,"bar":0.0001,"passed":true,"decode_path":"graph + grouped attention"},{"model":"Ted (Llama 3.2 3B)","weights":"F16","kl_max":2.8e-06,"bar":0.0001,"passed":true,"decode_path":"graph + grouped attention"},{"model":"Qwen 2.5 Coder 7B","weights":"Q8_0","kl_max":1.1e-06,"bar":0.0001,"passed":true,"decode_path":"graph + grouped attention"},{"model":"cad0 (Qwen 2.5 Coder 7B)","weights":"Q8_0","kl_max":8.1e-07,"bar":0.0001,"passed":true,"decode_path":"graph + grouped attention"},{"model":"unity-coder (Qwen 2.5 7B)","weights":"Q8_0","kl_max":1.2e-06,"bar":0.0001,"passed":true,"decode_path":"graph + grouped attention"},{"model":"MistralRP (Mistral 7B)","weights":"Q8_0","kl_max":1.8e-07,"bar":0.0001,"passed":true,"decode_path":"graph + grouped attention"},{"model":"Morpheus (Qwen 2.5 14B)","weights":"Q4_K_M","kl_max":1.7e-06,"bar":0.0001,"passed":true,"decode_path":"graph + grouped attention"},{"model":"DeepSeek-Coder-V2-Lite (MoE + MLA)","weights":"Q6_K","kl_max":8.9e-05,"bar":0.0001,"passed":true,"decode_path":"its own MLA attention"},{"model":"Gemma 4 fine-tune","weights":"Q8_0","kl_max":2.9e-11,"bar":0.0019,"passed":true,"decode_path":"its own forward"}],"optin":[{"model":"Llama 3.2 1B Instruct","weights":"Q6_K","kl_tc_attention":8.8e-06,"kl_int8_gemm":1e-06,"int8_applies":false},{"model":"Bill (Llama 3.2 3B)","weights":"F16","kl_tc_attention":9.3e-06,"kl_int8_gemm":2.8e-06,"int8_applies":false},{"model":"Ted (Llama 3.2 3B)","weights":"F16","kl_tc_attention":9.3e-06,"kl_int8_gemm":2.8e-06,"int8_applies":false},{"model":"Morpheus (Qwen 2.5 14B)","weights":"Q4_K_M","kl_tc_attention":3.2e-06,"kl_int8_gemm":1.7e-06,"int8_applies":false},{"model":"Qwen 2.5 Coder 7B","weights":"Q8_0","kl_tc_attention":2.2e-06,"kl_int8_gemm":0.00031,"int8_applies":true},{"model":"cad0 (Qwen 2.5 Coder 7B)","weights":"Q8_0","kl_tc_attention":1.4e-06,"kl_int8_gemm":0.00061,"int8_applies":true},{"model":"MistralRP (Mistral 7B)","weights":"Q8_0","kl_tc_attention":6.4e-07,"kl_int8_gemm":0.00077,"int8_applies":true},{"model":"unity-coder (Qwen 2.5 7B)","weights":"Q8_0","kl_tc_attention":8.2e-06,"kl_int8_gemm":0.0033,"int8_applies":true},{"model":"Gemma 4 fine-tune","weights":"Q8_0","kl_tc_attention":null,"kl_int8_gemm":0.14,"int8_applies":true}],"hood":[{"item":"Kernels a decode token","engine":"llama.cpp","value":539,"unit":"kernels","note":"169 of them quantize the activations to int8 before a matrix-vector product; replayed as CUDA graphs"},{"item":"Kernels a decode token","engine":"Leviathan 1.1.0 kernels","value":479,"unit":"kernels","note":"q, k and v as three kernels; one more for each bias, silu and residual add"},{"item":"Kernels a decode token","engine":"Leviathan now","value":255,"unit":"kernels","note":"q/k/v with their biases, gate + up + silu, down + residual each one kernel, the same bytes as before; the step replayed as one CUDA graph"},{"item":"Matrix-vector time a token","engine":"llama.cpp","value":12.07,"unit":"ms","note":"mul_mat_vec_q with the activations as int8 (q8_1); the mean of two traces, 12.09 and 12.06, taken either side of Leviathan's"},{"item":"Matrix-vector time a token","engine":"Leviathan now","value":12.14,"unit":"ms","note":"activations kept fp32: q/k/v, o, gate + up, down and the LM head"},{"item":"Attention a token, 4,096-token context","engine":"Leviathan now","value":1.24,"unit":"ms","kv_mb":472.5,"gb_s":382,"pct_ceiling":57,"note":"the grouped attention and its combine, reading fp32 keys and values for 28 layers"}],"bandwidth":[{"weight":"gate + up (fused)","engine":"Leviathan","gb_s":640,"ceiling_gb_s":670,"bytes_mb":144.3},{"weight":"gate + up (fused)","engine":"llama.cpp","gb_s":646,"ceiling_gb_s":670,"bytes_mb":144.3},{"weight":"LM head","engine":"Leviathan","gb_s":625,"ceiling_gb_s":670,"bytes_mb":579.0},{"weight":"LM head","engine":"llama.cpp","gb_s":641,"ceiling_gb_s":670,"bytes_mb":579.0},{"weight":"o projection","engine":"Leviathan","gb_s":608,"ceiling_gb_s":670,"bytes_mb":13.6},{"weight":"down projection","engine":"Leviathan","gb_s":605,"ceiling_gb_s":670,"bytes_mb":72.1},{"weight":"q / k / v (fused)","engine":"Leviathan","gb_s":588,"ceiling_gb_s":670,"bytes_mb":17.5}],"raw_formats":[{"model":"Qwen3-30B-A3B","format":"Q3_K_S, whole on the card","before_ms":6.32,"after_ms":5.85,"change_pct":-7.4},{"model":"TinyLlama 1.1B","format":"IQ1_M","before_ms":null,"after_ms":null,"change_pct":-34},{"model":"TinyLlama 1.1B","format":"IQ4_XS","before_ms":null,"after_ms":null,"change_pct":-27},{"model":"TinyLlama 1.1B","format":"Q4_0","before_ms":null,"after_ms":null,"change_pct":-25},{"model":"TinyLlama 1.1B","format":"Q2_K","before_ms":null,"after_ms":null,"change_pct":-19}],"gates":[{"test":"test_cuda_reference (canary 1)","proves":"every model = the 4080's recorded output, teacher-forced (KL bar, top-1, a control that must fail)","checks":"10/10","verdict":"PASS"},{"test":"test_cuda_reference (canary 2)","proves":"every model = the 4080's recorded output, teacher-forced (KL bar, top-1, a control that must fail)","checks":"10/10","verdict":"PASS"},{"test":"test_cuda_reference (canary 3)","proves":"every model = the 4080's recorded output, teacher-forced (KL bar, top-1, a control that must fail)","checks":"10/10","verdict":"PASS"},{"test":"test_cuda_reference (decode graph off)","proves":"every model = the 4080's recorded output, teacher-forced (KL bar, top-1, a control that must fail)","checks":"10/10","verdict":"PASS"},{"test":"test_cuda_reference (old decode attention)","proves":"every model = the 4080's recorded output, teacher-forced (KL bar, top-1, a control that must fail)","checks":"10/10","verdict":"PASS"},{"test":"test_spec_checkpass","proves":"speculative decoding's check pass = decode bit for bit; graph decode = plain decode bit for bit; replies = plain greedy","checks":"9/9","verdict":"PASS"},{"test":"test_gqa_decode_kernel","proves":"the decode attention kernels against float64 on 7 shapes x 14 lengths, extremes, determinism","checks":"10/10","verdict":"PASS"},{"test":"test_tc_gemm","proves":"the prompt's tensor-core matrices against exact sums, every weight format","checks":"6/6","verdict":"PASS"},{"test":"test_gqa_prefill_causality","proves":"a prompt's attention never sees a later token","checks":"3/3","verdict":"PASS"},{"test":"test_quant_kernels","proves":"every quantised weight format's kernel = gguf-py's dequantisation","checks":"4/4","verdict":"PASS"},{"test":"test_rolling_window","proves":"replies past the context window: the cache's move and key rotation exact","checks":"13/13","verdict":"PASS"},{"test":"test_live_absorb_gpu","proves":"text read into a loaded model through the real relay","checks":"11/11","verdict":"PASS"},{"test":"test_system_prompt_cache","proves":"a cached system prompt = recomputing it","checks":"11/11","verdict":"PASS"},{"test":"test_bridge_server","proves":"the app's runner answers end to end","checks":"pass","verdict":"PASS"},{"test":"test_qwen3moe","proves":"a Qwen3-MoE twin = llama.cpp teacher-forced; streamed = whole bit for bit","checks":"12/12","verdict":"PASS"},{"test":"test_mla_flat","proves":"DeepSeek's attention on the GPU = the exact path; batched = token by token","checks":"5/5","verdict":"PASS"},{"test":"test_mla_latent_kernel","proves":"DeepSeek's absorbed attention kernels against float64","checks":"10/10","verdict":"PASS"},{"test":"test_moe_gemm","proves":"the grouped expert kernels against float64","checks":"15/15","verdict":"PASS"},{"test":"test_gemma4_forward","proves":"Gemma 4's own forward = llama.cpp","checks":"5/5","verdict":"PASS"},{"test":"test_expert_stream","proves":"streamed experts = the whole model bit for bit","checks":"5/5","verdict":"PASS"},{"test":"test_shn5","proves":"the lossless .shn5 format decodes to the GGUF's bytes; damage is caught","checks":"10/10","verdict":"PASS"},{"test":"test_backend_choice","proves":"the engine picks a working GPU back end by itself","checks":"10/10","verdict":"PASS"},{"test":"test_qwen3moe_real","proves":"Qwen3-30B-A3B BF16 streamed on the 16 GB card against a float64 reference","checks":"4/4","verdict":"PASS"},{"test":"test_cuda_reference (canary on the live file)","proves":"every model = the 4080's recorded output, teacher-forced (KL bar, top-1, a control that must fail)","checks":"10/10","verdict":"PASS"},{"test":"test_spec_checkpass (canary on the live file)","proves":"speculative decoding's check pass = decode bit for bit; graph decode = plain decode bit for bit; replies = plain greedy","checks":"9/9","verdict":"PASS"},{"test":"test_qwen3moe (canary on the live file)","proves":"a Qwen3-MoE twin = llama.cpp teacher-forced; streamed = whole bit for bit","checks":"12/12","verdict":"PASS"}],"tests_since":[{"test":"test_ltx_dit_engine (full suite)","area":"video engine","proves":"every kernel against float64; one block and all 48 against Lightricks' FP32 model; inside their pipeline, each guidance pass alone = its batched lane bit for bit; renders of the same video","checks":"108 / 108","date":"2026-11-17"},{"test":"test_ltx_dit_engine, text to audio + video","area":"video engine","proves":"the sound made on the engine for the first time: every lane's audio live, lanes bit for bit, picture and sound closer to FP32 than PyTorch","checks":"16 / 16","date":"2026-11-18"},{"test":"the prompt-to-MP4 run, with a real render","area":"video engine","proves":"a prompt in, an MP4 out with a picture and a sound that isn't silent","checks":"16 / 16","date":"2026-11-18"},{"test":"test_shn5_stage10","area":".shn5","proves":"Stage 10's bits against the ideal; the GPU decode = the CPU reference bit for bit; damaged files refused; a whole model's quality; streamed experts = the whole model bit for bit","checks":"5 / 5","date":"2026-11-16"},{"test":"test_weight_pack","area":"engine","proves":"a load's weights packed into chunks of at most 1 GiB, bit for bit on CUDA and Vulkan, all freed on release","checks":"7 / 7","date":"2026-11-15"},{"test":"test_spec_checkpass","area":"engine","proves":"after the new raw-format kernels: every multi-row twin = decode bit for bit on 7 formats","checks":"9 / 9","date":"2026-11-15"}]};</script>
<script>
(function () {
  'use strict';
  var DATA = window.LM_DATA || {}, PALETTE = {"light": ["#22a99c", "#c8831f", "#7c6ee8", "#d9584a"], "dark": ["#22a99c", "#c8831f", "#7c6ee8", "#d9584a"]};
  var calcs = {}, cache = {}, draws = [], onData = [];
  window.__lmErrors = [];
  var darkQ = window.matchMedia ? window.matchMedia('(prefers-color-scheme: dark)') : null;
  function isDark() {
    var t = document.documentElement.getAttribute('data-theme');
    return t ? t === 'dark' : !!(darkQ && darkQ.matches);
  }
  function fail(where, e) { window.__lmErrors.push(where + ': ' + (e && e.message ? e.message : e)); }
  // a stand-in for the dashboard runtime the page was written for: the same calls, the data inline
  window.dash = {
    get colors() { return isDark() ? PALETTE.dark : PALETTE.light; },
    calc: function (id, spec) { calcs[id] = spec; },
    draw: function (name, fn) { if (typeof fn === 'function') draws.push([name, fn]); else run(name); },
    onData: function (fn) { onData.push(fn); },
    data: function (id) {
      if (Object.prototype.hasOwnProperty.call(DATA, id)) return { status: 'ok', data: DATA[id] };
      if (!calcs[id]) return { status: 'error', data: [] };
      if (!cache[id]) {
        var ins = calcs[id].inputs.map(function (i) { return window.dash.data(i); });
        if (ins.some(function (x) { return x.status !== 'ok'; })) return { status: 'error', data: [] };
        try { cache[id] = { status: 'ok', data: calcs[id].fn.apply(null, ins.map(function (x) { return x.data; })) }; }
        catch (e) { fail(id, e); cache[id] = { status: 'error', data: [] }; }
      }
      return cache[id];
    },
    params: function () { return {}; }, setParams: function () {}, resetParams: function () {}, setLink: function () {}
  };
  function run(only) {
    if (!window.d3) { var m = document.getElementById('lm-nod3'); if (m) m.hidden = false; return; }
    if (!only) onData.forEach(function (f) { try { f(); } catch (e) { fail('onData', e); } });
    draws.forEach(function (d) {
      if (only && d[0] !== only) return;
      document.querySelectorAll('[data-draw="' + d[0] + '"]').forEach(function (el) {
        try { d[1](el); } catch (e) { fail(d[0], e); }
      });
    });
  }
  var lastW = 0, timer = null;
  window.addEventListener('load', function () { lastW = window.innerWidth; run(); });
  window.addEventListener('resize', function () {
    clearTimeout(timer);
    timer = setTimeout(function () { if (window.innerWidth !== lastW) { lastW = window.innerWidth; run(); } }, 150);
  });
  if (darkQ) {
    var again = function () { run(); };
    if (darkQ.addEventListener) darkQ.addEventListener('change', again); else if (darkQ.addListener) darkQ.addListener(again);
  }
})();
</script>
<script>
{
// ── the figures worked out from the datasets (readers see these formulas in Sources) ──
  dash.calc('moe_vs_llama', {
    inputs: ['moe'],
    title: 'Leviathan vs llama.cpp, MoE',
    description: "Leviathan's 16-slot figure over llama.cpp's best figure for the same measure.",
    fn: (moe) => {
      const lev = moe.find((r) => String(r.engine).startsWith('Leviathan, 16'));
      const ll = moe.filter((r) => String(r.engine).startsWith('llama.cpp'));
      const best = (k) => d3.max(ll, (r) => (r[k] == null ? null : +r[k]));
      return ['decode_tok_s', 'prompt700_tok_s', 'prompt2048_tok_s'].map((k) => ({
        measure: k, leviathan: lev ? +lev[k] : null, llama_best: best(k),
        ratio: lev && best(k) ? Math.round((+lev[k] / best(k)) * 100) / 100 : null,
      }));
    },
  });
  dash.calc('dense_vs_llama', {
    inputs: ['decode7b'],
    title: 'Leviathan vs llama.cpp, 7B decode',
    description: "Leviathan's decode speed over llama.cpp's at each context, same session.",
    fn: (rows) => [128, 2048, 4096].map((c) => {
      const lev = rows.find((r) => r.engine === 'Leviathan' && +r.context === c);
      const ll = rows.find((r) => r.engine === 'llama.cpp' && +r.context === c);
      return { context: c, leviathan: lev ? +lev.tok_s : null, llama: ll ? +ll.tok_s : null,
        ratio: lev && ll ? Math.round((+lev.tok_s / +ll.tok_s) * 100) / 100 : null };
    }),
  });
  dash.calc('depth_cost', {
    inputs: ['decode7b'],
    title: 'What a longer context costs a token',
    description: "Each engine's milliseconds a token at a 4,096-token context minus at a 128-token one, same session.",
    fn: (decode7b) => ['Leviathan', 'llama.cpp'].map((engine) => {
      const at = (c) => { const r = decode7b.find((x) => x.engine === engine && +x.context === c); return r ? +r.ms : null; };
      const a = at(128), b = at(4096);
      return { engine, ms_128: a, ms_4096: b, extra_ms: a != null && b != null ? Math.round((b - a) * 100) / 100 : null };
    }),
  });
  dash.calc('fp16_estimate', {
    inputs: ['depth_cost', 'hood'],
    title: 'What an fp16 cache would save, estimated',
    description: "Half the attention's time a token at a 4,096-token context (half the bytes at the same speed), beside the difference between what depth costs each engine. Arithmetic, not a measurement.",
    fn: (depth_cost, hood) => {
      const lev = depth_cost.find((r) => r.engine === 'Leviathan');
      const ll = depth_cost.find((r) => r.engine === 'llama.cpp');
      const attn = hood.find((r) => String(r.item).startsWith('Attention'));
      return [{
        difference_ms: lev && ll && lev.extra_ms != null && ll.extra_ms != null ? Math.round((lev.extra_ms - ll.extra_ms) * 100) / 100 : null,
        fp16_saving_ms: attn ? Math.round((+attn.value / 2) * 100) / 100 : null,
      }];
    },
  });
  dash.calc('int8_vs_llama', {
    inputs: ['prompt7b'],
    title: 'Prompts with both opt-ins vs llama.cpp',
    description: "Leviathan's prompt speed with int8 matrices and tensor-core attention over llama.cpp's, at each prompt length.",
    fn: (prompt7b) => [512, 2048, 4096].map((n) => {
      const a = prompt7b.find((r) => r.arm_key === 'int8tc' && +r.prompt === n);
      const b = prompt7b.find((r) => r.arm_key === 'llama' && +r.prompt === n);
      return { prompt: n, leviathan_both_optins: a ? +a.tok_s : null, llama: b ? +b.tok_s : null,
        ratio: a && b ? Math.round((+a.tok_s / +b.tok_s) * 100) / 100 : null };
    }),
  });
  dash.calc('ref_summary', {
    inputs: ['refkl'],
    title: 'Reference check, summary',
    description: 'How many models passed, and the worst KL among the dense models (those decoding through the graph).',
    fn: (rows) => {
      const dense = rows.filter((r) => String(r.decode_path).startsWith('graph'));
      return [{ passed: rows.filter((r) => r.passed === true || r.passed === 'true').length, total: rows.length,
        worst_dense_kl: d3.max(dense, (r) => +r.kl_max) }];
    },
  });

  dash.calc('shn5_ratio', {
    inputs: ['shn5_files'],
    title: '.shn5 sizes against the BF16 GGUF',
    description: "Each file's size over the BF16 GGUF's, and how much smaller that is, in percent.",
    fn: (rows) => {
      const src = rows.find((r) => r.kind === 'source');
      return rows.map((r) => ({ file: r.file, kind: r.kind, size_gb: +r.size_gb,
        of_source: src ? Math.round((+r.size_gb / +src.size_gb) * 1000) / 1000 : null,
        smaller_pct: src ? Math.round((1 - +r.size_gb / +src.size_gb) * 100) : null }));
    },
  });
  dash.calc('shn5_q6_gain', {
    inputs: ['shn5_speed'],
    title: 'Stage 10 q6 against the lossless .shn5',
    description: "The q6 file's figure against the lossless file's, as a percent change, for each measure of the same session.",
    fn: (rows) => {
      const a = rows.find((r) => String(r.file).includes('lossless'));
      const b = rows.find((r) => String(r.file).includes('Stage 10'));
      return ['decode_tok_s', 'prompt2048_tok_s', 'pinned_ram_gb', 'load_s'].map((k) => ({
        measure: k, lossless: a ? +a[k] : null, q6: b ? +b[k] : null,
        change_pct: a && b ? Math.round((+b[k] / +a[k] - 1) * 1000) / 10 : null }));
    },
  });
  dash.calc('q6_vs_q6k_bits', {
    inputs: ['shn5_quality'],
    title: 'Stage 10 q6 against Q6_K',
    description: "For each model: how many fewer bits a weight Stage 10 q6 uses than Q6_K, in percent, and each file's KL from the reference.",
    fn: (rows) => [...new Set(rows.map((r) => r.model))].map((model) => {
      const s = rows.find((r) => r.model === model && String(r.file).includes('Stage 10'));
      const q = rows.find((r) => r.model === model && String(r.file).startsWith('Q6_K'));
      return { model, stage10_bits: s ? +s.bits_per_weight : null, q6k_bits: q ? +q.bits_per_weight : null,
        fewer_bits_pct: s && q ? Math.round((1 - +s.bits_per_weight / +q.bits_per_weight) * 1000) / 10 : null,
        stage10_kl: s ? +s.kl : null, q6k_kl: q ? +q.kl : null };
    }),
  });
  dash.calc('dit_speedup', {
    inputs: ['dit_ladder'],
    title: 'Video engine against PyTorch',
    description: "PyTorch's denoising time over the engine's: its first, exact version and today's default.",
    fn: (rows) => {
      const pt = rows.find((r) => r.engine === 'PyTorch');
      const lev = rows.filter((r) => r.engine === 'Leviathan').sort((a, b) => +a.step - +b.step);
      const exact = lev[0], now = lev[lev.length - 1];
      return [{ pytorch_s: pt ? +pt.seconds : null, exact_s: exact ? +exact.seconds : null, today_s: now ? +now.seconds : null,
        ratio_exact: pt && exact ? Math.round((+pt.seconds / +exact.seconds) * 100) / 100 : null,
        ratio: pt && now ? Math.round((+pt.seconds / +now.seconds) * 100) / 100 : null }];
    },
  });
  dash.calc('dit_closer', {
    inputs: ['dit_accuracy'],
    title: 'How much closer to FP32 than PyTorch',
    description: "PyTorch's relative error over the engine's, for each output of one denoising step; above 1, the engine is closer.",
    fn: (rows) => rows.map((r) => ({ stream: r.stream, pass: r.pass, leviathan: +r.leviathan, pytorch: +r.pytorch,
      ratio: +r.leviathan > 0 ? Math.round((+r.pytorch / +r.leviathan) * 10) / 10 : null })),
  });
  dash.calc('dit_step_total', {
    inputs: ['dit_profile'],
    title: 'One denoising step, GPU time in all',
    description: 'The sum of the profiled parts of one step at 1280 Γ— 736.',
    fn: (rows) => [{ seconds: Math.round(d3.sum(rows, (r) => +r.seconds) * 100) / 100 }],
  });

  // ── shared helpers ──
  const LM = {
    int: d3.format(',.0f'), d1: d3.format(',.1f'), d2: d3.format(',.2f'),
    kl: (v) => (v == null || !isFinite(v) ? 'β€”' : d3.format('.1e')(v).replace(/e\+0$/, '')),
    pow10: (v) => { const e = Math.round(Math.log10(v)); return e === 0 ? '1' : '1e' + e; },
    times: (v) => (v == null ? 'β€”' : d3.format('.2f')(v) + 'Γ—'),
    rate: (v) => (v == null ? 'β€”' : (v >= 100 ? d3.format(',.0f')(v) : d3.format(',.1f')(v))),
    set(el, text) { el.textContent = text; },
    ok(id) { const d = dash.data(id); return d.status === 'ok' ? d : null; },
    colors() {
      const c = dash.colors || [];
      const root = document.getElementById('dash-root') || document.documentElement;
      for (let i = 0; i < 4; i++) root.style.setProperty('--lm-c' + i, c[i] || 'var(--color-fg)');
      return c;
    },
    width(el) { return Math.max(260, Math.floor(el.clientWidth || 600)); },
    tip(el) {
      const t = document.createElement('div');
      t.className = 'lm-tip';
      t.hidden = true;
      el.appendChild(t);
      return {
        show(ev, value, lines) {
          t.replaceChildren();
          const v = document.createElement('div'); v.className = 'lm-tip-v'; v.textContent = value; t.appendChild(v);
          for (const l of lines) { const k = document.createElement('div'); k.className = 'lm-tip-k'; k.textContent = l; t.appendChild(k); }
          t.hidden = false;
          const box = el.getBoundingClientRect();
          let x = (ev.clientX ?? box.left + box.width / 2) - box.left + 12;
          let y = (ev.clientY ?? box.top + 20) - box.top + 12;
          x = Math.min(x, box.width - t.offsetWidth - 4);
          y = Math.min(y, box.height - t.offsetHeight - 4);
          t.style.left = Math.max(0, x) + 'px';
          t.style.top = Math.max(0, y) + 'px';
        },
        hide() { t.hidden = true; },
      };
    },
    failed(el, msg) {
      el.replaceChildren();
      const p = document.createElement('p'); p.className = 'lm-note'; p.textContent = msg; el.appendChild(p);
    },
    // a row label wider than the room left of the plot: two lines, then an ellipsis (the tooltip and table have it whole)
    fitLabel(sel, maxW) {
      if (sel.node().getComputedTextLength() <= maxW) return sel;
      const words = String(sel.text()).split(' '), x = sel.attr('x');
      const cut = (t, s) => { let v = s; t.text(v); while (v.length > 1 && t.node().getComputedTextLength() > maxW) { v = v.slice(0, -1); t.text(v.trimEnd() + '…'); } };
      if (words.length === 1) { cut(sel, words[0]); return sel; }
      sel.text(null).attr('dy', null);
      const l1 = sel.append('tspan').attr('x', x).attr('dy', '-0.25em');
      const l2 = sel.append('tspan').attr('x', x).attr('dy', '1.15em');
      let n = 1;
      while (n < words.length) {
        l1.text(words.slice(0, n + 1).join(' '));
        if (l1.node().getComputedTextLength() > maxW) break;
        n++;
      }
      cut(l1, words.slice(0, n).join(' '));
      cut(l2, words.slice(n).join(' '));
      return sel;
    },
    // horizontal bars: rows [{name, v, lines:[...], color}], one baseline at 0
    hbars(el, rows, opt) {
      el.replaceChildren();
      const W = LM.width(el), rowH = 34, barH = 18, padT = 4;
      const svg = d3.select(el).append('svg').attr('width', '100%').attr('role', 'img').attr('aria-label', opt.aria);
      const names = svg.append('g');
      const measured = rows.map((r) => { const t = names.append('text').attr('class', r.emph ? 'lm-strong' : null).text(r.name); const w = t.node().getComputedTextLength(); t.remove(); return w; });
      const left = Math.min(Math.max(...measured, 40) + 12, W * 0.45);
      const right = 64;
      const x = d3.scaleLinear().domain([0, opt.max || d3.max(rows, (r) => r.v) * 1.05]).nice().range([left, W - right]);
      const H = padT + rows.length * rowH + 24;
      svg.attr('viewBox', `0 0 ${W} ${H}`);
      svg.append('g').attr('class', 'lm-grid').attr('transform', `translate(0,${H - 22})`)
        .call(d3.axisBottom(x).ticks(Math.max(2, Math.floor((W - left) / 90))).tickSize(-(H - 26)).tickFormat(opt.tick || d3.format(',')));
      const tip = LM.tip(el);
      rows.forEach((r, i) => {
        const y = padT + i * rowH + (rowH - barH) / 2;
        LM.fitLabel(svg.append('text').attr('x', left - 10).attr('y', y + barH / 2).attr('dy', '0.35em').attr('text-anchor', 'end')
          .attr('class', r.emph ? 'lm-strong' : null).text(r.name), left - 12);
        if (r.v == null) {
          svg.append('text').attr('x', left + 4).attr('y', y + barH / 2).attr('dy', '0.35em').text('not measured');
          return;
        }
        const w = Math.max(1, x(r.v) - left);
        const path = d3.path();
        const rr = Math.min(4, w / 2);
        path.moveTo(left, y); path.lineTo(left + w - rr, y); path.quadraticCurveTo(left + w, y, left + w, y + rr);
        path.lineTo(left + w, y + barH - rr); path.quadraticCurveTo(left + w, y + barH, left + w - rr, y + barH);
        path.lineTo(left, y + barH); path.closePath();
        svg.append('path').attr('d', path.toString()).style('fill', r.color);
        if (r.lo != null) {
          svg.append('line').attr('x1', x(r.lo)).attr('x2', x(r.lo)).attr('y1', y - 3).attr('y2', y + barH + 3).attr('class', 'lm-ref');
        }
        svg.append('text').attr('x', left + w + 6).attr('y', y + barH / 2).attr('dy', '0.35em').attr('class', 'lm-strong')
          .text(opt.fmt(r.v, r));
        svg.append('rect').attr('class', 'lm-hit').attr('x', 0).attr('y', padT + i * rowH).attr('width', W).attr('height', rowH)
          .attr('tabindex', 0).attr('aria-label', `${r.name}: ${opt.fmt(r.v, r)}`)
          .on('pointermove focus', (ev) => tip.show(ev, opt.fmt(r.v, r) + (opt.unit ? ' ' + opt.unit : ''), [r.name, ...(r.lines || [])]))
          .on('pointerleave blur', () => tip.hide());
      });
    },
    // dots on a log axis, one row per item; series [{key, color, label}]; refs: per-row bar value
    logdots(el, rows, series, opt) {
      el.replaceChildren();
      const W = LM.width(el), rowH = 30, padT = 6;
      const svg = d3.select(el).append('svg').attr('width', '100%').attr('role', 'img').attr('aria-label', opt.aria);
      const probe = svg.append('g');
      const left = Math.min(Math.max(...rows.map((r) => { const t = probe.append('text').text(r.name); const w = t.node().getComputedTextLength(); t.remove(); return w; }), 40) + 12, W * 0.42);
      const H = padT + rows.length * rowH + 26;
      svg.attr('viewBox', `0 0 ${W} ${H}`);
      const x = d3.scaleLog().domain(opt.domain).range([left, W - 28]).clamp(true);
      const ticks = [];
      opt.ticks.filter((t) => t >= opt.domain[0] && t <= opt.domain[1]).forEach((t) => {
        if (!ticks.length || x(t) - x(ticks[ticks.length - 1]) >= 44) ticks.push(t);
      });
      svg.append('g').attr('class', 'lm-grid').attr('transform', `translate(0,${H - 22})`)
        .call(d3.axisBottom(x).tickValues(ticks).tickSize(-(H - 26)).tickFormat((v) => LM.pow10(v)));
      const tip = LM.tip(el);
      rows.forEach((r, i) => {
        const cy = padT + i * rowH + rowH / 2;
        LM.fitLabel(svg.append('text').attr('x', left - 10).attr('y', cy).attr('dy', '0.35em').attr('text-anchor', 'end').text(r.name), left - 12);
        if (r.bar != null) {
          svg.append('line').attr('class', 'lm-ref').attr('x1', x(r.bar)).attr('x2', x(r.bar)).attr('y1', cy - 10).attr('y2', cy + 10);
        }
        series.forEach((s) => {
          const v = r[s.key];
          if (v == null || !(v > 0)) return;
          svg.append('circle').attr('cx', x(v)).attr('cy', cy).attr('r', 5).style('fill', s.color)
            .style('stroke', 'var(--color-bg)').style('stroke-width', 2);
        });
        svg.append('rect').attr('class', 'lm-hit').attr('x', 0).attr('y', padT + i * rowH).attr('width', W).attr('height', rowH)
          .attr('tabindex', 0).attr('aria-label', `${r.name}: ` + series.map((s) => `${s.label} ${LM.kl(r[s.key])}`).join(', '))
          .on('pointermove focus', (ev) => tip.show(ev, series.map((s) => `${s.label}: ${LM.kl(r[s.key])}`).join(' Β· '),
            [r.name, ...(r.bar != null ? ['bar ' + LM.kl(r.bar)] : []), ...(r.lines || [])]))
          .on('pointerleave blur', () => tip.hide());
      });
    },
    rowsTable(tbody, rows, cols) {
      tbody.replaceChildren();
      for (const r of rows) {
        const tr = document.createElement('tr');
        for (const c of cols) {
          const td = document.createElement('td');
          if (c.num) td.className = 'lm-num';
          if (c.nowrap) td.classList.add('lm-nowrap');
          const v = r[c.key];
          td.textContent = v == null || v === '' ? 'β€”' : (c.fmt ? c.fmt(v, r) : String(v));
          tr.appendChild(td);
        }
        tbody.appendChild(tr);
      }
    },
  };

  dash.onData(() => LM.colors());          // the legend swatches take the chart colours from the start

  // ── the words and figures ──
  const num = (id, row, field, f) => (el) => {
    const d = LM.ok(id);
    if (!d) { LM.set(el, 'β€”'); return; }
    const rows = Array.isArray(d.data) ? d.data : [];
    const r = typeof row === 'function' ? rows.find(row) : rows[row];
    LM.set(el, r && r[field] != null ? f(+r[field]) : 'β€”');
  };
  dash.draw('lede-moe', num('moe', 0, 'decode_tok_s', LM.d1));
  dash.draw('lede-moe-ll', num('moe', 2, 'decode_tok_s_low', LM.d1));
  dash.draw('lede-moe-lh', num('moe', 2, 'decode_tok_s', LM.d1));
  dash.draw('lede-shn5', num('shn5_files', 1, 'size_gb', LM.d1));
  dash.draw('lede-shn5-q6', num('shn5_files', 2, 'size_gb', LM.d1));
  dash.draw('lede-shn5-bits', num('shn5_files', 2, 'bits_per_weight', LM.d1));
  dash.draw('lede-dit-x', num('dit_speedup', 0, 'ratio', (v) => LM.d1(v) + 'Γ—'));
  dash.draw('lede-dit-word', (el) => {
    const d = LM.ok('dit_closer'); const rows = d && Array.isArray(d.data) ? d.data : [];
    if (!rows.length || rows.some((r) => r.ratio == null)) { LM.set(el, 'β€”'); return; }
    LM.set(el, d3.min(rows, (r) => +r.ratio) >= 1.05 ? 'closer to' : 'no closer to');
  });
  dash.draw('t-shn5', num('shn5_files', 1, 'size_gb', LM.d1));
  dash.draw('t-shn5-src', num('shn5_files', 0, 'size_gb', LM.d1));
  dash.draw('t-shn5-x', num('shn5_ratio', 1, 'smaller_pct', LM.int));
  dash.draw('t-dit', num('dit_speedup', 0, 'today_s', LM.d1));
  dash.draw('t-dit-pt', num('dit_speedup', 0, 'pytorch_s', LM.d1));
  dash.draw('t-dit-x', num('dit_speedup', 0, 'ratio', LM.times));
  dash.draw('shn5-ll-pct', num('shn5_ratio', 1, 'smaller_pct', LM.int));
  dash.draw('shn5-q6-pct', num('shn5_ratio', 2, 'smaller_pct', LM.int));
  dash.draw('shn5-gain-decode', num('shn5_q6_gain', 0, 'change_pct', LM.int));
  dash.draw('shn5-gain-prompt', num('shn5_q6_gain', 1, 'change_pct', LM.int));
  dash.draw('shn5-ram-q6', num('shn5_speed', 1, 'pinned_ram_gb', LM.d1));
  dash.draw('shn5-ram-ll', num('shn5_speed', 0, 'pinned_ram_gb', LM.d1));
  dash.draw('shn5-load-q6', num('shn5_speed', 1, 'load_s', LM.d1));
  dash.draw('shn5-load-ll', num('shn5_speed', 0, 'load_s', LM.d1));
  dash.draw('shn5-ll-decode', num('shn5_speed', 0, 'decode_tok_s', LM.d1));
  dash.draw('shn5-ll-decode-then', num('moe', 0, 'decode_tok_s', LM.d1));
  dash.draw('q6-fewer-tiny', num('q6_vs_q6k_bits', 1, 'fewer_bits_pct', LM.d1));
  dash.draw('q6-fewer-30b', num('q6_vs_q6k_bits', 0, 'fewer_bits_pct', LM.d1));
  dash.draw('q6-kl-30b', num('q6_vs_q6k_bits', 0, 'stage10_kl', LM.kl));
  dash.draw('q6k-kl-30b', num('q6_vs_q6k_bits', 0, 'q6k_kl', LM.kl));
  dash.draw('dit-pt', num('dit_ladder', 0, 'seconds', LM.d1));
  dash.draw('dit-exact', num('dit_speedup', 0, 'exact_s', LM.d1));
  dash.draw('dit-exact-x', num('dit_speedup', 0, 'ratio_exact', LM.times));
  dash.draw('dit-closer-pic', num('dit_closer', 0, 'ratio', LM.d1));
  dash.draw('dit-closer-snd', num('dit_closer', 2, 'ratio', LM.d1));
  dash.draw('dit-psnr-control', num('dit_psnr', 4, 'psnr_db', LM.d1));
  dash.draw('dit-psnr-now', num('dit_psnr', 3, 'psnr_db', LM.d1));
  dash.draw('dit-psnr-pt', num('dit_psnr', 1, 'psnr_db', LM.d1));
  dash.draw('dit-step-total', num('dit_step_total', 0, 'seconds', LM.d2));
  dash.draw('raw-before', num('raw_formats', 0, 'before_ms', LM.d2));
  dash.draw('raw-after', num('raw_formats', 0, 'after_ms', LM.d2));
  dash.draw('t-moe-decode', num('moe', 0, 'decode_tok_s', LM.d1));
  dash.draw('t-moe-decode-ll', num('moe', 2, 'decode_tok_s_low', LM.d1));
  dash.draw('t-moe-decode-lh', num('moe', 2, 'decode_tok_s', LM.d1));
  dash.draw('t-moe-decode-x', (el) => { const d = LM.ok('moe_vs_llama'); LM.set(el, d && d.data[0] ? LM.times(d.data[0].ratio) : 'β€”'); });
  dash.draw('t-moe-prompt', num('moe', 0, 'prompt700_tok_s', LM.int));
  dash.draw('t-moe-prompt-ll', num('moe', 3, 'prompt700_tok_s', LM.int));
  dash.draw('t-moe-prompt-x', (el) => { const d = LM.ok('moe_vs_llama'); LM.set(el, d && d.data[1] ? LM.times(d.data[1].ratio) : 'β€”'); });
  dash.draw('moe-2048', num('moe', 0, 'prompt2048_tok_s', LM.int));
  dash.draw('moe-2048-ll', num('moe', 3, 'prompt2048_tok_s', LM.int));
  dash.draw('t-dense', num('decode7b', (r) => r.engine === 'Leviathan' && +r.context === 128, 'tok_s', LM.d1));
  dash.draw('t-dense-ll', num('decode7b', (r) => r.engine === 'llama.cpp' && +r.context === 128, 'tok_s', LM.d1));
  dash.draw('t-dense-x', (el) => {
    const d = LM.ok('dense_vs_llama'); const r = d && d.data[0];
    if (!r || r.ratio == null) { LM.set(el, 'β€”'); el.className = ''; return; }
    LM.set(el, LM.times(r.ratio));
    el.className = r.ratio >= 0.97 ? 'lm-good' : '';
  });
  dash.draw('t-ref', (el) => { const d = LM.ok('ref_summary'); LM.set(el, d && d.data[0] ? String(d.data[0].passed) : 'β€”'); });
  dash.draw('t-ref-n', (el) => { const d = LM.ok('ref_summary'); LM.set(el, d && d.data[0] ? String(d.data[0].total) : 'β€”'); });
  dash.draw('t-ref-worst', (el) => { const d = LM.ok('ref_summary'); LM.set(el, d && d.data[0] ? LM.kl(d.data[0].worst_dense_kl) : 'β€”'); });
  for (const n of [512, 2048, 4096]) dash.draw('i8x-' + n, num('int8_vs_llama', (r) => +r.prompt === n, 'ratio', LM.times));
  dash.draw('depth-lev', num('depth_cost', (r) => r.engine === 'Leviathan', 'extra_ms', LM.d2));
  dash.draw('depth-ll', num('depth_cost', (r) => r.engine === 'llama.cpp', 'extra_ms', LM.d2));
  dash.draw('kv-mb', num('hood', 5, 'kv_mb', LM.d1));
  dash.draw('attn-gbs', num('hood', 5, 'gb_s', LM.int));
  dash.draw('attn-pct', num('hood', 5, 'pct_ceiling', LM.int));
  dash.draw('fp16-save', num('fp16_estimate', 0, 'fp16_saving_ms', LM.d2));
  dash.draw('fp16-diff', num('fp16_estimate', 0, 'difference_ms', LM.d2));
  dash.draw('kl-default', num('prompt7b', (r) => r.arm_key === 'default' && +r.prompt === 2048, 'kl_vs_exact', LM.kl));
  dash.draw('kl-tc', num('prompt7b', (r) => r.arm_key === 'tc' && +r.prompt === 2048, 'kl_vs_exact', LM.kl));
  dash.draw('kl-int8', num('prompt7b', (r) => r.arm_key === 'int8tc' && +r.prompt === 2048, 'kl_vs_exact', LM.kl));
  dash.draw('mv-lev', num('hood', 4, 'value', LM.d2));
  dash.draw('mv-ll', num('hood', 3, 'value', LM.d2));

  // ── charts ──
  dash.draw('moe-decode', (el) => {
    const d = dash.data('moe');
    if (d.status === 'error') return LM.failed(el, 'Failed to load');
    if (d.status !== 'ok') { el.replaceChildren(); return; }
    const c = LM.colors();
    const rows = d.data.filter((r) => r.decode_tok_s != null).map((r) => ({
      name: r.engine, v: +r.decode_tok_s, lo: r.decode_tok_s_low != null ? +r.decode_tok_s_low : null,
      color: String(r.engine).startsWith('Leviathan') ? c[0] : 'var(--cds-chart-muted)', emph: String(r.engine).startsWith('Leviathan, 16'),
      lines: [r.settings, ...(r.decode_tok_s_low != null ? [`range ${LM.d1(+r.decode_tok_s_low)}–${LM.d1(+r.decode_tok_s)}`] : [])],
    }));
    LM.hbars(el, rows, { aria: 'Decode speed on Qwen3-30B-A3B BF16: ' + rows.map((r) => `${r.name} ${LM.d1(r.v)}`).join(', ') + ' tokens a second',
      fmt: (v, r) => (r.lo != null ? `${LM.d1(r.lo)}–${LM.d1(v)}` : LM.d1(v)), unit: 'tok/s' });
  });
  dash.draw('moe-prompt', (el) => {
    const d = dash.data('moe');
    if (d.status === 'error') return LM.failed(el, 'Failed to load');
    if (d.status !== 'ok') { el.replaceChildren(); return; }
    const c = LM.colors();
    const rows = d.data.filter((r) => r.prompt700_tok_s != null).map((r) => ({
      name: r.engine, v: +r.prompt700_tok_s, lo: r.prompt700_tok_s_low != null ? +r.prompt700_tok_s_low : null,
      color: String(r.engine).startsWith('Leviathan') ? c[0] : 'var(--cds-chart-muted)', emph: String(r.engine).startsWith('Leviathan, 16'),
      lines: [r.settings],
    }));
    LM.hbars(el, rows, { aria: '700-token prompt speed on Qwen3-30B-A3B BF16: ' + rows.map((r) => `${r.name} ${LM.int(r.v)}`).join(', ') + ' tokens a second',
      fmt: (v, r) => (r.lo != null ? `${LM.int(r.lo)}–${LM.int(v)}` : LM.int(v)), unit: 'tok/s' });
  });
  dash.draw('moe-table', (tb) => {
    const d = LM.ok('moe'); if (!d) { tb.replaceChildren(); return; }
    LM.rowsTable(tb, d.data, [{ key: 'engine' }, { key: 'vram_gib', num: true }, { key: 'decode_tok_s_low', num: true },
      { key: 'decode_tok_s', num: true }, { key: 'prompt700_tok_s_low', num: true }, { key: 'prompt700_tok_s', num: true },
      { key: 'prompt2048_tok_s', num: true }, { key: 'settings' }]);
  });

  dash.draw('dense-decode', (el) => {
    const d = dash.data('decode7b');
    if (d.status === 'error') return LM.failed(el, 'Failed to load');
    if (d.status !== 'ok') { el.replaceChildren(); return; }
    const c = LM.colors();
    el.replaceChildren();
    const W = LM.width(el), H = 260, m = { t: 22, r: 8, b: 30, l: 44 };
    const ctx = [128, 2048, 4096], eng = ['Leviathan', 'llama.cpp'];
    const val = (e, k) => { const r = d.data.find((x) => x.engine === e && +x.context === k); return r ? +r.tok_s : null; };
    const x0 = d3.scaleBand().domain(ctx).range([m.l, W - m.r]).paddingInner(0.25).paddingOuter(0.1);
    const x1 = d3.scaleBand().domain(eng).range([0, x0.bandwidth()]).padding(0.12);
    const ymax = d3.max(d.data, (r) => +r.tok_s) || 1;
    const y = d3.scaleLinear().domain([0, ymax * 1.12]).nice().range([H - m.b, m.t]);
    const svg = d3.select(el).append('svg').attr('width', '100%').attr('viewBox', `0 0 ${W} ${H}`).attr('role', 'img')
      .attr('aria-label', 'Decode speed, Qwen 2.5 Coder 7B Q8_0: ' + ctx.map((k) => `${k}-token context Leviathan ${LM.d1(val('Leviathan', k))}, llama.cpp ${LM.d1(val('llama.cpp', k))}`).join('; ') + ' tokens a second');
    svg.append('g').attr('class', 'lm-grid').attr('transform', `translate(${m.l},0)`)
      .call(d3.axisLeft(y).ticks(5).tickSize(-(W - m.l - m.r)));
    svg.append('g').attr('transform', `translate(0,${H - m.b})`)
      .call(d3.axisBottom(x0).tickSize(0).tickPadding(8).tickFormat((k) => (x0.step() >= 130 ? `${LM.int(k)}-token context` : `${LM.int(k)} tokens`))).select('.domain').remove();
    const bw = Math.min(24, x1.bandwidth());
    const tip = LM.tip(el);
    ctx.forEach((k) => eng.forEach((e, i) => {
      const v = val(e, k); if (v == null) return;
      const bx = x0(k) + x1(e) + (x1.bandwidth() - bw) / 2, by = y(v), bh = y(0) - by;
      const p = d3.path(), rr = Math.min(4, bh / 2, bw / 2);
      p.moveTo(bx, y(0)); p.lineTo(bx, by + rr); p.quadraticCurveTo(bx, by, bx + rr, by); p.lineTo(bx + bw - rr, by);
      p.quadraticCurveTo(bx + bw, by, bx + bw, by + rr); p.lineTo(bx + bw, y(0)); p.closePath();
      svg.append('path').attr('d', p.toString()).style('fill', c[i]);
      svg.append('text').attr('x', bx + bw / 2).attr('y', by - 6).attr('text-anchor', 'middle').attr('class', 'lm-strong').text(LM.d1(v));
      const r = d.data.find((x) => x.engine === e && +x.context === k);
      svg.append('rect').attr('class', 'lm-hit').attr('x', x0(k) + x1(e)).attr('y', m.t).attr('width', x1.bandwidth()).attr('height', H - m.t - m.b)
        .attr('tabindex', 0).attr('aria-label', `${e}, ${k}-token context: ${LM.d1(v)} tokens a second`)
        .on('pointermove focus', (ev) => tip.show(ev, `${LM.d1(v)} tok/s`, [e, `${LM.int(k)}-token context`, r && r.ms != null ? `${LM.d2(+r.ms)} ms a token` : '']))
        .on('pointerleave blur', () => tip.hide());
    }));
  });
  dash.draw('decode-table', (tb) => {
    const d = LM.ok('decode7b'); if (!d) { tb.replaceChildren(); return; }
    LM.rowsTable(tb, d.data, [{ key: 'engine' }, { key: 'context', num: true, fmt: (v) => LM.int(+v) }, { key: 'tok_s', num: true, fmt: (v) => LM.d2(+v) },
      { key: 'ms', num: true, fmt: (v) => LM.d2(+v) }, { key: 'round1_tok_s', num: true, fmt: (v) => LM.d2(+v) }, { key: 'round2_tok_s', num: true, fmt: (v) => LM.d2(+v) }]);
  });

  const ppArms = [['default', 0], ['tc', 1], ['int8tc', 2], ['llama', 3]];
  for (const n of [512, 2048, 4096]) {
    dash.draw('pp-' + n, (el) => {
      const d = dash.data('prompt7b');
      if (d.status === 'error') return LM.failed(el, 'Failed to load');
      if (d.status !== 'ok') { el.replaceChildren(); return; }
      const c = LM.colors();
      const all = d.data.filter((r) => +r.prompt === n);
      const max = d3.max(d.data, (r) => +r.tok_s);
      const rows = ppArms.map(([k, i]) => {
        const r = all.find((x) => x.arm_key === k);
        return r ? { name: r.arm_short || r.arm, v: +r.tok_s, color: c[i], emph: k === 'default',
          lines: [r.arm, r.precision, ...(r.kl_vs_exact != null ? ['KL vs exact ' + LM.kl(+r.kl_vs_exact) + ' (2,048-token prompt)'] : [])] } : null;
      }).filter(Boolean);
      LM.hbars(el, rows, { aria: `${n}-token prompt speed: ` + rows.map((r) => `${r.name} ${LM.int(r.v)}`).join(', ') + ' tokens a second',
        fmt: (v) => LM.int(v), unit: 'tok/s', max: max * 1.05 });
    });
  }
  dash.draw('prompt-table', (tb) => {
    const d = LM.ok('prompt7b'); if (!d) { tb.replaceChildren(); return; }
    LM.rowsTable(tb, d.data, [{ key: 'arm' }, { key: 'prompt', num: true, fmt: (v) => LM.int(+v) }, { key: 'tok_s', num: true, fmt: (v) => LM.int(+v) },
      { key: 'kl_vs_exact', num: true, fmt: (v) => LM.kl(+v) }, { key: 'precision' }]);
  });

  dash.draw('ref-dots', (el) => {
    const d = dash.data('refkl');
    if (d.status === 'error') return LM.failed(el, 'Failed to load');
    if (d.status !== 'ok') { el.replaceChildren(); return; }
    const c = LM.colors();
    const rows = d.data.map((r) => ({ name: r.model, kl: +r.kl_max, bar: +r.bar, lines: [r.weights + ' weights', r.decode_path] }));
    LM.logdots(el, rows, [{ key: 'kl', color: c[0], label: 'worst KL' }], {
      aria: 'Worst KL divergence from the stored reference, per model: ' + rows.map((r) => `${r.name} ${LM.kl(r.kl)}`).join(', '),
      domain: [1e-11, 1e-2], ticks: [1e-11, 1e-9, 1e-7, 1e-5, 1e-4, 1e-3, 1e-2] });
  });
  dash.draw('ref-table', (tb) => {
    const d = LM.ok('refkl'); if (!d) { tb.replaceChildren(); return; }
    LM.rowsTable(tb, d.data, [{ key: 'model' }, { key: 'weights' }, { key: 'kl_max', num: true, fmt: (v) => LM.kl(+v) },
      { key: 'bar', num: true, fmt: (v) => LM.kl(+v) }, { key: 'decode_path' }]);
  });

  dash.draw('optin-dots', (el) => {
    const d = dash.data('optin');
    if (d.status === 'error') return LM.failed(el, 'Failed to load');
    if (d.status !== 'ok') { el.replaceChildren(); return; }
    const c = LM.colors();
    const rows = d.data.map((r) => ({ name: r.model, tc: r.kl_tc_attention == null ? null : +r.kl_tc_attention,
      i8: r.int8_applies === true || r.int8_applies === 'true' ? +r.kl_int8_gemm : null, bar: 1e-4,
      lines: [r.weights + ' weights', ...(r.int8_applies === true || r.int8_applies === 'true' ? [] : ['int8 does not apply (not Q8_0)'])] }));
    LM.logdots(el, rows, [{ key: 'tc', color: c[0], label: 'tensor-core attention' }, { key: 'i8', color: c[2], label: 'int8 matrices' }], {
      aria: 'KL divergence from the stored reference with each opt-in switch, per model', domain: [1e-7, 1], ticks: [1e-7, 1e-6, 1e-5, 1e-4, 1e-3, 1e-2, 1e-1, 1] });
  });
  dash.draw('optin-table', (tb) => {
    const d = LM.ok('optin'); if (!d) { tb.replaceChildren(); return; }
    LM.rowsTable(tb, d.data, [{ key: 'model' }, { key: 'weights' }, { key: 'kl_tc_attention', num: true, fmt: (v) => LM.kl(+v) },
      { key: 'kl_int8_gemm', num: true, fmt: (v, r) => (r.int8_applies === true || r.int8_applies === 'true' ? LM.kl(+v) : 'n/a') }]);
  });

  dash.draw('launches', (el) => {
    const d = dash.data('hood');
    if (d.status === 'error') return LM.failed(el, 'Failed to load');
    if (d.status !== 'ok') { el.replaceChildren(); return; }
    const c = LM.colors();
    const rows = d.data.filter((r) => String(r.item).startsWith('Kernels')).map((r) => ({
      name: r.engine, v: +r.value, color: r.engine === 'Leviathan now' ? c[0] : 'var(--cds-chart-muted)', emph: r.engine === 'Leviathan now', lines: [r.note] }));
    LM.hbars(el, rows, { aria: 'Kernels a decode token: ' + rows.map((r) => `${r.name} ${r.v}`).join(', '), fmt: (v) => LM.int(v), unit: 'kernels' });
  });
  dash.draw('bandwidth', (el) => {
    const d = dash.data('bandwidth');
    if (d.status === 'error') return LM.failed(el, 'Failed to load');
    if (d.status !== 'ok') { el.replaceChildren(); return; }
    const c = LM.colors();
    const ceiling = d3.max(d.data, (r) => +r.ceiling_gb_s) || 670;
    const rows = d.data.map((r) => ({ name: `${r.weight}, ${r.engine}`, v: +r.gb_s, color: r.engine === 'Leviathan' ? c[0] : c[1],
      lines: [`${LM.int(Math.round(+r.gb_s / ceiling * 100))} % of the ${LM.int(ceiling)} GB/s ceiling`, `${LM.d1(+r.bytes_mb)} MB a token`] }));
    LM.hbars(el, rows, { aria: 'Streaming speed per weight against the card ceiling: ' + rows.map((r) => `${r.name} ${r.v} GB/s`).join(', '),
      fmt: (v) => LM.int(v), unit: 'GB/s', max: ceiling });
  });
  dash.draw('gates-table', (tb) => {
    const d = LM.ok('gates'); if (!d) { tb.replaceChildren(); return; }
    LM.rowsTable(tb, d.data, [{ key: 'test' }, { key: 'proves' }, { key: 'checks', num: true }]);
  });

  // ── .shn5 ──
  dash.draw('shn5-sizes', (el) => {
    const d = dash.data('shn5_files');
    if (d.status === 'error') return LM.failed(el, 'Failed to load');
    if (d.status !== 'ok') { el.replaceChildren(); return; }
    const c = LM.colors();
    const rows = d.data.map((r) => ({ name: r.file, v: +r.size_gb,
      color: r.kind === 'source' ? 'var(--cds-chart-muted)' : r.kind === 'lossy' ? c[1] : c[0], emph: r.kind === 'lossless',
      lines: [r.lossless === true || r.lossless === 'true' ? 'lossless' : 'lossy',
        ...(r.bits_per_weight != null ? [`${LM.d2(+r.bits_per_weight)} bits a weight`] : [])] }));
    LM.hbars(el, rows, { aria: 'Size of Qwen3-30B-A3B on disk: ' + rows.map((r) => `${r.name} ${LM.d1(r.v)} GB`).join(', '),
      fmt: (v) => LM.d1(v), unit: 'GB' });
  });
  for (const [name, key, f, what] of [['shn5-decode', 'decode_tok_s', LM.d1, 'Decode'], ['shn5-prompt', 'prompt2048_tok_s', LM.int, '2,048-token prompt']]) {
    dash.draw(name, (el) => {
      const d = dash.data('shn5_speed');
      if (d.status === 'error') return LM.failed(el, 'Failed to load');
      if (d.status !== 'ok') { el.replaceChildren(); return; }
      const c = LM.colors();
      const rows = d.data.map((r) => ({ name: r.file, v: +r[key], color: String(r.file).includes('Stage 10') ? c[1] : c[0],
        lines: [`${LM.d1(+r.pinned_ram_gb)} GB of RAM for the experts`, `load ${LM.d1(+r.load_s)} s`] }));
      LM.hbars(el, rows, { aria: `${what} speed of Qwen3-30B-A3B by file: ` + rows.map((r) => `${r.name} ${f(r.v)}`).join(', ') + ' tokens a second',
        fmt: (v) => f(v), unit: 'tok/s' });
    });
  }
  dash.draw('shn5-quality', (el) => {
    const d = dash.data('shn5_quality');
    if (d.status === 'error') return LM.failed(el, 'Failed to load');
    if (d.status !== 'ok') { el.replaceChildren(); return; }
    const c = LM.colors();
    const rows = [...new Set(d.data.map((r) => r.model))].map((m) => {
      const s = d.data.find((r) => r.model === m && String(r.file).includes('Stage 10'));
      const q = d.data.find((r) => r.model === m && String(r.file).startsWith('Q6_K'));
      return { name: m, s10: s ? +s.kl : null, q6k: q ? +q.kl : null,
        lines: [...(s ? [`Stage 10 q6: ${LM.d2(+s.bits_per_weight)} bits a weight`] : []),
          ...(q ? [`Q6_K: ${LM.d2(+q.bits_per_weight)} bits a weight`] : []), ...(s ? ['against ' + s.reference] : [])] };
    });
    LM.logdots(el, rows, [{ key: 's10', color: c[1], label: 'Stage 10 q6' }, { key: 'q6k', color: c[2], label: 'Q6_K' }], {
      aria: 'KL divergence from the reference, Stage 10 q6 and Q6_K, per model: ' + rows.map((r) => `${r.name} ${LM.kl(r.s10)} and ${LM.kl(r.q6k)}`).join('; '),
      domain: [1e-4, 4e-3], ticks: [1e-4, 1e-3] });
  });
  dash.draw('shn5-files-table', (tb) => {
    const d = LM.ok('shn5_files'); if (!d) { tb.replaceChildren(); return; }
    LM.rowsTable(tb, d.data, [{ key: 'file' }, { key: 'size_gb', num: true, fmt: (v) => LM.d2(+v) },
      { key: 'bits_per_weight', num: true, fmt: (v) => d3.format('.4~f')(+v) }, { key: 'lossless', fmt: (v) => (v === true || v === 'true' ? 'yes' : 'no') }]);
  });
  dash.draw('shn5-speed-table', (tb) => {
    const d = LM.ok('shn5_speed'); if (!d) { tb.replaceChildren(); return; }
    LM.rowsTable(tb, d.data, [{ key: 'file' }, { key: 'decode_tok_s', num: true, fmt: (v) => LM.d1(+v) },
      { key: 'prompt2048_tok_s', num: true, fmt: (v) => LM.int(+v) }, { key: 'pinned_ram_gb', num: true, fmt: (v) => LM.d1(+v) },
      { key: 'load_s', num: true, fmt: (v) => LM.d1(+v) }]);
  });
  dash.draw('shn5-quality-table', (tb) => {
    const d = LM.ok('shn5_quality'); if (!d) { tb.replaceChildren(); return; }
    LM.rowsTable(tb, d.data, [{ key: 'model' }, { key: 'file' }, { key: 'bits_per_weight', num: true, fmt: (v) => d3.format('.4~f')(+v) },
      { key: 'kl', num: true, fmt: (v) => LM.kl(+v) }, { key: 'reference' }, { key: 'note' }]);
  });

  // ── the video engine ──
  dash.draw('dit-ladder', (el) => {
    const d = dash.data('dit_ladder');
    if (d.status === 'error') return LM.failed(el, 'Failed to load');
    if (d.status !== 'ok') { el.replaceChildren(); return; }
    const c = LM.colors();
    const steps = [...d.data].sort((a, b) => +a.step - +b.step);
    const pt = steps.find((r) => r.engine === 'PyTorch');
    const last = steps[steps.length - 1];
    const rows = steps.map((r) => ({ name: r.change, v: +r.seconds, emph: r === last,
      color: r.engine === 'PyTorch' ? 'var(--cds-chart-muted)' : c[0],
      lines: [`step ${r.step}`, ...(pt && r !== pt ? [`${LM.d2(+pt.seconds / +r.seconds)}Γ— PyTorch's speed`] : [])] }));
    LM.hbars(el, rows, { aria: 'Seconds to denoise one 1280 by 736 shot, one change at a time: ' + rows.map((r) => `${r.name} ${LM.d1(r.v)}`).join('; '),
      fmt: (v) => LM.d1(v), unit: 's' });
  });
  dash.draw('dit-accuracy', (el) => {
    const d = dash.data('dit_accuracy');
    if (d.status === 'error') return LM.failed(el, 'Failed to load');
    if (d.status !== 'ok') { el.replaceChildren(); return; }
    const c = LM.colors();
    const cap = (s) => String(s).charAt(0).toUpperCase() + String(s).slice(1);
    const rows = d.data.map((r) => ({ name: `${cap(r.stream)}, ${r.pass}`, lev: +r.leviathan, pt: +r.pytorch,
      lines: [`PyTorch's error is ${LM.d1(+r.pytorch / +r.leviathan)}Γ— the engine's`] }));
    LM.logdots(el, rows, [{ key: 'lev', color: c[0], label: 'Video engine' }, { key: 'pt', color: 'var(--cds-chart-muted)', label: 'PyTorch' }], {
      aria: 'Relative error from FP32 of one denoising step, video engine and PyTorch: ' + rows.map((r) => `${r.name} ${LM.kl(r.lev)} and ${LM.kl(r.pt)}`).join('; '),
      domain: [1e-3, 1e-1], ticks: [1e-3, 1e-2, 1e-1] });
  });
  dash.draw('dit-psnr', (el) => {
    const d = dash.data('dit_psnr');
    if (d.status === 'error') return LM.failed(el, 'Failed to load');
    if (d.status !== 'ok') { el.replaceChildren(); return; }
    const c = LM.colors();
    const rows = d.data.map((r) => {
      const muted = r.control === true || r.control === 'true' || String(r.render).includes('PyTorch');
      return { name: r.render, v: +r.psnr_db, color: muted ? 'var(--cds-chart-muted)' : c[0],
        emph: String(r.render).includes('default'), lines: [`denoising ${LM.d1(+r.seconds)} s`] };
    });
    LM.hbars(el, rows, { aria: 'PSNR against the exact engine render: ' + rows.map((r) => `${r.name} ${LM.d1(r.v)} dB`).join('; '),
      fmt: (v) => LM.d1(v), unit: 'dB' });
  });
  dash.draw('dit-profile', (el) => {
    const d = dash.data('dit_profile');
    if (d.status === 'error') return LM.failed(el, 'Failed to load');
    if (d.status !== 'ok') { el.replaceChildren(); return; }
    const c = LM.colors();
    const total = d3.sum(d.data, (r) => +r.seconds) || 1;
    const rows = d.data.map((r) => ({ name: r.part, v: +r.seconds, color: c[0],
      lines: [`${LM.int(Math.round((+r.seconds / total) * 100))} % of the step`] }));
    LM.hbars(el, rows, { aria: 'GPU seconds of one denoising step by part: ' + rows.map((r) => `${r.name} ${LM.d2(r.v)}`).join(', '),
      fmt: (v) => LM.d2(v), unit: 's' });
  });
  dash.draw('dit-t2av-table', (tb) => {
    const d = LM.ok('dit_t2av'); if (!d) { tb.replaceChildren(); return; }
    LM.rowsTable(tb, d.data, [{ key: 'size' }, { key: 'clip_s', num: true, fmt: (v) => LM.d1(+v) },
      { key: 'dit_s', num: true, fmt: (v) => LM.d1(+v) }, { key: 'decode_s', num: true, fmt: (v) => LM.d1(+v) },
      { key: 'total_s', num: true, fmt: (v) => LM.d1(+v) }]);
  });
  dash.draw('dit-ladder-table', (tb) => {
    const d = LM.ok('dit_ladder'); if (!d) { tb.replaceChildren(); return; }
    LM.rowsTable(tb, d.data, [{ key: 'step' }, { key: 'change' }, { key: 'seconds', num: true, fmt: (v) => LM.d1(+v) }]);
  });
  dash.draw('dit-accuracy-table', (tb) => {
    const d = LM.ok('dit_accuracy'); if (!d) { tb.replaceChildren(); return; }
    LM.rowsTable(tb, d.data, [{ key: 'stream' }, { key: 'pass' }, { key: 'leviathan', num: true, fmt: (v) => LM.kl(+v) },
      { key: 'pytorch', num: true, fmt: (v) => LM.kl(+v) }]);
  });
  dash.draw('dit-psnr-table', (tb) => {
    const d = LM.ok('dit_psnr'); if (!d) { tb.replaceChildren(); return; }
    LM.rowsTable(tb, d.data, [{ key: 'render' }, { key: 'psnr_db', num: true, fmt: (v) => LM.d1(+v) },
      { key: 'seconds', num: true, fmt: (v) => LM.d1(+v) }]);
  });
  dash.draw('dit-profile-table', (tb) => {
    const d = LM.ok('dit_profile'); if (!d) { tb.replaceChildren(); return; }
    LM.rowsTable(tb, d.data, [{ key: 'part' }, { key: 'seconds', num: true, fmt: (v) => LM.d2(+v) }]);
  });

  // ── since 1.1.0 ──
  dash.draw('raw-formats', (el) => {
    const d = dash.data('raw_formats');
    if (d.status === 'error') return LM.failed(el, 'Failed to load');
    if (d.status !== 'ok') { el.replaceChildren(); return; }
    const c = LM.colors();
    const pct = (v) => (Math.abs(v % 1) > 1e-9 ? LM.d1(v) : LM.int(v)) + ' %';
    const rows = d.data.map((r) => ({ name: `${r.model}, ${r.format}`, v: -(+r.change_pct), color: c[0],
      lines: r.before_ms != null && r.after_ms != null ? [`${LM.d2(+r.before_ms)} β†’ ${LM.d2(+r.after_ms)} ms a token`] : [] }));
    LM.hbars(el, rows, { aria: 'Less time a decode token with the new kernels: ' + rows.map((r) => `${r.name} ${pct(r.v)}`).join(', '),
      fmt: (v) => pct(v), unit: 'less time a token', tick: (v) => v + ' %' });
  });
  dash.draw('raw-table', (tb) => {
    const d = LM.ok('raw_formats'); if (!d) { tb.replaceChildren(); return; }
    LM.rowsTable(tb, d.data, [{ key: 'model' }, { key: 'format' }, { key: 'before_ms', num: true, fmt: (v) => LM.d2(+v) },
      { key: 'after_ms', num: true, fmt: (v) => LM.d2(+v) }, { key: 'change_pct', num: true, fmt: (v) => d3.format('.1~f')(+v) }]);
  });
  dash.draw('since-table', (tb) => {
    const d = LM.ok('tests_since'); if (!d) { tb.replaceChildren(); return; }
    LM.rowsTable(tb, d.data, [{ key: 'test' }, { key: 'area' }, { key: 'proves' }, { key: 'checks', num: true }, { key: 'date', nowrap: true }]);
  });
}
</script>
</body>
</html>