Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,17 @@ uv run python tools/verify_prompt.py --all
uv run sensebench site build --results-dir results --output-dir _site --strict
```

The social sharing card (`og:image`) is the paper's cost/accuracy Pareto figure with a header
band above it. The figure is hand-curated in the paper repository, so it is committed here as
`tools/assets/pareto-figure.png` rather than regenerated. To refresh it, re-render the figure
there, trim its margins, overwrite the asset, and rebuild the card:

```bash
uv run python tools/make_og_card.py
```

The header carries no run or model counts, so the card does not go stale as runs are merged.

## About Glite

SenseBench is built and maintained by [Glite](https://glite.ai), the company behind the Glite
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ python_functions = "test_*"
[dependency-groups]
dev = [
"flowmark>=0.6.5",
"matplotlib>=3.9",
"mypy>=1.13",
"pre-commit>=4.0",
"pytest>=8.0",
Expand Down
15 changes: 15 additions & 0 deletions src/sensebench/site/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@
DATASET_VERSION_LABELS: dict[str, str] = {DEFAULT_LEXEN_RELEASE_ID: "lexEN v1"}
UNKNOWN_DATASET_VERSION_LABEL: str = "an unregistered dataset"
RUN_VERIFICATION_SENTENCE: str = "Verified from the stored raw API responses."
OG_IMAGE_FILENAME: str = "og-card.png"
OG_IMAGE_WIDTH: str = "1200"
OG_IMAGE_HEIGHT: str = "630"
OG_IMAGE_ALT: str = (
"SenseBench cost-versus-accuracy chart: every verified run plotted by "
"US dollars per million items against word sense disambiguation accuracy, "
"with the Pareto frontier marked."
)
PAGE_CONTEXT_KEY: str = "page"
FRONTIER_RUN_IDS_CONTEXT_KEY: str = "frontier_run_ids"
PROMPT_CONTEXT_KEY: str = "prompt"
Expand Down Expand Up @@ -1108,6 +1116,13 @@ def _render(
return template.render(
base_path=_base_path(base_url=base_url),
canonical_url=_absolute_url(base_url=base_url, path=path),
og_image_url=_absolute_url(
base_url=base_url,
path=f"{SITE_ASSETS_DIRNAME}/{OG_IMAGE_FILENAME}",
),
og_image_width=OG_IMAGE_WIDTH,
og_image_height=OG_IMAGE_HEIGHT,
og_image_alt=OG_IMAGE_ALT,
title=title,
description=description,
default_dataset_version=DEFAULT_LEXEN_RELEASE_ID,
Expand Down
Binary file added src/sensebench/site/static/og-card.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion src/sensebench/site/templates/base.html.j2
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
<meta property="og:description" content="{{ description }}">
<meta property="og:type" content="website">
<meta property="og:url" content="{{ canonical_url }}">
<meta name="twitter:card" content="summary">
<meta property="og:image" content="{{ og_image_url }}?v={{ asset_version }}">
<meta property="og:image:width" content="{{ og_image_width }}">
<meta property="og:image:height" content="{{ og_image_height }}">
<meta property="og:image:alt" content="{{ og_image_alt }}">
<meta name="twitter:card" content="summary_large_image">
<link rel="icon" type="image/svg+xml" href="{{ base_path }}assets/favicon.svg?v={{ asset_version }}">
<link rel="stylesheet" href="{{ base_path }}assets/site.css?v={{ asset_version }}">
</head>
Expand Down
34 changes: 34 additions & 0 deletions tests/test_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
)
from sensebench.site.build import (
DEFAULT_CUSTOM_DOMAIN,
OG_IMAGE_FILENAME,
PROMPTS_ROUTE_PREFIX,
UNKNOWN_DATASET_VERSION_LABEL,
RunDetail,
Expand Down Expand Up @@ -166,6 +167,9 @@
ALTERNATE_QUANTIZATION: str = "awq-int4"
RERUN_CREATED_AT: str = "2026-07-20T00:00:00+00:00"
RERUN_DATE_LABEL: str = "2026-07-20"
LARGE_SHARE_CARD_TEXT: str = '<meta name="twitter:card" content="summary_large_image">'
SMALL_SHARE_CARD_TEXT: str = '<meta name="twitter:card" content="summary">'
OG_IMAGE_ABSOLUTE_URL: str = f"{TEST_BASE_URL}{SITE_ASSETS_DIRNAME}/{OG_IMAGE_FILENAME}"
MACHINE_HOURS_TEXT: str = "Machine-hours / 1M items"
SPEED_COLUMN_HEADER_TEXT: str = "Speed (s / item)"
SPEED_SORT_BUTTON_TEXT: str = 'data-sort="seconds_per_item"'
Expand Down Expand Up @@ -732,6 +736,36 @@ def _page_title(html_text: str) -> str:
return html_text[start : html_text.index(TITLE_CLOSE_TAG, start)]


def test_pages_advertise_a_large_share_card(
tmp_path: Path,
monkeypatch: MonkeyPatch,
) -> None:
dataset = _dataset()
_patch_registered_dataset(monkeypatch=monkeypatch, dataset=dataset)
results_dir = tmp_path / SUBMITTED_RESULTS_DIR
output_dir = tmp_path / SITE_OUTPUT_DIR
_write_verified_run(results_dir=results_dir, dataset=dataset, run_id=TEST_RUN_ID)

build_site(
results_dir=results_dir,
output_dir=output_dir,
base_url=TEST_BASE_URL,
strict=True,
)

index_html = (output_dir / INDEX_HTML_FILENAME).read_text(encoding="utf-8")
run_html = (output_dir / SITE_RUNS_DIRNAME / TEST_RUN_ID / INDEX_HTML_FILENAME).read_text(
encoding="utf-8"
)

for html_text in (index_html, run_html):
assert LARGE_SHARE_CARD_TEXT in html_text
assert SMALL_SHARE_CARD_TEXT not in html_text
assert OG_IMAGE_ABSOLUTE_URL in html_text

assert (output_dir / SITE_ASSETS_DIRNAME / OG_IMAGE_FILENAME).exists()


def test_reasoning_effort_label_omits_absent_and_never_repeats_the_word() -> None:
assert _reasoning_effort_label(None) is None
assert _reasoning_effort_label(OMITTED_REASONING_EFFORT) is None
Expand Down
Binary file added tools/assets/pareto-figure.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
117 changes: 117 additions & 0 deletions tools/make_og_card.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
"""Compose the social sharing card from the published Pareto figure.

The card is the paper's cost/accuracy figure with a header band above it. The
figure itself is the hand-curated publication artifact (per-run label offsets and
frontier names are tuned by hand in the paper repository), so it is committed
here as an asset rather than regenerated: see `tools/assets/pareto-figure.png`.

To refresh it, re-render the figure in the paper repository, trim its margins,
overwrite the asset, and rerun this script:

uv run python tools/make_og_card.py

The header deliberately carries no run or model counts, so the card does not go
stale as runs are merged.
Comment on lines +13 to +14

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Clarify that the plotted figure can still become stale.

Removing run/model counts only prevents stale header text; newly verified runs can still make the committed chart—and the published “every verified run” alt text—outdated.

  • tools/make_og_card.py#L13-L14: describe the card as a snapshot that must be regenerated when plotted data should be current.
  • README.md#L286: replace the claim that the card does not go stale with the same snapshot/refresh guidance.
📍 Affects 2 files
  • tools/make_og_card.py#L13-L14 (this comment)
  • README.md#L286-L286

"""

from __future__ import annotations

from argparse import ArgumentParser
from pathlib import Path

import matplotlib as mpl

mpl.use("Agg")

import matplotlib.pyplot as plt
from matplotlib.image import imread

FIGURE_PATH: Path = Path("tools/assets/pareto-figure.png")
CARD_PATH: Path = Path("src/sensebench/site/static/og-card.png")

CARD_WIDTH_PX: int = 1200
CARD_HEIGHT_PX: int = 630
CARD_DPI: int = 100

HEADER_HEIGHT_FRACTION: float = 0.205
FIGURE_SIDE_PADDING_FRACTION: float = 0.012

INK: str = "#171717"
MUTED: str = "#6F747C"
RULE: str = "#D7DCD8"
PAPER: str = "#FFFFFF"

TITLE_SIZE: int = 33
SUBTITLE_SIZE: int = 17
URL_SIZE: int = 17

TITLE_TEXT: str = "SenseBench"
SUBTITLE_TEXT: str = "LLM word sense disambiguation · cost vs accuracy on lexEN"
URL_TEXT: str = "sense-bench.com"

SERIF_FAMILY: list[str] = ["Times New Roman", "TeX Gyre Termes", "Nimbus Roman", "DejaVu Serif"]


def _render_card(*, figure_path: Path, card_path: Path) -> None:
mpl.rcParams.update({"font.family": "serif", "font.serif": SERIF_FAMILY})

card = plt.figure(
figsize=(CARD_WIDTH_PX / CARD_DPI, CARD_HEIGHT_PX / CARD_DPI),
dpi=CARD_DPI,
facecolor=PAPER,
)

header_top = 1.0 - HEADER_HEIGHT_FRACTION
card.text(0.038, 0.975, TITLE_TEXT, size=TITLE_SIZE, weight="bold", color=INK, va="top")
card.text(0.038, 0.888, SUBTITLE_TEXT, size=SUBTITLE_SIZE, color=MUTED, va="top")
card.text(
0.962,
0.975,
URL_TEXT,
size=URL_SIZE,
color=MUTED,
ha="right",
va="top",
)
card.add_artist(
plt.Line2D(
[0.038, 0.962],
[header_top, header_top],
color=RULE,
linewidth=1.0,
transform=card.transFigure,
)
)

plot = card.add_axes(
(
FIGURE_SIDE_PADDING_FRACTION,
0.0,
1.0 - 2 * FIGURE_SIDE_PADDING_FRACTION,
header_top,
)
)
plot.imshow(imread(figure_path), interpolation="antialiased")
plot.set_axis_off()

card_path.parent.mkdir(parents=True, exist_ok=True)
card.savefig(card_path, dpi=CARD_DPI, facecolor=PAPER)
plt.close(card)


def main() -> int:
parser = ArgumentParser(description=__doc__)
parser.add_argument("--figure-path", type=Path, default=FIGURE_PATH)
parser.add_argument("--card-path", type=Path, default=CARD_PATH)
args = parser.parse_args()

if not args.figure_path.exists():
parser.error(f"{args.figure_path}: not found")

_render_card(figure_path=args.figure_path, card_path=args.card_path)
print(f"wrote {args.card_path}")
return 0


if __name__ == "__main__":
raise SystemExit(main())
Loading
Loading