Skip to content

[Draft] Add three sli based metrics in test script#4

Open
fhenneke wants to merge 3 commits into
mainfrom
sli_rewards
Open

[Draft] Add three sli based metrics in test script#4
fhenneke wants to merge 3 commits into
mainfrom
sli_rewards

Conversation

@fhenneke
Copy link
Copy Markdown
Owner

@fhenneke fhenneke commented Feb 3, 2026

Metrics checked:

  • Surplus provided
  • Number of orders executed
  • Robust score, an expected score taking into account participation rates of solvers

These metrics are turned into a marginal and individual contribution.

  • marginal: how much would a metric get worse when removing a solver
  • individual: what would a metric look like if only one solver were participating

Run

uv run python sli_rewards.py

to generate a chart.html file with a figure of the form
image

Comment thread sli_rewards.py
Comment on lines +58 to +74
def robust_surplus_metric(solutions, participation_rates):
robust_surplus = 0
all_order_uids = {trade.id for solution in solutions for trade in solution.trades}
for order_uid in all_order_uids:
order_scores = [(solution.solver, trade.score) for solution in solutions for trade in solution.trades if trade.id == order_uid]
# sorting
order_scores = sorted(order_scores, key=lambda x: x[1], reverse=True)
# removing duplicates
solvers_seen = set()
order_scores = [x for x in order_scores if not (x[0] in solvers_seen or solvers_seen.add(x[0]))]
robust_surplus_order = 0.0
remaining_probability = 1.
for solver, score in order_scores:
robust_surplus_order += remaining_probability * participation_rates[solver] * score / 1e18
remaining_probability *= 1 - participation_rates[solver]
robust_surplus += robust_surplus_order
return robust_surplus
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation of robust score.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant