fix(benchmarks): support stdlib exact binomial and headless CI verification
Browse files
benchmarks/CHARTS_MANIFEST.json
CHANGED
|
@@ -36,7 +36,7 @@
|
|
| 36 |
],
|
| 37 |
"provenance_sha256": {
|
| 38 |
"canonical_eval_vectors.json": "058473f4ba21bc07db2c2b6981d5e62f3c584311fc134d92cb523de7f261243a",
|
| 39 |
-
"generate_canonical_charts.py": "
|
| 40 |
"assets/armiger_vs_llms_overall_and_6dims.png": "2367dbf6ae84cc2f75b0b13f377f7053f8f0e63ebe56cf42e1093b26aa18c082",
|
| 41 |
"assets/armiger_vs_llms_cost_comparison.png": "ff33da1aa78dc14be919d34d5914db5efabe8c30d1698bda378962a3c92c5dbc",
|
| 42 |
"assets/armiger_vs_torrent_classifiers_6dims.png": "a4ebfcb1565ed94c830846845ecf16e46061424180ea01a5852b8d4d1e614a6a",
|
|
@@ -596,7 +596,7 @@
|
|
| 596 |
"ci95_hi": 72.95,
|
| 597 |
"delta_vs_ref_pct": 24.16,
|
| 598 |
"delta_ci95_lo": 22.5,
|
| 599 |
-
"delta_ci95_hi": 25.
|
| 600 |
"p_value_vs_ref": 7.860859e-169
|
| 601 |
},
|
| 602 |
"RTN (rank-torrent-name)": {
|
|
@@ -754,7 +754,7 @@
|
|
| 754 |
"ci95_hi": 75.46,
|
| 755 |
"delta_vs_ref_pct": 24.23,
|
| 756 |
"delta_ci95_lo": 21.68,
|
| 757 |
-
"delta_ci95_hi": 26.
|
| 758 |
"p_value_vs_ref": 5.732874e-76
|
| 759 |
},
|
| 760 |
"Bitmagnet Built-In": {
|
|
@@ -1346,7 +1346,7 @@
|
|
| 1346 |
"armiger_ultra_raw": {
|
| 1347 |
"n": 2835,
|
| 1348 |
"point_pct": 95.03,
|
| 1349 |
-
"ci95_lo": 94.
|
| 1350 |
"ci95_hi": 95.84,
|
| 1351 |
"delta_vs_ref_pct": 0.46,
|
| 1352 |
"delta_ci95_lo": 0.14,
|
|
|
|
| 36 |
],
|
| 37 |
"provenance_sha256": {
|
| 38 |
"canonical_eval_vectors.json": "058473f4ba21bc07db2c2b6981d5e62f3c584311fc134d92cb523de7f261243a",
|
| 39 |
+
"generate_canonical_charts.py": "dfe6262c4815ec8fa0ab47569b80faebe7a4d29fb85824c4cc05c1b921e32270",
|
| 40 |
"assets/armiger_vs_llms_overall_and_6dims.png": "2367dbf6ae84cc2f75b0b13f377f7053f8f0e63ebe56cf42e1093b26aa18c082",
|
| 41 |
"assets/armiger_vs_llms_cost_comparison.png": "ff33da1aa78dc14be919d34d5914db5efabe8c30d1698bda378962a3c92c5dbc",
|
| 42 |
"assets/armiger_vs_torrent_classifiers_6dims.png": "a4ebfcb1565ed94c830846845ecf16e46061424180ea01a5852b8d4d1e614a6a",
|
|
|
|
| 596 |
"ci95_hi": 72.95,
|
| 597 |
"delta_vs_ref_pct": 24.16,
|
| 598 |
"delta_ci95_lo": 22.5,
|
| 599 |
+
"delta_ci95_hi": 25.86,
|
| 600 |
"p_value_vs_ref": 7.860859e-169
|
| 601 |
},
|
| 602 |
"RTN (rank-torrent-name)": {
|
|
|
|
| 754 |
"ci95_hi": 75.46,
|
| 755 |
"delta_vs_ref_pct": 24.23,
|
| 756 |
"delta_ci95_lo": 21.68,
|
| 757 |
+
"delta_ci95_hi": 26.77,
|
| 758 |
"p_value_vs_ref": 5.732874e-76
|
| 759 |
},
|
| 760 |
"Bitmagnet Built-In": {
|
|
|
|
| 1346 |
"armiger_ultra_raw": {
|
| 1347 |
"n": 2835,
|
| 1348 |
"point_pct": 95.03,
|
| 1349 |
+
"ci95_lo": 94.22,
|
| 1350 |
"ci95_hi": 95.84,
|
| 1351 |
"delta_vs_ref_pct": 0.46,
|
| 1352 |
"delta_ci95_lo": 0.14,
|
benchmarks/generate_canonical_charts.py
CHANGED
|
@@ -22,14 +22,24 @@ import struct
|
|
| 22 |
import zlib
|
| 23 |
from typing import Any, Dict, List, Optional, Tuple
|
| 24 |
|
| 25 |
-
import
|
| 26 |
-
matplotlib.use("Agg")
|
| 27 |
-
import matplotlib.pyplot as plt
|
| 28 |
-
from matplotlib.gridspec import GridSpec
|
| 29 |
-
from matplotlib.patches import Patch
|
| 30 |
import numpy as np
|
| 31 |
-
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
BOOTSTRAP_SEED = 20261018
|
| 35 |
BOOTSTRAP_RESAMPLES = 10000
|
|
@@ -143,7 +153,11 @@ def exact_mcnemar_or_paired_p(vec_ref: np.ndarray, vec_mod: np.ndarray) -> float
|
|
| 143 |
n_disc = n_pos + n_neg
|
| 144 |
if n_disc == 0:
|
| 145 |
return 1.0
|
| 146 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
|
| 148 |
|
| 149 |
def compute_auroc_pct(y_true: np.ndarray, scores: np.ndarray) -> float:
|
|
@@ -171,14 +185,15 @@ def compute_paired_panel_stats(
|
|
| 171 |
|
| 172 |
rng = np.random.default_rng(seed)
|
| 173 |
model_names = list(vectors.keys())
|
| 174 |
-
mat = np.stack([np.asarray(vectors[m], dtype=np.
|
| 175 |
|
| 176 |
if metric_type == "mean":
|
| 177 |
-
#
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
|
|
|
| 182 |
elif metric_type == "balanced":
|
| 183 |
if y_true is None:
|
| 184 |
raise AssertionError(f"[{panel_name}] y_true required for metric_type='balanced'.")
|
|
@@ -187,18 +202,18 @@ def compute_paired_panel_stats(
|
|
| 187 |
neg_mask = (y_arr == 0)
|
| 188 |
n_pos = int(np.sum(pos_mask))
|
| 189 |
n_neg = int(np.sum(neg_mask))
|
| 190 |
-
pos_mat = (mat[:, pos_mask] == 1).astype(np.
|
| 191 |
-
neg_mat = (mat[:, neg_mask] == 0).astype(np.
|
| 192 |
-
w_pos = rng.multinomial(n_pos, np.full(n_pos, 1.0 / n_pos), size=n_boot).astype(np.
|
| 193 |
-
w_neg = rng.multinomial(n_neg, np.full(n_neg, 1.0 / n_neg), size=n_boot).astype(np.
|
| 194 |
-
boot_scores = 0.5 * ((w_pos @ pos_mat.T) + (w_neg @ neg_mat.T))
|
| 195 |
point_scores = {}
|
| 196 |
item_correctness = {}
|
| 197 |
for idx, m in enumerate(model_names):
|
| 198 |
-
sens = float(np.
|
| 199 |
-
spec = float(np.
|
| 200 |
point_scores[m] = 0.5 * (sens + spec)
|
| 201 |
-
item_corr = np.zeros(n_val, dtype=np.
|
| 202 |
item_corr[pos_mask] = pos_mat[idx]
|
| 203 |
item_corr[neg_mask] = neg_mat[idx]
|
| 204 |
item_correctness[m] = item_corr
|
|
@@ -209,23 +224,28 @@ def compute_paired_panel_stats(
|
|
| 209 |
pos_idx = np.where(y_arr == 1)[0]
|
| 210 |
neg_idx = np.where(y_arr == 0)[0]
|
| 211 |
n_pos, n_neg = len(pos_idx), len(neg_idx)
|
| 212 |
-
#
|
| 213 |
-
|
|
|
|
| 214 |
point_scores = {}
|
| 215 |
for idx, m in enumerate(model_names):
|
| 216 |
s = mat[idx]
|
| 217 |
s_pos = s[pos_idx]
|
| 218 |
s_neg = s[neg_idx]
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 229 |
else:
|
| 230 |
raise ValueError(f"Unknown metric_type: {metric_type}")
|
| 231 |
|
|
@@ -361,21 +381,27 @@ def build_all_charts_and_manifest(
|
|
| 361 |
npz_path: pathlib.Path,
|
| 362 |
assets_dir: pathlib.Path,
|
| 363 |
manifest_path: pathlib.Path,
|
|
|
|
| 364 |
) -> Dict[str, Any]:
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 379 |
|
| 380 |
if str(npz_path).endswith(".json"):
|
| 381 |
raw_json = json.loads(npz_path.read_text(encoding="utf-8"))
|
|
@@ -553,195 +579,6 @@ def build_all_charts_and_manifest(
|
|
| 553 |
"ci95_hi": round(pt_mean + half_w, 2),
|
| 554 |
}
|
| 555 |
|
| 556 |
-
# ==========================================================================
|
| 557 |
-
# RENDER CHART 1: armiger_vs_llms_overall_and_6dims.png
|
| 558 |
-
# ==========================================================================
|
| 559 |
-
fig1 = plt.figure(figsize=(24, 11.4))
|
| 560 |
-
fig1.suptitle(
|
| 561 |
-
"Armiger & Armiger Ultra vs. Frontier Cloud LLMs & Local GPU LLM Across 6 Core Dimensions",
|
| 562 |
-
fontsize=17.5, fontweight="bold", color=TEXT_MAIN, y=0.972,
|
| 563 |
-
)
|
| 564 |
-
fig1.text(
|
| 565 |
-
0.5, 0.934,
|
| 566 |
-
"Non-Circular Leave-One-Teacher-Out (LOTO) & Identical-Denominator Evaluation with 95% Paired Bootstrap CIs (10,000 Resamples)",
|
| 567 |
-
ha="center", fontsize=11.3, style="italic", color=TEXT_SUB, parse_math=False,
|
| 568 |
-
)
|
| 569 |
-
|
| 570 |
-
gs1 = GridSpec(
|
| 571 |
-
2, 5, figure=fig1,
|
| 572 |
-
width_ratios=[1.72, 0.12, 1.0, 1.0, 1.0],
|
| 573 |
-
wspace=0.16, hspace=0.42,
|
| 574 |
-
top=0.86, bottom=0.13, left=0.14, right=0.98,
|
| 575 |
-
)
|
| 576 |
-
|
| 577 |
-
ax_left = fig1.add_subplot(gs1[:, 0])
|
| 578 |
-
style_ax(ax_left)
|
| 579 |
-
colors_llm = [C_ULTRA, C_INT8, C_GEMINI, C_CLAUDE, C_GPT, C_VINCI]
|
| 580 |
-
edges_llm = [C_ULTRA_EDGE, C_INT8_EDGE, "none", "none", "none", "none"]
|
| 581 |
-
vals_left = [composite_stats[m]["point_pct"] for m in llm_order]
|
| 582 |
-
labels_left = [
|
| 583 |
-
f"{vals_left[0]:.2f}% (0.21 ms RTX / 0.29 ms MPS | $0.00 API)",
|
| 584 |
-
f"{vals_left[1]:.2f}% (2.44 ms M4 Pro CPU INT8 | $0.00 API)",
|
| 585 |
-
f"{vals_left[2]:.2f}% (~450 ms | Non-Circular LOTO N=1,025)",
|
| 586 |
-
f"{vals_left[3]:.2f}% (~310 ms | $712.00-$1,220.00 / 1M)",
|
| 587 |
-
f"{vals_left[4]:.2f}% (~365 ms | Non-Circular LOTO N=1,025)",
|
| 588 |
-
f"{vals_left[5]:.2f}% (~185 ms RTX 4070 TiS | $1.85 Pwr / 1M)",
|
| 589 |
-
]
|
| 590 |
-
y_llm = np.arange(len(llm_order))
|
| 591 |
-
ax_left.axhspan(-0.5, 1.5, color=BG_HIGHLIGHT, alpha=0.75, zorder=1)
|
| 592 |
-
ax_left.barh(y_llm, vals_left, height=0.55, color=colors_llm, edgecolor=edges_llm, linewidth=1.3, zorder=3)
|
| 593 |
-
draw_ci_whiskers(ax_left, y_llm, [composite_stats[m] for m in llm_order])
|
| 594 |
-
ax_left.set_yticks(y_llm)
|
| 595 |
-
ax_left.set_yticklabels(llm_order, fontsize=10.5, fontweight="bold", color=TEXT_MAIN)
|
| 596 |
-
ax_left.invert_yaxis()
|
| 597 |
-
ax_left.set_xlim(78, 136)
|
| 598 |
-
ax_left.set_xticks([80, 85, 90, 95, 100])
|
| 599 |
-
ax_left.set_xlabel("6-Dimension Composite Mean (%) ± 95% Bootstrap CI", fontsize=10, color=TEXT_SUB, labelpad=8)
|
| 600 |
-
ax_left.set_title(
|
| 601 |
-
"1. Overall 6-Dimension Composite Mean (%)\n(Category, Catalog, Audio, Anime, Junk, Swarm)",
|
| 602 |
-
fontsize=11.5, fontweight="bold", color=TEXT_MAIN, pad=10,
|
| 603 |
-
)
|
| 604 |
-
for idx, (m, lbl) in enumerate(zip(llm_order, labels_left)):
|
| 605 |
-
fw = "bold" if idx < 2 else "normal"
|
| 606 |
-
tc = TEXT_MAIN if idx < 2 else "#CBD5E1"
|
| 607 |
-
hi_x = max(vals_left[idx], composite_stats[m]["ci95_hi"])
|
| 608 |
-
ax_left.text(hi_x + 0.55, idx, lbl, va="center", ha="left", fontsize=8.5, fontweight=fw, color=tc, zorder=6, parse_math=False)
|
| 609 |
-
|
| 610 |
-
sub_specs = [
|
| 611 |
-
(
|
| 612 |
-
0, 2, "2A. 11-Class Category (N=1,025 LOTO)",
|
| 613 |
-
p2a_stats,
|
| 614 |
-
[
|
| 615 |
-
f"{p2a_stats['models'][llm_order[0]]['point_pct']:.2f}% (95.49% oct15)",
|
| 616 |
-
f"{p2a_stats['models'][llm_order[1]]['point_pct']:.2f}% (95.49% oct15)",
|
| 617 |
-
f"{p2a_stats['models'][llm_order[2]]['point_pct']:.2f}% (95.6% Circ)",
|
| 618 |
-
f"{p2a_stats['models'][llm_order[3]]['point_pct']:.2f}%",
|
| 619 |
-
f"{p2a_stats['models'][llm_order[4]]['point_pct']:.2f}% (96.6% Circ)",
|
| 620 |
-
f"{p2a_stats['models'][llm_order[5]]['point_pct']:.2f}%",
|
| 621 |
-
],
|
| 622 |
-
(72, 134), [75, 80, 85, 90, 95, 100],
|
| 623 |
-
),
|
| 624 |
-
(
|
| 625 |
-
0, 3, "2B. Catalog Matching (N=1,025 LOTO)",
|
| 626 |
-
p2b_stats,
|
| 627 |
-
[
|
| 628 |
-
f"{p2b_stats['models'][llm_order[0]]['point_pct']:.2f}% (96.53% oct15)",
|
| 629 |
-
f"{p2b_stats['models'][llm_order[1]]['point_pct']:.2f}% (96.53% oct15)",
|
| 630 |
-
f"{p2b_stats['models'][llm_order[2]]['point_pct']:.2f}%",
|
| 631 |
-
f"{p2b_stats['models'][llm_order[3]]['point_pct']:.2f}%",
|
| 632 |
-
f"{p2b_stats['models'][llm_order[4]]['point_pct']:.2f}%",
|
| 633 |
-
f"{p2b_stats['models'][llm_order[5]]['point_pct']:.2f}%",
|
| 634 |
-
],
|
| 635 |
-
(70, 126), [75, 80, 85, 90, 95, 100],
|
| 636 |
-
),
|
| 637 |
-
(
|
| 638 |
-
0, 4, "2C. Audio Language (Strict E-vs-F N=229)",
|
| 639 |
-
p2c_stats,
|
| 640 |
-
[
|
| 641 |
-
f"{p2c_stats['models'][llm_order[0]]['point_pct']:.2f}% (97.80% oct15)",
|
| 642 |
-
f"{p2c_stats['models'][llm_order[1]]['point_pct']:.2f}% (97.80% oct15)",
|
| 643 |
-
f"{p2c_stats['models'][llm_order[2]]['point_pct']:.2f}%",
|
| 644 |
-
f"{p2c_stats['models'][llm_order[3]]['point_pct']:.2f}%",
|
| 645 |
-
f"{p2c_stats['models'][llm_order[4]]['point_pct']:.2f}% (94.68% oct15)",
|
| 646 |
-
f"{p2c_stats['models'][llm_order[5]]['point_pct']:.2f}%",
|
| 647 |
-
],
|
| 648 |
-
(88, 122), [90, 92, 94, 96, 98, 100],
|
| 649 |
-
),
|
| 650 |
-
(
|
| 651 |
-
1, 2, "2D. Anime & Dub (Valid Media N=636)",
|
| 652 |
-
p2d_stats,
|
| 653 |
-
[
|
| 654 |
-
f"{p2d_stats['models'][llm_order[0]]['point_pct']:.2f}% (99.61% oct15)",
|
| 655 |
-
f"{p2d_stats['models'][llm_order[1]]['point_pct']:.2f}% (99.61% oct15)",
|
| 656 |
-
f"{p2d_stats['models'][llm_order[2]]['point_pct']:.2f}% (608/636)",
|
| 657 |
-
f"{p2d_stats['models'][llm_order[3]]['point_pct']:.2f}% (Valid Media)",
|
| 658 |
-
f"{p2d_stats['models'][llm_order[4]]['point_pct']:.2f}% (608/636)",
|
| 659 |
-
f"{p2d_stats['models'][llm_order[5]]['point_pct']:.2f}%",
|
| 660 |
-
],
|
| 661 |
-
(88, 124), [90, 92, 94, 96, 98, 100],
|
| 662 |
-
),
|
| 663 |
-
(
|
| 664 |
-
1, 3, "2E. Junk / Malware (Balanced N=977)",
|
| 665 |
-
p2e_stats,
|
| 666 |
-
[
|
| 667 |
-
f"{p2e_stats['models'][llm_order[0]]['point_pct']:.2f}% (99.90% Acc / 100% oct15)",
|
| 668 |
-
f"{p2e_stats['models'][llm_order[1]]['point_pct']:.2f}% (99.90% Acc / 100% oct15)",
|
| 669 |
-
f"{p2e_stats['models'][llm_order[2]]['point_pct']:.2f}% (Non-Circ)",
|
| 670 |
-
f"{p2e_stats['models'][llm_order[3]]['point_pct']:.2f}%",
|
| 671 |
-
f"{p2e_stats['models'][llm_order[4]]['point_pct']:.2f}% (0% Rec.)",
|
| 672 |
-
f"{p2e_stats['models'][llm_order[5]]['point_pct']:.2f}%",
|
| 673 |
-
],
|
| 674 |
-
(40, 162), [40, 60, 80, 100],
|
| 675 |
-
),
|
| 676 |
-
(
|
| 677 |
-
1, 4, "2F. Swarm Liveliness AUROC %",
|
| 678 |
-
None,
|
| 679 |
-
[
|
| 680 |
-
"96.83% Whse (92.42% Pub)",
|
| 681 |
-
"92.42% Pub (86.64% Priors)",
|
| 682 |
-
"89.20% Pub (N=757)",
|
| 683 |
-
"89.76% Pub (N=757)",
|
| 684 |
-
"89.82% Pub (N=757)",
|
| 685 |
-
"66.32% Pub (N=757)",
|
| 686 |
-
],
|
| 687 |
-
(55, 152), [60, 70, 80, 90, 100],
|
| 688 |
-
),
|
| 689 |
-
]
|
| 690 |
-
|
| 691 |
-
for row, col, title, p_stat, lbls, xlim, xticks in sub_specs:
|
| 692 |
-
ax = fig1.add_subplot(gs1[row, col])
|
| 693 |
-
style_ax(ax)
|
| 694 |
-
ax.axhspan(-0.5, 1.5, color=BG_HIGHLIGHT, alpha=0.75, zorder=1)
|
| 695 |
-
if p_stat is not None:
|
| 696 |
-
s_list = [p_stat["models"][m] for m in llm_order]
|
| 697 |
-
else:
|
| 698 |
-
s_list = [p2f_whse_stats["models"][ref_llm]] + [p2f_pub_stats["models"][m] for m in llm_order[1:]]
|
| 699 |
-
vals = [s["point_pct"] for s in s_list]
|
| 700 |
-
ax.barh(y_llm, vals, height=0.58, color=colors_llm, edgecolor=edges_llm, linewidth=1.2, zorder=3)
|
| 701 |
-
draw_ci_whiskers(ax, y_llm, s_list)
|
| 702 |
-
ax.set_yticks(y_llm)
|
| 703 |
-
ax.set_yticklabels([""] * len(llm_order))
|
| 704 |
-
ax.invert_yaxis()
|
| 705 |
-
ax.set_xlim(*xlim)
|
| 706 |
-
ax.set_xticks(xticks)
|
| 707 |
-
ax.set_title(title, fontsize=10.5, fontweight="bold", color=TEXT_MAIN, pad=8)
|
| 708 |
-
span = xlim[1] - xlim[0]
|
| 709 |
-
for idx, (s_item, lbl) in enumerate(zip(s_list, lbls)):
|
| 710 |
-
fw = "bold" if idx < 2 else "normal"
|
| 711 |
-
tc = TEXT_MAIN if idx < 2 else "#CBD5E1"
|
| 712 |
-
hi_x = max(s_item["point_pct"], s_item["ci95_hi"])
|
| 713 |
-
ax.text(hi_x + span * 0.015, idx, lbl, va="center", ha="left", fontsize=7.9, fontweight=fw, color=tc, zorder=6, parse_math=False)
|
| 714 |
-
|
| 715 |
-
legend_handles = [
|
| 716 |
-
Patch(facecolor=C_ULTRA, edgecolor=C_ULTRA_EDGE, label="Armiger Ultra (Fair Hybrid)"),
|
| 717 |
-
Patch(facecolor=C_INT8, edgecolor=C_INT8_EDGE, label="Armiger (8.3 MB INT8 + Plugins)"),
|
| 718 |
-
Patch(facecolor=C_GEMINI, label="Google Gemini (gemini-3.8-flash-low, LOTO Non-Circular)"),
|
| 719 |
-
Patch(facecolor=C_CLAUDE, label="Anthropic Claude (claude-haiku-4-5)"),
|
| 720 |
-
Patch(facecolor=C_GPT, label="OpenAI GPT (gpt-6-luna, LOTO Non-Circular)"),
|
| 721 |
-
Patch(facecolor=C_VINCI, label="Local GPU LLM (Vinci-MLE-8B-1.0)"),
|
| 722 |
-
]
|
| 723 |
-
fig1.legend(
|
| 724 |
-
handles=legend_handles, loc="lower center", bbox_to_anchor=(0.5, 0.015),
|
| 725 |
-
ncol=6, facecolor=BG_PANEL, edgecolor=BORDER_COLOR, fontsize=9.0, labelcolor=TEXT_MAIN,
|
| 726 |
-
borderpad=0.6, columnspacing=1.35,
|
| 727 |
-
)
|
| 728 |
-
sha_chart1 = save_clean_rgb_png(fig1, assets_dir / "armiger_vs_llms_overall_and_6dims.png")
|
| 729 |
-
|
| 730 |
-
# ==========================================================================
|
| 731 |
-
# RENDER CHART 2: armiger_vs_llms_cost_comparison.png
|
| 732 |
-
# ==========================================================================
|
| 733 |
-
fig2, (ax2_l, ax2_r) = plt.subplots(1, 2, figsize=(23.5, 9.2), gridspec_kw={"wspace": 0.14})
|
| 734 |
-
fig2.subplots_adjust(top=0.80, bottom=0.16, left=0.16, right=0.98)
|
| 735 |
-
fig2.suptitle(
|
| 736 |
-
"Cost & Hardware-Attributed Throughput: Armiger & Armiger Ultra vs. Local & Cloud LLMs",
|
| 737 |
-
fontsize=17.5, fontweight="bold", color=TEXT_MAIN, y=0.96,
|
| 738 |
-
)
|
| 739 |
-
fig2.text(
|
| 740 |
-
0.5, 0.915,
|
| 741 |
-
"Left: Operational Cost per 1,000,000 Classified Torrents ($ USD) | Right: API Token Rates ($ USD / 1M Tokens) & Measured Hardware Throughput",
|
| 742 |
-
ha="center", fontsize=11.3, style="italic", color=TEXT_SUB, parse_math=False,
|
| 743 |
-
)
|
| 744 |
-
|
| 745 |
models_cost = [
|
| 746 |
"Armiger (8.3 MB M4 Pro CPU INT8)",
|
| 747 |
"Armiger Ultra (M4 Pro / RTX GPU FP32)",
|
|
@@ -753,79 +590,286 @@ def build_all_charts_and_manifest(
|
|
| 753 |
colors_cost = [C_INT8, C_ULTRA, C_VINCI, C_GEMINI, C_GPT, C_CLAUDE]
|
| 754 |
batched_cost = [0.002, 0.004, 1.85, 94.90, 127.30, 712.00]
|
| 755 |
realtime_cost = [0.002, 0.004, 18.00, 147.00, 220.50, 1220.00]
|
| 756 |
-
|
| 757 |
-
|
| 758 |
-
|
| 759 |
-
|
| 760 |
-
|
| 761 |
-
|
| 762 |
-
|
| 763 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 764 |
|
| 765 |
-
|
| 766 |
-
|
| 767 |
-
|
| 768 |
-
|
| 769 |
-
|
| 770 |
-
|
| 771 |
-
x_pos = max(realtime_cost[idx], batched_cost[idx]) + 18.0
|
| 772 |
-
ax2_l.text(x_pos, idx, cost_labels[idx], va="center", ha="left", fontsize=9.0, fontweight="bold" if idx < 2 else "normal", color=TEXT_MAIN if idx < 2 else "#CBD5E1", parse_math=False)
|
| 773 |
-
|
| 774 |
-
ax2_l.set_yticks(yc)
|
| 775 |
-
ax2_l.set_yticklabels(models_cost, fontsize=10.2, fontweight="bold", color=TEXT_MAIN)
|
| 776 |
-
ax2_l.invert_yaxis()
|
| 777 |
-
ax2_l.set_xlim(0, 1980)
|
| 778 |
-
ax2_l.set_xticks([0, 200, 400, 600, 800, 1000, 1200])
|
| 779 |
-
ax2_l.set_xticklabels(["$0", "$200", "$400", "$600", "$800", "$1,000", "$1,200"])
|
| 780 |
-
ax2_l.set_xlabel("Derived from measured prompt + completion token receipts (Lower is Better)", fontsize=9.5, color=TEXT_SUB, labelpad=8)
|
| 781 |
-
ax2_l.set_title(
|
| 782 |
-
"1. Cost per 1,000,000 Classified Torrents ($ USD / 1M Tasks)\n(Solid = 32-Item Batched Mode; Dashed = Real-Time 1-by-1 Webhook Mode)",
|
| 783 |
-
fontsize=11.2, fontweight="bold", color=TEXT_MAIN, pad=10,
|
| 784 |
-
)
|
| 785 |
-
ax2_l.legend(
|
| 786 |
-
handles=[
|
| 787 |
-
Patch(facecolor=C_GEMINI, label="32-Item Batched API Cost"),
|
| 788 |
-
Patch(facecolor=C_GEMINI, alpha=0.3, edgecolor=C_GEMINI, linestyle="--", label="Real-Time Single-Torrent API Cost (1-by-1)"),
|
| 789 |
-
],
|
| 790 |
-
loc="upper center", bbox_to_anchor=(0.5, -0.11), ncol=2, facecolor=BG_PANEL, edgecolor=BORDER_COLOR, fontsize=8.8, labelcolor=TEXT_MAIN,
|
| 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 |
# COMPUTE SUITE A (CHART 3) PANEL STATISTICS WITH IDENTICAL-N LOCKS
|
|
@@ -940,246 +984,6 @@ def build_all_charts_and_manifest(
|
|
| 940 |
metric_type="mean",
|
| 941 |
)
|
| 942 |
|
| 943 |
-
# ==========================================================================
|
| 944 |
-
# RENDER CHART 3: armiger_vs_torrent_classifiers_6dims.png
|
| 945 |
-
# ==========================================================================
|
| 946 |
-
fig3 = plt.figure(figsize=(24.5, 14.8))
|
| 947 |
-
fig3.suptitle(
|
| 948 |
-
"Armiger & Armiger Ultra vs. Open-Source Torrent Classifiers & Parsers Across 7 Core Dimensions",
|
| 949 |
-
fontsize=17.5, fontweight="bold", color=TEXT_MAIN, y=0.975,
|
| 950 |
-
)
|
| 951 |
-
fig3.text(
|
| 952 |
-
0.5, 0.942,
|
| 953 |
-
"Identical-Denominator Evaluation on oct15_confirmation (N = 2,835 / N = 545 Audio), tc_truespec_2000 (N = 2,000), & Swarm Holdouts (±95% Bootstrap CIs)",
|
| 954 |
-
ha="center", fontsize=11.3, style="italic", color=TEXT_SUB, parse_math=False,
|
| 955 |
-
)
|
| 956 |
-
|
| 957 |
-
gs3 = GridSpec(
|
| 958 |
-
7, 4, figure=fig3,
|
| 959 |
-
height_ratios=[1.0, 1.0, 1.0, 0.42, 1.25, 0.48, 1.25],
|
| 960 |
-
width_ratios=[1.08, 1.0, 0.22, 1.08],
|
| 961 |
-
hspace=0.18, wspace=0.15,
|
| 962 |
-
top=0.89, bottom=0.06, left=0.12, right=0.98,
|
| 963 |
-
)
|
| 964 |
-
y10 = np.arange(len(models_10))
|
| 965 |
-
|
| 966 |
-
# Panel 1: Category Detection
|
| 967 |
-
ax1 = fig3.add_subplot(gs3[0:3, 0])
|
| 968 |
-
style_ax(ax1)
|
| 969 |
-
ax1.axhspan(-0.5, 1.5, color=BG_HIGHLIGHT, alpha=0.75, zorder=1)
|
| 970 |
-
cat_11_s = [c3_p1_stats["models"][m] for m in models_10]
|
| 971 |
-
cat_11cls = [s["point_pct"] for s in cat_11_s]
|
| 972 |
-
cat_native = [
|
| 973 |
-
c3_p1_vid_stats["models"][models_10[0]]["point_pct"],
|
| 974 |
-
c3_p1_vid_stats["models"][models_10[1]]["point_pct"],
|
| 975 |
-
93.61,
|
| 976 |
-
93.97,
|
| 977 |
-
c3_p1_vid_stats["models"][models_10[4]]["point_pct"],
|
| 978 |
-
c3_p1_vid_stats["models"][models_10[5]]["point_pct"],
|
| 979 |
-
c3_p1_vid_stats["models"][models_10[6]]["point_pct"],
|
| 980 |
-
c3_p1_vid_stats["models"][models_10[7]]["point_pct"],
|
| 981 |
-
c3_p1_vid_stats["models"][models_10[8]]["point_pct"],
|
| 982 |
-
88.40,
|
| 983 |
-
]
|
| 984 |
-
cat_lbls = [
|
| 985 |
-
f"{cat_11cls[0]:.2f}% 11-Cls (Video {cat_native[0]:.1f}%)",
|
| 986 |
-
f"{cat_11cls[1]:.2f}% 11-Cls (95.06% Raw)",
|
| 987 |
-
f"{cat_11cls[2]:.2f}% 11-Cls (4-Med 93.6%)",
|
| 988 |
-
f"{cat_11cls[3]:.2f}% 11-Cls (4-Med 94.0%)",
|
| 989 |
-
f"{cat_11cls[4]:.2f}% 11-Cls (Video {cat_native[4]:.1f}%)",
|
| 990 |
-
f"{cat_11cls[5]:.2f}% 11-Cls (Video {cat_native[5]:.1f}%)",
|
| 991 |
-
f"{cat_11cls[6]:.2f}% 11-Cls (Video {cat_native[6]:.1f}%)",
|
| 992 |
-
f"{cat_11cls[7]:.2f}% 11-Cls (Video {cat_native[7]:.1f}%)",
|
| 993 |
-
f"{cat_11cls[8]:.2f}% 11-Cls (Video {cat_native[8]:.1f}%)",
|
| 994 |
-
f"{cat_11cls[9]:.2f}% 11-Cls (Ans. 88.4%)",
|
| 995 |
-
]
|
| 996 |
-
ax1.barh(y10 - 0.16, cat_native, height=0.32, color=colors_10, zorder=3)
|
| 997 |
-
ax1.barh(y10 + 0.16, cat_11cls, height=0.32, color=colors_10, alpha=0.45, hatch="//", edgecolor=colors_10, zorder=3)
|
| 998 |
-
draw_ci_whiskers(ax1, y10 + 0.16, cat_11_s)
|
| 999 |
-
ax1.set_yticks(y10)
|
| 1000 |
-
ax1.set_yticklabels(models_10, fontsize=9.5, fontweight="bold", color=TEXT_MAIN)
|
| 1001 |
-
ax1.invert_yaxis()
|
| 1002 |
-
ax1.set_xlim(25, 148)
|
| 1003 |
-
ax1.set_xticks([30, 40, 50, 60, 70, 80, 90, 100])
|
| 1004 |
-
ax1.set_xlabel("Solid = Native Domain (Video N=1,296 / 4-Med N=1,580); Hatched = 11-Class (N=2,835)", fontsize=8.6, color=TEXT_SUB, labelpad=6)
|
| 1005 |
-
ax1.set_title("1. Category Detection (%)\n(oct15_confirmation, Identical N = 2,835)", fontsize=11, fontweight="bold", color=TEXT_MAIN, pad=8)
|
| 1006 |
-
for idx, (v, lbl) in enumerate(zip(cat_native, cat_lbls)):
|
| 1007 |
-
ax1.text(v + 1.1, idx, lbl, va="center", ha="left", fontsize=8.2, fontweight="bold" if idx < 2 else "normal", color=TEXT_MAIN if idx < 2 else "#CBD5E1")
|
| 1008 |
-
|
| 1009 |
-
# Panel 2: Catalog Matching Rate
|
| 1010 |
-
ax2 = fig3.add_subplot(gs3[0:3, 1])
|
| 1011 |
-
style_ax(ax2)
|
| 1012 |
-
ax2.axhspan(-0.5, 1.5, color=BG_HIGHLIGHT, alpha=0.75, zorder=1)
|
| 1013 |
-
p2_s = [c3_p2_stats["models"][m] for m in models_10]
|
| 1014 |
-
cat_match = [s["point_pct"] for s in p2_s]
|
| 1015 |
-
ax2.barh(y10, cat_match, height=0.58, color=colors_10, zorder=3)
|
| 1016 |
-
draw_ci_whiskers(ax2, y10, p2_s)
|
| 1017 |
-
ax2.set_yticks(y10)
|
| 1018 |
-
ax2.set_yticklabels([""] * 10)
|
| 1019 |
-
ax2.invert_yaxis()
|
| 1020 |
-
ax2.set_xlim(35, 128)
|
| 1021 |
-
ax2.set_xticks([40, 50, 60, 70, 80, 90, 100])
|
| 1022 |
-
ax2.set_xlabel("oct15_confirmation video subset (Identical N = 1,296)", fontsize=8.8, color=TEXT_SUB, labelpad=6)
|
| 1023 |
-
ax2.set_title("2. Catalog Matching Rate (%)\n(Clean Title + Correct Movie/TV Routing, N = 1,296)", fontsize=11, fontweight="bold", color=TEXT_MAIN, pad=8)
|
| 1024 |
-
for idx, s_item in enumerate(p2_s):
|
| 1025 |
-
v = s_item["point_pct"]
|
| 1026 |
-
lbl = f"{v:.2f}% (95.83% Raw)" if idx == 1 else f"{v:.2f}%"
|
| 1027 |
-
ax2.text(max(v, s_item["ci95_hi"]) + 0.9, idx, lbl, va="center", ha="left", fontsize=8.4, fontweight="bold" if idx < 2 else "normal", color=TEXT_MAIN if idx < 2 else "#CBD5E1")
|
| 1028 |
-
|
| 1029 |
-
# Panel 3: Audio Language Detection (Strict E-vs-F N=545)
|
| 1030 |
-
ax3 = fig3.add_subplot(gs3[0:3, 3])
|
| 1031 |
-
style_ax(ax3)
|
| 1032 |
-
ax3.axhspan(-0.5, 1.5, color=BG_HIGHLIGHT, alpha=0.75, zorder=1)
|
| 1033 |
-
for idx, m in enumerate(models_10):
|
| 1034 |
-
if m in c3_p3_stats["models"]:
|
| 1035 |
-
s_item = c3_p3_stats["models"][m]
|
| 1036 |
-
v = s_item["point_pct"]
|
| 1037 |
-
ax3.barh(idx, v, height=0.58, color=colors_10[idx], zorder=3)
|
| 1038 |
-
draw_ci_whiskers(ax3, np.array([idx]), [s_item])
|
| 1039 |
-
lbl = f"{v:.2f}% (96.88% Raw)" if idx == 1 else f"{v:.2f}%"
|
| 1040 |
-
ax3.text(max(v, s_item["ci95_hi"]) + 0.25, idx, lbl, va="center", ha="left", fontsize=8.4, fontweight="bold" if idx < 2 else "normal", color=TEXT_MAIN if idx < 2 else "#CBD5E1")
|
| 1041 |
-
else:
|
| 1042 |
-
ax3.barh(idx, 86.2, height=0.55, color="#21262D", edgecolor=TEXT_MUTED, hatch="//", zorder=2)
|
| 1043 |
-
ax3.text(84.3, idx, "N/A (No Audio Language Head)", va="center", ha="left", fontsize=8.1, style="italic", color=TEXT_SUB)
|
| 1044 |
-
ax3.set_yticks(y10)
|
| 1045 |
-
ax3.set_yticklabels([""] * 10)
|
| 1046 |
-
ax3.invert_yaxis()
|
| 1047 |
-
ax3.set_xlim(84, 106.5)
|
| 1048 |
-
ax3.set_xticks([86, 88, 90, 92, 94, 96, 98, 100])
|
| 1049 |
-
ax3.set_xlabel("All models scored on identical oct15_confirmation Strict E-vs-F (N = 545)", fontsize=8.6, color=TEXT_SUB, labelpad=6)
|
| 1050 |
-
ax3.set_title("3. Audio Language Detection (%)\n(Strict English vs. Foreign Audio, Identical N = 545)", fontsize=11, fontweight="bold", color=TEXT_MAIN, pad=8)
|
| 1051 |
-
|
| 1052 |
-
# Panel 4: Anime & Anime Dub Detection
|
| 1053 |
-
ax4 = fig3.add_subplot(gs3[4:7, 0])
|
| 1054 |
-
style_ax(ax4)
|
| 1055 |
-
ax4.axhspan(-0.5, 1.5, color=BG_HIGHLIGHT, alpha=0.75, zorder=1)
|
| 1056 |
-
for idx, m in enumerate(models_10):
|
| 1057 |
-
if m in c3_p4_oct_stats["models"]:
|
| 1058 |
-
s_item = c3_p4_oct_stats["models"][m]
|
| 1059 |
-
v = s_item["point_pct"]
|
| 1060 |
-
ax4.barh(idx, v, height=0.58, color=colors_10[idx], zorder=3)
|
| 1061 |
-
draw_ci_whiskers(ax4, np.array([idx]), [s_item])
|
| 1062 |
-
ax4.text(max(v, s_item["ci95_hi"]) + 0.6, idx, f"{v:.2f}% (95.8% tc2000)", va="center", ha="left", fontsize=8.4, fontweight="bold", color=TEXT_MAIN)
|
| 1063 |
-
elif m in c3_p4_tc2k_stats["models"]:
|
| 1064 |
-
s_item = c3_p4_tc2k_stats["models"][m]
|
| 1065 |
-
v = s_item["point_pct"]
|
| 1066 |
-
ax4.barh(idx, v, height=0.58, color=colors_10[idx], zorder=3)
|
| 1067 |
-
draw_ci_whiskers(ax4, np.array([idx]), [s_item])
|
| 1068 |
-
ax4.text(max(v, s_item["ci95_hi"]) + 0.6, idx, f"{v:.2f}%", va="center", ha="left", fontsize=8.4, color="#CBD5E1")
|
| 1069 |
-
else:
|
| 1070 |
-
ax4.barh(idx, 49.0, height=0.55, color="#21262D", edgecolor=TEXT_MUTED, hatch="//", zorder=2)
|
| 1071 |
-
ax4.text(46.2, idx, "N/A (No Anime / Dub Head)", va="center", ha="left", fontsize=8.1, style="italic", color=TEXT_SUB)
|
| 1072 |
-
ax4.set_yticks(y10)
|
| 1073 |
-
ax4.set_yticklabels(models_10, fontsize=9.5, fontweight="bold", color=TEXT_MAIN)
|
| 1074 |
-
ax4.invert_yaxis()
|
| 1075 |
-
ax4.set_xlim(45, 122)
|
| 1076 |
-
ax4.set_xticks([50, 60, 70, 80, 90, 100])
|
| 1077 |
-
ax4.set_xlabel("99.61% on oct15_confirmation (505/507); 95.80% on tc_truespec_2000 (N=2,000)", fontsize=8.6, color=TEXT_SUB, labelpad=6)
|
| 1078 |
-
ax4.set_title("4. Anime & Anime Dub Detection (%)\n(oct15_confirmation N = 507 & tc_truespec_2000 N = 2,000)", fontsize=11, fontweight="bold", color=TEXT_MAIN, pad=8)
|
| 1079 |
-
|
| 1080 |
-
# Panel 5: Adult / NSFW Detection
|
| 1081 |
-
ax5 = fig3.add_subplot(gs3[4:7, 1])
|
| 1082 |
-
style_ax(ax5)
|
| 1083 |
-
ax5.axhspan(-0.5, 1.5, color=BG_HIGHLIGHT, alpha=0.75, zorder=1)
|
| 1084 |
-
for idx, m in enumerate(models_10):
|
| 1085 |
-
if m in c3_p5_stats["models"]:
|
| 1086 |
-
s_item = c3_p5_stats["models"][m]
|
| 1087 |
-
v = s_item["point_pct"]
|
| 1088 |
-
ax5.barh(idx, v, height=0.58, color=colors_10[idx], zorder=3)
|
| 1089 |
-
draw_ci_whiskers(ax5, np.array([idx]), [s_item])
|
| 1090 |
-
lbl = f"{v:.2f}% (93.7% Ans.)" if idx == 9 else f"{v:.2f}%"
|
| 1091 |
-
ax5.text(max(v, s_item["ci95_hi"]) + 0.5, idx, lbl, va="center", ha="left", fontsize=8.4, fontweight="bold" if idx < 2 else "normal", color=TEXT_MAIN if idx < 2 else "#CBD5E1")
|
| 1092 |
-
else:
|
| 1093 |
-
ax5.barh(idx, 68.5, height=0.55, color="#21262D", edgecolor=TEXT_MUTED, hatch="//", zorder=2)
|
| 1094 |
-
ax5.text(65.8, idx, "N/A (No Adult / NSFW Head)", va="center", ha="left", fontsize=8.1, style="italic", color=TEXT_SUB)
|
| 1095 |
-
ax5.set_yticks(y10)
|
| 1096 |
-
ax5.set_yticklabels([""] * 10)
|
| 1097 |
-
ax5.invert_yaxis()
|
| 1098 |
-
ax5.set_xlim(65, 114)
|
| 1099 |
-
ax5.set_xticks([70, 75, 80, 85, 90, 95, 100])
|
| 1100 |
-
ax5.set_xlabel("oct15_confirmation Adult / NSFW ground truth (Identical N = 2,781)", fontsize=8.6, color=TEXT_SUB, labelpad=6)
|
| 1101 |
-
ax5.set_title("5. Adult / NSFW Detection (%)\n(oct15_confirmation, Identical N = 2,781)", fontsize=11, fontweight="bold", color=TEXT_MAIN, pad=8)
|
| 1102 |
-
|
| 1103 |
-
# Panel 6A: Junk / Malware Detection
|
| 1104 |
-
ax6a = fig3.add_subplot(gs3[4, 3])
|
| 1105 |
-
style_ax(ax6a)
|
| 1106 |
-
ax6a.axhspan(-0.5, 1.5, color=BG_HIGHLIGHT, alpha=0.75, zorder=1)
|
| 1107 |
-
m6a = ["Armiger Ultra", "Armiger INT8", "Bitmagnet", "RTN Filter", "Other 6 Tools"]
|
| 1108 |
-
v6a = [100.00, 100.00, 54.60, 50.38, None]
|
| 1109 |
-
c6a = [C_ULTRA, C_INT8, "#94A3B8", "#F59E0B", "#21262D"]
|
| 1110 |
-
l6a = [
|
| 1111 |
-
"100.00% (2,170/2,170 oct15)",
|
| 1112 |
-
"100.00% (99.90% Acc beyond N=977)",
|
| 1113 |
-
"54.60% Bal (0% Recall on oct15)",
|
| 1114 |
-
"50.38% Bal (0% Recall on oct15)",
|
| 1115 |
-
"N/A (No Junk Head)",
|
| 1116 |
-
]
|
| 1117 |
-
for idx, (v, lbl) in enumerate(zip(v6a, l6a)):
|
| 1118 |
-
if v is not None:
|
| 1119 |
-
ax6a.barh(idx, v, height=0.6, color=c6a[idx], zorder=3)
|
| 1120 |
-
ax6a.text(v + 0.8, idx, lbl, va="center", ha="left", fontsize=8.2, fontweight="bold" if idx < 2 else "normal", color=TEXT_MAIN if idx < 2 else "#CBD5E1")
|
| 1121 |
-
else:
|
| 1122 |
-
ax6a.barh(idx, 49.0, height=0.55, color="#21262D", edgecolor=TEXT_MUTED, hatch="//", zorder=2)
|
| 1123 |
-
ax6a.text(46.2, idx, lbl, va="center", ha="left", fontsize=8.1, style="italic", color=TEXT_SUB)
|
| 1124 |
-
ax6a.set_yticks(np.arange(len(m6a)))
|
| 1125 |
-
ax6a.set_yticklabels(m6a, fontsize=9, fontweight="bold", color=TEXT_MAIN)
|
| 1126 |
-
ax6a.invert_yaxis()
|
| 1127 |
-
ax6a.set_xlim(45, 144)
|
| 1128 |
-
ax6a.set_xticks([50, 60, 70, 80, 90, 100])
|
| 1129 |
-
ax6a.set_title("6A. Junk / Malware Detection (oct15 N=2,170 & beyond N=977)", fontsize=10, fontweight="bold", color=TEXT_MAIN, pad=7)
|
| 1130 |
-
|
| 1131 |
-
# Panel 6B: Swarm Liveliness AUROC
|
| 1132 |
-
ax6b = fig3.add_subplot(gs3[6, 3])
|
| 1133 |
-
style_ax(ax6b)
|
| 1134 |
-
ax6b.axhspan(-0.5, 1.5, color=BG_HIGHLIGHT, alpha=0.75, zorder=1)
|
| 1135 |
-
m6b = ["Armiger Ultra", "Armiger Priors", "Seeder Count", "All 8 Tools"]
|
| 1136 |
-
s6b = [
|
| 1137 |
-
p2f_whse_stats["models"]["Armiger Ultra (Fair Hybrid)"],
|
| 1138 |
-
p2f_whse_stats["models"]["Armiger 4-Way Priors"],
|
| 1139 |
-
p2f_pub_stats["models"]["Armiger Ultra (Fair Hybrid)"], # replaced below for seeder
|
| 1140 |
-
None,
|
| 1141 |
-
]
|
| 1142 |
-
v6b = [96.83, 86.64, 85.17, None]
|
| 1143 |
-
c6b = [C_ULTRA, C_INT8, "#64748B", "#21262D"]
|
| 1144 |
-
l6b = [
|
| 1145 |
-
"96.83% Whse (92.42% Pub N=757)",
|
| 1146 |
-
"86.64% AUROC (4-Way Priors)",
|
| 1147 |
-
"85.17% Public / 53.02% Whse",
|
| 1148 |
-
"N/A (No Swarm Head)",
|
| 1149 |
-
]
|
| 1150 |
-
for idx, (v, lbl) in enumerate(zip(v6b, l6b)):
|
| 1151 |
-
if v is not None:
|
| 1152 |
-
ax6b.barh(idx, v, height=0.6, color=c6b[idx], zorder=3)
|
| 1153 |
-
ax6b.text(v + 0.8, idx, lbl, va="center", ha="left", fontsize=8.2, fontweight="bold" if idx < 2 else "normal", color=TEXT_MAIN if idx < 2 else "#CBD5E1")
|
| 1154 |
-
else:
|
| 1155 |
-
ax6b.barh(idx, 52.5, height=0.55, color="#21262D", edgecolor=TEXT_MUTED, hatch="//", zorder=2)
|
| 1156 |
-
ax6b.text(49.5, idx, lbl, va="center", ha="left", fontsize=8.1, style="italic", color=TEXT_SUB)
|
| 1157 |
-
ax6b.set_yticks(np.arange(len(m6b)))
|
| 1158 |
-
ax6b.set_yticklabels(m6b, fontsize=9, fontweight="bold", color=TEXT_MAIN)
|
| 1159 |
-
ax6b.invert_yaxis()
|
| 1160 |
-
ax6b.set_xlim(48, 144)
|
| 1161 |
-
ax6b.set_xticks([50, 60, 70, 80, 90, 100])
|
| 1162 |
-
ax6b.set_xlabel("Public Tracker (N=757: 92.42%, N=493: 93.03%) & Warehouse (N=10,278: 96.83%)", fontsize=8.2, color=TEXT_SUB, labelpad=6)
|
| 1163 |
-
ax6b.set_title("6B. Swarm Liveliness AUROC % (swarm_adapter.pt)", fontsize=10, fontweight="bold", color=TEXT_MAIN, pad=7)
|
| 1164 |
-
|
| 1165 |
-
sha_chart3 = save_clean_rgb_png(fig3, assets_dir / "armiger_vs_torrent_classifiers_6dims.png")
|
| 1166 |
-
|
| 1167 |
-
# ==========================================================================
|
| 1168 |
-
# COMPUTE & RENDER CHART 4: armiger_categorical_breakdown.png
|
| 1169 |
-
# ==========================================================================
|
| 1170 |
-
fig4, (ax4_l, ax4_r) = plt.subplots(1, 2, figsize=(22.5, 11.2), gridspec_kw={"wspace": 0.22})
|
| 1171 |
-
fig4.subplots_adjust(top=0.84, bottom=0.16, left=0.11, right=0.98)
|
| 1172 |
-
fig4.suptitle(
|
| 1173 |
-
"Categorical Accuracy Breakdown Across All 10 Media & Software Categories",
|
| 1174 |
-
fontsize=17, fontweight="bold", color=TEXT_MAIN, y=0.965,
|
| 1175 |
-
)
|
| 1176 |
-
fig4.text(
|
| 1177 |
-
0.5, 0.925,
|
| 1178 |
-
"Left: oct15_confirmation (Identical N = 2,835) vs. Open-Source Classifiers | Right: beyond_confirmation (Identical N = 1,025, LOTO Non-Circular)",
|
| 1179 |
-
ha="center", fontsize=11.2, style="italic", color=TEXT_SUB, parse_math=False,
|
| 1180 |
-
)
|
| 1181 |
-
|
| 1182 |
-
# Order for Left Panel (sorted by Armiger Ultra accuracy on oct15_confirmation)
|
| 1183 |
oct_cat_spec = [
|
| 1184 |
(6, "Audiobook"),
|
| 1185 |
(2, "Adult / XXX"),
|
|
@@ -1215,27 +1019,6 @@ def build_all_charts_and_manifest(
|
|
| 1215 |
"bitmagnet_pct": round(b_v, 2),
|
| 1216 |
}
|
| 1217 |
|
| 1218 |
-
style_ax(ax4_l)
|
| 1219 |
-
y_c = np.arange(len(cats_oct_labels))
|
| 1220 |
-
h = 0.19
|
| 1221 |
-
ax4_l.barh(y_c - 1.5 * h, oct_ultra, height=h, color=C_ULTRA, label="Armiger Ultra Fair Hybrid (95.49% Overall)", zorder=3)
|
| 1222 |
-
ax4_l.barh(y_c - 0.5 * h, oct_int8, height=h, color=C_INT8, label="Armiger INT8 + ZeroCue (95.49% Overall, 95.06% Raw)", zorder=3)
|
| 1223 |
-
ax4_l.barh(y_c + 0.5 * h, oct_mimmo, height=h, color="#818CF8", label="MIMMO BERT 360M (72.24% Overall on N=2,835)", zorder=3)
|
| 1224 |
-
ax4_l.barh(y_c + 1.5 * h, oct_bit, height=h, color="#64748B", label="Bitmagnet Built-In (35.17% Overall on N=2,835)", zorder=3)
|
| 1225 |
-
ax4_l.set_yticks(y_c)
|
| 1226 |
-
ax4_l.set_yticklabels(cats_oct_labels, fontsize=10, fontweight="bold", color=TEXT_MAIN)
|
| 1227 |
-
ax4_l.set_ylim(len(cats_oct_labels) - 0.35, -0.6)
|
| 1228 |
-
ax4_l.set_xlim(0, 128)
|
| 1229 |
-
ax4_l.set_xticks([0, 20, 40, 60, 80, 100])
|
| 1230 |
-
ax4_l.set_xlabel("Category Accuracy (%) — Identical N = 2,835 Ground-Truth Mask", fontsize=9.8, color=TEXT_SUB, labelpad=8)
|
| 1231 |
-
ax4_l.set_title("1. Per-Category Accuracy vs. Open-Source Classifiers\n(oct15_confirmation, Identical N = 2,835)", fontsize=11.5, fontweight="bold", color=TEXT_MAIN, pad=10)
|
| 1232 |
-
for idx in range(len(cats_oct_labels)):
|
| 1233 |
-
ax4_l.text(oct_ultra[idx] + 1.0, idx - 1.1 * h, f"{oct_ultra[idx]:.1f}%", va="center", ha="left", fontsize=8.0, fontweight="bold", color=C_ULTRA_EDGE)
|
| 1234 |
-
ax4_l.text(oct_mimmo[idx] + 1.0, idx + 0.5 * h, f"{oct_mimmo[idx]:.1f}%", va="center", ha="left", fontsize=7.6, color="#CBD5E1")
|
| 1235 |
-
ax4_l.text(oct_bit[idx] + 1.0, idx + 1.5 * h, f"{oct_bit[idx]:.1f}%", va="center", ha="left", fontsize=7.6, color=TEXT_SUB)
|
| 1236 |
-
ax4_l.legend(loc="upper center", bbox_to_anchor=(0.5, -0.09), ncol=2, facecolor=BG_PANEL, edgecolor=BORDER_COLOR, fontsize=8.6, labelcolor=TEXT_MAIN)
|
| 1237 |
-
|
| 1238 |
-
# Order for Right Panel (beyond_confirmation N=1,025 Non-Circular LOTO)
|
| 1239 |
y_bc_cat11 = d["beyond_cat11_y_true"]
|
| 1240 |
bc_cat_spec = [
|
| 1241 |
(6, "Audiobook"),
|
|
@@ -1271,26 +1054,363 @@ def build_all_charts_and_manifest(
|
|
| 1271 |
"gpt_noncirc_pct": round(gp_v, 2),
|
| 1272 |
"gemini_noncirc_pct": round(gm_v, 2),
|
| 1273 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1274 |
|
| 1275 |
-
|
| 1276 |
-
|
| 1277 |
-
|
| 1278 |
-
|
| 1279 |
-
|
| 1280 |
-
|
| 1281 |
-
|
| 1282 |
-
|
| 1283 |
-
|
| 1284 |
-
|
| 1285 |
-
|
| 1286 |
-
|
| 1287 |
-
|
| 1288 |
-
|
| 1289 |
-
|
| 1290 |
-
|
| 1291 |
-
|
| 1292 |
-
|
| 1293 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1294 |
|
| 1295 |
# ==========================================================================
|
| 1296 |
# FIVE-SPLIT SUMMARY TABLE STATS
|
|
|
|
| 22 |
import zlib
|
| 23 |
from typing import Any, Dict, List, Optional, Tuple
|
| 24 |
|
| 25 |
+
import math
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
import numpy as np
|
| 27 |
+
|
| 28 |
+
try:
|
| 29 |
+
import matplotlib
|
| 30 |
+
matplotlib.use("Agg")
|
| 31 |
+
import matplotlib.pyplot as plt
|
| 32 |
+
from matplotlib.gridspec import GridSpec
|
| 33 |
+
from matplotlib.patches import Patch
|
| 34 |
+
from PIL import Image
|
| 35 |
+
HAS_MATPLOTLIB = True
|
| 36 |
+
except ImportError:
|
| 37 |
+
matplotlib = None # type: ignore[assignment]
|
| 38 |
+
plt = None # type: ignore[assignment]
|
| 39 |
+
GridSpec = None # type: ignore[assignment]
|
| 40 |
+
Patch = None # type: ignore[assignment]
|
| 41 |
+
Image = None # type: ignore[assignment]
|
| 42 |
+
HAS_MATPLOTLIB = False
|
| 43 |
|
| 44 |
BOOTSTRAP_SEED = 20261018
|
| 45 |
BOOTSTRAP_RESAMPLES = 10000
|
|
|
|
| 153 |
n_disc = n_pos + n_neg
|
| 154 |
if n_disc == 0:
|
| 155 |
return 1.0
|
| 156 |
+
m_min = min(n_pos, n_neg)
|
| 157 |
+
if 2 * m_min == n_disc:
|
| 158 |
+
return 1.0
|
| 159 |
+
tail_sum = sum(math.comb(n_disc, i) for i in range(m_min + 1))
|
| 160 |
+
return float(min(1.0, (2 * tail_sum) / (1 << n_disc)))
|
| 161 |
|
| 162 |
|
| 163 |
def compute_auroc_pct(y_true: np.ndarray, scores: np.ndarray) -> float:
|
|
|
|
| 185 |
|
| 186 |
rng = np.random.default_rng(seed)
|
| 187 |
model_names = list(vectors.keys())
|
| 188 |
+
mat = np.stack([np.asarray(vectors[m], dtype=np.float64) for m in model_names], axis=0) # (M, N)
|
| 189 |
|
| 190 |
if metric_type == "mean":
|
| 191 |
+
# Exact integer-scaled dot product in float64 (bit-exact across ARM64 Accelerate & x86_64 OpenBLAS)
|
| 192 |
+
mat_int6 = np.round(mat * 6.0)
|
| 193 |
+
weights = rng.multinomial(n_val, np.full(n_val, 1.0 / n_val), size=n_boot).astype(np.float64)
|
| 194 |
+
boot_scores = (weights @ mat_int6.T) * (100.0 / (6.0 * n_val))
|
| 195 |
+
point_scores = {m: float(np.sum(np.round(np.asarray(vectors[m], dtype=np.float64) * 6.0)) * 100.0 / (6.0 * n_val)) for m in model_names}
|
| 196 |
+
item_correctness = {m: np.asarray(vectors[m], dtype=np.float64) for m in model_names}
|
| 197 |
elif metric_type == "balanced":
|
| 198 |
if y_true is None:
|
| 199 |
raise AssertionError(f"[{panel_name}] y_true required for metric_type='balanced'.")
|
|
|
|
| 202 |
neg_mask = (y_arr == 0)
|
| 203 |
n_pos = int(np.sum(pos_mask))
|
| 204 |
n_neg = int(np.sum(neg_mask))
|
| 205 |
+
pos_mat = (mat[:, pos_mask] == 1).astype(np.float64)
|
| 206 |
+
neg_mat = (mat[:, neg_mask] == 0).astype(np.float64)
|
| 207 |
+
w_pos = rng.multinomial(n_pos, np.full(n_pos, 1.0 / n_pos), size=n_boot).astype(np.float64)
|
| 208 |
+
w_neg = rng.multinomial(n_neg, np.full(n_neg, 1.0 / n_neg), size=n_boot).astype(np.float64)
|
| 209 |
+
boot_scores = 0.5 * ((w_pos @ pos_mat.T) * (100.0 / n_pos) + (w_neg @ neg_mat.T) * (100.0 / n_neg))
|
| 210 |
point_scores = {}
|
| 211 |
item_correctness = {}
|
| 212 |
for idx, m in enumerate(model_names):
|
| 213 |
+
sens = float(np.sum(pos_mat[idx]) * 100.0 / n_pos)
|
| 214 |
+
spec = float(np.sum(neg_mat[idx]) * 100.0 / n_neg)
|
| 215 |
point_scores[m] = 0.5 * (sens + spec)
|
| 216 |
+
item_corr = np.zeros(n_val, dtype=np.float64)
|
| 217 |
item_corr[pos_mask] = pos_mat[idx]
|
| 218 |
item_corr[neg_mask] = neg_mat[idx]
|
| 219 |
item_correctness[m] = item_corr
|
|
|
|
| 224 |
pos_idx = np.where(y_arr == 1)[0]
|
| 225 |
neg_idx = np.where(y_arr == 0)[0]
|
| 226 |
n_pos, n_neg = len(pos_idx), len(neg_idx)
|
| 227 |
+
# Exact integer-scaled placement counts in float64 (bit-exact across BLAS engines)
|
| 228 |
+
placement_int2 = np.zeros((len(model_names), n_val), dtype=np.float64)
|
| 229 |
+
placement_unit = np.zeros((len(model_names), n_val), dtype=np.float64)
|
| 230 |
point_scores = {}
|
| 231 |
for idx, m in enumerate(model_names):
|
| 232 |
s = mat[idx]
|
| 233 |
s_pos = s[pos_idx]
|
| 234 |
s_neg = s[neg_idx]
|
| 235 |
+
v10_int2 = 2.0 * (s_pos[:, None] > s_neg[None, :]).sum(axis=1) + (s_pos[:, None] == s_neg[None, :]).sum(axis=1)
|
| 236 |
+
v01_int2 = 2.0 * (s_pos[:, None] > s_neg[None, :]).sum(axis=0) + (s_pos[:, None] == s_neg[None, :]).sum(axis=0)
|
| 237 |
+
placement_int2[idx, pos_idx] = v10_int2
|
| 238 |
+
placement_int2[idx, neg_idx] = v01_int2
|
| 239 |
+
placement_unit[idx, pos_idx] = v10_int2 / (2.0 * n_neg)
|
| 240 |
+
placement_unit[idx, neg_idx] = v01_int2 / (2.0 * n_pos)
|
| 241 |
+
point_scores[m] = float(np.sum(v10_int2) * 100.0 / (2.0 * n_pos * n_neg))
|
| 242 |
+
w_pos = rng.multinomial(n_pos, np.full(n_pos, 1.0 / n_pos), size=n_boot).astype(np.float64)
|
| 243 |
+
w_neg = rng.multinomial(n_neg, np.full(n_neg, 1.0 / n_neg), size=n_boot).astype(np.float64)
|
| 244 |
+
boot_scores = 0.5 * (
|
| 245 |
+
(w_pos @ placement_int2[:, pos_idx].T) * (100.0 / (2.0 * n_pos * n_neg))
|
| 246 |
+
+ (w_neg @ placement_int2[:, neg_idx].T) * (100.0 / (2.0 * n_pos * n_neg))
|
| 247 |
+
)
|
| 248 |
+
item_correctness = {m: placement_unit[idx] for idx, m in enumerate(model_names)}
|
| 249 |
else:
|
| 250 |
raise ValueError(f"Unknown metric_type: {metric_type}")
|
| 251 |
|
|
|
|
| 381 |
npz_path: pathlib.Path,
|
| 382 |
assets_dir: pathlib.Path,
|
| 383 |
manifest_path: pathlib.Path,
|
| 384 |
+
render_pngs: Optional[bool] = None,
|
| 385 |
) -> Dict[str, Any]:
|
| 386 |
+
if render_pngs is None:
|
| 387 |
+
render_pngs = HAS_MATPLOTLIB
|
| 388 |
+
if render_pngs:
|
| 389 |
+
if not HAS_MATPLOTLIB:
|
| 390 |
+
raise RuntimeError("matplotlib and Pillow are required when render_pngs=True")
|
| 391 |
+
plt.rcParams.update({
|
| 392 |
+
"figure.facecolor": BG_CANVAS,
|
| 393 |
+
"axes.facecolor": BG_PANEL,
|
| 394 |
+
"axes.edgecolor": BORDER_COLOR,
|
| 395 |
+
"axes.labelcolor": TEXT_SUB,
|
| 396 |
+
"xtick.color": TEXT_SUB,
|
| 397 |
+
"ytick.color": TEXT_MAIN,
|
| 398 |
+
"text.color": TEXT_MAIN,
|
| 399 |
+
"font.sans-serif": ["DejaVu Sans", "Arial", "Helvetica"],
|
| 400 |
+
"axes.grid": True,
|
| 401 |
+
"grid.color": GRID_COLOR,
|
| 402 |
+
"grid.linestyle": "--",
|
| 403 |
+
"grid.alpha": 0.85,
|
| 404 |
+
})
|
| 405 |
|
| 406 |
if str(npz_path).endswith(".json"):
|
| 407 |
raw_json = json.loads(npz_path.read_text(encoding="utf-8"))
|
|
|
|
| 579 |
"ci95_hi": round(pt_mean + half_w, 2),
|
| 580 |
}
|
| 581 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 582 |
models_cost = [
|
| 583 |
"Armiger (8.3 MB M4 Pro CPU INT8)",
|
| 584 |
"Armiger Ultra (M4 Pro / RTX GPU FP32)",
|
|
|
|
| 590 |
colors_cost = [C_INT8, C_ULTRA, C_VINCI, C_GEMINI, C_GPT, C_CLAUDE]
|
| 591 |
batched_cost = [0.002, 0.004, 1.85, 94.90, 127.30, 712.00]
|
| 592 |
realtime_cost = [0.002, 0.004, 18.00, 147.00, 220.50, 1220.00]
|
| 593 |
+
fallback_assets = assets_dir if (assets_dir / "armiger_vs_llms_overall_and_6dims.png").is_file() else (npz_path.parent.parent / "assets")
|
| 594 |
+
if render_pngs:
|
| 595 |
+
# ==========================================================================
|
| 596 |
+
# RENDER CHART 1: armiger_vs_llms_overall_and_6dims.png
|
| 597 |
+
# ==========================================================================
|
| 598 |
+
fig1 = plt.figure(figsize=(24, 11.4))
|
| 599 |
+
fig1.suptitle(
|
| 600 |
+
"Armiger & Armiger Ultra vs. Frontier Cloud LLMs & Local GPU LLM Across 6 Core Dimensions",
|
| 601 |
+
fontsize=17.5, fontweight="bold", color=TEXT_MAIN, y=0.972,
|
| 602 |
+
)
|
| 603 |
+
fig1.text(
|
| 604 |
+
0.5, 0.934,
|
| 605 |
+
"Non-Circular Leave-One-Teacher-Out (LOTO) & Identical-Denominator Evaluation with 95% Paired Bootstrap CIs (10,000 Resamples)",
|
| 606 |
+
ha="center", fontsize=11.3, style="italic", color=TEXT_SUB, parse_math=False,
|
| 607 |
+
)
|
| 608 |
|
| 609 |
+
gs1 = GridSpec(
|
| 610 |
+
2, 5, figure=fig1,
|
| 611 |
+
width_ratios=[1.72, 0.12, 1.0, 1.0, 1.0],
|
| 612 |
+
wspace=0.16, hspace=0.42,
|
| 613 |
+
top=0.86, bottom=0.13, left=0.14, right=0.98,
|
| 614 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 615 |
|
| 616 |
+
ax_left = fig1.add_subplot(gs1[:, 0])
|
| 617 |
+
style_ax(ax_left)
|
| 618 |
+
colors_llm = [C_ULTRA, C_INT8, C_GEMINI, C_CLAUDE, C_GPT, C_VINCI]
|
| 619 |
+
edges_llm = [C_ULTRA_EDGE, C_INT8_EDGE, "none", "none", "none", "none"]
|
| 620 |
+
vals_left = [composite_stats[m]["point_pct"] for m in llm_order]
|
| 621 |
+
labels_left = [
|
| 622 |
+
f"{vals_left[0]:.2f}% (0.21 ms RTX / 0.29 ms MPS | $0.00 API)",
|
| 623 |
+
f"{vals_left[1]:.2f}% (2.44 ms M4 Pro CPU INT8 | $0.00 API)",
|
| 624 |
+
f"{vals_left[2]:.2f}% (~450 ms | Non-Circular LOTO N=1,025)",
|
| 625 |
+
f"{vals_left[3]:.2f}% (~310 ms | $712.00-$1,220.00 / 1M)",
|
| 626 |
+
f"{vals_left[4]:.2f}% (~365 ms | Non-Circular LOTO N=1,025)",
|
| 627 |
+
f"{vals_left[5]:.2f}% (~185 ms RTX 4070 TiS | $1.85 Pwr / 1M)",
|
| 628 |
+
]
|
| 629 |
+
y_llm = np.arange(len(llm_order))
|
| 630 |
+
ax_left.axhspan(-0.5, 1.5, color=BG_HIGHLIGHT, alpha=0.75, zorder=1)
|
| 631 |
+
ax_left.barh(y_llm, vals_left, height=0.55, color=colors_llm, edgecolor=edges_llm, linewidth=1.3, zorder=3)
|
| 632 |
+
draw_ci_whiskers(ax_left, y_llm, [composite_stats[m] for m in llm_order])
|
| 633 |
+
ax_left.set_yticks(y_llm)
|
| 634 |
+
ax_left.set_yticklabels(llm_order, fontsize=10.5, fontweight="bold", color=TEXT_MAIN)
|
| 635 |
+
ax_left.invert_yaxis()
|
| 636 |
+
ax_left.set_xlim(78, 136)
|
| 637 |
+
ax_left.set_xticks([80, 85, 90, 95, 100])
|
| 638 |
+
ax_left.set_xlabel("6-Dimension Composite Mean (%) ± 95% Bootstrap CI", fontsize=10, color=TEXT_SUB, labelpad=8)
|
| 639 |
+
ax_left.set_title(
|
| 640 |
+
"1. Overall 6-Dimension Composite Mean (%)\n(Category, Catalog, Audio, Anime, Junk, Swarm)",
|
| 641 |
+
fontsize=11.5, fontweight="bold", color=TEXT_MAIN, pad=10,
|
| 642 |
+
)
|
| 643 |
+
for idx, (m, lbl) in enumerate(zip(llm_order, labels_left)):
|
| 644 |
+
fw = "bold" if idx < 2 else "normal"
|
| 645 |
+
tc = TEXT_MAIN if idx < 2 else "#CBD5E1"
|
| 646 |
+
hi_x = max(vals_left[idx], composite_stats[m]["ci95_hi"])
|
| 647 |
+
ax_left.text(hi_x + 0.55, idx, lbl, va="center", ha="left", fontsize=8.5, fontweight=fw, color=tc, zorder=6, parse_math=False)
|
| 648 |
+
|
| 649 |
+
sub_specs = [
|
| 650 |
+
(
|
| 651 |
+
0, 2, "2A. 11-Class Category (N=1,025 LOTO)",
|
| 652 |
+
p2a_stats,
|
| 653 |
+
[
|
| 654 |
+
f"{p2a_stats['models'][llm_order[0]]['point_pct']:.2f}% (95.49% oct15)",
|
| 655 |
+
f"{p2a_stats['models'][llm_order[1]]['point_pct']:.2f}% (95.49% oct15)",
|
| 656 |
+
f"{p2a_stats['models'][llm_order[2]]['point_pct']:.2f}% (95.6% Circ)",
|
| 657 |
+
f"{p2a_stats['models'][llm_order[3]]['point_pct']:.2f}%",
|
| 658 |
+
f"{p2a_stats['models'][llm_order[4]]['point_pct']:.2f}% (96.6% Circ)",
|
| 659 |
+
f"{p2a_stats['models'][llm_order[5]]['point_pct']:.2f}%",
|
| 660 |
+
],
|
| 661 |
+
(72, 134), [75, 80, 85, 90, 95, 100],
|
| 662 |
+
),
|
| 663 |
+
(
|
| 664 |
+
0, 3, "2B. Catalog Matching (N=1,025 LOTO)",
|
| 665 |
+
p2b_stats,
|
| 666 |
+
[
|
| 667 |
+
f"{p2b_stats['models'][llm_order[0]]['point_pct']:.2f}% (96.53% oct15)",
|
| 668 |
+
f"{p2b_stats['models'][llm_order[1]]['point_pct']:.2f}% (96.53% oct15)",
|
| 669 |
+
f"{p2b_stats['models'][llm_order[2]]['point_pct']:.2f}%",
|
| 670 |
+
f"{p2b_stats['models'][llm_order[3]]['point_pct']:.2f}%",
|
| 671 |
+
f"{p2b_stats['models'][llm_order[4]]['point_pct']:.2f}%",
|
| 672 |
+
f"{p2b_stats['models'][llm_order[5]]['point_pct']:.2f}%",
|
| 673 |
+
],
|
| 674 |
+
(70, 126), [75, 80, 85, 90, 95, 100],
|
| 675 |
+
),
|
| 676 |
+
(
|
| 677 |
+
0, 4, "2C. Audio Language (Strict E-vs-F N=229)",
|
| 678 |
+
p2c_stats,
|
| 679 |
+
[
|
| 680 |
+
f"{p2c_stats['models'][llm_order[0]]['point_pct']:.2f}% (97.80% oct15)",
|
| 681 |
+
f"{p2c_stats['models'][llm_order[1]]['point_pct']:.2f}% (97.80% oct15)",
|
| 682 |
+
f"{p2c_stats['models'][llm_order[2]]['point_pct']:.2f}%",
|
| 683 |
+
f"{p2c_stats['models'][llm_order[3]]['point_pct']:.2f}%",
|
| 684 |
+
f"{p2c_stats['models'][llm_order[4]]['point_pct']:.2f}% (94.68% oct15)",
|
| 685 |
+
f"{p2c_stats['models'][llm_order[5]]['point_pct']:.2f}%",
|
| 686 |
+
],
|
| 687 |
+
(88, 122), [90, 92, 94, 96, 98, 100],
|
| 688 |
+
),
|
| 689 |
+
(
|
| 690 |
+
1, 2, "2D. Anime & Dub (Valid Media N=636)",
|
| 691 |
+
p2d_stats,
|
| 692 |
+
[
|
| 693 |
+
f"{p2d_stats['models'][llm_order[0]]['point_pct']:.2f}% (99.61% oct15)",
|
| 694 |
+
f"{p2d_stats['models'][llm_order[1]]['point_pct']:.2f}% (99.61% oct15)",
|
| 695 |
+
f"{p2d_stats['models'][llm_order[2]]['point_pct']:.2f}% (608/636)",
|
| 696 |
+
f"{p2d_stats['models'][llm_order[3]]['point_pct']:.2f}% (Valid Media)",
|
| 697 |
+
f"{p2d_stats['models'][llm_order[4]]['point_pct']:.2f}% (608/636)",
|
| 698 |
+
f"{p2d_stats['models'][llm_order[5]]['point_pct']:.2f}%",
|
| 699 |
+
],
|
| 700 |
+
(88, 124), [90, 92, 94, 96, 98, 100],
|
| 701 |
+
),
|
| 702 |
+
(
|
| 703 |
+
1, 3, "2E. Junk / Malware (Balanced N=977)",
|
| 704 |
+
p2e_stats,
|
| 705 |
+
[
|
| 706 |
+
f"{p2e_stats['models'][llm_order[0]]['point_pct']:.2f}% (99.90% Acc / 100% oct15)",
|
| 707 |
+
f"{p2e_stats['models'][llm_order[1]]['point_pct']:.2f}% (99.90% Acc / 100% oct15)",
|
| 708 |
+
f"{p2e_stats['models'][llm_order[2]]['point_pct']:.2f}% (Non-Circ)",
|
| 709 |
+
f"{p2e_stats['models'][llm_order[3]]['point_pct']:.2f}%",
|
| 710 |
+
f"{p2e_stats['models'][llm_order[4]]['point_pct']:.2f}% (0% Rec.)",
|
| 711 |
+
f"{p2e_stats['models'][llm_order[5]]['point_pct']:.2f}%",
|
| 712 |
+
],
|
| 713 |
+
(40, 162), [40, 60, 80, 100],
|
| 714 |
+
),
|
| 715 |
+
(
|
| 716 |
+
1, 4, "2F. Swarm Liveliness AUROC %",
|
| 717 |
+
None,
|
| 718 |
+
[
|
| 719 |
+
"96.83% Whse (92.42% Pub)",
|
| 720 |
+
"92.42% Pub (86.64% Priors)",
|
| 721 |
+
"89.20% Pub (N=757)",
|
| 722 |
+
"89.76% Pub (N=757)",
|
| 723 |
+
"89.82% Pub (N=757)",
|
| 724 |
+
"66.32% Pub (N=757)",
|
| 725 |
+
],
|
| 726 |
+
(55, 152), [60, 70, 80, 90, 100],
|
| 727 |
+
),
|
| 728 |
+
]
|
| 729 |
+
|
| 730 |
+
for row, col, title, p_stat, lbls, xlim, xticks in sub_specs:
|
| 731 |
+
ax = fig1.add_subplot(gs1[row, col])
|
| 732 |
+
style_ax(ax)
|
| 733 |
+
ax.axhspan(-0.5, 1.5, color=BG_HIGHLIGHT, alpha=0.75, zorder=1)
|
| 734 |
+
if p_stat is not None:
|
| 735 |
+
s_list = [p_stat["models"][m] for m in llm_order]
|
| 736 |
+
else:
|
| 737 |
+
s_list = [p2f_whse_stats["models"][ref_llm]] + [p2f_pub_stats["models"][m] for m in llm_order[1:]]
|
| 738 |
+
vals = [s["point_pct"] for s in s_list]
|
| 739 |
+
ax.barh(y_llm, vals, height=0.58, color=colors_llm, edgecolor=edges_llm, linewidth=1.2, zorder=3)
|
| 740 |
+
draw_ci_whiskers(ax, y_llm, s_list)
|
| 741 |
+
ax.set_yticks(y_llm)
|
| 742 |
+
ax.set_yticklabels([""] * len(llm_order))
|
| 743 |
+
ax.invert_yaxis()
|
| 744 |
+
ax.set_xlim(*xlim)
|
| 745 |
+
ax.set_xticks(xticks)
|
| 746 |
+
ax.set_title(title, fontsize=10.5, fontweight="bold", color=TEXT_MAIN, pad=8)
|
| 747 |
+
span = xlim[1] - xlim[0]
|
| 748 |
+
for idx, (s_item, lbl) in enumerate(zip(s_list, lbls)):
|
| 749 |
+
fw = "bold" if idx < 2 else "normal"
|
| 750 |
+
tc = TEXT_MAIN if idx < 2 else "#CBD5E1"
|
| 751 |
+
hi_x = max(s_item["point_pct"], s_item["ci95_hi"])
|
| 752 |
+
ax.text(hi_x + span * 0.015, idx, lbl, va="center", ha="left", fontsize=7.9, fontweight=fw, color=tc, zorder=6, parse_math=False)
|
| 753 |
+
|
| 754 |
+
legend_handles = [
|
| 755 |
+
Patch(facecolor=C_ULTRA, edgecolor=C_ULTRA_EDGE, label="Armiger Ultra (Fair Hybrid)"),
|
| 756 |
+
Patch(facecolor=C_INT8, edgecolor=C_INT8_EDGE, label="Armiger (8.3 MB INT8 + Plugins)"),
|
| 757 |
+
Patch(facecolor=C_GEMINI, label="Google Gemini (gemini-3.8-flash-low, LOTO Non-Circular)"),
|
| 758 |
+
Patch(facecolor=C_CLAUDE, label="Anthropic Claude (claude-haiku-4-5)"),
|
| 759 |
+
Patch(facecolor=C_GPT, label="OpenAI GPT (gpt-6-luna, LOTO Non-Circular)"),
|
| 760 |
+
Patch(facecolor=C_VINCI, label="Local GPU LLM (Vinci-MLE-8B-1.0)"),
|
| 761 |
+
]
|
| 762 |
+
fig1.legend(
|
| 763 |
+
handles=legend_handles, loc="lower center", bbox_to_anchor=(0.5, 0.015),
|
| 764 |
+
ncol=6, facecolor=BG_PANEL, edgecolor=BORDER_COLOR, fontsize=9.0, labelcolor=TEXT_MAIN,
|
| 765 |
+
borderpad=0.6, columnspacing=1.35,
|
| 766 |
+
)
|
| 767 |
+
sha_chart1 = save_clean_rgb_png(fig1, assets_dir / "armiger_vs_llms_overall_and_6dims.png")
|
| 768 |
+
|
| 769 |
+
# ==========================================================================
|
| 770 |
+
# RENDER CHART 2: armiger_vs_llms_cost_comparison.png
|
| 771 |
+
# ==========================================================================
|
| 772 |
+
fig2, (ax2_l, ax2_r) = plt.subplots(1, 2, figsize=(23.5, 9.2), gridspec_kw={"wspace": 0.14})
|
| 773 |
+
fig2.subplots_adjust(top=0.80, bottom=0.16, left=0.16, right=0.98)
|
| 774 |
+
fig2.suptitle(
|
| 775 |
+
"Cost & Hardware-Attributed Throughput: Armiger & Armiger Ultra vs. Local & Cloud LLMs",
|
| 776 |
+
fontsize=17.5, fontweight="bold", color=TEXT_MAIN, y=0.96,
|
| 777 |
+
)
|
| 778 |
+
fig2.text(
|
| 779 |
+
0.5, 0.915,
|
| 780 |
+
"Left: Operational Cost per 1,000,000 Classified Torrents ($ USD) | Right: API Token Rates ($ USD / 1M Tokens) & Measured Hardware Throughput",
|
| 781 |
+
ha="center", fontsize=11.3, style="italic", color=TEXT_SUB, parse_math=False,
|
| 782 |
+
)
|
| 783 |
+
|
| 784 |
+
models_cost = [
|
| 785 |
+
"Armiger (8.3 MB M4 Pro CPU INT8)",
|
| 786 |
+
"Armiger Ultra (M4 Pro / RTX GPU FP32)",
|
| 787 |
+
"Local GPU LLM (Vinci-MLE-8B-1.0)",
|
| 788 |
+
"Cheap Google (gemini-3.8-flash-low)",
|
| 789 |
+
"Cheap OpenAI GPT (gpt-6-luna)",
|
| 790 |
+
"Cheap Anthropic (claude-haiku-4-5)",
|
| 791 |
+
]
|
| 792 |
+
colors_cost = [C_INT8, C_ULTRA, C_VINCI, C_GEMINI, C_GPT, C_CLAUDE]
|
| 793 |
+
batched_cost = [0.002, 0.004, 1.85, 94.90, 127.30, 712.00]
|
| 794 |
+
realtime_cost = [0.002, 0.004, 18.00, 147.00, 220.50, 1220.00]
|
| 795 |
+
cost_labels = [
|
| 796 |
+
"$0.00 API (~$0.0020 Compute Electricity / 1M Tasks)",
|
| 797 |
+
"$0.00 API (~$0.0040 Compute Electricity / 1M Tasks)",
|
| 798 |
+
"$0.00 API ($1.85 Local GPU Power | ~$18.00 Cloud GPU / 1M)",
|
| 799 |
+
"$94.90 Batched ($147.00 Real-Time 1-by-1)",
|
| 800 |
+
"$127.30 Batched ($220.50 Real-Time 1-by-1)",
|
| 801 |
+
"$712.00 Batched ($1,220.00 Real-Time 1-by-1)",
|
| 802 |
+
]
|
| 803 |
+
|
| 804 |
+
style_ax(ax2_l)
|
| 805 |
+
yc = np.arange(len(models_cost))
|
| 806 |
+
ax2_l.axhspan(-0.5, 1.5, color=BG_HIGHLIGHT, alpha=0.75, zorder=1)
|
| 807 |
+
for idx in range(len(models_cost)):
|
| 808 |
+
ax2_l.barh(idx, realtime_cost[idx], height=0.56, color=colors_cost[idx], alpha=0.28, edgecolor=colors_cost[idx], linestyle="--", linewidth=1.2, zorder=2)
|
| 809 |
+
ax2_l.barh(idx, batched_cost[idx], height=0.56, color=colors_cost[idx], zorder=3)
|
| 810 |
+
x_pos = max(realtime_cost[idx], batched_cost[idx]) + 18.0
|
| 811 |
+
ax2_l.text(x_pos, idx, cost_labels[idx], va="center", ha="left", fontsize=9.0, fontweight="bold" if idx < 2 else "normal", color=TEXT_MAIN if idx < 2 else "#CBD5E1", parse_math=False)
|
| 812 |
+
|
| 813 |
+
ax2_l.set_yticks(yc)
|
| 814 |
+
ax2_l.set_yticklabels(models_cost, fontsize=10.2, fontweight="bold", color=TEXT_MAIN)
|
| 815 |
+
ax2_l.invert_yaxis()
|
| 816 |
+
ax2_l.set_xlim(0, 1980)
|
| 817 |
+
ax2_l.set_xticks([0, 200, 400, 600, 800, 1000, 1200])
|
| 818 |
+
ax2_l.set_xticklabels(["$0", "$200", "$400", "$600", "$800", "$1,000", "$1,200"])
|
| 819 |
+
ax2_l.set_xlabel("Derived from measured prompt + completion token receipts (Lower is Better)", fontsize=9.5, color=TEXT_SUB, labelpad=8)
|
| 820 |
+
ax2_l.set_title(
|
| 821 |
+
"1. Cost per 1,000,000 Classified Torrents ($ USD / 1M Tasks)\n(Solid = 32-Item Batched Mode; Dashed = Real-Time 1-by-1 Webhook Mode)",
|
| 822 |
+
fontsize=11.2, fontweight="bold", color=TEXT_MAIN, pad=10,
|
| 823 |
+
)
|
| 824 |
+
ax2_l.legend(
|
| 825 |
+
handles=[
|
| 826 |
+
Patch(facecolor=C_GEMINI, label="32-Item Batched API Cost"),
|
| 827 |
+
Patch(facecolor=C_GEMINI, alpha=0.3, edgecolor=C_GEMINI, linestyle="--", label="Real-Time Single-Torrent API Cost (1-by-1)"),
|
| 828 |
+
],
|
| 829 |
+
loc="upper center", bbox_to_anchor=(0.5, -0.11), ncol=2, facecolor=BG_PANEL, edgecolor=BORDER_COLOR, fontsize=8.8, labelcolor=TEXT_MAIN,
|
| 830 |
+
)
|
| 831 |
+
|
| 832 |
+
style_ax(ax2_r)
|
| 833 |
+
ax2_r.axhspan(-0.5, 1.5, color=BG_HIGHLIGHT, alpha=0.75, zorder=1)
|
| 834 |
+
in_rates = [0.0, 0.0, 0.012, 0.10, 0.15, 0.80]
|
| 835 |
+
out_rates = [0.0, 0.0, 0.12, 0.40, 0.60, 4.00]
|
| 836 |
+
rate_labels = [
|
| 837 |
+
"$0.00 API (2.44 ms single / 326 items/s batch-64 M4 Pro CPU)",
|
| 838 |
+
"$0.00 API (3,416 items/s M4 Pro MPS / 4,795 items/s RTX GPU)",
|
| 839 |
+
"$0.00 API (~$0.012/1M Pwr Equiv. | 5.4 items/s RTX 4070 TiS)",
|
| 840 |
+
"$0.10 In | $0.40 Out ($0.13 Blended / 1M Tokens)",
|
| 841 |
+
"$0.15 In | $0.60 Out ($0.18 Blended / 1M Tokens)",
|
| 842 |
+
"$0.80 In | $4.00 Out ($1.05 Blended / 1M Tokens)",
|
| 843 |
+
]
|
| 844 |
+
for idx in range(len(models_cost)):
|
| 845 |
+
ax2_r.barh(idx - 0.14, in_rates[idx], height=0.28, color=colors_cost[idx], alpha=0.55, hatch="//", edgecolor=colors_cost[idx], zorder=3)
|
| 846 |
+
ax2_r.barh(idx + 0.14, out_rates[idx], height=0.28, color=colors_cost[idx], zorder=3)
|
| 847 |
+
ax2_r.text(max(in_rates[idx], out_rates[idx]) + 0.08, idx + 0.05, rate_labels[idx], va="center", ha="left", fontsize=9.0, fontweight="bold" if idx < 2 else "normal", color=TEXT_MAIN if idx < 2 else "#CBD5E1", parse_math=False)
|
| 848 |
+
|
| 849 |
+
ax2_r.set_yticks(yc)
|
| 850 |
+
ax2_r.set_yticklabels([""] * len(models_cost))
|
| 851 |
+
ax2_r.invert_yaxis()
|
| 852 |
+
ax2_r.set_xlim(0, 7.05)
|
| 853 |
+
ax2_r.set_xticks([0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0])
|
| 854 |
+
ax2_r.set_xticklabels(["$0.00", "$0.50", "$1.00", "$1.50", "$2.00", "$2.50", "$3.00", "$3.50", "$4.00"])
|
| 855 |
+
ax2_r.set_xlabel("Standard API List Rates ($ USD / 1M Tokens) & Measured Local Hardware Speed", fontsize=9.5, color=TEXT_SUB, labelpad=8)
|
| 856 |
+
ax2_r.set_title(
|
| 857 |
+
"2. Token Pricing ($ USD / 1M Tokens) & Hardware-Attributed Throughput\n(M4 Pro CPU INT8: 2.44 ms single / 326/s batch-64; M4 Pro MPS: 3,416/s; RTX GPU: 4,795/s)",
|
| 858 |
+
fontsize=11.2, fontweight="bold", color=TEXT_MAIN, pad=10,
|
| 859 |
+
)
|
| 860 |
+
ax2_r.legend(
|
| 861 |
+
handles=[
|
| 862 |
+
Patch(facecolor=C_GEMINI, alpha=0.55, hatch="//", edgecolor=C_GEMINI, label="Input Tokens ($ / 1M)"),
|
| 863 |
+
Patch(facecolor=C_GEMINI, label="Output Tokens ($ / 1M)"),
|
| 864 |
+
],
|
| 865 |
+
loc="upper center", bbox_to_anchor=(0.5, -0.11), ncol=2, facecolor=BG_PANEL, edgecolor=BORDER_COLOR, fontsize=8.8, labelcolor=TEXT_MAIN,
|
| 866 |
+
)
|
| 867 |
+
sha_chart2 = save_clean_rgb_png(fig2, assets_dir / "armiger_vs_llms_cost_comparison.png")
|
| 868 |
+
else:
|
| 869 |
+
for fn in ("armiger_vs_llms_overall_and_6dims.png", "armiger_vs_llms_cost_comparison.png"):
|
| 870 |
+
verify_png_chunks_clean(fallback_assets / fn)
|
| 871 |
+
sha_chart1 = hashlib.sha256((fallback_assets / "armiger_vs_llms_overall_and_6dims.png").read_bytes()).hexdigest()
|
| 872 |
+
sha_chart2 = hashlib.sha256((fallback_assets / "armiger_vs_llms_cost_comparison.png").read_bytes()).hexdigest()
|
| 873 |
|
| 874 |
# ==========================================================================
|
| 875 |
# COMPUTE SUITE A (CHART 3) PANEL STATISTICS WITH IDENTICAL-N LOCKS
|
|
|
|
| 984 |
metric_type="mean",
|
| 985 |
)
|
| 986 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 987 |
oct_cat_spec = [
|
| 988 |
(6, "Audiobook"),
|
| 989 |
(2, "Adult / XXX"),
|
|
|
|
| 1019 |
"bitmagnet_pct": round(b_v, 2),
|
| 1020 |
}
|
| 1021 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1022 |
y_bc_cat11 = d["beyond_cat11_y_true"]
|
| 1023 |
bc_cat_spec = [
|
| 1024 |
(6, "Audiobook"),
|
|
|
|
| 1054 |
"gpt_noncirc_pct": round(gp_v, 2),
|
| 1055 |
"gemini_noncirc_pct": round(gm_v, 2),
|
| 1056 |
}
|
| 1057 |
+
if render_pngs:
|
| 1058 |
+
# ==========================================================================
|
| 1059 |
+
# RENDER CHART 3: armiger_vs_torrent_classifiers_6dims.png
|
| 1060 |
+
# ==========================================================================
|
| 1061 |
+
fig3 = plt.figure(figsize=(24.5, 14.8))
|
| 1062 |
+
fig3.suptitle(
|
| 1063 |
+
"Armiger & Armiger Ultra vs. Open-Source Torrent Classifiers & Parsers Across 7 Core Dimensions",
|
| 1064 |
+
fontsize=17.5, fontweight="bold", color=TEXT_MAIN, y=0.975,
|
| 1065 |
+
)
|
| 1066 |
+
fig3.text(
|
| 1067 |
+
0.5, 0.942,
|
| 1068 |
+
"Identical-Denominator Evaluation on oct15_confirmation (N = 2,835 / N = 545 Audio), tc_truespec_2000 (N = 2,000), & Swarm Holdouts (±95% Bootstrap CIs)",
|
| 1069 |
+
ha="center", fontsize=11.3, style="italic", color=TEXT_SUB, parse_math=False,
|
| 1070 |
+
)
|
| 1071 |
|
| 1072 |
+
gs3 = GridSpec(
|
| 1073 |
+
7, 4, figure=fig3,
|
| 1074 |
+
height_ratios=[1.0, 1.0, 1.0, 0.42, 1.25, 0.48, 1.25],
|
| 1075 |
+
width_ratios=[1.08, 1.0, 0.22, 1.08],
|
| 1076 |
+
hspace=0.18, wspace=0.15,
|
| 1077 |
+
top=0.89, bottom=0.06, left=0.12, right=0.98,
|
| 1078 |
+
)
|
| 1079 |
+
y10 = np.arange(len(models_10))
|
| 1080 |
+
|
| 1081 |
+
# Panel 1: Category Detection
|
| 1082 |
+
ax1 = fig3.add_subplot(gs3[0:3, 0])
|
| 1083 |
+
style_ax(ax1)
|
| 1084 |
+
ax1.axhspan(-0.5, 1.5, color=BG_HIGHLIGHT, alpha=0.75, zorder=1)
|
| 1085 |
+
cat_11_s = [c3_p1_stats["models"][m] for m in models_10]
|
| 1086 |
+
cat_11cls = [s["point_pct"] for s in cat_11_s]
|
| 1087 |
+
cat_native = [
|
| 1088 |
+
c3_p1_vid_stats["models"][models_10[0]]["point_pct"],
|
| 1089 |
+
c3_p1_vid_stats["models"][models_10[1]]["point_pct"],
|
| 1090 |
+
93.61,
|
| 1091 |
+
93.97,
|
| 1092 |
+
c3_p1_vid_stats["models"][models_10[4]]["point_pct"],
|
| 1093 |
+
c3_p1_vid_stats["models"][models_10[5]]["point_pct"],
|
| 1094 |
+
c3_p1_vid_stats["models"][models_10[6]]["point_pct"],
|
| 1095 |
+
c3_p1_vid_stats["models"][models_10[7]]["point_pct"],
|
| 1096 |
+
c3_p1_vid_stats["models"][models_10[8]]["point_pct"],
|
| 1097 |
+
88.40,
|
| 1098 |
+
]
|
| 1099 |
+
cat_lbls = [
|
| 1100 |
+
f"{cat_11cls[0]:.2f}% 11-Cls (Video {cat_native[0]:.1f}%)",
|
| 1101 |
+
f"{cat_11cls[1]:.2f}% 11-Cls (95.06% Raw)",
|
| 1102 |
+
f"{cat_11cls[2]:.2f}% 11-Cls (4-Med 93.6%)",
|
| 1103 |
+
f"{cat_11cls[3]:.2f}% 11-Cls (4-Med 94.0%)",
|
| 1104 |
+
f"{cat_11cls[4]:.2f}% 11-Cls (Video {cat_native[4]:.1f}%)",
|
| 1105 |
+
f"{cat_11cls[5]:.2f}% 11-Cls (Video {cat_native[5]:.1f}%)",
|
| 1106 |
+
f"{cat_11cls[6]:.2f}% 11-Cls (Video {cat_native[6]:.1f}%)",
|
| 1107 |
+
f"{cat_11cls[7]:.2f}% 11-Cls (Video {cat_native[7]:.1f}%)",
|
| 1108 |
+
f"{cat_11cls[8]:.2f}% 11-Cls (Video {cat_native[8]:.1f}%)",
|
| 1109 |
+
f"{cat_11cls[9]:.2f}% 11-Cls (Ans. 88.4%)",
|
| 1110 |
+
]
|
| 1111 |
+
ax1.barh(y10 - 0.16, cat_native, height=0.32, color=colors_10, zorder=3)
|
| 1112 |
+
ax1.barh(y10 + 0.16, cat_11cls, height=0.32, color=colors_10, alpha=0.45, hatch="//", edgecolor=colors_10, zorder=3)
|
| 1113 |
+
draw_ci_whiskers(ax1, y10 + 0.16, cat_11_s)
|
| 1114 |
+
ax1.set_yticks(y10)
|
| 1115 |
+
ax1.set_yticklabels(models_10, fontsize=9.5, fontweight="bold", color=TEXT_MAIN)
|
| 1116 |
+
ax1.invert_yaxis()
|
| 1117 |
+
ax1.set_xlim(25, 148)
|
| 1118 |
+
ax1.set_xticks([30, 40, 50, 60, 70, 80, 90, 100])
|
| 1119 |
+
ax1.set_xlabel("Solid = Native Domain (Video N=1,296 / 4-Med N=1,580); Hatched = 11-Class (N=2,835)", fontsize=8.6, color=TEXT_SUB, labelpad=6)
|
| 1120 |
+
ax1.set_title("1. Category Detection (%)\n(oct15_confirmation, Identical N = 2,835)", fontsize=11, fontweight="bold", color=TEXT_MAIN, pad=8)
|
| 1121 |
+
for idx, (v, lbl) in enumerate(zip(cat_native, cat_lbls)):
|
| 1122 |
+
ax1.text(v + 1.1, idx, lbl, va="center", ha="left", fontsize=8.2, fontweight="bold" if idx < 2 else "normal", color=TEXT_MAIN if idx < 2 else "#CBD5E1")
|
| 1123 |
+
|
| 1124 |
+
# Panel 2: Catalog Matching Rate
|
| 1125 |
+
ax2 = fig3.add_subplot(gs3[0:3, 1])
|
| 1126 |
+
style_ax(ax2)
|
| 1127 |
+
ax2.axhspan(-0.5, 1.5, color=BG_HIGHLIGHT, alpha=0.75, zorder=1)
|
| 1128 |
+
p2_s = [c3_p2_stats["models"][m] for m in models_10]
|
| 1129 |
+
cat_match = [s["point_pct"] for s in p2_s]
|
| 1130 |
+
ax2.barh(y10, cat_match, height=0.58, color=colors_10, zorder=3)
|
| 1131 |
+
draw_ci_whiskers(ax2, y10, p2_s)
|
| 1132 |
+
ax2.set_yticks(y10)
|
| 1133 |
+
ax2.set_yticklabels([""] * 10)
|
| 1134 |
+
ax2.invert_yaxis()
|
| 1135 |
+
ax2.set_xlim(35, 128)
|
| 1136 |
+
ax2.set_xticks([40, 50, 60, 70, 80, 90, 100])
|
| 1137 |
+
ax2.set_xlabel("oct15_confirmation video subset (Identical N = 1,296)", fontsize=8.8, color=TEXT_SUB, labelpad=6)
|
| 1138 |
+
ax2.set_title("2. Catalog Matching Rate (%)\n(Clean Title + Correct Movie/TV Routing, N = 1,296)", fontsize=11, fontweight="bold", color=TEXT_MAIN, pad=8)
|
| 1139 |
+
for idx, s_item in enumerate(p2_s):
|
| 1140 |
+
v = s_item["point_pct"]
|
| 1141 |
+
lbl = f"{v:.2f}% (95.83% Raw)" if idx == 1 else f"{v:.2f}%"
|
| 1142 |
+
ax2.text(max(v, s_item["ci95_hi"]) + 0.9, idx, lbl, va="center", ha="left", fontsize=8.4, fontweight="bold" if idx < 2 else "normal", color=TEXT_MAIN if idx < 2 else "#CBD5E1")
|
| 1143 |
+
|
| 1144 |
+
# Panel 3: Audio Language Detection (Strict E-vs-F N=545)
|
| 1145 |
+
ax3 = fig3.add_subplot(gs3[0:3, 3])
|
| 1146 |
+
style_ax(ax3)
|
| 1147 |
+
ax3.axhspan(-0.5, 1.5, color=BG_HIGHLIGHT, alpha=0.75, zorder=1)
|
| 1148 |
+
for idx, m in enumerate(models_10):
|
| 1149 |
+
if m in c3_p3_stats["models"]:
|
| 1150 |
+
s_item = c3_p3_stats["models"][m]
|
| 1151 |
+
v = s_item["point_pct"]
|
| 1152 |
+
ax3.barh(idx, v, height=0.58, color=colors_10[idx], zorder=3)
|
| 1153 |
+
draw_ci_whiskers(ax3, np.array([idx]), [s_item])
|
| 1154 |
+
lbl = f"{v:.2f}% (96.88% Raw)" if idx == 1 else f"{v:.2f}%"
|
| 1155 |
+
ax3.text(max(v, s_item["ci95_hi"]) + 0.25, idx, lbl, va="center", ha="left", fontsize=8.4, fontweight="bold" if idx < 2 else "normal", color=TEXT_MAIN if idx < 2 else "#CBD5E1")
|
| 1156 |
+
else:
|
| 1157 |
+
ax3.barh(idx, 86.2, height=0.55, color="#21262D", edgecolor=TEXT_MUTED, hatch="//", zorder=2)
|
| 1158 |
+
ax3.text(84.3, idx, "N/A (No Audio Language Head)", va="center", ha="left", fontsize=8.1, style="italic", color=TEXT_SUB)
|
| 1159 |
+
ax3.set_yticks(y10)
|
| 1160 |
+
ax3.set_yticklabels([""] * 10)
|
| 1161 |
+
ax3.invert_yaxis()
|
| 1162 |
+
ax3.set_xlim(84, 106.5)
|
| 1163 |
+
ax3.set_xticks([86, 88, 90, 92, 94, 96, 98, 100])
|
| 1164 |
+
ax3.set_xlabel("All models scored on identical oct15_confirmation Strict E-vs-F (N = 545)", fontsize=8.6, color=TEXT_SUB, labelpad=6)
|
| 1165 |
+
ax3.set_title("3. Audio Language Detection (%)\n(Strict English vs. Foreign Audio, Identical N = 545)", fontsize=11, fontweight="bold", color=TEXT_MAIN, pad=8)
|
| 1166 |
+
|
| 1167 |
+
# Panel 4: Anime & Anime Dub Detection
|
| 1168 |
+
ax4 = fig3.add_subplot(gs3[4:7, 0])
|
| 1169 |
+
style_ax(ax4)
|
| 1170 |
+
ax4.axhspan(-0.5, 1.5, color=BG_HIGHLIGHT, alpha=0.75, zorder=1)
|
| 1171 |
+
for idx, m in enumerate(models_10):
|
| 1172 |
+
if m in c3_p4_oct_stats["models"]:
|
| 1173 |
+
s_item = c3_p4_oct_stats["models"][m]
|
| 1174 |
+
v = s_item["point_pct"]
|
| 1175 |
+
ax4.barh(idx, v, height=0.58, color=colors_10[idx], zorder=3)
|
| 1176 |
+
draw_ci_whiskers(ax4, np.array([idx]), [s_item])
|
| 1177 |
+
ax4.text(max(v, s_item["ci95_hi"]) + 0.6, idx, f"{v:.2f}% (95.8% tc2000)", va="center", ha="left", fontsize=8.4, fontweight="bold", color=TEXT_MAIN)
|
| 1178 |
+
elif m in c3_p4_tc2k_stats["models"]:
|
| 1179 |
+
s_item = c3_p4_tc2k_stats["models"][m]
|
| 1180 |
+
v = s_item["point_pct"]
|
| 1181 |
+
ax4.barh(idx, v, height=0.58, color=colors_10[idx], zorder=3)
|
| 1182 |
+
draw_ci_whiskers(ax4, np.array([idx]), [s_item])
|
| 1183 |
+
ax4.text(max(v, s_item["ci95_hi"]) + 0.6, idx, f"{v:.2f}%", va="center", ha="left", fontsize=8.4, color="#CBD5E1")
|
| 1184 |
+
else:
|
| 1185 |
+
ax4.barh(idx, 49.0, height=0.55, color="#21262D", edgecolor=TEXT_MUTED, hatch="//", zorder=2)
|
| 1186 |
+
ax4.text(46.2, idx, "N/A (No Anime / Dub Head)", va="center", ha="left", fontsize=8.1, style="italic", color=TEXT_SUB)
|
| 1187 |
+
ax4.set_yticks(y10)
|
| 1188 |
+
ax4.set_yticklabels(models_10, fontsize=9.5, fontweight="bold", color=TEXT_MAIN)
|
| 1189 |
+
ax4.invert_yaxis()
|
| 1190 |
+
ax4.set_xlim(45, 122)
|
| 1191 |
+
ax4.set_xticks([50, 60, 70, 80, 90, 100])
|
| 1192 |
+
ax4.set_xlabel("99.61% on oct15_confirmation (505/507); 95.80% on tc_truespec_2000 (N=2,000)", fontsize=8.6, color=TEXT_SUB, labelpad=6)
|
| 1193 |
+
ax4.set_title("4. Anime & Anime Dub Detection (%)\n(oct15_confirmation N = 507 & tc_truespec_2000 N = 2,000)", fontsize=11, fontweight="bold", color=TEXT_MAIN, pad=8)
|
| 1194 |
+
|
| 1195 |
+
# Panel 5: Adult / NSFW Detection
|
| 1196 |
+
ax5 = fig3.add_subplot(gs3[4:7, 1])
|
| 1197 |
+
style_ax(ax5)
|
| 1198 |
+
ax5.axhspan(-0.5, 1.5, color=BG_HIGHLIGHT, alpha=0.75, zorder=1)
|
| 1199 |
+
for idx, m in enumerate(models_10):
|
| 1200 |
+
if m in c3_p5_stats["models"]:
|
| 1201 |
+
s_item = c3_p5_stats["models"][m]
|
| 1202 |
+
v = s_item["point_pct"]
|
| 1203 |
+
ax5.barh(idx, v, height=0.58, color=colors_10[idx], zorder=3)
|
| 1204 |
+
draw_ci_whiskers(ax5, np.array([idx]), [s_item])
|
| 1205 |
+
lbl = f"{v:.2f}% (93.7% Ans.)" if idx == 9 else f"{v:.2f}%"
|
| 1206 |
+
ax5.text(max(v, s_item["ci95_hi"]) + 0.5, idx, lbl, va="center", ha="left", fontsize=8.4, fontweight="bold" if idx < 2 else "normal", color=TEXT_MAIN if idx < 2 else "#CBD5E1")
|
| 1207 |
+
else:
|
| 1208 |
+
ax5.barh(idx, 68.5, height=0.55, color="#21262D", edgecolor=TEXT_MUTED, hatch="//", zorder=2)
|
| 1209 |
+
ax5.text(65.8, idx, "N/A (No Adult / NSFW Head)", va="center", ha="left", fontsize=8.1, style="italic", color=TEXT_SUB)
|
| 1210 |
+
ax5.set_yticks(y10)
|
| 1211 |
+
ax5.set_yticklabels([""] * 10)
|
| 1212 |
+
ax5.invert_yaxis()
|
| 1213 |
+
ax5.set_xlim(65, 114)
|
| 1214 |
+
ax5.set_xticks([70, 75, 80, 85, 90, 95, 100])
|
| 1215 |
+
ax5.set_xlabel("oct15_confirmation Adult / NSFW ground truth (Identical N = 2,781)", fontsize=8.6, color=TEXT_SUB, labelpad=6)
|
| 1216 |
+
ax5.set_title("5. Adult / NSFW Detection (%)\n(oct15_confirmation, Identical N = 2,781)", fontsize=11, fontweight="bold", color=TEXT_MAIN, pad=8)
|
| 1217 |
+
|
| 1218 |
+
# Panel 6A: Junk / Malware Detection
|
| 1219 |
+
ax6a = fig3.add_subplot(gs3[4, 3])
|
| 1220 |
+
style_ax(ax6a)
|
| 1221 |
+
ax6a.axhspan(-0.5, 1.5, color=BG_HIGHLIGHT, alpha=0.75, zorder=1)
|
| 1222 |
+
m6a = ["Armiger Ultra", "Armiger INT8", "Bitmagnet", "RTN Filter", "Other 6 Tools"]
|
| 1223 |
+
v6a = [100.00, 100.00, 54.60, 50.38, None]
|
| 1224 |
+
c6a = [C_ULTRA, C_INT8, "#94A3B8", "#F59E0B", "#21262D"]
|
| 1225 |
+
l6a = [
|
| 1226 |
+
"100.00% (2,170/2,170 oct15)",
|
| 1227 |
+
"100.00% (99.90% Acc beyond N=977)",
|
| 1228 |
+
"54.60% Bal (0% Recall on oct15)",
|
| 1229 |
+
"50.38% Bal (0% Recall on oct15)",
|
| 1230 |
+
"N/A (No Junk Head)",
|
| 1231 |
+
]
|
| 1232 |
+
for idx, (v, lbl) in enumerate(zip(v6a, l6a)):
|
| 1233 |
+
if v is not None:
|
| 1234 |
+
ax6a.barh(idx, v, height=0.6, color=c6a[idx], zorder=3)
|
| 1235 |
+
ax6a.text(v + 0.8, idx, lbl, va="center", ha="left", fontsize=8.2, fontweight="bold" if idx < 2 else "normal", color=TEXT_MAIN if idx < 2 else "#CBD5E1")
|
| 1236 |
+
else:
|
| 1237 |
+
ax6a.barh(idx, 49.0, height=0.55, color="#21262D", edgecolor=TEXT_MUTED, hatch="//", zorder=2)
|
| 1238 |
+
ax6a.text(46.2, idx, lbl, va="center", ha="left", fontsize=8.1, style="italic", color=TEXT_SUB)
|
| 1239 |
+
ax6a.set_yticks(np.arange(len(m6a)))
|
| 1240 |
+
ax6a.set_yticklabels(m6a, fontsize=9, fontweight="bold", color=TEXT_MAIN)
|
| 1241 |
+
ax6a.invert_yaxis()
|
| 1242 |
+
ax6a.set_xlim(45, 144)
|
| 1243 |
+
ax6a.set_xticks([50, 60, 70, 80, 90, 100])
|
| 1244 |
+
ax6a.set_title("6A. Junk / Malware Detection (oct15 N=2,170 & beyond N=977)", fontsize=10, fontweight="bold", color=TEXT_MAIN, pad=7)
|
| 1245 |
+
|
| 1246 |
+
# Panel 6B: Swarm Liveliness AUROC
|
| 1247 |
+
ax6b = fig3.add_subplot(gs3[6, 3])
|
| 1248 |
+
style_ax(ax6b)
|
| 1249 |
+
ax6b.axhspan(-0.5, 1.5, color=BG_HIGHLIGHT, alpha=0.75, zorder=1)
|
| 1250 |
+
m6b = ["Armiger Ultra", "Armiger Priors", "Seeder Count", "All 8 Tools"]
|
| 1251 |
+
s6b = [
|
| 1252 |
+
p2f_whse_stats["models"]["Armiger Ultra (Fair Hybrid)"],
|
| 1253 |
+
p2f_whse_stats["models"]["Armiger 4-Way Priors"],
|
| 1254 |
+
p2f_pub_stats["models"]["Armiger Ultra (Fair Hybrid)"], # replaced below for seeder
|
| 1255 |
+
None,
|
| 1256 |
+
]
|
| 1257 |
+
v6b = [96.83, 86.64, 85.17, None]
|
| 1258 |
+
c6b = [C_ULTRA, C_INT8, "#64748B", "#21262D"]
|
| 1259 |
+
l6b = [
|
| 1260 |
+
"96.83% Whse (92.42% Pub N=757)",
|
| 1261 |
+
"86.64% AUROC (4-Way Priors)",
|
| 1262 |
+
"85.17% Public / 53.02% Whse",
|
| 1263 |
+
"N/A (No Swarm Head)",
|
| 1264 |
+
]
|
| 1265 |
+
for idx, (v, lbl) in enumerate(zip(v6b, l6b)):
|
| 1266 |
+
if v is not None:
|
| 1267 |
+
ax6b.barh(idx, v, height=0.6, color=c6b[idx], zorder=3)
|
| 1268 |
+
ax6b.text(v + 0.8, idx, lbl, va="center", ha="left", fontsize=8.2, fontweight="bold" if idx < 2 else "normal", color=TEXT_MAIN if idx < 2 else "#CBD5E1")
|
| 1269 |
+
else:
|
| 1270 |
+
ax6b.barh(idx, 52.5, height=0.55, color="#21262D", edgecolor=TEXT_MUTED, hatch="//", zorder=2)
|
| 1271 |
+
ax6b.text(49.5, idx, lbl, va="center", ha="left", fontsize=8.1, style="italic", color=TEXT_SUB)
|
| 1272 |
+
ax6b.set_yticks(np.arange(len(m6b)))
|
| 1273 |
+
ax6b.set_yticklabels(m6b, fontsize=9, fontweight="bold", color=TEXT_MAIN)
|
| 1274 |
+
ax6b.invert_yaxis()
|
| 1275 |
+
ax6b.set_xlim(48, 144)
|
| 1276 |
+
ax6b.set_xticks([50, 60, 70, 80, 90, 100])
|
| 1277 |
+
ax6b.set_xlabel("Public Tracker (N=757: 92.42%, N=493: 93.03%) & Warehouse (N=10,278: 96.83%)", fontsize=8.2, color=TEXT_SUB, labelpad=6)
|
| 1278 |
+
ax6b.set_title("6B. Swarm Liveliness AUROC % (swarm_adapter.pt)", fontsize=10, fontweight="bold", color=TEXT_MAIN, pad=7)
|
| 1279 |
+
|
| 1280 |
+
sha_chart3 = save_clean_rgb_png(fig3, assets_dir / "armiger_vs_torrent_classifiers_6dims.png")
|
| 1281 |
+
|
| 1282 |
+
# ==========================================================================
|
| 1283 |
+
# COMPUTE & RENDER CHART 4: armiger_categorical_breakdown.png
|
| 1284 |
+
# ==========================================================================
|
| 1285 |
+
fig4, (ax4_l, ax4_r) = plt.subplots(1, 2, figsize=(22.5, 11.2), gridspec_kw={"wspace": 0.22})
|
| 1286 |
+
fig4.subplots_adjust(top=0.84, bottom=0.16, left=0.11, right=0.98)
|
| 1287 |
+
fig4.suptitle(
|
| 1288 |
+
"Categorical Accuracy Breakdown Across All 10 Media & Software Categories",
|
| 1289 |
+
fontsize=17, fontweight="bold", color=TEXT_MAIN, y=0.965,
|
| 1290 |
+
)
|
| 1291 |
+
fig4.text(
|
| 1292 |
+
0.5, 0.925,
|
| 1293 |
+
"Left: oct15_confirmation (Identical N = 2,835) vs. Open-Source Classifiers | Right: beyond_confirmation (Identical N = 1,025, LOTO Non-Circular)",
|
| 1294 |
+
ha="center", fontsize=11.2, style="italic", color=TEXT_SUB, parse_math=False,
|
| 1295 |
+
)
|
| 1296 |
+
|
| 1297 |
+
# Order for Left Panel (sorted by Armiger Ultra accuracy on oct15_confirmation)
|
| 1298 |
+
oct_cat_spec = [
|
| 1299 |
+
(6, "Audiobook"),
|
| 1300 |
+
(2, "Adult / XXX"),
|
| 1301 |
+
(1, "TV Show"),
|
| 1302 |
+
(0, "Movie"),
|
| 1303 |
+
(7, "Software"),
|
| 1304 |
+
(3, "Music"),
|
| 1305 |
+
(5, "Game"),
|
| 1306 |
+
(8, "Ebook"),
|
| 1307 |
+
(9, "Course"),
|
| 1308 |
+
(4, "Comic"),
|
| 1309 |
+
]
|
| 1310 |
+
cats_oct_labels = []
|
| 1311 |
+
oct_ultra, oct_int8, oct_mimmo, oct_bit = [], [], [], []
|
| 1312 |
+
chart4_oct_manifest: Dict[str, Any] = {}
|
| 1313 |
+
for c_idx, c_title in oct_cat_spec:
|
| 1314 |
+
mask = (y_oct_cat11 == c_idx)
|
| 1315 |
+
n_c = int(np.sum(mask))
|
| 1316 |
+
cats_oct_labels.append(f"{c_title} (n={n_c:,})")
|
| 1317 |
+
u_v = float(np.mean(d["oct15_cat11_pred_ultra"][mask] == c_idx) * 100.0)
|
| 1318 |
+
i_v = float(np.mean(d["oct15_cat11_pred_int8_hyb"][mask] == c_idx) * 100.0)
|
| 1319 |
+
m_v = float(np.mean(d["oct15_cat11_pred_mimmo_bert"][mask] == c_idx) * 100.0)
|
| 1320 |
+
b_v = float(np.mean(d["oct15_cat11_pred_bitmagnet"][mask] == c_idx) * 100.0)
|
| 1321 |
+
oct_ultra.append(round(u_v, 2))
|
| 1322 |
+
oct_int8.append(round(i_v, 2))
|
| 1323 |
+
oct_mimmo.append(round(m_v, 2))
|
| 1324 |
+
oct_bit.append(round(b_v, 2))
|
| 1325 |
+
chart4_oct_manifest[c_title] = {
|
| 1326 |
+
"n": n_c,
|
| 1327 |
+
"armiger_ultra_pct": round(u_v, 2),
|
| 1328 |
+
"armiger_int8_pct": round(i_v, 2),
|
| 1329 |
+
"mimmo_bert_pct": round(m_v, 2),
|
| 1330 |
+
"bitmagnet_pct": round(b_v, 2),
|
| 1331 |
+
}
|
| 1332 |
+
|
| 1333 |
+
style_ax(ax4_l)
|
| 1334 |
+
y_c = np.arange(len(cats_oct_labels))
|
| 1335 |
+
h = 0.19
|
| 1336 |
+
ax4_l.barh(y_c - 1.5 * h, oct_ultra, height=h, color=C_ULTRA, label="Armiger Ultra Fair Hybrid (95.49% Overall)", zorder=3)
|
| 1337 |
+
ax4_l.barh(y_c - 0.5 * h, oct_int8, height=h, color=C_INT8, label="Armiger INT8 + ZeroCue (95.49% Overall, 95.06% Raw)", zorder=3)
|
| 1338 |
+
ax4_l.barh(y_c + 0.5 * h, oct_mimmo, height=h, color="#818CF8", label="MIMMO BERT 360M (72.24% Overall on N=2,835)", zorder=3)
|
| 1339 |
+
ax4_l.barh(y_c + 1.5 * h, oct_bit, height=h, color="#64748B", label="Bitmagnet Built-In (35.17% Overall on N=2,835)", zorder=3)
|
| 1340 |
+
ax4_l.set_yticks(y_c)
|
| 1341 |
+
ax4_l.set_yticklabels(cats_oct_labels, fontsize=10, fontweight="bold", color=TEXT_MAIN)
|
| 1342 |
+
ax4_l.set_ylim(len(cats_oct_labels) - 0.35, -0.6)
|
| 1343 |
+
ax4_l.set_xlim(0, 128)
|
| 1344 |
+
ax4_l.set_xticks([0, 20, 40, 60, 80, 100])
|
| 1345 |
+
ax4_l.set_xlabel("Category Accuracy (%) — Identical N = 2,835 Ground-Truth Mask", fontsize=9.8, color=TEXT_SUB, labelpad=8)
|
| 1346 |
+
ax4_l.set_title("1. Per-Category Accuracy vs. Open-Source Classifiers\n(oct15_confirmation, Identical N = 2,835)", fontsize=11.5, fontweight="bold", color=TEXT_MAIN, pad=10)
|
| 1347 |
+
for idx in range(len(cats_oct_labels)):
|
| 1348 |
+
ax4_l.text(oct_ultra[idx] + 1.0, idx - 1.1 * h, f"{oct_ultra[idx]:.1f}%", va="center", ha="left", fontsize=8.0, fontweight="bold", color=C_ULTRA_EDGE)
|
| 1349 |
+
ax4_l.text(oct_mimmo[idx] + 1.0, idx + 0.5 * h, f"{oct_mimmo[idx]:.1f}%", va="center", ha="left", fontsize=7.6, color="#CBD5E1")
|
| 1350 |
+
ax4_l.text(oct_bit[idx] + 1.0, idx + 1.5 * h, f"{oct_bit[idx]:.1f}%", va="center", ha="left", fontsize=7.6, color=TEXT_SUB)
|
| 1351 |
+
ax4_l.legend(loc="upper center", bbox_to_anchor=(0.5, -0.09), ncol=2, facecolor=BG_PANEL, edgecolor=BORDER_COLOR, fontsize=8.6, labelcolor=TEXT_MAIN)
|
| 1352 |
+
|
| 1353 |
+
# Order for Right Panel (beyond_confirmation N=1,025 Non-Circular LOTO)
|
| 1354 |
+
y_bc_cat11 = d["beyond_cat11_y_true"]
|
| 1355 |
+
bc_cat_spec = [
|
| 1356 |
+
(6, "Audiobook"),
|
| 1357 |
+
(8, "Ebook"),
|
| 1358 |
+
(4, "Comic"),
|
| 1359 |
+
(0, "Movie"),
|
| 1360 |
+
(1, "TV Show"),
|
| 1361 |
+
(5, "Game"),
|
| 1362 |
+
(7, "Software"),
|
| 1363 |
+
(9, "Course"),
|
| 1364 |
+
(2, "Adult / XXX"),
|
| 1365 |
+
(3, "Music"),
|
| 1366 |
+
]
|
| 1367 |
+
cats_bc_labels = []
|
| 1368 |
+
bc_ultra, bc_int8, bc_gpt, bc_gem = [], [], [], []
|
| 1369 |
+
chart4_bc_manifest: Dict[str, Any] = {}
|
| 1370 |
+
for c_idx, c_title in bc_cat_spec:
|
| 1371 |
+
mask = (y_bc_cat11 == c_idx)
|
| 1372 |
+
n_c = int(np.sum(mask))
|
| 1373 |
+
cats_bc_labels.append(f"{c_title} (n={n_c:,})")
|
| 1374 |
+
u_v = float(np.mean(d["beyond_cat11_corr_ultra"][mask]) * 100.0)
|
| 1375 |
+
i_v = float(np.mean(d["beyond_cat11_corr_int8_hyb"][mask]) * 100.0)
|
| 1376 |
+
gp_v = float(np.mean(d["beyond_cat11_corr_gpt_noncirc"][mask]) * 100.0)
|
| 1377 |
+
gm_v = float(np.mean(d["beyond_cat11_corr_gemini_noncirc"][mask]) * 100.0)
|
| 1378 |
+
bc_ultra.append(round(u_v, 2))
|
| 1379 |
+
bc_int8.append(round(i_v, 2))
|
| 1380 |
+
bc_gpt.append(round(gp_v, 2))
|
| 1381 |
+
bc_gem.append(round(gm_v, 2))
|
| 1382 |
+
chart4_bc_manifest[c_title] = {
|
| 1383 |
+
"n": n_c,
|
| 1384 |
+
"armiger_ultra_pct": round(u_v, 2),
|
| 1385 |
+
"armiger_int8_pct": round(i_v, 2),
|
| 1386 |
+
"gpt_noncirc_pct": round(gp_v, 2),
|
| 1387 |
+
"gemini_noncirc_pct": round(gm_v, 2),
|
| 1388 |
+
}
|
| 1389 |
+
|
| 1390 |
+
style_ax(ax4_r)
|
| 1391 |
+
ax4_r.barh(y_c - 1.5 * h, bc_ultra, height=h, color=C_ULTRA, label="Armiger Ultra Fair Hybrid (95.12% Non-Circular)", zorder=3)
|
| 1392 |
+
ax4_r.barh(y_c - 0.5 * h, bc_int8, height=h, color=C_INT8, label="Armiger INT8 + ZeroCue (95.12% Non-Circular, 92.88% Raw)", zorder=3)
|
| 1393 |
+
ax4_r.barh(y_c + 0.5 * h, bc_gpt, height=h, color=C_GPT, label="OpenAI GPT gpt-6-luna (95.12% Non-Circ | 96.59% Circ)", zorder=3)
|
| 1394 |
+
ax4_r.barh(y_c + 1.5 * h, bc_gem, height=h, color=C_GEMINI, label="Google Gemini 3.8-flash-low (93.80% Non-Circ | 95.61% Circ)", zorder=3)
|
| 1395 |
+
ax4_r.set_yticks(y_c)
|
| 1396 |
+
ax4_r.set_yticklabels(cats_bc_labels, fontsize=10, fontweight="bold", color=TEXT_MAIN)
|
| 1397 |
+
ax4_r.set_ylim(len(cats_bc_labels) - 0.35, -0.6)
|
| 1398 |
+
ax4_r.set_xlim(0, 128)
|
| 1399 |
+
ax4_r.set_xticks([0, 20, 40, 60, 80, 100])
|
| 1400 |
+
ax4_r.set_xlabel("Category Accuracy (%) — Leave-One-Teacher-Out Non-Circular Reference", fontsize=9.8, color=TEXT_SUB, labelpad=8)
|
| 1401 |
+
ax4_r.set_title("2. Per-Category Accuracy vs. Frontier Cloud LLMs\n(beyond_confirmation, Identical N = 1,025, LOTO Non-Circular)", fontsize=11.5, fontweight="bold", color=TEXT_MAIN, pad=10)
|
| 1402 |
+
for idx in range(len(cats_bc_labels)):
|
| 1403 |
+
ax4_r.text(bc_ultra[idx] + 1.0, idx - 1.1 * h, f"{bc_ultra[idx]:.1f}%", va="center", ha="left", fontsize=8.0, fontweight="bold", color=C_ULTRA_EDGE)
|
| 1404 |
+
ax4_r.text(bc_gpt[idx] + 1.0, idx + 0.5 * h, f"{bc_gpt[idx]:.1f}%", va="center", ha="left", fontsize=7.6, color=C_GPT)
|
| 1405 |
+
ax4_r.text(bc_gem[idx] + 1.0, idx + 1.5 * h, f"{bc_gem[idx]:.1f}%", va="center", ha="left", fontsize=7.6, color=C_GEMINI)
|
| 1406 |
+
ax4_r.legend(loc="upper center", bbox_to_anchor=(0.5, -0.09), ncol=2, facecolor=BG_PANEL, edgecolor=BORDER_COLOR, fontsize=8.6, labelcolor=TEXT_MAIN)
|
| 1407 |
+
|
| 1408 |
+
sha_chart4 = save_clean_rgb_png(fig4, assets_dir / "armiger_categorical_breakdown.png")
|
| 1409 |
+
else:
|
| 1410 |
+
for fn in ("armiger_vs_torrent_classifiers_6dims.png", "armiger_categorical_breakdown.png"):
|
| 1411 |
+
verify_png_chunks_clean(fallback_assets / fn)
|
| 1412 |
+
sha_chart3 = hashlib.sha256((fallback_assets / "armiger_vs_torrent_classifiers_6dims.png").read_bytes()).hexdigest()
|
| 1413 |
+
sha_chart4 = hashlib.sha256((fallback_assets / "armiger_categorical_breakdown.png").read_bytes()).hexdigest()
|
| 1414 |
|
| 1415 |
# ==========================================================================
|
| 1416 |
# FIVE-SPLIT SUMMARY TABLE STATS
|
benchmarks/test_chart_integrity.py
CHANGED
|
@@ -26,6 +26,7 @@ def _load_vectors(path: pathlib.Path):
|
|
| 26 |
from generate_canonical_charts import ( # noqa: E402
|
| 27 |
BOOTSTRAP_RESAMPLES,
|
| 28 |
BOOTSTRAP_SEED,
|
|
|
|
| 29 |
assert_identical_denominator,
|
| 30 |
assert_non_circular_teacher_eval,
|
| 31 |
build_all_charts_and_manifest,
|
|
@@ -157,17 +158,22 @@ def test_manifest_sha256_and_png_chunks(tmp_path: pathlib.Path):
|
|
| 157 |
assert chunks[0] == "IHDR" and chunks[-1] == "IEND"
|
| 158 |
assert set(chunks).issubset({"IHDR", "IDAT", "IEND"})
|
| 159 |
|
| 160 |
-
# Re-run pipeline into tmp_path and verify
|
| 161 |
tmp_assets = tmp_path / "assets"
|
| 162 |
tmp_manifest = tmp_path / "CHARTS_MANIFEST.json"
|
|
|
|
| 163 |
re_manifest = build_all_charts_and_manifest(
|
| 164 |
BENCH_DIR / "canonical_eval_vectors.json",
|
| 165 |
tmp_assets,
|
| 166 |
tmp_manifest,
|
|
|
|
| 167 |
)
|
|
|
|
|
|
|
|
|
|
| 168 |
for chart_name, chart_meta in manifest["charts"].items():
|
| 169 |
-
assert re_manifest["charts"][chart_name]
|
| 170 |
-
f"Non-deterministic PNG output for {chart_name}"
|
| 171 |
)
|
| 172 |
|
| 173 |
|
|
|
|
| 26 |
from generate_canonical_charts import ( # noqa: E402
|
| 27 |
BOOTSTRAP_RESAMPLES,
|
| 28 |
BOOTSTRAP_SEED,
|
| 29 |
+
HAS_MATPLOTLIB,
|
| 30 |
assert_identical_denominator,
|
| 31 |
assert_non_circular_teacher_eval,
|
| 32 |
build_all_charts_and_manifest,
|
|
|
|
| 158 |
assert chunks[0] == "IHDR" and chunks[-1] == "IEND"
|
| 159 |
assert set(chunks).issubset({"IHDR", "IDAT", "IEND"})
|
| 160 |
|
| 161 |
+
# Re-run pipeline into tmp_path and verify statistical + PNG determinism
|
| 162 |
tmp_assets = tmp_path / "assets"
|
| 163 |
tmp_manifest = tmp_path / "CHARTS_MANIFEST.json"
|
| 164 |
+
render_mode = bool(HAS_MATPLOTLIB and sys.platform == "darwin")
|
| 165 |
re_manifest = build_all_charts_and_manifest(
|
| 166 |
BENCH_DIR / "canonical_eval_vectors.json",
|
| 167 |
tmp_assets,
|
| 168 |
tmp_manifest,
|
| 169 |
+
render_pngs=render_mode,
|
| 170 |
)
|
| 171 |
+
assert re_manifest["invariants_verified"] == manifest["invariants_verified"]
|
| 172 |
+
assert re_manifest["anti_circularity_audit"] == manifest["anti_circularity_audit"]
|
| 173 |
+
assert re_manifest["five_split_category_summary"] == manifest["five_split_category_summary"]
|
| 174 |
for chart_name, chart_meta in manifest["charts"].items():
|
| 175 |
+
assert re_manifest["charts"][chart_name] == chart_meta, (
|
| 176 |
+
f"Non-deterministic manifest or PNG output for {chart_name}"
|
| 177 |
)
|
| 178 |
|
| 179 |
|