File size: 5,394 Bytes
515bedd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91485a4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
---
license: cc0-1.0
task_categories:
- text-generation
language:
- en
tags:
- code
- minecraft
- forge
- neoforge
- benchmark
- loader-migration
size_categories:
- n<1K
pretty_name: ForgeBench v2 (dual-target Forge 1.20.1 / NeoForge 1.21.1)
configs:
- config_name: forgebench_v2_full
  data_files:
  - split: train
    path: data/forgebench_v2_full.jsonl
---
# ForgeBench v2 — dual-target Forge 1.20.1 / NeoForge 1.21.1 evaluation benchmark

**Dataset**: `ComerX/forgebench-v2` · **Predecessor**: `ComerX/forgebench-v1`
**Task**: code generation benchmark for Minecraft loader migration, 130 tasks.

## What changed vs v1 (and why)

| v1 defect | v2 fix |
|---|---|
| `net.minecraftforge.*` hard-coded as hallucination for ALL targets (Forge 1.20.1 code scored 0) | target-aware profiles in `ast_eval.py`: forge-1.20.1 allows `net.minecraftforge.*` natively; neoforge-1.21.1 penalizes it |
| Single MDK template (NeoForge 21.1.77) | dual templates: `template-forge-1.20.1` (ForgeGradle 6, JDK 17, Gradle 8.1.1) + `template-neoforge-1.21.1` (NeoForge 21.1.77, JDK 21, Gradle 8.9); `--target` switch |
| api module punished Forge 1.20.1 via `forbidden_apis` | new native forge tasks `FORGE_API_001..020` (registry, events, capabilities, config, menus, networking, datagen, ...) |
| Porting limited to single-file micro-refactors | new `porting` module: `PORT_001..010` multi-file slices (context = Forge 1.20.1 slice, golden = NeoForge 1.21.1 file set); architecture chain example PORT_006 (block → BlockEntity → Menu → Screen → registries → client event) |
| ast_eval was globally static | per-target profiles, `--self-test` mode, tokenizer fallback for modern grammar (records/switch), comment-aware resource gate |

## Contents

```
data/forgebench_v2_full.jsonl   130 tasks (merged)
data/schema_example_v2.jsonl    schema examples
parts/forge_api_{a..d}.jsonl    FORGE_API_001..020  (forge 1.20.1, single_file)
parts/porting_{a..c}.jsonl      PORT_001..010        (neoforge 1.21.1, multi_file)
harness/Dockerfile              dual-target sandbox image
harness/sandbox_runner.py       --target forge-1.20.1 | neoforge-1.21.1; single-file & multi-file staging
harness/ast_eval.py             target-aware static gate (+ --self-test)
harness/run_benchmark.py        batch driver
harness/gametest_runner.py      GameTest stage (optional, gametest_required tasks)
harness/judge_prompt.txt        LLM-as-a-Judge prompt
template-forge-1.20.1/          ForgeGradle 6 MDK template (Java 17)
template-neoforge-1.21.1/       NeoForge 21.1.77 MDK template (Java 21)
VERIFICATION.md                 self-verification results
```

## Task schema (v2)

```json
{
  "task_id": "FORGE_API_014 | PORT_003 | ...",
  "module": "api | mixin | migration | debug | build | porting",
  "target_loader": "forge | neoforge",
  "target_version": "1.20.1 | 1.21.1",
  "task_scope": "single_file | multi_file",
  "instruction": "...",
  "context": "string | {relative_path: code}",
  "golden_reference": "string | {relative_path: code}",
  "eval_criteria": {
    "must_compile": true,
    "required_annotations": ["@Mod", "@SubscribeEvent"],
    "forbidden_apis": ["net.neoforged (forge tasks) | net.minecraftforge (neoforge tasks)"],
    "allowed_legacy_apis": [],
    "gametest_required": false
  }
}
```

Composition: api 40 (20 v1-neoforge + 20 forge-native) · mixin 20 · migration 20 · debug 20 · build 20 · porting 10.
Targets: neoforge-1.21.1 × 110 · forge-1.20.1 × 20. Scopes: single_file × 120 · multi_file × 10.

## Runner usage

```bash
docker build -t forgebench-sandbox:v2 harness/
# single file, forge target:
python3 harness/sandbox_runner.py --task task.json --code-file answer.java --target forge-1.20.1
# multi-file porting:
python3 harness/sandbox_runner.py --task task.json --candidate-dir answer/ --target neoforge-1.21.1
# static gate + golden self-test:
python3 harness/ast_eval.py --task task.json --code answer.java
python3 harness/ast_eval.py --task task.json --self-test
```

## Honest limitations

1. **Gradle compile gates are NOT executed at publication time.** Publication host has a
   ~4 GB memory ceiling and no guaranteed Docker; NeoForm decompilation needs ≥8 GB. The
   harness, templates and both targets are shipped untested-by-execution; the golden
   self-verification performed is static only (`ast_eval --self-test`, 130/130 pass) plus
   schema and contamination checks. Do not cite compile-validated numbers for v2 until a
   ≥8 GB runner executes the sandbox end-to-end.
2. Gradle wrapper JARs are binaries: copy them from the official MDK archives into both
   template trees before `docker build` (see harness/Dockerfile header).
3. `ast_eval.py` uses javalang (Java 8 grammar): modern-syntax answers (records, switch
   expressions) fall back to regex checks with a PARSE_LIMITATION info finding — no score
   penalty; the authoritative gate is the sandbox Gradle build.
4. Porting slices are focused (1–6 files, avg 2.4); PORT_006 is the full 6-file
   architecture chain. Broader slices (5–10 files) are reserved for v2.1.
5. The sandbox resource gate forbids raw `javac` and Mockito; gradle build is the only
   compile authority.

## License

Tasks are original synthetic artifacts (CC0-1.0 for the benchmark data). Harness: Apache-2.0.
ForgeBench tasks are contamination-checked against the ComerX SFT corpus (see VERIFICATION.md).