acceptodds
Under review as a conference paper at ICLR 2027

Semantic Contracts for Traceable NL-to-Code Generation

Abstract

Large language models can generate code from natural-language problem statements, yet remain unreliable on constraint-intensive tasks. A failure may mean the model misread the task, or that it implemented a reasonable reading incorrectly, and the two call for different remedies. Requirement-alignment methods improve task understanding before generation; program-repair methods use post-generation feedback to fix implementation errors. The two are rarely connected by an explicit, stable semantic target, so repair has no fixed set of task obligations against which to compare successive programs. We introduce a semantic-contract-based dual-loop framework that keeps the semantic target and the program as separate states, each updated by its own loop. The Semantic Alignment Loop (SAL) induces a structured specification and revises it field by field, admitting a revision only when a coverage–faithfulness–precision diagnostic and a Spec Alignment Score (SAS) show non-regression and grounded progress; the specification current at termination is frozen as a semantic contract. The Implementation Repair Loop (IRL) then selects an initial program under that contract and repairs it iteratively from public-test feedback and conservatively compiled property clauses. Because the contract is fixed before repair begins, semantic revisions and implementation repairs are recorded as separate state transitions. On 1,055 LiveCodeBench release_v6 problems, Full Dual-Loop produces 401 complete-suite passes, a Final Pass Rate of 0.3801: 9.19 percentage points above Direct NL-to-Code and 3.98 points above the strongest shared-protocol external baseline. Final correctness improves while the evidence for task obligations and implementation transitions remains inspectable.

open until 14 Dec 2026

est. 32% chance this paper gets accepted at ICLR 2027.

Reject 68%Accept 32%

What do you think this paper will get?

All positions stay anonymous.

Related papers

Loading the map…

Discussion (0)

Sign in to comment.