CorrectnessJudge scores 0 for any reply that is not bare JSON (`_find_first_json_object` has no `self`)

Aperta Adatta ai principianti
#61 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
1/5
Tempo stimato
Meno di un'ora
Idoneità per principianti
94/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
testing-qa

Direzione di ricerca

Leggi evaluator/judge.py nella sezione intorno a _parse_response e _find_first_json_object. Esegui la riproduzione dell’issue da evaluator/ per confermare che il JSON semplice venga analizzato e che una frase seguita da JSON generi TypeError. Aggiungi il decoratore indicato, poi esegui di nuovo entrambi i casi e conferma che il JSON racchiuso restituisca la spiegazione e il punteggio attesi.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

CorrectnessJudge._find_first_json_object is defined without self or @staticmethod (judge.py#L283). _parse_response calls it as self._find_first_json_object(text) (judge.py#L231). The call raises TypeError whenever the judge's reply isn't a bare JSON object, for example JSON after a sentence or inside a ```json fence. judge() catches the error and returns score 0 (judge.py#L336), so a correct prediction fails. The fenced-JSON fallback right after the call is never reached.

Repro, with no LLM call (run from evaluator/):

from judge import CorrectnessJudge
j = CorrectnessJudge.__new__(CorrectnessJudge)
j._parse_response('{"explanation": "ok", "score": 1}')
# {'explanation': 'ok', 'score': 1}
j._parse_response('Here is my grading: {"explanation": "ok", "score": 1}')
# TypeError: CorrectnessJudge._find_first_json_object() takes 1 positional argument but 2 were given

In our CUGA train runs with gpt-oss-120b as the judge, this never fired: the correctness judge raised no errors at all. A judge model that wraps its JSON would score 0 on every such reply. The cause would also be hidden, because the error message at L336 lacks its f prefix. #55 fixes the prefix but not this bug.

Fix: add @staticmethod above the definition.

Lingua principale
Python
Stelle
79
Fork
23
Merge medio
2g 7h
PR unite (30g)
3

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di IBM/vakra

Tutte le issue di IBM/vakra

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.