Repository navigation
feat(agentic_mme): add the Agentic-MME environment, agent and benchmark - #5523
Merged
Merged
Conversation
Agentic-MME (Track B, task-only scoring) as a native Gym environment: - resources_servers/agentic_mme: verifier with the released contains/exact/numeric matching, an optional LLM correctness judge, synthetic smoke examples, configs. - responses_api_agents/agentic_mme_agent: the 14 atomic image tools plus optional retrieval (google_search, google_lens_search, fetch_webpage), multi-turn image observations, refused model calls end the episode unanswered, explicit item types. - benchmarks/agentic_mme: prepare script and benchmark config (no round or tool-call limit; judge key defaulted so gym eval prepare loads the config). Signed-off-by: smohsenitahe <[email protected]>
…l cache - retrieval.search_provider: serper | serpapi | tavily | exa; lens_provider for Google Lens (serper | serpapi | none), answers normalised to the Serper shape. - Shared on-disk cache (search_cache.py + sqlite_fuzzy_index.py): exact + fuzzy query matching, Lens keyed by image pixels, pages by URL; index rebuild command; writes are best-effort and keep the shared directory readable across users. - benchmarks/agentic_mme retrieval overlays (incl. JINA_API_KEY for fetch_webpage) and docs. Signed-off-by: smohsenitahe <[email protected]>
…en-capture model path - retrieval.fetch_provider (jina | exa): Exa /contents for fetch_webpage. - Contamination guard (on by default): items quoting Agentic-MME itself are dropped on every read; the cache keeps raw answers. - fetch_webpage without a cache no longer returns the whole page to the model. - Model calls go through url_path_for_run / url_path_for_request (NeMo RL token capture). Signed-off-by: smohsenitahe <[email protected]>
Every model call keeps the same tools and tool_choice, so each call's prompt extends the previous one (NeMo RL token capture links a rollout's calls by that prefix; the tools- stripped answer-only call broke the chain). The episode ends unanswered when the rounds run out or the model calls a tool beyond max_tool_calls; using the whole budget still allows an answer on the next call. Signed-off-by: smohsenitahe <[email protected]>
- The shared input fixture sets detail on input_image parts (now required), like the agent's own image observations do. - The test Request carries a path: url_path_for_request reads request.url.path to keep token-capture routes. Signed-off-by: smohsenitahe <[email protected]>
… for SerpAPI Lens SerpAPI's Image API (POST /image, multipart, JPEG/PNG/WebP up to 500 KB) returns an image_id that google_lens takes instead of a public URL, so lens_provider=serpapi needs only the SerpAPI key. retrieval.image_host (auto | serpapi | imgbb): auto uses SerpAPI for SerpAPI Lens and ImgBB for Serper, whose Lens needs a public URL. Images are re-encoded as JPEG under 500 KB (quality first, then size). allow_image_upload stays required. The SerpAPI-Lens overlays drop IMGBB_API_KEY. Signed-off-by: smohsenitahe <[email protected]> (cherry picked from commit 853bb654f30483af2424c162d5c948ecc6d54e00)
… exa), no Jina retrieval_exa.yaml and retrieval_exa_serpapi_lens.yaml set fetch_provider: exa, so fetch_webpage calls Exa /contents and Exa is the only text provider, as in the RL search configs; JINA_API_KEY is no longer needed with these overlays. Signed-off-by: smohsenitahe <[email protected]>
…status as 0 A policy call that failed before giving an HTTP status (connection lost, timeout after the client's retries, a body that is not JSON or not a Response) raised out of run(), so rollout collection wrote it to the failures sidecar and left it out of the mean. Every failed episode should score 0. The post, body read and Response validation now sit in one guard that ends the episode through the existing policy_error path, exactly like an HTTP refusal. Tests: all five failure types, on the first call and mid-episode. Signed-off-by: Danial MohseniTaheri <[email protected]>
…calls tool_trace records every retrieval call, including calls rejected before the provider (local or benchmark URL, bad image_index, invalid arguments). Replay validated and short-circuited before consuming its entry, so after such a call every later call raised a replay mismatch. In replay mode the entry is now matched and consumed first and its recorded output, a recorded error included, is returned. Arguments match as sent or once normalized; a mismatch still raises without advancing. README updated. Test: four kinds of rejected call followed by a valid one, no network. Signed-off-by: Danial MohseniTaheri <[email protected]>
…tamination fetch_webpage checked only the max_chars prefix the model sees, so an answer-key page whose Agentic-MME attribution came after the cut passed the guard. With a cache configured, a live page was also checked only on its prefix, because _cache_store dropped full_text before _decontaminate ran. _decontaminate now scans full_text (the live page or the cached copy) and then drops it; _cache_store keeps it until then. full_text never reaches the model. The scan costs about 0.13 ms at the 50K-character Exa cap. Tests: attribution past max_chars, live and through a cache miss and hit. Signed-off-by: Danial MohseniTaheri <[email protected]>
…zzy hit's query With cache_fuzzy_threshold 0.8, a cached query such as 'capital of austria' answered 'capital of australia' (token_sort_ratio about 95), tagged only cache: fuzzy, so the model reasoned over results about a different entity. Fuzzy matching is now opt-in: cache_fuzzy_threshold defaults to 0 (exact only) in RetrievalConfig, SearchCache and retrieval_cache.yaml. When enabled, a fuzzy hit carries matched_query, the cached query the results answer, in the tool output the model sees. The fuzzy index also loses its dead code: add_many, master_count, local_count, last_candidate_count, the unreachable rapidfuzz ImportError fallback and the unused tokenizer and candidate_limit knobs, plus the docstring's reference to a document in an archived repo. Tests: the near miss is a miss by default and a fuzzy hit when opted in; a fuzzy hit through Retrieval shows matched_query without a provider call; the process-local tier matches before any rebuild and writes each norm to its shard once; rebuild_index() indexes norms that exist only in another process's shard. Signed-off-by: Danial MohseniTaheri <[email protected]>
README env table regenerated with scripts/update_env_list.py. Signed-off-by: Danial MohseniTaheri <[email protected]>
Signed-off-by: Danial MohseniTaheri <[email protected]>
- Front agentic_mme_agent with a legacy_agent environment server, which rollout collection now requires. - Export a VERIFIER_FIXTURE (full reward, zero reward, malformed request) and add benchmarks/agentic_mme/manifest.yaml (experimental) and README with the measurement contract. - Add data/example_rollouts.jsonl from a live smoke run. - Import from the current nemo_gym module paths instead of the deprecated aliases. Signed-off-by: Danial MohseniTaheri <[email protected]>
DanialTaheri
marked this pull request as ready for review
November 4, 2026 20:40
Contributor
|
/ok to test b9b90d0 |
Contributor
yfw
reviewed
Nov 5, 2026
…ex.py Use the two-line SPDX header of the other new files instead of the long 2025 Apache text. Signed-off-by: Danial MohseniTaheri <[email protected]>
Contributor
Author
|
Thanks for the thorough review. All 17 comments are addressed at
Could you trigger CI on the new head? |
The pinned dataset revision (a commit hash) and a test URL with dummy credentials, which retrieval must reject, are not secrets. Signed-off-by: Danial MohseniTaheri <[email protected]>
Contributor
|
/ok to test c6cf096 |
yfw
reviewed
Nov 7, 2026
Root can write to a 0o500 directory, so as root (as in CI) the entry is stored and the lookup hits. Skip the test for root, as other Gym tests do. Signed-off-by: Danial MohseniTaheri <[email protected]>
A reply with several answer tags is scored on the last one, so a model that quotes the format (<answer>YOUR_SHORT_ANSWER</answer>) before answering is graded on its actual answer. Reasoning blocks are still removed first. Matches the parser of the other Agentic-MME harness we compare against. Signed-off-by: Danial MohseniTaheri <[email protected]>
Contributor
Author
|
/ok to test bbbd596 |
1 similar comment
Contributor
|
/ok to test bbbd596 |
yfw
approved these changes
Nov 9, 2026
Contributor
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/42587733760 |
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds the Agentic-MME benchmark: multi-turn visual reasoning where the policy answers image questions using atomic image tools and, optionally, web retrieval. It is onboarded as a manifest-backed benchmark (
experimental: true). No existing environment covers this task, so there is no linked issue; this PR is the proposal.resources_servers/agentic_mme: task-only verification. The terminal answer is scored by an LLM judge, with the released evaluator'sexact/contains/numericstring match reported alongside asstring_match_reward. Verifier metadata never enters the model context. Exports aVERIFIER_FIXTURE.responses_api_agents/agentic_mme_agent: native multi-turn agent with append-only history, so every model call's prompt extends the previous one (compatible with token capture for RL). It is fronted by alegacy_agentenvironment server.policy_error, so no rollout is silently dropped.benchmarks/agentic_mme:manifest.yaml,config.yaml(judge binding, no round or tool-call limit),prepare.py, retrieval overlays, and a README with the measurement contract.Tasks and licensing. 418 tasks: the full release of Crystal1047/Agentic-MME at pinned revision
b9ea9d3f, unfiltered. The release's only split is namedtrainbut is an evaluation set. Domains include charts, architecture, news, music and anime, at levels L1 to L3. Dataset license: Apache-2.0 (dataset card). The reference harness (ChoS3nE11ven/Agentic-MME) declares no code license, so nothing is vendored: the tools are an independent implementation on Pillow (HPND), NumPy (BSD) and OpenCV (Apache-2.0). The five checked-in example tasks are templated colour-identification questions on generated solid-colour images; no model was used to generate task data.Validation
Run against the final diff (branch merged with current
main):pre-commit run --all-files: all hooks pass (ruff, ruff-format, import ordering, verified flag, README table, import-linter).gym env validate agentic_mme: manifest, components and 418 prepared rows OK; inferred profilecustom-gym-agent-loopmatches the declared one.gym env test agentic_mme: verifier fixture, 3 cases pass.gym env publish agentic_mme: publication checks pass (local only).gym env test +entrypoint=resources_servers/agentic_mme +should_validate_data=true: 32 passed, data validated.gym env test +entrypoint=responses_api_agents/agentic_mme_agent: 122 passed.scripts/add_legacy_agent_environment_servers.py --check: clean repo-wide.-W erroronnemo_gymdeprecation warnings (imports use the current module paths).Rollouts
Smoke rollouts on the final code, policy Kimi K3 through an OpenAI-compatible endpoint, judge
gpt-4o-mini, retrieval disabled, servers started withgym env start --config benchmarks/agentic_mme/config.yamland collected withgym eval run --no-serve --agent agentic_mme_agent:Example data (
resources_servers/agentic_mme/data/example_rollouts.jsonl): 5 of 5 correct. Each episode callscrop, receives the cropped image in the next turn, and answers in<answer>tags; judge and string match agree.First 5 benchmark tasks (
--limit 5): 3 of 5 correct, no failed rollouts, nopolicy_error.The judge accepted the unit difference (
$44.6 million) and rejected both wrong entities, matching string match on all five.A full evaluation and reward profile are not included. No published result has been reproduced yet, so the manifest stays
experimental: true.Compatibility and benchmark impact
None for existing environments: all changes are new packages plus one new README table row. Retrieval is opt-in through the benchmark overlays and needs provider API keys only when enabled.
Proposed labels:
feature,area:environment,benchmark-onboarding.Checklist
pre-commit run --all-files) (so CI lint/format checks pass).git commit -s) (so the DCO check passes).