penfever commited on
Commit
7ce8aac
·
verified ·
1 Parent(s): 46e58e6

v2: document test.sh reward-recording fix

Browse files
Files changed (1) hide show
  1. README.md +67 -0
README.md ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ license: apache-2.0
5
+ task_categories:
6
+ - text-generation
7
+ size_categories:
8
+ - 1K<n<10K
9
+ tags:
10
+ - agent
11
+ - code
12
+ - code-contests
13
+ - harbor
14
+ - reinforcement-learning
15
+ - rlvr
16
+ ---
17
+
18
+ # code-contests-noblock
19
+
20
+ Harbor-format competitive-programming RL tasks (8,728 tasks) derived from CodeContests.
21
+ Each task is a Harbor task binary (gzip tar) stored in `tasks.parquet` with columns
22
+ `path` (str, `<task_id>.tar.gz`) and `task_binary` (binary). Each tar contains
23
+ `instruction.md`, `task.toml`, `environment/Dockerfile`, and a `tests/` verifier
24
+ (`test.sh`, `test_state.py`, `test_data.json`).
25
+
26
+ ## v2 (current) — verifier reward-recording fix
27
+
28
+ > **Resolves a silent reward-distribution bias.** All 8,728 task verifiers are updated;
29
+ > task content (instructions, environments, tests, test data) is otherwise byte-identical to v1.
30
+
31
+ The v1 `tests/test.sh` ran pytest under `set -euo pipefail`:
32
+
33
+ ```bash
34
+ set -euo pipefail
35
+ pytest --ctrf /logs/verifier/ctrf.json /tests/test_state.py -rA # aborts the script on test failure
36
+ if [ $? -eq 0 ]; then echo 1 > /logs/verifier/reward.txt; else echo 0 > /logs/verifier/reward.txt; fi
37
+ ```
38
+
39
+ Under `set -e`, a failing solution makes pytest exit non-zero and the script **dies before
40
+ `reward.txt` is written**. Harbor then finds the verifier dir (with `ctrf.json`) but no reward
41
+ file and raises `RewardFileNotFoundError`. The net effect:
42
+
43
+ - Failed solutions (legitimate `reward=0`) **crash instead of recording 0**, so they are dropped
44
+ from generated trace sets rather than counted.
45
+ - The surviving reward distribution collapses to a single `1.0` bucket — useless for any config
46
+ that needs the success/failure signal — and reported mean reward is inflated.
47
+
48
+ v2 wraps pytest so the script never dies on a test failure and **always** records a reward:
49
+
50
+ ```bash
51
+ set +e
52
+ pytest --ctrf /logs/verifier/ctrf.json /tests/test_state.py -rA
53
+ PYTEST_EXIT=$?
54
+ set -e
55
+ if [ $PYTEST_EXIT -eq 0 ]; then echo 1 > /logs/verifier/reward.txt; else echo 0 > /logs/verifier/reward.txt; fi
56
+ ```
57
+
58
+ This matches the correct pattern already used by the Nemotron task verifiers (which had zero
59
+ `RewardFileNotFoundError`s for exactly this reason).
60
+
61
+ The buggy original remains resolvable at the [`v1`](https://huggingface.co/datasets/DCAgent/code-contests-noblock/tree/v1) tag.
62
+
63
+ ```python
64
+ from huggingface_hub import hf_hub_download
65
+ hf_hub_download("DCAgent/code-contests-noblock", "tasks.parquet", repo_type="dataset") # v2 (fixed)
66
+ hf_hub_download("DCAgent/code-contests-noblock", "tasks.parquet", repo_type="dataset", revision="v1") # original
67
+ ```