Tengo Gzirishvili Claude Sonnet 5 commited on
Commit
5dc55c5
·
1 Parent(s): 598a072

Commit the first real benchmark result + fix a self-invalidating test

Browse files

Pulled the live result from /api/admin/run-benchmarks (run by the founder
against the bundled BLAT_ECOLX fixture on the actual Space, real ESM-2
small): median Spearman rho 0.5165, top-decile precision 47.8%, across all
4,996 real mutations. This is now the permanent, committed state, so it
survives future redeploys instead of resetting to the empty placeholder.

Also fixes test_benchmarks_route_public_and_honest_empty, which asserted the
bundled file is ALWAYS empty — true when it was written, but wrong the moment
a real run legitimately populates it (which just happened). Replaced with a
shape-only assertion (the route never fabricates, whatever the current file
state is) plus a separate test that the honest-empty behavior still holds
when the file is genuinely absent.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

Files changed (2) hide show
  1. dee/data/benchmarks.json +18 -9
  2. tests/test_benchmark.py +17 -2
dee/data/benchmarks.json CHANGED
@@ -1,12 +1,21 @@
1
  {
2
- "generated_at": null,
3
- "model": null,
4
- "note": "Validation results are produced by scripts/run_benchmarks.py against published DMS data with the live ESM-2 model (where the weights exist), never hand-entered. Until a real run populates this file, the app shows an honest 'pending' state — no fabricated numbers.",
 
 
 
 
 
 
 
 
 
 
5
  "summary": {
6
- "n_datasets": 0,
7
- "n_variants": 0,
8
- "median_spearman": null,
9
- "median_top_decile_precision": null
10
- },
11
- "datasets": []
12
  }
 
1
  {
2
+ "datasets": [
3
+ {
4
+ "n": 4996,
5
+ "name": "BLAT_ECOLX_Stiffler2015",
6
+ "protein": "TEM-1 beta-lactamase (BLAT_ECOLX, UniProt P62593, mature residues 24-286)",
7
+ "source": "Stiffler, Hekstra & Ranganathan 2015, Cell 160:882-892, \"Evolvability as a Function of Purifying Selection in TEM-1 beta-Lactamase\" (DOI 10.1016/j.cell.2015.01.035). Fitness score = the 2500 ug/mL ampicillin selection condition (the most stringent tested), the complete single-mutant scan (all 263 positions x 19 substitutions). Data file redistributed by facebookresearch/esm (examples/variant-prediction/data/BLAT_ECOLX_Ranganathan2015.csv) as the reference DMS example for Meier et al. 2021 'Language models enable zero-shot prediction of the effects of mutations on protein function' -- the exact scoring scheme dee/models/scorer.py implements. Reference sequence reconstructed from the accompanying BLAT_ECOLX_1_b0.5.a3m alignment (header BLAT_ECOLX/24-286); mutation labels renumbered from the paper's absolute residue numbering (offset +23) to 1-indexed local positions matching this sequence. Every one of the 4,996 mutations was cross-validated against this sequence (100% wild-type-residue match) before being committed.",
8
+ "spearman": 0.5165,
9
+ "top_decile_precision": 0.478
10
+ }
11
+ ],
12
+ "generated_at": "2026-07-15T08:35:43.806166+00:00",
13
+ "model": "small",
14
+ "note": "Computed live on this Space against dee/data/dms_fixtures/ (see manifest.json for provenance/citations). Never hand-entered.",
15
  "summary": {
16
+ "median_spearman": 0.5165,
17
+ "median_top_decile_precision": 0.478,
18
+ "n_datasets": 1,
19
+ "n_variants": 4996
20
+ }
 
21
  }
tests/test_benchmark.py CHANGED
@@ -107,13 +107,28 @@ def test_summarize_empty():
107
  "median_spearman": None, "median_top_decile_precision": None}
108
 
109
 
110
- def test_benchmarks_route_public_and_honest_empty():
111
  from dee import server
112
  app = server.create_app()
113
  app.config.update(TESTING=True)
114
  body = app.test_client().get("/api/benchmarks").get_json() # no auth — public
115
  assert body["ok"] is True
116
  assert "summary" in body and "datasets" in body
117
- # Ships empty (no fabricated numbers) until a real run populates it.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  assert body["summary"]["n_datasets"] == 0
119
  assert body["datasets"] == []
 
 
107
  "median_spearman": None, "median_top_decile_precision": None}
108
 
109
 
110
+ def test_benchmarks_route_public_and_shaped():
111
  from dee import server
112
  app = server.create_app()
113
  app.config.update(TESTING=True)
114
  body = app.test_client().get("/api/benchmarks").get_json() # no auth — public
115
  assert body["ok"] is True
116
  assert "summary" in body and "datasets" in body
117
+ assert set(body["summary"]) == {"n_datasets", "n_variants",
118
+ "median_spearman", "median_top_decile_precision"}
119
+ # n_datasets/datasets length must agree, whatever the current bundled state is
120
+ # (empty before the first real run, or real numbers once /api/admin/run-
121
+ # benchmarks has populated it — this route never fabricates either way).
122
+ assert body["summary"]["n_datasets"] == len(body["datasets"])
123
+
124
+
125
+ def test_benchmarks_route_honest_empty_when_file_absent(monkeypatch, tmp_path):
126
+ from dee import server
127
+ monkeypatch.setattr(server, "__file__", str(tmp_path / "server.py"))
128
+ app = server.create_app()
129
+ app.config.update(TESTING=True)
130
+ body = app.test_client().get("/api/benchmarks").get_json()
131
+ assert body["ok"] is True
132
  assert body["summary"]["n_datasets"] == 0
133
  assert body["datasets"] == []
134
+ assert body["generated_at"] is None