Rapidata leaderboard
RapidataLeaderboard #
RapidataLeaderboard(
name: str,
instruction: str,
show_prompt: bool,
show_prompt_asset: bool,
inverse_ranking: bool,
response_budget: int,
min_responses_per_matchup: int,
benchmark_id: str,
id: str,
openapi_service: OpenAPIService,
included_tags: list[str] | None = None,
excluded_tags: list[str] | None = None,
vote_aggregation: VoteAggregation | None = None,
)
An instance of a Rapidata leaderboard.
Used to interact with a specific leaderboard in the Rapidata system, such as retrieving prompts and evaluating models.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name that will be used to identify the leaderboard on the overview. |
required |
instruction
|
str
|
The instruction that will determine what how the models will be evaluated. |
required |
show_prompt
|
bool
|
Whether to show the prompt to the users. |
required |
id
|
str
|
The ID of the leaderboard. |
required |
openapi_service
|
OpenAPIService
|
The OpenAPIService instance for API interaction. |
required |
included_tags
|
list[str] | None
|
The prompt tag values the leaderboard restricts its matchups to. |
None
|
excluded_tags
|
list[str] | None
|
The prompt tag values the leaderboard skips when building matchups. |
None
|
vote_aggregation
|
VoteAggregation | None
|
How the responses on a single matchup are aggregated into that matchup's result. None resolves it on first read. |
None
|
Source code in src/rapidata/rapidata_client/benchmark/leaderboard/rapidata_leaderboard.py
response_budget
property
#
The leaderboard's response budget — the total number of comparison responses collected per model evaluation.
This is the raw number behind :attr:level_of_detail; read it when you need
the exact budget rather than the named level (which is "custom" for
budgets that don't match a named level).
level_of_detail
property
#
The level of detail of the leaderboard.
This is a friendly name for the leaderboard's :attr:response_budget — the
total number of comparison responses collected per model evaluation. A larger
budget buys more matchups and therefore more precise standings, at the cost
of a slower and more expensive evaluation. The named levels map to these
budgets: 'debug' (20), 'low' (2,000), 'medium' (4,000),
'high' (8,000), 'very high' (16,000). Any other budget reads back as
'custom' — use :attr:response_budget to get the exact number.
min_responses_per_matchup
property
#
Returns the minimum number of responses required to be considered for the leaderboard.
vote_aggregation
property
#
vote_aggregation: VoteAggregation
How the responses on a single matchup are aggregated into that matchup's result.
:attr:VoteAggregation.MAJORITY_VOTE collapses each matchup to one win for the
side the majority of responses picked (ties split 0.5/0.5), so every matchup
carries the same weight regardless of how many responses it collected.
:attr:VoteAggregation.ALL_VOTES instead counts every individual response as
its own matchup.
show_prompt_asset
property
#
Returns whether the prompt asset is shown to the users.
included_tags
property
#
The prompt tag values this leaderboard restricts its matchups to.
Only benchmark prompts carrying at least one of these tags are used to build matchups; an empty list (the default) means no restriction. Fixed at creation — to re-scope a leaderboard, create a new one.
Not to be confused with the tags argument of :meth:get_standings, which
filters the standings you read back rather than what gets collected.
excluded_tags
property
#
The prompt tag values this leaderboard skips when building matchups.
A prompt carrying any of these tags is never used, even if it also carries one
of :attr:included_tags. Fixed at creation — to re-scope a leaderboard, create
a new one.
jobs
property
#
jobs: list[RapidataJob]
Returns all Rapidata jobs that have run for this leaderboard.
Every model evaluation on the leaderboard is carried out by a job. This collects the jobs across all runs of the leaderboard, most recent first.
Returns:
| Type | Description |
|---|---|
list[RapidataJob]
|
A list of RapidataJob instances, one per run that has an associated job. |
update #
update(
name: str | None = None,
level_of_detail: LevelOfDetail | int | None = None,
min_responses_per_matchup: int | None = None,
vote_aggregation: VoteAggregation | None = None,
) -> None
Updates the leaderboard's configuration.
Only the arguments you pass are changed; anything omitted keeps its stored value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
The new name of the leaderboard. (not shown to the users) |
None
|
level_of_detail
|
LevelOfDetail | int | None
|
The new response budget — either one of the named levels ('debug', 'low', 'medium', 'high', 'very high') or a positive integer for a custom budget. Takes effect for future evaluations; already-computed standings are not recomputed. |
None
|
min_responses_per_matchup
|
int | None
|
The new minimum number of responses collected per matchup. Must be at least 3. |
None
|
vote_aggregation
|
VoteAggregation | None
|
How the responses on a single matchup are aggregated into that matchup's result. Standings are derived from the raw responses on every read, so this also changes how already-collected responses are counted — no re-evaluation needed. |
None
|
Source code in src/rapidata/rapidata_client/benchmark/leaderboard/rapidata_leaderboard.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | |
get_standings #
get_standings(
tags: Optional[list[str]] = None,
country: Optional[list[str]] = None,
language: Optional[list[str]] = None,
gender: Optional[list[Gender]] = None,
age_bucket: Optional[list[AgeGroup]] = None,
occupation: Optional[list[str]] = None,
run_id: Optional[str] = None,
) -> "pd.DataFrame"
Returns the standings of the leaderboard.
The demographic filters compute the standings from only the votes cast by
matching voters — e.g. the standings among women, or among US voters.
gender and age_bucket are estimated (inferred); country and
language are observed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tags
|
Optional[list[str]]
|
The matchups with these tags should be used to create the standings. If tags are None, all matchups will be considered. If tags are empty, no matchups will be considered. |
None
|
country
|
Optional[list[str]]
|
Only count votes from these countries (ISO-2 codes). |
None
|
language
|
Optional[list[str]]
|
Only count votes from these languages. |
None
|
gender
|
Optional[list[Gender]]
|
Only count votes from voters of these (estimated) genders. |
None
|
age_bucket
|
Optional[list[AgeGroup]]
|
Only count votes from voters in these (estimated) age buckets. |
None
|
occupation
|
Optional[list[str]]
|
Only count votes from voters of these (estimated) occupations. |
None
|
run_id
|
Optional[str]
|
Only count votes from this evaluation run. |
None
|
Returns:
| Type | Description |
|---|---|
'pd.DataFrame'
|
A pandas DataFrame containing the standings of the leaderboard. |
Source code in src/rapidata/rapidata_client/benchmark/leaderboard/rapidata_leaderboard.py
get_win_loss_matrix #
get_win_loss_matrix(
tags: Optional[list[str]] = None,
use_weighted_scoring: Optional[bool] = None,
country: Optional[list[str]] = None,
language: Optional[list[str]] = None,
gender: Optional[list[Gender]] = None,
age_bucket: Optional[list[AgeGroup]] = None,
occupation: Optional[list[str]] = None,
run_id: Optional[str] = None,
) -> DataFrame
Returns the pairwise win/loss matrix for the participants in this leaderboard.
The returned DataFrame is square, with participant names on both the index
(rows) and columns. Cell [i, j] is how often participant i (row) beat
participant j (column) in their direct matchups. Read a row to see how a
model did against every opponent; the diagonal (a model against itself) is
always 0. This is the head-to-head breakdown behind :meth:get_standings,
which collapses the same matchups into a single Elo score per model.
The demographic filters restrict the matrix to matchups decided by matching
voters. gender and age_bucket are estimated (inferred); country
and language are observed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tags
|
Optional[list[str]]
|
Only count matchups carrying one of these prompt tags. If None, every matchup on the leaderboard is included; if an empty list, none are. |
None
|
use_weighted_scoring
|
Optional[bool]
|
If True, each matchup is weighted by the responding
annotators' reliability ( |
None
|
country
|
Optional[list[str]]
|
Only count votes from these countries (ISO-2 codes). |
None
|
language
|
Optional[list[str]]
|
Only count votes from these languages. |
None
|
gender
|
Optional[list[Gender]]
|
Only count votes from voters of these (estimated) genders. |
None
|
age_bucket
|
Optional[list[AgeGroup]]
|
Only count votes from voters in these (estimated) age buckets. |
None
|
occupation
|
Optional[list[str]]
|
Only count votes from voters of these (estimated) occupations. |
None
|
run_id
|
Optional[str]
|
Only count votes from this evaluation run. |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
A pandas DataFrame indexed by participant name on both axes, where cell |
DataFrame
|
|
DataFrame
|
participant over the column participant. |
Source code in src/rapidata/rapidata_client/benchmark/leaderboard/rapidata_leaderboard.py
view #
Views the leaderboard.