Published July 27, 2026 | Version v1

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

Authors/Creators

  • 1. Independent Researcher

Description

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

Files

Arjun Mani research paper.pdf

Files (407.5 kB)

Name Size Download all
md5:d1dad4b6106a89a57b083d18086f69eb
407.5 kB Preview Download

Additional details