Dataset / reports /verification_report.md
dsfasdfaserwer's picture
Add Dataset #2: Magicoder-OSS-Instruct-75K python subset (+673 records)
159bae2 verified
|
Raw History Blame Contribute Delete
11.5 kB
# Verification Report — Dataset #1 (bigcode/self-oss-instruct-sc2-exec-filter-50k)
Date: 2026-10-03 · Environment: sandboxed Linux workspace, Python 3.11.2, 2 CPUs
## 1. Sandbox design (security & isolation, per §18)
Every candidate row's code was treated as **untrusted** and executed as follows:
- Fresh `tempfile.mkdtemp()` working directory per row; removed after execution.
- `subprocess.run([sys.executable, "-I", "-u", "run_tests.py"], env={"PATH": "/usr/bin:/bin:/usr/local/bin"}, stdin=DEVNULL)`.
- **Empty environment**: no `HF_TOKEN`, no home-dir variables, no credentials reachable by dataset code. The Hugging Face token lived only in an ephemeral `/tmp` file outside the workspace and was never passed to any executed dataset code.
- `-I`: isolated mode (ignores user site-packages and env vars).
- `preexec_fn` resource limits: `RLIMIT_CPU=10s`, `RLIMIT_AS=2GB`, `RLIMIT_NPROC=64`, `RLIMIT_FSIZE=8MB`, `RLIMIT_CORE=0`.
- Wall-clock timeout 8–12 s per row (`subprocess.TimeoutExpired` → kill → fail).
- 2 parallel workers (`multiprocessing.Pool`, `maxtasksperchild` recycling), incremental append-only result logs (resumable; no retry loops — per §10 each row executed once per stage, plus at most 2 adjudication re-runs for failures).
- Residual risk (documented): no network namespace was available; mitigated by the source's own upstream Docker execution filtering, small function-level payloads, and rlimits. One row (`check_and_create_dir('/home/user/my_directory')`) attempted an absolute-path write outside its temp cwd; it was detected by non-deterministic re-verification and dropped (state-dependent test = also a quality defect).
## 2. Verification stages actually performed (by us)
| Stage | What ran | Rows | Passed | Failed |
|---|---|---|---|---|
| Parse & compile (AST) | `ast.parse` on every extracted code block | 50,661 | 49,687 solution-clean | 974 syntax-error blocks |
| Core execution | solution + released test block (or inline module-level asserts) | 1,059 | 1,046 (98.8%) | 13 |
| Repair re-execution | 7 fixture/bug repairs (Case A) | 7 | 7 | 0 |
| Derived execution | solution + tests extracted from instruction examples | 11,269 | 10,672 (94.7%) | 597 |
| Inline-split re-execution | 111 inline-assert rows; asserts extracted from code into `tests`, re-verified | 111 | 100 kept split | 11 kept inline (extraction unsafe) |
| **Final artifact re-verification** | exact shipped `code` + `tests` fields after all transformations | 10,315 | 10,308 | 7 (all randomness/state-dependent → dropped) |
| Post-drop invariant | shipped dataset = 100% execution-verified artifacts | **10,275** | **10,275 (100%)** | 0 |
### Dataset #2 stages (ise-uiuc/Magicoder-OSS-Instruct-75K, python subset)
| Stage | What ran | Rows | Passed | Failed |
|---|---|---|---|---|
| Parse & compile (AST) | every python-subset row parsed; code blocks AST-validated | 38,284 | 27,711 gate-pass | dep/no-solution/dup/syntax rejections |
| Sandbox execution | solution + derived/inline/released tests | 1,338 | 746 (55.8%) | 592 (369 assertion, 82 file-not-found, 63 name, 21 type, 16 attribute, 5 import, 3 timeout, 33 other) |
| Inline-split re-execution | module-level asserts extracted into `tests` where AST-safe | 69 kept | re-verified | — |
| **Determinism double-run** | every candidate final artifact executed twice; inconsistent → dropped | 675 | 673 | 2 flaky dropped |
| Final invariant | shipped Magicoder records | **673** | **673 (100%)** | 0 |
### Failure taxonomy
- Core 13 failures: 6 solution-contradicts-own-test → `rejected_incorrect` (incl. a genuinely wrong `is_prime(9)`, a duplicate-removal bug, a `RuntimeError: dictionary keys changed during iteration`); 7 FileNotFound → repaired with fixtures built from instruction-described file contents → `accepted_after_fix`.
- Derived 597 failures: 437 AssertionError (solution inconsistent with the instruction's stated example, or conservative mis-extraction), 35 FileNotFound (file-based tasks without derivable fixtures), 34 NameError (instruction function name ≠ solution def), 27 TypeError, 63 other, 1 ImportError → all `rejected_unverifiable` (we do not claim they are incorrect when the derivation itself could be the failing part — honest labeling).
- Final re-verification 7 failures: flaky (`random`-dependent asserts, set-ordering under stripped `PYTHONHASHSEED`, file-mtime ordering, pre-existing-directory state) → `rejected_low_quality` (non-deterministic tests are poor training signal).
## 3. Derived-test extraction (method & why it is sound)
Rows without released tests were accepted **only** when high-confidence tests could be extracted from the instruction itself:
1. **Pattern E** — explicit assert blocks in the instruction ("Your code should pass the following assertions: ```python assert f(...) == ...```"). Each assert parsed with `ast.parse`; kept only if every referenced name is a solution-defined function, a safe builtin, a safe stdlib module (auto-imported), or a literal assignment inside the same block. 9,467 rows.
2. **Pattern A** — `` `fname(args)` `` calls in the instruction followed within 220 chars by `` == `lit` `` / "returns `lit`" / "-> `lit`"; args parsed via balanced-paren scan + `ast.literal_eval`; chained calls rejected; arity-checked against the solution signature; "either/or" ambiguity skipped. 866 rows.
3. **Pattern C** — "given `x = lit` and `y = lit` … returns `lit`" with strict arity match against the solution's single def. 714 rows.
4. **Pattern F** — single-def arity-1 "input … is `lit` … should return `lit`". 314 rows.
Every extracted literal passed `ast.literal_eval` (no arbitrary code from instruction text is ever executed beyond these validated asserts). Extraction is precision-first: ambiguous cases were skipped, and **failed derivations reject the row** rather than being retried or loosened (a mis-extraction almost always fails against the solution, i.e., errors degrade to rejection, not to false acceptance). Each record's `verification.verification_method` states exactly which mechanism applied.
**Pattern G (added for Dataset #2, Magicoder-style problems):** problems there commonly declare variables in a code block ("given the list of fields: ```python fields = [...]```") and then state "the function call `f(fields, "age")` should return `int`". Pattern G collects assignment preludes from instruction code blocks (values must be literals or AST-validated safe expressions), then accepts calls whose arguments reference only prelude variables, whitelisted builtins, or a narrow safe-module set (`math`, `datetime`, `statistics`, `string`, `fractions`, `decimal`); expected values undergo the same AST safety validation (no lambdas/comprehensions/imports/arbitrary calls; arity-checked against the solution signature). Emitted tests = prelude assignments + assert statements. 604 Magicoder records were accepted via Patterns A/C/F/G-derived tests, 69 via inline module-level asserts.
## 4. Benchmark-contamination screening (§3 hard rule)
Screening corpora (downloaded **for screening only — never added to the dataset**):
- HumanEval (openai/openai_humaneval): 164 prompts
- MBPP (google-research-datasets/mbpp): full test 500 + full train 374 + validation 90 + sanitized 43 = 1,007 texts
- BigCodeBench v0.1.4 (bigcode/bigcodebench): 1,140 complete prompts
- DS-1000 (xlangai/DS-1000): 1,000 problem texts
Method: content-token containment + character-8-gram Jaccard with LSH candidate generation; boilerplate stopwords removed to avoid generic-phrasing false positives.
Policy: **when in doubt, exclude** — both the auto-reject band and the manual-review band were excluded.
Results over the 11,725-row accepted pool (Dataset #1):
- HumanEval/MBPP screen: 842 auto-reject + 563 review-band → **1,405 rejected_benchmark** (typical hits: instruction ≡ MBPP task "two lists share a common element", "largest prime factor", "longest increasing subsequence length", "gcd of two positive integers", "difference between sum of squares and square of sum").
- BigCodeBench/DS-1000 screen: 2 auto-reject + 3 review-band → **5 rejected_benchmark**.
- Dataset #2 (Magicoder) 746-row passed pool: **71 rejected_benchmark** (e.g. "find all prime numbers up to a given n" ≡ MBPP task; review-band folded into rejections under the same when-in-doubt policy).
- Total excluded for benchmark overlap across both datasets: **1,481**.
- Not screened: LiveCodeBench (recent contest problems; our sources are OSS-function-derived — different provenance class; documented as residual risk), SWE-bench family (repo-level issues; structurally absent from these sources).
## 5. Token accounting (§12)
- Tokenizer: `tiktoken o200k_base` (target training model unspecified; o200k_base used as a modern model-agnostic proxy — documented choice, not an estimate by character count).
- Counted: the **complete serialized JSON record** (instruction + reasoning + code + tests + documentation + verification + quality + provenance).
- Result (Dataset #1): min 728 · p50 1,009 · mean 1,038 · p95 1,328 · max 2,675.
- Result (Dataset #2): min 891 · p50 1,159 · max 2,391.
- Combined repository: **0 records > 16,000 tokens**; `over_16k/train.jsonl` is intentionally empty.
## 6. Manual review (§8 individual assessment)
A stratified random sample of **40 accepted records (Dataset #1)** and **20 accepted records (Dataset #2)** was read end-to-end (instruction ↔ reasoning ↔ code ↔ tests ↔ documentation consistency). Findings:
- No fabricated or inconsistent reasoning observed; extracted rationales match the verified code.
- 2 systemic issues found and fixed globally: (a) instruction↔solution **function-name mismatch** → 33 rows dropped (`rejected_low_quality`); (b) **transition-sentence residue** in reasoning/documentation ("Here is the implementation:") → cleaned in 4,943 records; 129 thin rationales replaced with factual AST-based summaries (tagged `reasoning_generated_factual_summary_from_code`; no fake monologue).
- Minor, accepted-and-documented observations: 1 record retains a module-level demo `print` (executes harmlessly); 2 records have loose spec naming ("extended Euclidean" implemented as plain Euclid; out-of-range behavior via IndexError instead of explicit raise) — both fully consistent with their stated tests.
- Dataset #2 sample: consistent with gates; several solutions retain upstream demo blocks (`# Test the function ... print(...)`) which execute harmlessly during verification and remain visible in `code` (no hidden behavior); Pattern-G prelude tests faithfully reproduce the problem's stated example values.
## 7. What we claim vs. what we don't (§22)
- **VERIFIED_BY_US**: every accepted record's `code`+`tests` executed and passed in our sandbox (twice: at selection and post-transformation); all token counts; dedup; contamination screens; repairs.
- **DOCUMENTED (creators)**: upstream Docker execution filtering; OSS seed grounding (MultiPL-T/The Stack); pipeline peer-reviewed (NeurIPS'24).
- **UNKNOWN**: whether upstream decontamination (MBPP/DS-1000 scripts) was applied to the released file — mitigated by our own screening; per-row human review — none exists, so `human_verified=false` everywhere.
- **Not claimed**: exhaustiveness of derived tests (they encode instruction-stated examples only); semantic-level dedup; network isolation of the sandbox.