Elo Ratings for a Model Arena

easy
Unit 5 · Evaluation & Embeddings0/3 to milestone

Chatbot Arena ranks LLMs from head-to-head human votes using Elo ratings. For models A and B with ratings RAR_A and RBR_B:

EA=11+10(RB−RA)/400,RA′=RA+K(SA−EA)E_A = \frac{1}{1 + 10^{(R_B - R_A)/400}}, \qquad R_A' = R_A + K(S_A - E_A)

where SAS_A is 1 for a win, 0.5 for a tie and 0 for a loss (and B is updated symmetrically).

Implement elo_ratings(matches, k=32, initial=1000), where matches is a list of (model_a, model_b, result) with result "a", "b" or "tie", processed in order. Return a dict of final ratings. Then implement leaderboard(ratings): a list of (model, rating) sorted by rating, highest first, with ties by name.

#evaluation#ranking#llm2 visible + 2 hidden tests
solution.py · Python 3.13
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Elo Ratings for a Model Arena · TechGradify