The HealthBench analysis scripts allow you to evaluate the relationship between model performance (rubric scores) and inference cost. You can calculate the average cost per model by multiplying average input and output token counts by their respective dollar costs per million tokens.
To visualize this, use plot_dollar_cost_scatter to generate scatter plots showing the performance-cost frontier. You can choose between a 'linear' or 'log' scale for the x-axis (cost).
Key data points used in this analysis include:
rubric_score_cost: A list containing [avg_cost_per_model, avg_rubric_score, model_name].MODEL_FAMILIES: A grouping of related models (e.g., low, standard, and high versions) to facilitate comparison in plots.
# Example of plotting the performance-cost frontier
plot_dollar_cost_scatter(
rubric_score_cost,
title="HealthBench performance-cost frontier",
x_label="Inference cost per example ($)",
y_label="HealthBench score",
model_families=MODEL_FAMILIES,
scale='log'
)
# Exporting the cost-performance data to CSV
cost_perf_data = pd.DataFrame(rubric_score_cost, columns=['cost_usd', 'performance_pct', 'model'])[['model', 'cost_usd', 'performance_pct']]
save_csv_and_print(cost_perf_data, 'cost_perf_data.csv')