# ========================================================= # Academic-style Ablation Figure # ========================================================= import matplotlib.pyplot as plt import numpy as np import csv configs = [ "Biomni\n(Baseline)", "+MCP\nInfra.", "+MCP Infra.\n+Graph-Scale\nPlanning", ] # 仅更新此处的数字,完全对齐表格中的最新数据 metrics = { "BioAgentBench": [39.67, 42.68, 46.84], "LAB-Bench DbQA": [57.46, 66.35, 67.29], "LAB-Bench SeqQA": [84.76, 89.84, 90.48], } # ========================================================= # Muted academic palette # ========================================================= fill_colors = [ "#E5E7EB", # soft gray "#D6E4F0", # muted blue "#E8D6DC", # muted wine ] edge_colors = [ "#6B7280", "#4B6A88", "#8A3D5D", ] # ========================================================= # Style # ========================================================= plt.rcParams.update( { "font.family": "DejaVu Sans", "font.size": 10, "axes.titlesize": 12, "xtick.labelsize": 9, "ytick.labelsize": 9.5, "pdf.fonttype": 42, "ps.fonttype": 42, } ) fig, axes = plt.subplots( 1, 3, figsize=(9.0, 3.05), sharey=True, ) y = np.arange(len(configs)) for idx, (ax, (title, values)) in enumerate(zip(axes, metrics.items())): values = np.array(values) baseline = values[0] # Reviewer-facing revision: use a zero-based axis for all panels. ax.set_xlim(0, 100) # subtle baseline reference ax.axvline( baseline, color="#C7CCD4", linestyle="--", linewidth=0.9, zorder=1, ) for i, val in enumerate(values): # main bar ax.barh( y[i], val, left=0, height=0.42, color=fill_colors[i], edgecolor=edge_colors[i], linewidth=1.15, zorder=3, ) # subtle inner highlight ax.barh( y[i], val * 0.52, left=0, height=0.42, color="white", alpha=0.12, linewidth=0, zorder=4, ) # Absolute score and delta are printed directly to avoid relying on # visual distance alone. delta = val - baseline label = f"{val:.1f}" if i == 0 else f"{val:.1f} (+{delta:.1f})" ax.text( min(val + 1.6, 98.5), y[i], label, ha="left", va="center", fontsize=9.2, color=edge_colors[i], fontweight="bold" if i == 2 else "normal", ) # panel title ax.set_title(title, pad=7, fontweight="bold") ax.set_xticks([0, 25, 50, 75, 100]) ax.set_xlabel("Score (%)") ax.grid(axis="x", color="#E5E7EB", linewidth=0.8, zorder=0) # minimal style ax.spines["top"].set_visible(False) ax.spines["right"].set_visible(False) ax.spines["bottom"].set_color("#D1D5DB") ax.spines["bottom"].set_linewidth(0.8) ax.spines["left"].set_color("#D1D5DB") ax.spines["left"].set_linewidth(0.8) if idx == 0: ax.set_yticks(y) ax.set_yticklabels(configs) else: ax.tick_params(axis="y", left=False, labelleft=False) # top-to-bottom axes[0].invert_yaxis() # ========================================================= # Figure title # ========================================================= fig.suptitle( "Ablation of MCP Infrastructure and Graph Planning", fontsize=13.5, fontweight="bold", y=1.02, ) # ========================================================= # Layout # ========================================================= fig.subplots_adjust( left=0.16, right=0.985, top=0.72, bottom=0.22, wspace=0.18, ) # ========================================================= # Save # ========================================================= fig.savefig("ablation_academic.pdf", bbox_inches="tight") fig.savefig("ablation_academic.png", dpi=500, bbox_inches="tight") fig.savefig("ablation_academic.svg", bbox_inches="tight") with open("ablation_absolute_scores_and_deltas.csv", "w", newline="") as handle: writer = csv.writer(handle) writer.writerow(["benchmark", "method", "score", "delta_vs_biomni"]) for benchmark, values in metrics.items(): baseline = values[0] for method, score in zip(configs, values): writer.writerow( [ benchmark, " ".join(method.split()), f"{score:.2f}", f"{score - baseline:.2f}", ] )