Guiding Human Validation of LLM-Generated Code via Verifiable Literate Programming

πŸ“… 2026-07-02
πŸ“ˆ Citations: 0
✨ Influential: 0
πŸ“„ PDF
πŸ€– AI Summary
This work addresses the challenge of verifying code generated by large language models (LLMs), which often deviates from user intent and is difficult to validate due to reliance on unreliable automated tests or limited human involvement that may miss edge cases. To bridge this gap, the paper introduces Verifiable Literate Programming (VLP), a novel framework that leverages unambiguous natural language documentation as a verifiable intermediary between user intent and generated code. VLP integrates fine-grained intent-code mismatch detection, LLM-driven traceability links, and model-checking-based formal verification to enable end-to-end human–machine collaborative review. Experimental results demonstrate that, with moderate user effort, VLP significantly improves the pass@1 accuracy of LLM-generated code from 28.7%–73.2% to 65.4%–93.5%, substantially lowering the verification barrier for non-expert users.
πŸ“ Abstract
Vibe coding democratizes software development by allowing users to generate code via natural-language (NL) interaction with large language models (LLMs). However, the code is reliable only when it faithfully implements the user's intent, which is difficult and labor-intensive for users to validate. Existing validation methods either rely on LLM-assisted automated testing, which suffers from prompt ambiguity and model fallibility, or involve users only in partial software artifacts such as prompts and test cases, which may overlook corner cases and program details. Motivated by a bug study of LLM-generated code, we find that detailed human feedback is essential, as failures often stem from underspecified requirements or subtle semantic deviations. This paper presents verifiable literate programming (VLP), a human-in-the-loop framework designed to make the review/validation process of LLM-generated code accessible to users at all programming levels. At its core, VLP proposes unambiguous NL-based documentation as a readable intermediate layer between prompts and code. The documentation demonstrates concrete program semantics and enables users to provide feedback on potential intent-code mismatches. It supports human-involved, end-to-end repair and validation via three techniques: (i) an NL-style literate language with unambiguous syntax and mostly deterministic code-to-documentation translation, (ii) LLM-based fine-grained mismatch detection that uses trace links between prompts and documentation to focus users' review effort on suspicious documentation lines, and (iii) a verification module that leverages user-validated documentation to derive API-usage checks and formal properties, which are then verified against the generated code using model checking. Our evaluation shows that VLP improves code pass@1 from 28.7%-73.2% to 65.4%-93.5% with reasonable user effort.
Problem

Research questions and friction points this paper is trying to address.

LLM-generated code
human validation
intent-code mismatch
verifiable literate programming
code reliability
Innovation

Methods, ideas, or system contributions that make the work stand out.

verifiable literate programming
human-in-the-loop validation
LLM-generated code
intent-code mismatch detection
formal verification
πŸ”Ž Similar Papers
No similar papers found.