dsfasdfaserwer commited on
Commit
01ee847
·
verified ·
1 Parent(s): 3716b57

batch 1: upload RULES.md (19 execution-verified Python examples)

Browse files
Files changed (1) hide show
  1. RULES.md +53 -0
RULES.md ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Generation & Quality Rules (researched + distilled from top-tier datasets)
2
+
3
+ Sources: DeepSeek-R1 / OpenThoughts trace style, ToRA & NuminaMath-TIR interleaved-reasoning
4
+ pattern, KodCode (arXiv 2503.02951) verifiability principles, instruction-backtranslation
5
+ naturalness criteria (Humpback), SWE-smith/TACO execution-gating methodology.
6
+
7
+ ## §1 — Chain-of-Thought rules (for GENERATING and for VERIFYING native CoT)
8
+ A high-quality coding CoT must:
9
+ 1. Read as natural first-person thinking ("Let me…", "Wait — …"), NOT a template checklist.
10
+ 2. **Understand**: restate the goal + constraints in own words.
11
+ 3. **Edge cases first**: enumerate tricky inputs (empty, single element, max size, negatives…) BEFORE writing code.
12
+ 4. **Explore**: consider ≥2 plausible approaches with trade-offs; commit to one WITH a reason.
13
+ 5. **Plan → build**: outline the structure, then justify key implementation decisions as the code is derived.
14
+ 6. **Self-correction**: contain ≥1 genuine backtrack ("Actually that breaks when X, so instead…").
15
+ 7. **Dry-run**: trace a concrete example step-by-step with real values, including one edge case.
16
+ 8. **Sanity-check**: state complexity / robustness reasoning at the end.
17
+ 9. **Fidelity (hard gate)**: every significant code element must be motivated by the CoT; CoT must not contradict the code.
18
+ 10. TIR-style only: reasoning and code INTERLEAVE; every code block executes; printed intermediates are used by later reasoning.
19
+ 11. FORBIDDEN: mentioning hidden tests/the dataset/being an AI; unexecutable pseudocode in code blocks; bullet-point boilerplate; CoT shorter than the code's decision surface.
20
+
21
+ Native CoT verification = run checks 1,2,3(or 4),6,7,9,11 programmatically where possible + manual read;
22
+ if a native CoT fails quality but the code passes tests → REWRITE the CoT (cot_source=native_rewritten).
23
+
24
+ ## §2 — Instruction rules (how real humans ask for code)
25
+ 1. First-person user with a plausible situation: homework, contest practice, job task, personal tooling, debugging pain.
26
+ 2. Outcome-focused: what the program must DO; include I/O format + any constraints the user would naturally know.
27
+ 3. NEVER prescribe implementation: no library names, no API/function names, no algorithm names, no data-structure or loop choices ("using uuid5 and for loops" ❌ → "generate a bunch of unique ids" ✔).
28
+ 4. Must keep the FULL functional spec (a solver should not have to guess requirements).
29
+ 5. Natural tone, 1–6 sentences; may include a small example input/output the user has at hand.
30
+ 6. May or may not say "in Python" (both are realistic; our answer is always Python).
31
+
32
+ ## §3 — Doc rules
33
+ 2–6 sentences, plain language: what the code does, how it works (high level), what goes in / comes out,
34
+ edge cases handled, notable complexity or caveats. No marketing filler.
35
+
36
+ ## §4 — "Worth adding" gate (ALL must pass, else discard with reason)
37
+ - [ ] Executes and passes ALL bundled/generated tests (execution-verified, timeout 10s, memory-limited)
38
+ - [ ] language == python, Python 3, idiomatic, no dead code
39
+ - [ ] instruction realistic per §2, no solution leakage
40
+ - [ ] CoT per §1, faithful to the final code
41
+ - [ ] non-trivial & instructive (not hello-world, not a 1-liner with nothing to reason about)
42
+ - [ ] deduplicated against everything already accepted
43
+ - [ ] token_count(instruction+cot+code+doc) computed with tiktoken o200k_base:
44
+ ≤ 16,384 → data/under_16k/ · > 16,384 → data/over_16k/
45
+
46
+ ## §5 — Repair policy (no infinite loops)
47
+ attempt 1: run as-is → fail → attempt 2: bounded repair (pick another passing solution from the
48
+ source's solution list, or trivial deterministic fixes) → fail → DISCARD (log reason).
49
+ Max 2 attempts per example, ever.
50
+
51
+ ## §6 — Safety when executing dataset code
52
+ subprocess with: 10s wall timeout, RLIMIT_CPU 8s, RLIMIT_AS 1.5GB, RLIMIT_NPROC 64, empty env,
53
+ isolated tmpdir cwd, stdin from test case only. No network-dependent tasks accepted.