fix: correct O(N²) energy/FLOPs savings calculation (#95) (#97)

The energy_wh_saved and flops_saved values were orders of magnitude too
high because a scaling factor that grows linearly with N was applied to
the energy calculation, making it scale as O(N³) instead of O(N²).

Replace the buggy scale-factor approach with a direct FLOP-to-energy
conversion using each provider's per-token constants. Add regression
tests to prevent recurrence.

Closes #95

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jon Saad-Falcon
2026-03-20 18:52:18 -07:00
committed by GitHub
co-authored by Claude Opus 4.6
parent c2756964a7
commit 8468f08c41
3 changed files with 57 additions and 22 deletions
+2
View File
@@ -10,6 +10,8 @@
var currentPage = 0;
// No-KV-cache formula: FLOPs = params_b * 1e9 * N * (N+1)
// Reference values only (GPT-5.3 constants) — recompute functions below
// are defined but not called; the leaderboard displays database values directly.
var DEFAULT_PARAMS_B = 137;
var ENERGY_WH_PER_FLOP = 0.4 / (1000 * 3e12);