[Bug]: JSON Mode Eval exact match conflates Boolean and numeric values

Open
#23,268 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@JunkaiWang-TheoPhy is already working on this.

Since Dec 2, 2026.

  • #23269 by @JunkaiWang-TheoPhy — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
35/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
python
Domain
testing-qa

Research direction

Start with tensorrt_llm/evaluate/json_mode_eval.py and inspect JsonModeEval.compute_score, then run the reproduction in the issue; it needs no model or GPU. Add or locate coverage for Boolean versus numeric values nested in objects and arrays, while preserving object key order and equivalent numeric representations. Done when those Boolean and numeric mismatches score 0 and equivalent JSON values still match.

Written by the indexing model from the issue text.

Description

System Info

TensorRT-LLM main at c29791e46a7ef586921114da197d5d6be899bdaf. Reproduced on CPU with Python 3.12 and the real evaluator. This is score calculation after generation and needs no model or GPU.

Reproduction

Call the scorer with a schema-valid Boolean prediction and a numeric reference:

from types import SimpleNamespace

from tensorrt_llm.evaluate.json_mode_eval import JsonModeEval

evaluator = JsonModeEval.__new__(JsonModeEval)
output = SimpleNamespace(outputs=[SimpleNamespace(text='{"items": [false]}')])
print(evaluator.compute_score([output], ['{"items": [0]}'], ['{"type": "object"}']))

The default dataset exhibits this too. In zero-indexed training row 39, replacing properties.propertiesCount.minimum from the integer 0 with false preserves validation against that row's schema. Pinned NousResearch dataset revision

Expected behavior

Both predictions can be grammar-valid, but their exact-match score should be 0. JSON Boolean and numeric values differ, including when nested inside an object or array. JSON Schema instance equality

Actual behavior

The example above returns 100.0, and the substitution in default dataset row 39 does the same. Python compares False == 0 and also treats these values as equal inside nested containers.

Additional notes

The evaluation should still accept differences in object property order and equivalent JSON numeric representations such as 1 and 1.0. The score can reuse the JSON Schema validator's const semantics.

Dominant language
Python
Stars
15.2k
Forks
3k
Avg merge
2d 21h
Merged PRs (30d)
477

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from NVIDIA/TensorRT-LLM

All issues in NVIDIA/TensorRT-LLM

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.