Introduction
Current Large Language Model (LLM) development often feels more like alchemy than engineering. While natural language prompts offer incredible flexibility, their inherent ambiguity makes building reliable, production-grade systems a significant challenge. This paper argues that the "missing link" to maturing AI development into a true engineering discipline is the adoption of rigorous specifications—precise descriptions of what a task should do and how to verify its output.
The Core Challenge: Ambiguity
In traditional software engineering, behavior is defined through code and formal specifications. In contrast, LLM applications rely on natural language, which lacks the precision required for verification, debugging, and modularity. Without clear specifications, systems become monolithic, prone to hallucinations, and difficult to maintain. The authors argue that ambiguity is the primary hurdle preventing LLMs from being used in safety-critical or high-reliability environments.
A Conceptual Framework for Specifications
The authors propose a shift toward two distinct types of specifications to bring rigor to the field:
- Statement Specification: Defines what a task should accomplish (e.g., a prompt or product requirement document).
- Solution Specification: Defines how to verify the output (e.g., unit tests, mathematical proofs, or reward models).
The Engineering Properties of Specifications
By centering development around specifications, AI systems can achieve properties essential for engineering excellence. Specifications act as the hub for five critical capabilities.
As illustrated in the framework above, specifications enable:
- Verifiability: The ability to programmatically prove the output is correct.
- Debuggability: Pinpointing the exact location of failures within a system.
- Modularity: The capacity to swap components without breaking the entire system.
- Reusability: Building complex systems from trusted, smaller parts.
- Automated Decision-Making: Enabling systems to operate reliably without constant human oversight.
Technical Pathways to Rigor
The paper outlines several methods to implement these specifications and reduce ambiguity:
- Structured Outputs: Enforcing syntactic correctness using schemas like JSON or Pydantic.
- Iterative Disambiguation: Designing systems that ask clarifying questions to resolve hidden ambiguities in a user's prompt.
- Process Supervision: Verifying the individual steps of a reasoning process rather than just the final answer.
- Domain-Specific Rules: Leveraging existing formal structures, such as legal codes or physical laws, to constrain model behavior.
Key Insights: Modularity and the "Stranger Test"
A central theme of the paper is that modularity is the antidote to monoliths. Instead of relying on a single, massive prompt, developers should build "compound AI systems" where each module has a narrow, clear specification. This makes it easier to identify which specific component is failing or hallucinating.
To test for underspecification, the authors suggest the "Stranger Test": prompt the LLM as if it were a total stranger with zero shared context. If the output fails this test, the prompt is likely too ambiguous for a production environment.
Qualitative Results and Failure Analysis
While this is a position paper rather than a benchmark study, it provides a roadmap for failure analysis. By examining high-profile LLM failures—such as the Air Canada chatbot hallucinating a refund policy—the authors demonstrate how specific policy-based specifications could have served as a safeguard. Additionally, they show that highlighting differences between multiple generated outputs can help users identify and resolve hidden ambiguities in their own requirements.
Future Directions
The transition to an engineering discipline will require new tools and research, including:
- Proof-Carrying Outputs: Models that generate a proof of correctness alongside their answers.
- Automated Spec Generation: Using LLMs to help humans write their own unit tests and specifications.
- Execution-then-Verification: Utilizing sandboxed environments to safely test LLM-generated code before it affects the real world.
Note: As a position paper, this work focuses on architectural principles and engineering philosophy rather than benchmarking specific models on new datasets.
Summary updated