Decision Before Code: A Three-Gate Architecture for One-Shot Quality Code Generation

We propose a Decision-First Architecture consisting of three explicit decision gates: a Specification Judge (Gate 1) that detects underspecification and elicits missing requirements before any code is written; a Plan Judge (Gate 2) that selects among K candidate implementation approaches using a trained rubric; and a Hack-Resistant Verifier (Gate 3) that audits generated code against the original specification rather than proxy tests. We train Gates 1 and 2 using Direct Preference Optimization (DPO) on a 14B parameter generator (Qwen2.5-14B-Instruct, frozen) with a 7B judge model (Qwen2.5-Coder-7B-Instruct + QLoRA, rank 16, alpha 32). On a 155-task degraded-specification variant of HumanEval, inserting Gate 1 alone raises one-shot pass@1 from 0.419 (baseline) to 0.639 — a +22 percentage-point improvement on the identical generator (McNemar p<0.000001, 95% CI [+0.142, +0.297]), seed-stable across three runs. We additionally document two reproducible negative results: DPO training with harder negative examples caused ask-rate collapse from 91.9% to 18.9% (Gate 1 v2); and Gate 2 regressed due to plan homogeneity and defensive-selection bias confirmed by manual validation of 33 samples. Gate 3 had a training-construction flaw and is being retrained with a corrected format-contrast approach. All results support the hypothesis that decision quality is a meaningful scaling lever independent of base model capacity. Code: https://github.com/Arjunpixel28/decision-gates

Authors

Publication Details

Journal
Zenodo (CERN European Organization for Nuclear Research)
Published
2026-07-27
DOI
https://doi.org/10.5281/zenodo.21630006
Primary Topic
Software Engineering Research
Type
preprint
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
preprint

Decision Before Code: A Three-Gate Architecture for One-Shot Quality Code Generation

ARJUN ARJUN MANI
Zenodo (CERN European Organization for Nuclear Research)
Software Engineering Research
preprint

Decision Before Code: A Three-Gate Architecture for One-Shot Quality Code Generation

ARJUN ARJUN MANI
preprint en

Abstract

We propose a Decision-First Architecture consisting of three explicit decision gates: a Specification Judge (Gate 1) that detects underspecification and elicits missing requirements before any code is written; a Plan Judge (Gate 2) that selects among K candidate implementation approaches using a trained rubric; and a Hack-Resistant Verifier (Gate 3) that audits generated code against the original specification rather than proxy tests. We train Gates 1 and 2 using Direct Preference Optimization (DPO) on a 14B parameter generator (Qwen2.5-14B-Instruct, frozen) with a 7B judge model (Qwen2.5-Coder-7B-Instruct + QLoRA, rank 16, alpha 32). On a 155-task degraded-specification variant of HumanEval, inserting Gate 1 alone raises one-shot pass@1 from 0.419 (baseline) to 0.639 — a +22 percentage-point improvement on the identical generator (McNemar p<0.000001, 95% CI [+0.142, +0.297]), seed-stable across three runs. We additionally document two reproducible negative results: DPO training with harder negative examples caused ask-rate collapse from 91.9% to 18.9% (Gate 1 v2); and Gate 2 regressed due to plan homogeneity and defensive-selection bias confirmed by manual validation of 33 samples. Gate 3 had a training-construction flaw and is being retrained with a corrected format-contrast approach. All results support the hypothesis that decision quality is a meaningful scaling lever independent of base model capacity. Code: https://github.com/Arjunpixel28/decision-gates

Zenodo (CERN European Organization for Nuclear Research)
Peace, Justice and strong institutions
Software Engineering Research
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Decision Before Code: A Three-Gate Architecture for One-Shot Quality Code Generation — ARJUN ARJUN MANI · Zenodo (CERN European Organization for Nuclear Research) (2026) | TGRS Research Map | TGRS