RAM_Altman_GPT / src /plot_benchmarks.py
brunuu's picture
Add benchmarks: RAM-ALTMAN vs Claude Fable 5.2 and GPT-6.2 Astra
2fd37dd verified
Raw History Blame Contribute Delete
8.56 kB
"""Draw the benchmark charts for the model card.
python src/plot_benchmarks.py # needs benchmarks/terminal_bench_results.json
Writes assets/benchmarks.png, assets/attention_span.png, assets/context_to_scale.png.
"""
import json
import random
import statistics
from pathlib import Path
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
from config import PROJECT_ROOT
OUT = PROJECT_ROOT / "assets"
RESULTS = PROJECT_ROOT / "benchmarks" / "terminal_bench_results.json"
# palette: categorical slots 1-3, validated all-pairs (light). Slot 3 is < 3:1, so every bar is labeled.
SURFACE, INK, INK2, MUTED, GRID = "#fcfcfb", "#0b0b0b", "#52514e", "#8a8984", "#e8e7e2"
FABLE, GPT, RAM = "#2a78d6", "#eb6834", "#1baf7a"
NOFIT = "#c9c8c2"
CTX = 379
# Published numbers (see MODEL_CARD.md for sources). None = RAM_Altman_GPT's result, drawn as text.
BENCHES = [
("Terminal-Bench 4.0", "% tasks solved", 100, [67.6, 63.1, 0.0], ["67.6%", "63.1%", "0%"]),
("Terminal-Bench-Science 0.1", "% tasks solved (approx.)", 100, [73, 77, None], ["~73%", "~77%", "DNF"]),
("Artificial Analysis\nIntelligence Index", "index points", 70, [65, 62, None], ["65", "62", "NOT RATED"]),
]
MODELS = [("Claude Fable 5.2", FABLE), ("GPT-6.2 Astra", GPT), ("RAM_Altman_GPT", RAM)]
RAM_NOTES = ["couldn't read 62 of 66 tasks", "0 of 70 tasks fit in its brain", "they couldn't find enough RAM"]
plt.rcParams.update({
"font.family": ["Segoe UI", "Inter", "Helvetica", "Arial", "DejaVu Sans"],
"font.size": 10, "text.color": INK, "axes.labelcolor": INK2,
"xtick.color": MUTED, "ytick.color": INK, "axes.edgecolor": GRID,
"figure.facecolor": SURFACE, "axes.facecolor": SURFACE, "savefig.facecolor": SURFACE,
})
def bar(ax, y, value, height, color):
if value > 0:
ax.add_patch(Rectangle((0, y - height / 2), value, height, fc=color, ec="none", zorder=3))
def style_axis(ax, xmax):
ax.set_xlim(0, xmax)
for side in ("top", "right", "left"):
ax.spines[side].set_visible(False)
ax.spines["bottom"].set_color(GRID)
ax.tick_params(axis="x", length=0, labelsize=8.5)
ax.tick_params(axis="y", length=0)
ax.grid(axis="x", color=GRID, linewidth=0.8, zorder=0)
ax.set_axisbelow(True)
def header(fig, title, subtitle):
fig.text(0.035, 0.94, title, fontsize=17, fontweight="bold", va="top")
fig.text(0.035, 0.865, subtitle, fontsize=10.5, color=INK2, va="top")
def footer(fig, text):
fig.text(0.035, 0.03, text, fontsize=7.5, color=MUTED, va="bottom")
def chart_benchmarks():
fig, axes = plt.subplots(1, 3, figsize=(12, 4.6), dpi=200, sharey=True)
fig.subplots_adjust(left=0.135, right=0.985, top=0.70, bottom=0.17, wspace=0.12)
header(fig, "RAM_Altman_GPT vs. the frontier",
"Published scores of the two newest frontier models, next to a 100,000-parameter model that only wants RAM.")
ys = [2, 1, 0]
for ax, (name, unit, xmax, values, labels) in zip(axes, BENCHES):
style_axis(ax, xmax)
ax.set_ylim(-0.6, 2.6)
ax.set_title(name, loc="left", fontsize=11, fontweight="bold", pad=10)
ax.set_xlabel(unit, fontsize=8.5, color=MUTED, labelpad=6)
fig.canvas.draw()
for (model, color), y, v, lab in zip(MODELS, ys, values, labels):
if model == "RAM_Altman_GPT":
if v:
bar(ax, y, v, 0.42, color)
ax.text(xmax * 0.015, y + 0.07, lab, fontsize=13, fontweight="bold", color=INK, va="center", zorder=4)
ax.text(xmax * 0.015, y - 0.30, RAM_NOTES[BENCHES.index((name, unit, xmax, values, labels))],
fontsize=8, color=INK2, va="center", style="italic", zorder=4)
else:
bar(ax, y, v, 0.42, color)
ax.text(v + xmax * 0.015, y, lab, fontsize=9.5, color=INK, va="center", zorder=4)
axes[0].set_yticks(ys, [m for m, _ in MODELS])
for tick, (model, color) in zip(axes[0].get_yticklabels(), MODELS):
tick.set_fontweight("bold" if model == "RAM_Altman_GPT" else "normal")
for ax in axes:
ax.axhspan(-0.6, 0.55, color=RAM, alpha=0.07, zorder=0, lw=0)
footer(fig, "Their numbers are the published ones. Mine are real too, unfortunately.")
fig.savefig(OUT / "benchmarks.png")
plt.close(fig)
def chart_attention_span(results):
rows = [("Terminal-Bench 4.0", results["Terminal-Bench 4.0"]["tasks"]),
("Terminal-Bench-Science 0.1", results["Terminal-Bench-Science 0.1"]["tasks"])]
fig, ax = plt.subplots(figsize=(12, 4.6), dpi=200)
fig.subplots_adjust(left=0.19, right=0.985, top=0.70, bottom=0.17)
header(fig, "Every task is longer than its whole brain",
"Length of each task's instructions, in RAM_Altman_GPT's own tokens. It can read 379. Not one more.")
rng = random.Random(0)
xmin, xmax = 150, 12000
ax.set_xscale("log")
ax.set_xlim(xmin, xmax)
ax.set_ylim(-0.7, 1.7)
ax.axvspan(xmin, CTX, color=RAM, alpha=0.10, lw=0, zorder=0)
ax.axvline(CTX, color=RAM, lw=2, zorder=2)
ax.text(CTX * 0.93, 1.62, "RAM_Altman_GPT's\nentire context: 379", ha="right", va="top",
fontsize=9, fontweight="bold", color=INK)
for y, (name, tasks) in zip([1, 0], rows):
for t in tasks:
fit = t["fits_in_context"]
ax.scatter(t["instruction_tokens"], y + rng.uniform(-0.22, 0.22), s=42,
color=RAM if fit else NOFIT, edgecolor=SURFACE, linewidth=1.2, zorder=3 + fit)
med = int(statistics.median(t["instruction_tokens"] for t in tasks) + 0.5)
ax.plot([med, med], [y - 0.32, y + 0.32], color=INK, lw=2, zorder=5, solid_capstyle="round")
ax.text(med, y + 0.36, f"median {med:,}", ha="center", va="bottom", fontsize=8.5, color=INK2)
ax.set_yticks([1, 0], [f"{name}\n{sum(t['fits_in_context'] for t in tasks)} of {len(tasks)} fit"
for name, tasks in rows], fontsize=10.5, linespacing=1.5)
for side in ("top", "right", "left"):
ax.spines[side].set_visible(False)
ax.spines["bottom"].set_color(GRID)
ax.tick_params(length=0)
ticks = [200, 379, 500, 1000, 2000, 5000, 10000]
ax.set_xticks(ticks, [f"{t:,}" for t in ticks], fontsize=8.5)
ax.minorticks_off()
ax.grid(axis="x", color=GRID, lw=0.8, zorder=0)
ax.set_xlabel("instruction tokens (log scale)", fontsize=8.5, color=MUTED, labelpad=6)
ax.scatter([], [], s=42, color=RAM, label="fits: it read it, then ignored it")
ax.scatter([], [], s=42, color=NOFIT, label="does not fit")
fig.legend(loc="upper left", bbox_to_anchor=(0.03, 0.81), ncol=2, frameon=False, fontsize=9,
handletextpad=0.3, columnspacing=1.6)
footer(fig, "Each dot is one task. And that's before anyone even explains what a terminal is.")
fig.savefig(OUT / "attention_span.png")
plt.close(fig)
def chart_context():
fig, ax = plt.subplots(figsize=(12, 3.4), dpi=200)
fig.subplots_adjust(left=0.135, right=0.985, top=0.62, bottom=0.22)
header(fig, "Context window, drawn to scale", "Same axis, same pixels. Look closely at the bottom bar.")
style_axis(ax, 1_000_000)
ax.set_ylim(-0.6, 1.6)
fig.canvas.draw()
bar(ax, 1, 1_000_000, 0.5, FABLE)
ax.text(985_000, 1, "1,000,000 tokens", ha="right", va="center", fontsize=10, color="white", fontweight="bold", zorder=5)
ax.add_patch(Rectangle((0, -0.25), CTX, 0.5, fc=RAM, ec="none", zorder=3))
ax.annotate("379 tokens. It's there, I promise. (0.04%)", xy=(CTX, 0), xytext=(40_000, 0),
va="center", fontsize=10, fontweight="bold", color=INK,
arrowprops=dict(arrowstyle="-|>", color=INK, lw=1.2, shrinkA=0, shrinkB=2))
ax.set_yticks([1, 0], ["Claude Fable 5.2", "RAM_Altman_GPT"])
ax.get_yticklabels()[1].set_fontweight("bold")
ax.set_xticks([0, 250_000, 500_000, 750_000, 1_000_000], ["0", "250K", "500K", "750K", "1M"])
footer(fig, "Position 380 was sold to buy more RAM.")
fig.savefig(OUT / "context_to_scale.png")
plt.close(fig)
def main():
OUT.mkdir(exist_ok=True)
results = json.loads(RESULTS.read_text(encoding="utf-8"))
chart_benchmarks()
chart_attention_span(results)
chart_context()
print("wrote", *(p.name for p in sorted(OUT.glob("*.png"))))
if __name__ == "__main__":
main()