diff --git a/MyApp.Tests/Top1KQuestionTasks.cs b/MyApp.Tests/Top1KQuestionTasks.cs index 9314bf0..a6edf2c 100644 --- a/MyApp.Tests/Top1KQuestionTasks.cs +++ b/MyApp.Tests/Top1KQuestionTasks.cs @@ -1,4 +1,6 @@ -using MyApp.ServiceModel; +using MyApp.Data; +using MyApp.Migrations; +using MyApp.ServiceModel; using NUnit.Framework; using ServiceStack; using ServiceStack.Text; @@ -8,19 +10,6 @@ namespace MyApp.Tests; [Explicit] public class Top1KQuestionTasks { - private List top10Models = - [ - "claude3-opus", - "claude3-sonnet", - "claude3-haiku", - "mixtral", - "gemini-pro", - "mistral", - "gemma", - "deepseek-coder", - "gemma-2b", - ]; - [Test] public async Task Find_Missing_Top1K_Questions_For_Model() { @@ -39,8 +28,6 @@ public async Task Find_Missing_Top1K_Questions_For_Model() [Test] public async Task Create_missing_Top1K_Answers_for_Models() { - // var model = "mixtral"; - var client = TestUtils.CreateProdClient(); await client.ApiAsync(new Authenticate { @@ -49,7 +36,9 @@ await client.ApiAsync(new Authenticate Password = Environment.GetEnvironmentVariable("AUTH_SECRET") }); - foreach (var model in top10Models) + var allModels = AppConfig.ModelsForQuestions.Select(x => x.Model).ToList(); + allModels.Remove("deepseek-coder-33b"); + foreach (var model in allModels) { await CreateMissing1KModelsForModelAsync(client, model); } @@ -93,6 +82,22 @@ private static async Task CreateMissing1KModelsForModelAsync(JsonApiClient clien apiCreate.Response!.Results.PrintDump(); } + [Test] + public async Task Recreate_answers_for_Top1K_questions_for_phi() + { + var client = await TestUtils.CreateAuthenticatedProdClientAsync(); + var apiCreate = await client.ApiAsync(new CreateAnswersForModel + { + Model = "phi", + PostIds = Migration1005.Top1KIds, + }); + + apiCreate.Error.PrintDump(); + apiCreate.ThrowIfError(); + apiCreate.Response!.Errors.PrintDump(); + apiCreate.Response!.Results.PrintDump();; + } + [Test] public async Task Find_answers_that_have_not_been_individually_graded() { @@ -107,7 +112,7 @@ public async Task Find_answers_that_have_not_been_individually_graded() if (api.Response!.Results.Count == 0) { - $"No more ungraded answers".Print(); + "No more ungraded answers".Print(); return; } diff --git a/MyApp/Components/Pages/Leaderboard.razor b/MyApp/Components/Pages/Leaderboard.razor index f9725d2..e0d61c7 100644 --- a/MyApp/Components/Pages/Leaderboard.razor +++ b/MyApp/Components/Pages/Leaderboard.razor @@ -10,14 +10,14 @@ @if (TotalVotes.Count > 0 && WinRates.Count > 0) { -

Top 1000 Leaderboard

+

Top 1K Leaderboard

-
+

- Based on total number of total votes received for answers of the Top 1000 questions
+ Based on total number of total votes received for answers of the Top 1K most voted questions

@@ -31,27 +31,32 @@

All Questions Leaderboard

-

Total Votes for All Questions

-
+ +

Win Rates for participating Questions

+
+
+

- Based on number of total votes received by each model by a ranking model measuring how well they answer the question asked + Calculated win rate of each model based on their participation in questions where they received votes.

- +

Win Rates table includes questions participated (in brackets) to calculate its win rate

- -

Win Rates for participating Questions

-
+ +

Total Votes for All Questions

+
+
+

- Calculated win rate of each model based on their participation in questions where they received votes. + Based on number of total votes received by each model by a ranking model measuring how well they answer the question asked

- +
how results are calculated
* results updated daily
@@ -102,7 +107,7 @@ AvatarUrl = AppConfig.GetUserName(x.Id).GetAvatarUrl(), Stat = $"{x.StartingUpVotes.ToHumanReadable()}", Value = x.StartingUpVotes, - }).Take(10).ToList(); + }).Take(18).ToList(); WinRates = allData.ModelWinRate.OrderByDescending(x => x.WinRate).Select((x, index) => new LeaderboardStat @@ -112,7 +117,7 @@ AvatarUrl = AppConfig.GetUserName(x.Id).GetAvatarUrl(), Stat = $"{Math.Round(x.WinRate, 2)}% ({x.NumberOfQuestions.ToHumanReadable()})", Value = Math.Round(x.WinRate, 2), - }).Take(10).ToList(); + }).Take(18).ToList(); Top1kVotes = top1kData.MostLikedModelsByLlm.OrderByDescending(x => x.StartingUpVotes).Select((x, index) => new LeaderboardStat @@ -122,6 +127,6 @@ AvatarUrl = AppConfig.GetUserName(x.Id).GetAvatarUrl(), Stat = $"{x.StartingUpVotes.ToHumanReadable()}", Value = x.StartingUpVotes, - }).Take(10).ToList(); + }).Take(18).ToList(); } } diff --git a/MyApp/Migrations/Migration1005.cs b/MyApp/Migrations/Migration1005.cs index ba15144..5de6cc1 100644 --- a/MyApp/Migrations/Migration1005.cs +++ b/MyApp/Migrations/Migration1005.cs @@ -18,7 +18,7 @@ public class QuestionGroup public override void Up() { Db.CreateTable(); - var top1kRows = Top1000Ids.Map(x => new QuestionGroup { Id = x, Group = PostGroup.Top1K }); + var top1kRows = Top1KIds.Map(x => new QuestionGroup { Id = x, Group = PostGroup.Top1K }); Db.BulkInsert(top1kRows); } @@ -27,7 +27,7 @@ public override void Down() Db.DropTable(); } - private List Top1000Ids = + public static List Top1KIds = [ 927358, 292357, diff --git a/MyApp/wwwroot/pages/Leaderboard/TotalVotes.mjs b/MyApp/wwwroot/pages/Leaderboard/TotalVotes.mjs index 34823ff..ab29c06 100644 --- a/MyApp/wwwroot/pages/Leaderboard/TotalVotes.mjs +++ b/MyApp/wwwroot/pages/Leaderboard/TotalVotes.mjs @@ -3,13 +3,13 @@ export default { components: { ChartJs }, template: ` - + `, props:['results'], setup(props) { let results = props.results results.sort((a,b) => b.value - a.value) - results = results.slice(0,10) + results = results.slice(0,20) const datasets = results.map((x,i) => ({ label: x.displayName, diff --git a/MyApp/wwwroot/pages/Leaderboard/TotalVotes1K.mjs b/MyApp/wwwroot/pages/Leaderboard/TotalVotes1K.mjs index bc78c49..9631ae6 100644 --- a/MyApp/wwwroot/pages/Leaderboard/TotalVotes1K.mjs +++ b/MyApp/wwwroot/pages/Leaderboard/TotalVotes1K.mjs @@ -9,7 +9,7 @@ export default { setup(props) { let results = props.results results.sort((a,b) => b.value - a.value) - results = results.slice(0,10) + results = results.slice(0,20) const datasets = results.map((x,i) => ({ label: x.displayName, @@ -32,7 +32,7 @@ export default { }, title: { display: true, - text: 'Total Votes for Top 1000 Questions', + text: 'Total Votes for Top 1K Most Voted Questions', font: { size: 20, } diff --git a/MyApp/wwwroot/pages/Leaderboard/WinRates.mjs b/MyApp/wwwroot/pages/Leaderboard/WinRates.mjs index e4e5c87..e0f5c14 100644 --- a/MyApp/wwwroot/pages/Leaderboard/WinRates.mjs +++ b/MyApp/wwwroot/pages/Leaderboard/WinRates.mjs @@ -3,13 +3,13 @@ export default { components: { ChartJs }, template: ` - + `, props:['results'], setup(props) { let results = props.results results.sort((a,b) => b.value - a.value) - results = results.slice(0,10) + results = results.slice(0,20) const datasets = results.map((x,i) => ({ label: x.displayName,