Repository navigation
Add human-eval-infilling (FIM) benchmark + code_fim resource server - #1258
Merged
bxyu-nvidia merged 3 commits intoMay 8, 2026
Conversation
Adds the HumanEval-Infilling (Bavarian et al., 2022) Code Fill-in-the-Middle benchmark and a small new `code_fim` resource server that splices prefix + completion + suffix and runs the spliced program via `human_eval_infilling.execution.check_correctness`. Mirrors NeMo-Skills' `eval_human_eval_infilling` evaluator step-for-step (last-fence + strict-mode extraction, leading-newline drop, prefix/suffix overlap trimming). Strictly additive — `evalplus` server unchanged so parallel MBPP migration stacking on the same base branch is unaffected. Three default splits (single_line / multi_line / random_span) byte-equivalent to Skills' prepare.py output (0 field mismatches across 1033 + 5815 + 1640 rows). 30/30 unit tests pass at 99% coverage; existing 24 evalplus tests still pass. Signed-off-by: gwarmstrong <[email protected]>
4 of 5 tasks
Signed-off-by: gwarmstrong <[email protected]>
…uman-eval-infilling-on-main-fixmerge Signed-off-by: gwarmstrong <[email protected]> # Conflicts: # README.md
bxyu-nvidia
approved these changes
May 8, 2026
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.
Add human-eval-infilling (FIM) benchmark
Summary
nemo_skills/dataset/human-eval-infilling) into NeMo Gym.code_fim, that splicesprefix + completion + suffix + testand runs the spliced program viahuman_eval_infilling.execution.check_correctness(the same library Skills uses at evaluation time). The server is independent of the existingevalplusserver —evalplushandles function-completion (HumanEval+, MBPP+);code_fimhandles fill-in-the-middle, which has a different data shape (prefix/suffix/test/entry_pointinstead ofprompt/entry_point/test).human_eval_infillingbenchmark dir, which inherits fromcode_fimand ships data + prompt + prepare script for the three default difficulty levels (single_line/multi_line/random_span). Default benchmark variant israndom_span(matches Skills'EVAL_SPLIT).Follow-up to the EvalPlus-server / HumanEval+ migration (#1201). All changes are additive —
resources_servers/evalplus/is untouched.Files added
benchmarks/human_eval_infilling/config.yaml— agent + resource-server config,_inherit_from: code_fimprepare.py— fetches the three splits viahuman_eval_infilling.data.read_problems(...)(the upstream.jsonl.gzfiles; the HF mirror atloubnabnl/humaneval_infillingis a script-based dataset and is no longer compatible with moderndatasetsversions, but the gz files are content-equivalent)prompts/default.yaml— char-for-char copy of Skills'nemo_skills/prompt/config/generic/fim.yamlREADME.md,__init__.pyresources_servers/code_fim/app.py— FastAPI / Ray verifier with last-fence + strict-mode code extraction (matches Skills'preprocess_codewithstrip_whitespace=False), Skills'remove_overlappostprocessing, and a thin Ray-remote wrapper aroundhuman_eval_infilling.execution.check_correctnesshuman_eval_infilling_integration/runner.py— Ray-remote shim, mirrors the pattern inresources_servers/evalplus/evalplus_integration/runner.pyconfigs/code_fim.yaml,tests/test_app.py(30 tests, all passing),data/example.jsonl+example_rollouts.jsonl+example_metrics.jsonfor CI,pyproject.toml,README.mdSkills → Gym component mapping
nemo_skills/dataset/human-eval-infilling/__init__.py(METRICS_TYPE=human_eval_infilling,EVAL_SPLIT=random_span)benchmarks/human_eval_infilling/config.yamlnemo_skills/dataset/human-eval-infilling/prepare.pybenchmarks/human_eval_infilling/prepare.pynemo_skills/prompt/config/generic/fim.yamlbenchmarks/human_eval_infilling/prompts/default.yaml(char-for-char)preprocess_code, last-fence + strict +strip_whitespace=False)nemo_skills/evaluation/evaluator/code.py::preprocess_codecode_fimserver'sextract_code_strictremove_overlapagainst prefix and suffix, drop one leading\n)nemo_skills/evaluation/evaluator/code.py::eval_human_eval_infilling(postprocess_code)code_fimserver'spostprocess_completionhuman_eval_infilling.evaluate.evaluate(...)code_fimserver's Ray-remotecheck_correctnessHumanEvalInfillingMetrics, pass@k onpassed)nemo_skills/evaluation/metrics/code_metrics.pycode_fimserver'scompute_metrics(usescompute_pass_majority_metricswithaccuracy=passed)Data parity (Skills vs Gym)
prepare.pyproduces JSONLs whose per-row fields match Skills byte-for-byte for every sharedtask_idacross all three default splits. Verified viacompare_prepare.py:single_linemulti_linerandom_spanThe compared fields are the ones Skills writes:
prefix,suffix,canonical_solution,language,split,comment_delimiter. Gym additionally writes averifier_metadata.task_idfield (= top-leveltask_id) so the resource server can look upentry_point+testat verify time without bloating the on-disk JSONL.Verification details (parity with Skills)
The Gym verifier mirrors Skills'
eval_human_eval_infillingstep-for-step:<think>...</think>, take the LAST fenced block (preferring```pythonover```), strict mode (no closer → empty), no.strip()(FIM usesstrip_whitespace=Falsein Skills since indentation is significant for the spliced program).\n— LLMs emit```python\n<fill>```, so the literal newline is part of the fence formatting and not the completion.remove_overlap(prefix, completion, "following")— strips a tail ofprefixthat the model re-emits at the head of its completion. Whitespace-only overlaps without a newline are skipped, matching Skills.remove_overlap(completion, suffix, "preceding")— symmetric: strips a head ofsuffixthat the model re-emits at the tail.human_eval_infilling.execution.check_correctness(problem, completion, timeout=3.0). The check program executed by the upstream library isprefix + completion + suffix + "\n" + test + "\n" + check(entry_point), the same program Skills' evaluator runs.Why a new
code_fimserver, not extendingevalplus?The
evalplusserver on the base branch handles function-completion benchmarks (HumanEval+, MBPP+) by feedingprompt + completionintoevalplus.evaluate.check_correctnessagainst base + plus tests. FIM is structurally different:prefix+suffix(not justprompt),prefix + completion + suffix + test,passedverdict per task,human_eval_infilling.execution.check_correctness(a different package), notevalplus.evaluate.check_correctness.A new directory keeps
evalplus's server logic, schemas, and tests untouched, which keeps the parallel MBPP migration that stacks on the same base branch unaffected.End-to-end smoke test
Ran
ng_run+ng_collect_rolloutsagainsthttps://integrate.api.nvidia.com/v1withnvidia/nvidia-nemotron-nano-9b-v2on the 5-rowresources_servers/code_fim/data/example.jsonl:output_textstatuspopulated by the upstream library)[0, 1]pass@1/accuracy,majority@1/accuracy,pass@1[avg-of-1]/accuracyThe model passes 0% on this small smoke run with
max_output_tokens=2048(the 9B model truncates / mis-indents); a real parity run vs Skills would use a 30B-class model with the larger token budget Skills' baseline uses.Tests
resources_servers/code_fim/tests/test_app.py— 30 tests covering: code extraction (last-fence + strict + no-strip +<think>handling),remove_overlap,postprocess_completion, the verify endpoint (pass / fail / no-code / unknown task / missing task / boundary trim), the metrics layer (pass@k, no_answer tracking, headline-metrics selection), and dataset loading.resources_servers/evalplus/tests/test_app.py— 24 tests pre-existed; all still pass (no regressions).Licensing
human-eval-infillinglibrary: MIT (https://github.com/openai/human-eval-infilling)loubnabnl/humaneval_infillingHF dataset: MITTest plan
pytest resources_servers/code_fim/tests/— 30/30 passpytest resources_servers/evalplus/tests/— 24/24 pass (no regressions)prepare.pybyte-equivalence check across all three default splits (1033 + 5815 + 1640 rows, 0 field mismatches, row order matches)ng_run+ng_collect_rolloutssmoke test againsthttps://integrate.api.nvidia.com/v1migrate-gym-human-eval)