Skip to content

Support image evidence in DecisionJudge - #3269

Merged
xeophon merged 2 commits into
mainfrom
feat/decision-judge-images
Nov 24, 2026
Merged

xeophon merged 2 commits into
mainfrom
feat/decision-judge-images

Conversation

@xeophon

@xeophon xeophon commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Add ordered image evidence to the native DecisionJudge. Callers can pass images=[...] to evaluate(), or configure images_field when the judge scores a task data field. The evaluations API receives the original image data URLs in its top-level images field.

Image traces record the count and verdict without copying image bytes. Callers grading large artifacts can pass compact trace_state metadata. A malformed score raises DecisionScoreError after the judge call and usage are recorded, so callers can retry that verdict independently.

The native evaluate_batch() method scores up to 64 named questions per request with the same state and images. It returns scores in input order and records usage once for each batch.

This supports the visual JobBench and APEX grading paths in PrimeIntellect-ai/prime-envs#1100.

Verification

  • Added coverage for the configured task scoring path, image order, compact tracing and malformed responses.
  • Ran the Verifiers unit suite with Harbor (320 passed and 18 skipped), pre-commit hooks and type checker. A 65-question regression check covered the batch boundary and reversed response order.
  • A single live CLEF request scored both red and blue criteria against a red square (0.9916 and 0.0161).
  • Sent two generated solid-color images to live CLEF with the same question. It scored the red square 0.9903 and the blue square 0.0064 for “is the square red?”

Note

Add image evidence support to DecisionJudge scoring and evaluation

  • Adds DecisionJudgeConfig.images_field to name a task field holding image data URLs. DecisionJudge.score forwards those images to evaluation and raises ValueError if the field is not a list of strings.
  • Refactors DecisionJudge.evaluate to delegate to a shared _evaluate_questions helper that attaches image data URLs to requests, batches up to 64 questions per request, and returns scores in question order.
  • Adds DecisionScoreError for invalid, missing, boolean, or out-of-range grades; usage is recorded with token counts defaulting to zero.
  • Trace records omit image data and large state payloads, recording an image count and compact state instead. DecisionJudge.evaluate_batch now rejects a string in place of a prompt sequence.
  • Behavioral Change: score raises ValueError when the configured images_field task attribute is missing or malformed; boolean grade scores now raise DecisionScoreError instead of being accepted.

Macroscope summarized 4790d43.


Note

Medium Risk
Changes the core decision-judge request/response handling and scoring errors used for visual grading paths; malformed API responses now fail with a new exception type while still recording billable usage.

Overview
Extends DecisionJudge so grading can include ordered image data URLs on evaluation requests, either via new optional images / config images_field on tasks, or shared across many criteria in one call.

evaluate and task score now route through shared _evaluate_questions, which can post multiple named score questions per request. New evaluate_batch scores up to 64 prompts per API round with the same state and images, returning normalized scores in input order. Invalid or out-of-range grades raise DecisionScoreError instead of a generic ValueError, while usage and trace logging still run in a finally block.

Tracing is tightened when images or trace_state are used: logged requests drop raw image payloads (recording image_count instead), optional compact state replaces full artifacts in traces, and responses log answers only when providers might echo large state or image data. New unit tests cover image order, compact traces, malformed grades, and batch chunking at the 64-question boundary.

Reviewed by Cursor Bugbot for commit 4790d43. Bugbot is set up for automated code reviews on this repo. Configure here.

@xeophon
xeophon marked this pull request as ready for review November 24, 2026 20:18
@macroscopeapp

macroscopeapp Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 4790d43

Macroscope's review found this PR approvable — Adds opt-in image evidence and batched grading through the existing evaluation endpoint, with compact traces and usage recording. Existing defaults remain unchanged, and the caller-controlled additions present no obvious material risk requiring human judgment.

You can add or adjust custom eligibility rules. Learn more.

@xeophon
xeophon merged commit 44b2e4d into main Nov 24, 2026
64 of 71 checks passed
@xeophon
xeophon deleted the feat/decision-judge-images branch November 24, 2026 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant