v10g2 — Correctness-Priced DQN Compiler-Flag Predictor (the positive result)

A Deep Q-Network that selects the best gcc flag (-O0/-O1/-O2/-O3/-Ofast/-Os) per C/C++ translation unit for execution + CPU time, with a hard safety gate (no numeric/functional regression vs the -O0 reference). Best of 5 seeds (seed 1337, 2M one-step bandit episodes).

Headline — safe AND fast (5-seed, held-out, program-disjoint)

Metric Value
Utility / mean speedup vs -O2 1.174× ± 0.011
Numeric regression 0.0% (all 5 seeds, bootstrap 95% CI [0,0])
Functional regression 0.0%
Accuracy (best-flag) 55.6% ± 0.7

This is the result the v10F preprint set out to obtain. v10F was an honest negative result — a speed-weighted agent degenerated into an -Ofast-chaser (≈20% numeric regressions). v10g2 prices correctness above speed (numeric_fail penalty 200 + an -Ofast-risk term) and trains on a corpus deliberately balanced across the fast-math safety boundary, so the agent finds safe speedups instead of chasing unsafe ones.

Reward-mode ablation (held-out, n=15) — why this works

reward utility numeric reg 95% CI
speed_only 1.232× 13.3% [0, 33]
v10f (partial penalty) 1.201× 13.3% [0, 33]
correctness_dominant 1.189× 0.0% [0, 0]

Pricing correctness above speed drives regressions to zero for ~4% of mean speedup; a partial penalty (v10f) is not enough.

Lineage

v10F speed-weighted (1.069×, ~20% reg, Ofast-chaser) → v10g correctness/small corpus (1.006×, 10%) → v10g2 correctness/balanced corpus (1.174×, 0%).

Files

v10g2_dqn_seed1337_BEST_2M.zip (SB3 DQN, best seed), dataset_v10g2_public.csv (PolyBench×2, micro, fast-math-balanced C++, OpenMP — internal TUs excluded), split_public.json, scaler.json, EVAL_SUMMARY.md, metadata.json. Papers: PAPER_V10H_PIVOT_AND_NOVEL.md (PPO→DQN pivot proofs + novel CVaR-DQN), PAPER_V10F_ARXIV.md (honest methodology).

Safe use

Serve with the ofast_guarded floor (default): -Ofast only when verified safe for the input, else -O3. The bare argmax is conservative here; the floor guarantees the served flag is never -Ofast-unsafe.

Downloads last month
431
Video Preview
loading