|
| 1 | +# Task for Codex: Harden DevBench JavaScript Code2NL/NL2Code |
| 2 | + |
| 3 | +## Context |
| 4 | + |
| 5 | +DevBench is a code generation benchmark rejected from ICLR 2026 (ceiling effect). Resubmitting to NeurIPS 2026. Python is done (53% overall for GPT-5.5). Now doing JavaScript. |
| 6 | + |
| 7 | +FIM code completion format: |
| 8 | +- Model sees: `prefix + #TODO: You Code Here + suffix` |
| 9 | +- Model does NOT see `assertions` (hidden tests) |
| 10 | +- Execution: `prefix + model_completion + suffix + assertions` |
| 11 | +- Pass@1 with n=5 samples |
| 12 | + |
| 13 | +## Goal |
| 14 | + |
| 15 | +**Bring GPT-5.5 Pass@1 on JavaScript Code2NL/NL2Code to ≤45%** (currently 62.4%). |
| 16 | + |
| 17 | +- Current total points: 3120 (out of 5000) |
| 18 | +- Target: ≤2250 points (45%) |
| 19 | +- Need to reduce by: 870 points |
| 20 | +- If each conversion takes a 100% task to 0%: need ~9 conversions |
| 21 | +- There are 28 tasks at 100% — plenty of candidates |
| 22 | + |
| 23 | +## MANDATORY: Read these files first |
| 24 | + |
| 25 | +1. **`HARDENING_LOG.md`** — Full methodology. Pay special attention to: |
| 26 | + - Round 7 (Code2NL Codex report) — docstring precision mechanism |
| 27 | + - The exact failure pattern: GPT-5.5 returns empty completion or `pass` instead of precise docs |
| 28 | +2. **`benchmark/javascript/code2NL_NL2code/code2NL_NL2code.jsonl`** — Current 50 JavaScript tasks |
| 29 | +3. **`eval_poc.py`** (at repo root) — Evaluation script |
| 30 | +4. **`.env`** — API keys |
| 31 | + |
| 32 | +## What Worked for Python Code2NL (from HARDENING_LOG.md — achieved 46.4%) |
| 33 | + |
| 34 | +**Docstring precision gaps** — the ONLY mechanism that worked: |
| 35 | +- Completion slot is immediately after a function/method header, before the executable body |
| 36 | +- The body is visible in the suffix and shows specific API behavior |
| 37 | +- Hidden assertions check that `.__doc__` contains specific keywords |
| 38 | +- GPT-5.5 returns empty completion or generic "Processes input" instead of precise docs |
| 39 | + |
| 40 | +**For JavaScript, the docstring approach uses:** |
| 41 | +1. **`.doc` property**: `myFunc.doc = 'precise description...'` — assertions check `myFunc.doc.includes('keyword')` |
| 42 | +2. **`describe*()` function**: returns description string — assertions check return value |
| 43 | +3. **NL2Code**: prefix has natural language spec, completion is code implementation with subtle behavioral requirements |
| 44 | + |
| 45 | +### What the 17 existing 0% tasks prove works in JS: |
| 46 | +- Tasks 1-8: `.doc` property and `describe*()` approaches — GPT-5.5 writes generic descriptions missing specific keywords like "mutating", "WeakSet", "circular", "leading", "undefined" |
| 47 | +- Tasks 21-22, 24-28, 30: doc property and describe functions requiring precise API documentation — GPT-5.5 omits details about LRU promotion, bottom-up traversal, deref(), non-enumerable properties |
| 48 | +- Task 40: Complex template engine NL2Code — GPT-5.5 can't coordinate pipe filters + double-brace escaping |
| 49 | + |
| 50 | +## Current GPT-5.5 Scores |
| 51 | + |
| 52 | +``` |
| 53 | +100% (28 tasks): 9,10,11,12,13,14,15,17,18,19,20,23,29,31,32,33,34,36,37,38,39,41,42,44,46,47,49,50 |
| 54 | +80% (3 tasks): 16,45,48 |
| 55 | +60% (1 task): 43 |
| 56 | +20% (1 task): 35 |
| 57 | +0% (17 tasks): 1,2,3,4,5,6,7,8,21,22,24,25,26,27,28,30,40 |
| 58 | +``` |
| 59 | + |
| 60 | +Overall: 62.4% (3120/5000). Target: ≤45% (2250/5000). |
| 61 | + |
| 62 | +## Your Task |
| 63 | + |
| 64 | +**Replace 100% tasks ONE AT A TIME with harder Code2NL/NL2Code tasks.** |
| 65 | + |
| 66 | +### Recommended mechanism mix (for 9 conversions): |
| 67 | +- **5-6 doc/describe tasks**: Completion is a `.doc` property string or `describe*()` return value. Assertions check for specific keywords that GPT-5.5 omits from generic descriptions. |
| 68 | +- **3-4 NL2Code tasks**: Prefix has detailed natural language spec, completion is code with subtle behavioral requirements that differ from standard implementations. |
| 69 | + |
| 70 | +### Doc/describe task template: |
| 71 | + |
| 72 | +```javascript |
| 73 | +// PREFIX: |
| 74 | +function stablePartition(arr, predicate) { |
| 75 | + |
| 76 | +// GOLDEN_COMPLETION (doc property): |
| 77 | + stablePartition.doc = 'Stably partition array in place by predicate. ' + |
| 78 | + 'Items where predicate returns true move to front, preserving relative order ' + |
| 79 | + 'within both groups. Mutates the input array. Predicate is called exactly once ' + |
| 80 | + 'per item. Returns the split index.'; |
| 81 | + |
| 82 | +// SUFFIX (implementation visible to model): |
| 83 | + const kept = []; |
| 84 | + const rest = []; |
| 85 | + for (const item of arr) { |
| 86 | + (predicate(item) ? kept : rest).push(item); |
| 87 | + } |
| 88 | + const idx = kept.length; |
| 89 | + kept.push(...rest); |
| 90 | + arr.length = 0; |
| 91 | + arr.push(...kept); |
| 92 | + return idx; |
| 93 | +} |
| 94 | + |
| 95 | +// ASSERTIONS (hidden): |
| 96 | +const assert = require('assert'); |
| 97 | +assert(stablePartition.doc.includes('in place')); |
| 98 | +assert(stablePartition.doc.includes('Mutates')); |
| 99 | +assert(stablePartition.doc.includes('exactly once')); |
| 100 | +assert(stablePartition.doc.includes('split index')); |
| 101 | +``` |
| 102 | + |
| 103 | +### Keywords that GPT-5.5 consistently OMITS (use these in assertions): |
| 104 | +- "mutate" / "in place" / "modifies" (for mutation operations) |
| 105 | +- Specific API method names (e.g., "WeakSet", "deref", "bisect") |
| 106 | +- "exactly once" / "at most once" (for call count guarantees) |
| 107 | +- Exception/error behavior ("throws TypeError", "throws RangeError") |
| 108 | +- Return value details ("returns the split index", "returns undefined") |
| 109 | +- Side effect details ("appends to audit log", "updates counter") |
| 110 | +- Edge case behavior ("empty input returns", "null treated as") |
| 111 | + |
| 112 | +### NL2Code task template: |
| 113 | + |
| 114 | +```javascript |
| 115 | +// PREFIX (natural language spec): |
| 116 | +// Implement slugify(str) that: |
| 117 | +// - Converts to lowercase |
| 118 | +// - Replaces spaces with hyphens |
| 119 | +// - REMOVES non-alphanumeric chars (does NOT replace with hyphens) |
| 120 | +// - Collapses consecutive hyphens |
| 121 | +// - Trims leading/trailing hyphens |
| 122 | + |
| 123 | +// GOLDEN_COMPLETION: |
| 124 | +function slugify(str) { |
| 125 | + return str.toLowerCase() |
| 126 | + .replace(/\s+/g, '-') |
| 127 | + .replace(/[^a-z0-9-]/g, '') // remove, not replace |
| 128 | + .replace(/-+/g, '-') |
| 129 | + .replace(/^-|-$/g, ''); |
| 130 | +} |
| 131 | + |
| 132 | +// SUFFIX: |
| 133 | +const assert = require('assert'); |
| 134 | +assert.strictEqual(slugify('Hello World'), 'hello-world'); |
| 135 | + |
| 136 | +// ASSERTIONS (hidden — test the subtle behavior): |
| 137 | +assert.strictEqual(slugify('a!!!b'), 'ab'); // NOT 'a-b' |
| 138 | +``` |
| 139 | + |
| 140 | +### Process for each task: |
| 141 | +1. Pick from the 100% list |
| 142 | +2. Design using doc/describe or NL2Code mechanism |
| 143 | +3. Write JSON with all fields |
| 144 | +4. Validate with Node.js |
| 145 | +5. Eval against GPT-5.5 (n=5) |
| 146 | +6. If pass@1 ≤ 40%: SUCCESS |
| 147 | +7. If pass@1 ≥ 80%: try different (up to 3 attempts) |
| 148 | +8. Update running score |
| 149 | +9. **Stop when overall ≤ 45%** |
| 150 | + |
| 151 | +### MANDATORY: Save completions |
| 152 | + |
| 153 | +```bash |
| 154 | +echo '{TASK_JSON}' > /tmp/codex_eval_task.jsonl |
| 155 | +EVAL_MODEL=gpt-5.5-2026-04-23 \ |
| 156 | +EVAL_FILE=/tmp/codex_eval_task.jsonl \ |
| 157 | +SAVE_COMPLETIONS=1 \ |
| 158 | +COMPLETIONS_OUT=/Users/adarshkumarappan/Impt/devbench/benchmark/javascript/code2NL_NL2code/completions-codex-mutation-task{ID}-attempt{N}.jsonl \ |
| 159 | +/Users/adarshkumarappan/miniconda3/envs/devbench/bin/python -u /Users/adarshkumarappan/Impt/devbench/eval_poc.py |
| 160 | +``` |
| 161 | + |
| 162 | +### Evaluation setup: |
| 163 | +- Model: `gpt-5.5-2026-04-23` (no temperature) |
| 164 | +- `max_completion_tokens` not `max_tokens` |
| 165 | +- n=5, Pass@1 = c/n |
| 166 | +- Eval script: `/Users/adarshkumarappan/Impt/devbench/eval_poc.py` |
| 167 | +- Node.js: `/Users/adarshkumarappan/.nvm/versions/node/v24.12.0/bin/node` |
| 168 | +- Conda: `/Users/adarshkumarappan/miniconda3/envs/devbench/bin/python` |
| 169 | +- **ALWAYS use absolute paths** |
| 170 | + |
| 171 | +### Important constraints: |
| 172 | +- Doc tasks: completion is DOCUMENTATION, not code |
| 173 | +- NL2Code tasks: completion is CODE from a spec, with subtle behavioral traps |
| 174 | +- Do NOT use encoding tasks — wrong category |
| 175 | +- Golden completions: 3-12 lines |
| 176 | +- Node.js standard modules only |
| 177 | +- ONE task at a time |
| 178 | + |
| 179 | +### What to save: |
| 180 | +1. Append new tasks to: `benchmark/javascript/code2NL_NL2code/codex_mutations.jsonl` |
| 181 | +2. Save per-task completions |
| 182 | +3. Save scores to: `benchmark/javascript/code2NL_NL2code/codex_mutation_scores.jsonl` |
| 183 | +4. Update `HARDENING_LOG.md` |
| 184 | +5. Do NOT assemble final file |
| 185 | + |
| 186 | +## [CODEX: ADD YOUR OWN INSIGHTS HERE] |
| 187 | + |
| 188 | +Analyze the 17 existing 0% tasks. What keywords do their assertions check for? Which doc/describe patterns are most effective? Use that to design your replacements. |
| 189 | + |
| 190 | +## Stop condition |
| 191 | + |
| 192 | +**Stop when running_score ≤ 45%.** Need ~9 conversions. |
0 commit comments