Make transformation exact-match and failures field-aware
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 56/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Tranquilla
- Stack tecnologico
- python
- Ambito
- machine-learning
Direzione di ricerca
Start with rulechef/matching.py around lines 100–150 and rulechef/evaluation.py around lines 340–450, then inspect output_matcher and TRANSFORMATION references in rulechef and tests. Run the existing test suite with pytest -q to see the current behavior. Done means transformation outputs are compared by field, failures identify failed fields for default matching, custom matchers control correctness, and EvalResult.to_dict() retains failure details.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
evaluate_dataset() currently reuses entity matching for arbitrary transformation outputs. _get_entities() keeps only list-valued fields and discards their field names, so scalar fields are ignored entirely. Some list shapes are also mis-scored or crash because the downstream matcher expects entity dictionaries.
This means a structurally valid but completely wrong LLM-generated object can be reported as correct. For example, for a transformation whose expected output is:
{"company": "Acme", "amount": "5"}
an actual output of:
{"company": "Wrong", "amount": "999"}
currently produces exact_match=1.0, no failures, and zero TP/FP/FN. That prevents the evaluator from identifying the bad example for refinement.
Schema validity and output correctness are separate concerns: #33 handles fail-closed schema validation. This issue makes evaluation compare valid transformation values correctly.
Desired behavior
Add an explicit TaskType.TRANSFORMATION path to dataset evaluation instead of flattening transformation values into entities.
For the default comparator:
- compare all top-level fields and report which fields failed;
- distinguish a missing key from a present
nullvalue; - reject extra keys;
- compare scalar values type-sensitively (
1,1.0, andTrueare different); - match present
nullonly with presentnull; - keep list comparison order-independent while preserving duplicate multiplicity;
- compare nested JSON values as field values, but keep diagnostics at the top-level field name for this first cut.
matching.outputs_match() already contains transformation comparison logic and Task.output_matcher already provides a custom boolean comparator. Reuse or refactor those paths rather than creating a second unrelated definition of transformation equality.
When Task.output_matcher is supplied, it controls document correctness. A custom boolean matcher cannot explain field-level differences, so failures should either omit failed_fields or mark those diagnostics as unavailable; do not present default-comparator differences as the reason a custom matcher failed.
Scope
- Branch explicitly for transformations in
rulechef/evaluation.py. - Make default transformation equality obey the semantics above in
rulechef/matching.py. - Use the comparison result for document-level
exact_matchand normal refinementfailures. - For default matching failures, include a bounded, sorted
failed_fieldslist in the failure record; ensureEvalResult.to_dict()retains it. - Preserve all extraction, NER, and classification behavior.
Treat each top-level list as one field comparison in this issue. Do not reinterpret arbitrary arrays as extraction entities or invent TP/FP/FN denominators for structured JSON.
Acceptance tests
- Correct scalar-only output is an exact match and produces no failure.
- A wrong scalar reduces exact match and produces a failure naming that field.
- Missing, extra, present-null, and type-mismatched fields are distinguished.
- Wrong contents inside a list of objects are rejected.
- Lists of scalar values do not crash.
- List order is ignored but duplicate multiplicity is preserved.
- Mixed scalar/list output fails when either field fails.
- A custom matcher is called and controls document correctness.
EvalResult.to_dict()retains the new failure detail.- Existing extraction, NER, classification, and matching tests remain unchanged and green.
Non-goals
- Recursive JSON-path diagnostics or semantic/LLM-as-judge comparison.
- New micro/macro field metrics;
micro_*,per_class, and TP/FP/FN remain entity-oriented and may stay zero for transformations. - Redesigning the learner's candidate-selection score for scalar-only transformation tasks. That should follow once exact-match behavior is trustworthy.
- Changes to schema validation (#33).
Start here
git clone https://github.com/KRLabsOrg/rulechef.git
cd rulechef
pip install -e ".[dev]"
pytest -q
sed -n '100,150p' rulechef/matching.py
sed -n '340,450p' rulechef/evaluation.py
rg "output_matcher|TRANSFORMATION" rulechef tests
- Lingua principale
- Python
- Stelle
- 34
- Fork
- 9
- Merge medio
- 9g 13h
- PR unite (30g)
- 1
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di KRLabsOrg/rulechef
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 52/100
-
Reproducible learning runsForse già presa @nadiaverdha l’ha presa 8 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
-
Add option to interleave patch failures by entity textForse già presa @nadiaverdha l’ha presa 12 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 20/100
-
research
Difficoltà 5/5 Più di una settimana Idoneità per principianti 32/100
-
research
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
Tutte le issue di KRLabsOrg/rulechef
Issue simili
-
question
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100
vllm-project/vime#524 ·
I maintainer di solito rispondono entro 7 giorni
-
WOPI editor page is scrollable by a few pixels, which breaks scrolling in the document (Firefox)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
suitenumerique/drive#969 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
theupdateframework/python-tuf#3044 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
FAIRmat-NFDI/pynxtools#861 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
NVIDIA/nsight-python#88 ·
I maintainer di solito rispondono entro 1 giorno