Specification Before Generation: A Pre-Registered, Five-Model Paired Evaluation of a Specification Frame for LLM-Generated Code in Money, Time, Idempotency, and Access Tasks

Hugging Face Daily Papers Papers

Summary

This paper evaluates a specification frame that improves LLM-generated code by reducing defects in critical areas like money arithmetic and access control, based on a pre-registered five-model study across finance, healthcare, and insurance tasks.

Code generated by large language models passes security checks at a rate that has barely moved in four years. In regulated backends, the defect classes that matter most are money arithmetic, time handling, retry safety, and access control. Teams answer with instruction files, yet the largest controlled study of instruction files to date found no benefit. This paper tests a narrower idea: generated code improves when the prompt carries a specification, a fixed preamble stating what must be true of the result. We pre-registered hypotheses, refuters, analysis code, and a one-shot generation rule, then ran 50 realistic backend tasks from finance, healthcare, and insurance practice through five frontier models from five vendor lineages, each task twice: bare, and preceded by a 267-word filled specification frame. Nine deterministic AST-based checkers scored the outputs. The Bandit security scanner, which knows nothing of the frame, scored them independently. The frame reduced defects in all five models (mean reduction 0.16 to 0.70 findings per task, every Holm-adjusted sign test significant, every bootstrap confidence interval excluding zero). Where the arms differed, the frame arm won 95 of 100 times. It never made any model worse in any domain. Bandit found 53 medium-or-high issues in the bare arm and 11 in the frame arm, in the same direction for every model. The effect was largest where a model's unprompted defaults were weakest: the frame supplies the discipline a model lacks. All 500 outputs, prompts, checkers, scoring code, and the pre-registration are published with a DOI, so any team can re-derive the result without trusting the author.
Original Article
View Cached Full Text

Cached at: 09/30/26, 12:13 AM

Paper page - Specification Before Generation: A Pre-Registered, Five-Model Paired Evaluation of a Specification Frame for LLM-Generated Code in Money, Time, Idempotency, and Access Tasks

Source: https://huggingface.co/papers/2609.23270

Abstract

Codegeneratedbylargelanguagemodelspassessecuritychecksataratethathasbarelymovedinfouryears.Inregulatedbackends,thedefectclassesthatmattermostaremoneyarithmetic,timehandling,retrysafety,andaccesscontrol.Teamsanswerwithinstructionfiles,yetthelargestcontrolledstudyofinstructionfilestodatefoundnobenefit.Thispapertestsanarroweridea:generatedcodeimproveswhenthepromptcarriesaspecification,afixedpreamblestatingwhatmustbetrueoftheresult.Wepre-registeredhypotheses,refuters,analysiscode,andaone-shotgenerationrule,thenran50realisticbackendtasksfromfinance,healthcare,andinsurancepracticethroughfivefrontiermodelsfromfivevendorlineages,eachtasktwice:bare,andprecededbya267-wordfilledspecificationframe.NinedeterministicAST-basedcheckersscoredtheoutputs.TheBanditsecurityscanner,whichknowsnothingoftheframe,scoredthemindependently.Theframereduceddefectsinallfivemodels(meanreduction0.16to0.70findingspertask,everyHolm-adjustedsigntestsignificant,everybootstrapconfidenceintervalexcludingzero).Wherethearmsdiffered,theframearmwon95of100times.Itnevermadeanymodelworseinanydomain.Banditfound53medium-or-highissuesinthebarearmand11intheframearm,inthesamedirectionforeverymodel.Theeffectwaslargestwhereamodel’sunprompteddefaultswereweakest:theframesuppliesthedisciplineamodellacks.All500outputs,prompts,checkers,scoringcode,andthepre-registrationarepublishedwithaDOI,soanyteamcanre-derivetheresultwithouttrustingtheauthor.

View arXiv pageView PDFProject pageGitHubAdd to collection

Get this paper in your agent:

hf papers read 2609\.23270

Don’t have the latest CLI?curl \-LsSf https://hf\.co/cli/install\.sh \| bash

Models citing this paper0

No model linking this paper

Cite arxiv.org/abs/2609.23270 in a model README.md to link it from this page.

Datasets citing this paper1

#### sandeepdhuriauthor/delta-frame-validation-study

Spaces citing this paper0

No Space linking this paper

Cite arxiv.org/abs/2609.23270 in a Space README.md to link it from this page.

Collections including this paper0

No Collection including this paper

Add this paper to acollectionto link it from this page.

Similar Articles

AuXSpec: Learning to Autoformalize Program Specifications via Executable Postconditions

Hugging Face Daily Papers

AuXSpec introduces a Lean framework that pairs declarative postconditions with executable counterparts, enabling execution-based agreement as an RL reward for training specification-generation models. Models trained with this reward achieve up to 84.3% SpecGen pass@4, surpassing prior open-source SOTA and frontier models on the Verina benchmark.