Datasets:
AceCode-87K train / held-out 1k test split used for the Qwen3-1.7B-Base code RL runs
Browse filesFiles changed (5)
- README.mdAdded+59
- eval.parquetAdded+3
- preprocess_acecode_data.pyAdded+127
- stats.jsonAdded+35
- train.parquetAdded+3
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859---license: mittask_categories:- text-generationtags:- code- reinforcement-learning- rlvrconfigs:- config_name: default data_files: - split: train path: train.parquet - split: test path: eval.parquet---
# AceCode-87K train / held-out test split (verl format)
The exact train and test data used for the binary-reward code RL runs on Qwen3-1.7B-Base(GRPO / MaxRL) in [max-rl](https://huggingface.co/max-rl).
Source: [TIGER-Lab/AceCode-87K](https://huggingface.co/datasets/TIGER-Lab/AceCode-87K)(AceCoder, arXiv:2502.01718), which ships a single `train` split: function-level Python problems,each with GPT-4o-mini-synthesized `assert` test cases.
| file | split | rows | `data_source` ||---|---|---|---|| `train.parquet` | train | 85,847 | `acecode` || `eval.parquet` | test (held-out) | 1,000 | `acecode_eval` |
Train and test share no AceCode `id` (overlap 0). Per-split counts are in `stats.json`.
## How the split was made
`preprocess_acecode_data.py` (included) on the full 87,149 rows:
1. shuffle with seed 42;2. keep only `assert ...` test strings; drop rows with < 3 tests, empty questions, or a duplicate question (302 rows dropped); keep at most 16 tests per prompt;3. drop prompts longer than 3,072 tokens under the Qwen3-1.7B-Base chat template (0 dropped);4. the **last 1,000** surviving rows are the test split, the rest are train.
## Schema (verl RL parquet)
- `prompt`: chat messages, one user turn = the AceCode question + the suffix `"\nPlease reason step by step, then write a self-contained Python solution. Give your final program in a single ```python code block."`- `ability`: `"code"`- `reward_model`: `{"style": "rule", "ground_truth": "{\"tests\": [\"assert ...\", ...]}"}`- `extra_info`: `split`, `index`, `acecode_id`, `num_tests`
## Reward
Strictly binary: take the last ```python block of the response, append all `assert` tests, runin a fresh `python -I` subprocess (10 s wall / CPU limit, 4 GiB address space). Score 1.0 iffthe process exits 0, else 0.0 (no code block → 0.0). Validated 60/60 against AceCode-87K's own`pass_rate ∈ {0, 1}` inference labels.
Evaluation in the runs: 4 samples per test prompt (T=0.6, top-p 0.95), reporting mean@4 and best@4.123version https://git-lfs.github.com/spec/v1oid sha256:5fbcfbca1612f99ca6894e43b0767445e6c34acc47042107a66467eb074f5b5fsize 652037123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127# Copyright 2024 Bytedance Ltd. and/or its affiliates## Licensed under the Apache License, Version 2.0 (the "License");# you may not use this file except in compliance with the License.# You may obtain a copy of the License at## http://www.apache.org/licenses/LICENSE-2.0## Unless required by applicable law or agreed to in writing, software# distributed under the License is distributed on an "AS IS" BASIS,# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.# See the License for the specific language governing permissions and# limitations under the License."""Preprocess TIGER-Lab/AceCode-87K into verl parquet for the binary code-RL recipe.
Writes the same schema as scripts/preprocess_knights_and_knaves_data.py: data_source | prompt (chat, single user turn) | ability | reward_model | extra_info
* data_source : "acecode" for train, "acecode_eval" for the held-out split (both route to verl/utils/reward_score/acecode.py, binary all-tests-pass) * prompt : the AceCode question + a fixed suffix asking for ONE ```python block * ground_truth: JSON {"tests": [...]} straight from the dataset's test list * split : the LAST --eval-size rows of a seeded shuffle are eval, the rest train
Rows are dropped when the question or the tests are unusable (empty / non-assert / toofew tests) or when the prompt would exceed --max-prompt-tokens under the model's chattemplate (data.filter_overlong_prompts would drop them at train time anyway; doing ithere keeps the parquet row count honest).
Usage (login node has internet; needs the `maxrl` conda env): python scripts/preprocess_acecode_data.py \ --out-dir /n/netscratch/qianqian_lab/Lab/gzeng/RL-ASSETS/acecode_data/acecode87k \ --model-path $HOME/.cache/maxrl/models/Qwen3-1.7B-Base"""
from __future__ import annotations
import argparseimport jsonimport os
PROMPT_SUFFIX = ( "\nPlease reason step by step, then write a self-contained Python solution. " "Give your final program in a single ```python code block.")
MIN_TESTS = 3 # AceCoder filtering keeps prompts with enough signal for binary reward
def build_row(question: str, tests: list[str], data_source: str, split: str, index: int, src_id) -> dict: return { "data_source": data_source, "prompt": [{"role": "user", "content": question + PROMPT_SUFFIX}], "ability": "code", "reward_model": {"style": "rule", "ground_truth": json.dumps({"tests": tests})}, "extra_info": {"split": split, "index": index, "acecode_id": str(src_id), "num_tests": len(tests)}, }
def main() -> None: ap = argparse.ArgumentParser() ap.add_argument("--dataset", default="TIGER-Lab/AceCode-87K") ap.add_argument("--out-dir", required=True) ap.add_argument("--eval-size", type=int, default=1000) ap.add_argument("--seed", type=int, default=42) ap.add_argument("--model-path", required=True, help="tokenizer for the prompt-length filter") ap.add_argument("--max-prompt-tokens", type=int, default=3072) ap.add_argument("--max-tests", type=int, default=16, help="cap tests per prompt (reward caps at 32)") args = ap.parse_args()
import pandas as pd from datasets import load_dataset from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained(args.model_path) ds = load_dataset(args.dataset, split="train") ds = ds.shuffle(seed=args.seed)
kept, dropped_tests, dropped_long = [], 0, 0 seen_questions: set[int] = set() for row in ds: question = (row.get("question") or "").strip() tests = [t.strip() for t in (row.get("test_cases") or []) if isinstance(t, str) and t.strip()] tests = [t for t in tests if t.startswith("assert")] if not question or len(tests) < MIN_TESTS: dropped_tests += 1 continue qh = hash(question) if qh in seen_questions: dropped_tests += 1 continue seen_questions.add(qh)
n_tokens = len( tokenizer.apply_chat_template( [{"role": "user", "content": question + PROMPT_SUFFIX}], add_generation_prompt=True, tokenize=True, ) ) if n_tokens > args.max_prompt_tokens: dropped_long += 1 continue kept.append((question, tests[: args.max_tests], row.get("id")))
assert len(kept) > args.eval_size, f"only {len(kept)} usable rows" eval_rows = kept[-args.eval_size :] train_rows = kept[: -args.eval_size]
os.makedirs(args.out_dir, exist_ok=True) train_df = pd.DataFrame( [build_row(q, t, "acecode", "train", i, sid) for i, (q, t, sid) in enumerate(train_rows)] ) eval_df = pd.DataFrame( [build_row(q, t, "acecode_eval", "eval", i, sid) for i, (q, t, sid) in enumerate(eval_rows)] ) train_df.to_parquet(os.path.join(args.out_dir, "train.parquet")) eval_df.to_parquet(os.path.join(args.out_dir, "eval.parquet"))
print( f"wrote {len(train_df)} train / {len(eval_df)} eval to {args.out_dir} " f"(dropped: {dropped_tests} bad-tests/dup, {dropped_long} overlong)" )
if __name__ == "__main__": main()1234567891011121314151617181920212223242526272829303132333435{ "train": { "rows": 85847, "data_source": [ "acecode" ], "num_tests": { "mean": 14.05, "min": 3, "max": 16 }, "acecode_source": { "bigcode_python_fns": 33910, "evol": 26505, "oss": 25432 } }, "eval": { "rows": 1000, "data_source": [ "acecode_eval" ], "num_tests": { "mean": 14.08, "min": 5, "max": 16 }, "acecode_source": { "bigcode_python_fns": 400, "evol": 324, "oss": 276 } }, "train_eval_id_overlap": 0}123version https://git-lfs.github.com/spec/v1oid sha256:08663a09682c52d57a98c4d2aaa30868da78223dc104e1276f7de271a983f0e6size 55665848README.mdAdded+59
eval.parquetAdded+3
preprocess_acecode_data.pyAdded+127
stats.jsonAdded+35
train.parquetAdded+3