From 6bef138c239782bed5cb48e43efb09b5b098e768 Mon Sep 17 00:00:00 2001 From: Ilker Manap Date: Tue, 20 Oct 2026 22:45:58 +0200 Subject: [PATCH] The judge check gives each judgment a text of its own The same text again was answered from what the engine kept of the last reading, in a tenth of the time: the check read 4.9 s, then 0.5 and 0.5. Each judgment now begins with a line of its own. Co-Authored-By: Claude Opus 5.5 (1M context) --- internal/control/adminapi/judges.go | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/internal/control/adminapi/judges.go b/internal/control/adminapi/judges.go index 84d1fe0..4921a75 100644 --- a/internal/control/adminapi/judges.go +++ b/internal/control/adminapi/judges.go @@ -275,8 +275,20 @@ func (a *API) checkJudge(w http.ResponseWriter, r *http.Request) { v.Burst = 2 * jv.Ready } v.Burst = min(v.Burst, 32) + var mu sync.Mutex + start := time.Now() + // Each text begins differently: the engine keeps what it read before, + // and the same text again is answered from that in a tenth of the time + // a request's own prompt takes. + n := 0 + text := func() string { + mu.Lock() + defer mu.Unlock() + n++ + return fmt.Sprintf("Request %d of a check begun at %s.\n", n, start.Format(time.RFC3339Nano)) + judgeCheckText + } for range 3 { - ans, err := a.guard.Ask(r.Context(), jv.Model, judgeCheckText, "") + ans, err := a.guard.Ask(r.Context(), jv.Model, text(), "") if err != nil { writeError(w, http.StatusBadGateway, fmt.Sprintf("the judge %s gave no verdict: %v", jv.Model, err)) return @@ -284,14 +296,13 @@ func (a *API) checkJudge(w http.ResponseWriter, r *http.Request) { v.TookMs = append(v.TookMs, ans.Took.Milliseconds()) v.SlowestMs = max(v.SlowestMs, ans.Took.Milliseconds()) } - var mu sync.Mutex var wg sync.WaitGroup - start := time.Now() + start = time.Now() for range v.Burst { wg.Add(1) go func() { defer wg.Done() - ans, err := a.guard.Ask(r.Context(), jv.Model, judgeCheckText, "") + ans, err := a.guard.Ask(r.Context(), jv.Model, text(), "") mu.Lock() defer mu.Unlock() if err != nil {