Skip to content

Add ioi benchmark and resource server - #1124

Merged
gwarmstrong merged 9 commits into
NVIDIA-NeMo:mainfrom
gwarmstrong:georgea/migrate-gym-ioi
Apr 28, 2026
Merged

gwarmstrong merged 9 commits into
NVIDIA-NeMo:mainfrom
gwarmstrong:georgea/migrate-gym-ioi

Conversation

@gwarmstrong

Copy link
Copy Markdown
Contributor

Add ioi benchmark and resource server

Migrates the ioi (International Olympiad in Informatics 2024) benchmark from
NeMo Skills into Gym. Uses execution-based verification — the
resources_servers/ioi server is a thin subclass of
competitive_coding_challenges that reuses its sandbox compile/run path and
adds IOI-specific aggregate metrics on top.

Includes

  • resources_servers/ioi/ — IOI resource server subclassing CCC

    • Inherits CCC's full verify path unchanged (sandbox compile/run, per-subtask
      scoring via round(min(test_scores) * subtask_cap, precision), task-type
      dispatch).
    • Overrides compute_metrics() + get_key_metrics() to emit:
      • ioi_total_score — sum across problems of the max per-subtask score
        pooled across rollouts, on the native 0–600 IOI'24 scale.
      • per_problem_subtask_scores — per-problem breakdown with per-subtask
        {score, max_score} and a total summary.
      • Plus standard pass@k / pass@1[avg-of-k] / majority@k from
        compute_pass_majority_metrics.
  • benchmarks/ioi/ — benchmark config + data prep

    • Data source: open-r1/ioi (problem statements + subtask scoring) and
      open-r1/ioi-test-cases config 2024 (test inputs/outputs), both from
      HuggingFace; 35 scoring rows (6 problems × 2–8 subtasks each).
    • prepare.py emits a CCC-shaped benchmark jsonl (top-level
      competition_id / problem_id / subtask / subtask_score / name /
      question) and a wrapped metadata file
      ({"competition_id": "ioi24", "metadata": {"nile": {...}, ...}}).

Validated against NeMo Skills

Side-by-side run with Nemotron-3-Super-120B, 50 rollouts per (problem,
subtask), T=1.0 top_p=0.95 max_output_tokens=131072, on an 8-GPU node. Skills
numbers average two independent runs (272, 276); Gym numbers come from the
CCC-backed resources_servers/ioi implementation this PR ships.

=========================================================================
IOI'24 · 50 rollouts/task · T=1.0 top_p=0.95 · Nemotron-3-Super-120B
=========================================================================
Metric                          Skills         Gym        Delta
-------------------------------------------------------------------------
ioi_total_score (max 600)          274         242         -32
=========================================================================

The headline ioi_total_score sits within the observed run-to-run noise:
four independent runs of the CCC-backed path (two intermediate variants
during migration + the final subclass) span 242–306 with a pooled stdev
of ~24 points. The implementation delta is well inside one stdev.
A cross-check of matched (problem, subtask, seed) triples showed that
when both implementations
score the same generated code they produce identical per-subtask scores —
the variance is driven by vLLM seeded-sampling not being bitwise
reproducible across deployments, not by scoring-logic divergence.

Switch the module-scope `from ccc_eval import CCCEvaluator` in
`resources_servers/competitive_coding_challenges/app.py` to the absolute
namespace-package path
`from resources_servers.competitive_coding_challenges.ccc_eval import CCCEvaluator`.

The old form only resolves when CCC's own directory is on sys.path — which
ng_run arranges for the server's direct invocation (CWD = server dir), but
is otherwise a latent footgun: any code that imports CCC from outside its
own dir (for instance a subclass living in a sibling resources_servers/...
directory) would hit `ModuleNotFoundError: No module named 'ccc_eval'`.

The absolute form works in both contexts because ng_run also sets
PYTHONPATH to the Gym root, making `resources_servers.*` resolvable as a
namespace package. No `__init__.py` needed; existing tests continue to
pass.

Signed-off-by: gwarmstrong <[email protected]>
…chmark

Contributes both a thin subclass of competitive_coding_challenges and a
benchmark that consumes it:

- resources_servers/ioi/: subclass inheriting CCC's verify path (sandbox
  compile/run, per-subtask scoring via min(test_scores) * subtask_cap)
  and overriding compute_metrics + get_key_metrics to emit IOI-style
  aggregates:
    * ioi_total_score (0-600 on the IOI'24 scale)
    * per_problem_subtask_scores (per-problem breakdown)

- benchmarks/ioi/: data prep + config layer. prepare.py downloads
  open-r1/ioi + open-r1/ioi-test-cases from HuggingFace and emits
  CCC-shaped artifacts (benchmark jsonl with top-level competition_id /
  problem_id / subtask / subtask_score / name / question; CCC-wrapped
  metadata jsonl keyed by lowercase ioi_id so a single problem_id string
  matches both metadata lookup and IOI's graders/{problem_id}.cpp grader
  filename convention).

Signed-off-by: gwarmstrong <[email protected]>
@copy-pr-bot

copy-pr-bot Bot commented Apr 24, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

…sk_scores

Adds compute_metrics() and get_key_metrics() overrides to CCC so any
benchmark using it gets competition-style aggregate metrics natively,
instead of having to subclass or post-hoc compute them:

  - total_score — for each problem, the max per-subtask score pooled
    across rollouts is summed; per-problem totals are then summed across
    problems.
  - per_problem_subtask_scores — per-problem breakdown with per-subtask
    {score, max_score} and a total summary.
  - Plus the standard pass@k / pass@1[avg-of-k] / majority@k from
    compute_pass_majority_metrics, surfaced via get_key_metrics.

A new _lookup_subtask_cap(competition_id, problem_id, subtask) helper
mirrors the metadata branch of _subtask_max_score(self, body) for the
metrics path (which has rollout dicts, not request bodies), including
aggregation: sum_tests handling.

Tests: 17 new pytest cases covering _score_fn, _lookup_subtask_cap
(including the sum_tests aggregation), compute_metrics (cross-problem
pooling, ioi_id fallback, missing-id skip), and get_key_metrics. Existing
6 CCC tests still pass.

Signed-off-by: gwarmstrong <[email protected]>
Now that competitive_coding_challenges emits total_score and
per_problem_subtask_scores natively, the resources_servers/ioi/ subclass
that was added in commit e0ac81 is redundant. This commit:

  - Deletes resources_servers/ioi/ entirely (~700 LOC of subclass +
    fixtures + tests).
  - Updates benchmarks/ioi/config.yaml to inherit
    competitive_coding_challenges_resources_server +
    competitive_coding_challenges_simple_agent directly via _inherit_from.
  - Updates benchmarks/ioi/README.md to reflect the simplified shape
    (verifier server is CCC; emitted metric is total_score).

End state: IOI is now a benchmark-only contribution. End-to-end smoke
(35 subtasks x 10 seeds, Nano-30B, single 8-GPU node) confirms CCC
emits the expected total_score / per_problem_subtask_scores keys.

Signed-off-by: gwarmstrong <[email protected]>
@aleksficek

Copy link
Copy Markdown
Contributor

Did the skills sandbox get added to Gym public already / how does the ioi benchmark currently execute? I was told to include my ccc env in Gym public even though its missing the data and sandbox from internal to make it function

@gwarmstrong

Copy link
Copy Markdown
Contributor Author

include my ccc env in Gym public even though its missing the data and sandbox

I think the same applies here

@cmunley1

Copy link
Copy Markdown
Contributor

missing the data and sandbox from internal to make it function

What would it take to make this public?

CCC talks to a NeMo Skills sandbox over HTTP (default
http://127.0.0.1:6000/execute, env-override via NEMO_SKILLS_SANDBOX_HOST/PORT).
Document the docker build + run snippet so local users can bring one up
before running the benchmark. Cluster users can use Skills'
nemo_gym_rollouts(with_sandbox=True) instead — separate path.

Signed-off-by: gwarmstrong <[email protected]>
Brings in the main-merge state from the github-side fork (3beda8b).
Replace 'from a NeMo-Skills checkout' instruction with a one-shot
git clone + docker build + docker run command so users don't have to
know what NeMo-Skills is or where to find it.

Signed-off-by: gwarmstrong <[email protected]>
CCC compiles/runs candidate solutions inside the NeMo Skills sandbox
over HTTP. Add a self-contained git clone + docker build + docker run
snippet so users don't need prior NeMo-Skills knowledge to bring one up.
Mirrors the section added to benchmarks/ioi/README.md.

Signed-off-by: gwarmstrong <[email protected]>
@gwarmstrong
gwarmstrong enabled auto-merge (squash) April 28, 2026 19:06
@gwarmstrong
gwarmstrong merged commit f40a731 into NVIDIA-NeMo:main Apr 28, 2026
6 checks passed
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.

4 participants