DedeProGames commited on
Commit
eeb8945
·
verified ·
1 Parent(s): 93d33bb

Size-class leaders: relative neighbourhoods (-20%/+25%) instead of a fixed ±20M window

Browse files
Files changed (1) hide show
  1. leaderboard.py +17 -8
leaderboard.py CHANGED
@@ -9,7 +9,10 @@ import hashlib
9
  import html
10
  import math
11
 
12
- MIN_GAMES_GLOW = 3 # a leader needs a few ranked games, so one lucky win doesn't glow
 
 
 
13
 
14
  _CDN = "https://cdn-avatars.huggingface.co/v1/production/uploads/"
15
  # owner on the Hub -> (display name, logo, "r, g, b", border colour). Same identities as the BananaMind leaderboard.
@@ -86,14 +89,20 @@ def _logo(org, cls="lb-logo") -> str:
86
  return f'<span class="{cls} lb-initial" aria-hidden="true">{_esc(org["name"][:1].upper())}</span>'
87
 
88
 
89
- def leaders(entries, gap: int) -> set:
90
- """Size-class leaders: no rated model within ±gap parameters has a higher Elo.
91
- The window is the same one ranked matches use, so every leader beat real peers."""
 
 
 
92
  out = set()
93
  for e in entries:
94
- if e.get("games", 0) < MIN_GAMES_GLOW or not e.get("params"):
 
95
  continue
96
- peers = [o for o in entries if o.get("params") and abs(o["params"] - e["params"]) <= gap]
 
 
97
  if all(o["elo"] <= e["elo"] for o in peers):
98
  out.add(e["model"])
99
  return out
@@ -261,8 +270,8 @@ def leaderboard_html(entries, protocol: str, gap: int, gap_label: str) -> str:
261
  return (
262
  '<div class="lb-root">'
263
  f'<section class="lb-panel lb-chart-panel">{views}'
264
- f'<div class="lb-footer"><span><i class="lb-rainbow-dot"></i>Size-class leader: best Elo within ±{gap_label} parameters '
265
- f'(min. {MIN_GAMES_GLOW} ranked games)</span><span>{len(entries)} models · click a model to open it ↗</span></div></section>'
266
  '<section class="lb-panel lb-param-panel"><div class="lb-heading"><div><h2>Elo vs. Parameters</h2>'
267
  '<p class="lb-muted">Model size on a logarithmic scale · higher and further left is better</p></div></div>'
268
  '<div class="lb-key"><span><i class="lb-quadrant-key"></i>Fewer parameters, higher Elo</span><span>┈ Pareto line</span></div>'
 
9
  import html
10
  import math
11
 
12
+ MIN_GAMES_GLOW = 2 # a leader needs more than one ranked game, so a single lucky win doesn't glow
13
+ # Size classes are relative, not absolute: a model's neighbourhood runs from size/1.25 to size*1.25
14
+ # (-20% to +25%). A fixed ±20M window lumped every model under 20M into one class, so only one tiny model could glow.
15
+ SIZE_RATIO = 1.25
16
 
17
  _CDN = "https://cdn-avatars.huggingface.co/v1/production/uploads/"
18
  # owner on the Hub -> (display name, logo, "r, g, b", border colour). Same identities as the BananaMind leaderboard.
 
89
  return f'<span class="{cls} lb-initial" aria-hidden="true">{_esc(org["name"][:1].upper())}</span>'
90
 
91
 
92
+ def leaders(entries, gap: int = 0) -> set:
93
+ """Size-class leaders: the best Elo among rated models of similar relative size.
94
+
95
+ A model glows when (1) it has at least MIN_GAMES_GLOW ranked games, (2) its Elo is above the 1000 start,
96
+ (3) at least one other rated model sits in its neighbourhood [size/SIZE_RATIO, size*SIZE_RATIO], and
97
+ (4) none of those neighbours has a higher Elo. Ties glow together. `gap` is kept for API compatibility."""
98
  out = set()
99
  for e in entries:
100
+ p = e.get("params")
101
+ if not p or e.get("games", 0) < MIN_GAMES_GLOW or e["elo"] <= 1000:
102
  continue
103
+ peers = [o for o in entries if o.get("params") and p / SIZE_RATIO <= o["params"] <= p * SIZE_RATIO]
104
+ if len(peers) < 2:
105
+ continue # no neighbour to compare with
106
  if all(o["elo"] <= e["elo"] for o in peers):
107
  out.add(e["model"])
108
  return out
 
270
  return (
271
  '<div class="lb-root">'
272
  f'<section class="lb-panel lb-chart-panel">{views}'
273
+ f'<div class="lb-footer"><span><i class="lb-rainbow-dot"></i>Size-class leader: best Elo among models from −20% to +25% of its size '
274
+ f'(min. {MIN_GAMES_GLOW} ranked games, Elo above 1000)</span><span>{len(entries)} models · click a model to open it ↗</span></div></section>'
275
  '<section class="lb-panel lb-param-panel"><div class="lb-heading"><div><h2>Elo vs. Parameters</h2>'
276
  '<p class="lb-muted">Model size on a logarithmic scale · higher and further left is better</p></div></div>'
277
  '<div class="lb-key"><span><i class="lb-quadrant-key"></i>Fewer parameters, higher Elo</span><span>┈ Pareto line</span></div>'