Evals for AI Engineers
At the application stage, developers must build around a pre-trained model by translating product goals into prompts and agent logic while verifying outputs. This process faces recurring difficulties including vague initial objectives, instruction gaps in natural language prompts, and performance shifts on new inputs. To systematically analyze these failure points, the Three Gulfs framework categorizes breakdowns into comprehension, specification, and generalization. Each identified gulf requires a distinct strategy to effectively address application development challenges. The Three Gulfs model offers a diagnostic framework to understand the challenges of building and evaluating LLM-based applications. Adapted from Shankar et al. (2025) and inspired by Norman (1988), the framework outlines three primary gaps: comprehension, specification, and generalization. It serves as a practical guide for identifying why an LLM application is failing and selecting appropriate remedies. Even seemingly straightforward tasks, such as an email-processing agent, encounter distinct hurdles across these three stages. The Gulf of Comprehension represents the disconnect between a developer and both the real-world input data and the resulting model outputs when building prompts and agents. Designing systems based on a few clean, idealized samples causes models to fail against the messiness of production inputs like forwards, multi-language signatures, and unformatted text. This gulf also extends to outputs, where developers must understand recurring failure modes and behavioral patterns across scale rather than being misled by isolated successes. Bridging this gulf requires developing systematic strategies to characterize inputs and outputs at scale without manual inspection.
Read the original ↗Contents
- 01Evaluation in Applications
- 02The Three Gulfs of LLM Application Development
- 03The Gulf of Comprehension (Between the Developer and Data)
- 04The Gulf of Specification (Between the Developer and the LLM Agent)
- 05The Gulf of Generalization (Between the Data and the LLM Agent)
- 06Applying the Three Gulfs to Other Domains
- 07Why LLM Agent Evaluation Is Challenging
- 08The LLM Evaluation Lifecycle: Bridging the Gulfs with Evaluation
- 09Analyze
- 10Measure
- 11Improve
- 12Putting It Together
Evaluation in Applications
At the application stage, developers must build around a pre-trained model by translating product goals into prompts and agent logic while verifying outputs. This process faces recurring difficulties including vague initial objectives, instruction gaps in natural language prompts, and performance shifts on new inputs. To systematically analyze these failure points, the Three Gulfs framework categorizes breakdowns into comprehension, specification, and generalization. Each identified gulf requires a distinct strategy to effectively address application development challenges.
- Application development focuses on building around an already-trained model rather than model training.
- Initial application objectives often appear simple but reveal ambiguities only after inspecting actual outputs.
- Prompts and agent logic written in natural language rarely capture full intent, leading to gaps and inconsistent model behavior.
- System behavior frequently degrades when moving from small test suites to variable real-world data.
- The Three Gulfs framework identifies three primary points of failure in LLM development: comprehension, specification, and generalization.
The Three Gulfs of LLM Application Development
The Three Gulfs model offers a diagnostic framework to understand the challenges of building and evaluating LLM-based applications. Adapted from Shankar et al. (2025) and inspired by Norman (1988), the framework outlines three primary gaps: comprehension, specification, and generalization. It serves as a practical guide for identifying why an LLM application is failing and selecting appropriate remedies. Even seemingly straightforward tasks, such as an email-processing agent, encounter distinct hurdles across these three stages.
- The Three Gulfs model identifies three core failure gaps in LLM development: comprehension, specification, and generalization.
- The framework is adapted from Shankar et al. (2025) and inspired by Norman's 1988 work.
- The model is designed to diagnose application failures and guide developers toward appropriate solutions.
- Common tasks like parsing, summarizing, and categorizing emails expose distinct challenges across the Three Gulfs.
The Gulf of Comprehension (Between the Developer and Data)
The Gulf of Comprehension represents the disconnect between a developer and both the real-world input data and the resulting model outputs when building prompts and agents. Designing systems based on a few clean, idealized samples causes models to fail against the messiness of production inputs like forwards, multi-language signatures, and unformatted text. This gulf also extends to outputs, where developers must understand recurring failure modes and behavioral patterns across scale rather than being misled by isolated successes. Bridging this gulf requires developing systematic strategies to characterize inputs and outputs at scale without manual inspection.
- Prompt designs fail when built around idealized inputs rather than the messiness of actual production data.
- The Gulf of Comprehension encompasses both understanding the diversity of real inputs and understanding model behavior across outputs.
- Failure modes such as misidentifying names, omitting details, or summarizing boilerplate can undermine system reliability even if they occur intermittently.
- Developers need systematic methods to characterize inputs and model outputs at scale rather than relying on manual case-by-case review.
The Gulf of Specification (Between the Developer and the LLM Agent)
The Gulf of Specification represents the gap between a developer's internal intent and the explicit instructions given to an LLM agent. Because natural language is inherently imprecise, seemingly clear prompts frequently leave critical formatting and scoping decisions unstated. When developers omit these details, the model makes arbitrary assumptions, resulting in inconsistent outputs across runs. Bridging this gulf requires making expectations explicit and aligning prompts with the actual data the agent processes.
- The Gulf of Specification is the disconnect between human intent and the prompts or logic provided to an LLM agent.
- Natural language is inherently ambiguous, meaning small phrasing gaps can lead to large behavioral differences.
- Unspecified requirements force LLMs to guess, producing inconsistent formats and edge-case handling across runs.
- Closing the Gulf of Specification requires explicitly defining output formats, level of detail, and edge-case behaviors.
The Gulf of Generalization (Between the Data and the LLM Agent)
The Gulf of Generalization describes the discrepancy between the data an AI system encounters and how an LLM generalizes to that data. Even with clear prompt specifications and well-understood inputs, LLMs remain prone to inconsistent execution and unexpected errors. These generalization issues are often triggered by latent biases from pre-training data, such as favoring recognizable names over prompt instructions. Consequently, these unpredictable errors emerge in real-world data variety and remain unavoidable regardless of model capabilities.
- The Gulf of Generalization refers to an LLM's unpredictable behavior despite proper input comprehension and prompt specification.
- LLMs can fail to follow explicit instructions consistently even when given well-scoped and unambiguous prompts.
- Prior training data bias can lead an LLM to override specific contextual instructions, such as extracting a prominent name over an email sender.
- Generalization errors typically remain hidden until a system is exposed to the full diversity of real-world inputs.
- Model errors cannot be entirely eliminated through advancements, making occasional failures an inherent property of LLMs.
Applying the Three Gulfs to Other Domains
The Three Gulfs framework applies to diverse AI domains beyond email processing, including customer support chatbots and code generation assistants. In both areas, the Gulf of Comprehension concerns the diversity and messiness of user inputs, such as typos, vague requests, or undocumented contexts. The Gulf of Specification involves defining concrete instructions and standards for acceptable outputs, while the Gulf of Generalization pertains to performance drops on less familiar or edge-case domains. Consequently, developing an effective evaluation strategy requires identifying which specific gulf drives system failures.
- The Three Gulfs framework can be generalized to domains such as customer support bots and code assistants.
- For customer support bots, comprehension challenges stem from multilingual messages, typos, and multi-part queries.
- Specification failures in support bots occur when behavior like escalation to humans is not explicitly guided.
- For code generation assistants, the Gulf of Comprehension involves vague developer prompts, missing context, and internal API references.
- In code generation, the Gulf of Generalization appears when assistants handle common languages like Python well but fail on rarer languages or multi-file edits.
- An AI application's evaluation strategy should be determined by its primary source of failure among the three gulfs.
Why LLM Agent Evaluation Is Challenging
Evaluating LLM applications is an iterative challenge requiring practitioners to bridge the Three Gulfs: Comprehension, Specification, and Generalization. Rather than treating evaluation as a one-time validation step, teams can use this framework to systematically diagnose whether failures arise from unclear prompts (specification) or inconsistent model performance (generalization). Different applications vary significantly in how much users can assist in bridging these gulfs, from high-agency coding assistants to consumer applications like personal stylists. Consequently, effective evaluation systems must be designed with greater rigor in areas where user error detection is low and the stakes of failure are high.
- Evaluating LLM applications is an iterative process where requirements clarify as teams interact with real outputs.
- The Three Gulfs framework provides a shared vocabulary to diagnose whether problems stem from prompt specification or model generalization.
- When a prompt is well-specified but the model still fails, automated evaluations are needed to measure generalization failure rates.
- User agency determines how much an application can rely on users to bridge gulfs and catch errors on their own.
- Applications where users cannot readily detect mistakes require more rigorous processes and evaluation safeguards.
The LLM Evaluation Lifecycle: Bridging the Gulfs with Evaluation
The LLM evaluation lifecycle provides a structured methodology to address application failures defined by the Three Gulfs: Comprehension, Specification, and Generalization. It employs an iterative framework organized into three continuous phases: Analyze, Measure, and Improve. Within this lifecycle, evaluation serves to systematically diagnose, quantify, and resolve defects. This systematic process brings visibility to failure modes and guides practitioners on how to resolve them.
- The Three Gulfs (Comprehension, Specification, and Generalization) describe the primary failure modes in LLM applications.
- The Analyze-Measure-Improve lifecycle is an iterative framework designed to bridge the Three Gulfs.
- The Analyze phase focuses on systematically understanding failure modes in LLM applications.
- The Measure phase quantifies failures, while the Improve phase focuses on fixing them.
- The framework makes evaluation gulfs visible and guides actionable decisions to remediate failures.
Analyze
The evaluation cycle begins with the Analyze phase, where practitioners inspect real system inputs and outputs to understand actual behavior. The primary goal is qualitative identification of failure modes rather than quantitative measurement. In practice, this process involves reviewing agent execution traces and consulting domain experts to define correctness, which uncovers specification gaps, comprehension issues, and generalization failures.
- The primary objective of the Analyze phase is identifying failure modes qualitatively rather than measuring them quantitatively.
- Analyze connects directly to the Gulf of Comprehension while also surfacing specification gaps and generalization issues.
- Inspecting agent execution traces allows teams to observe where behavior diverges from expectations.
- Consulting domain experts and users during trace analysis helps establish what correct system behavior looks like.
Measure
The Measure step quantifies LLM generalization issues that persist despite clear prompting. It addresses the limitation of relying on small sample impressions, which can falsely portray a system as entirely broken or completely functional. By designing automated evaluators—such as code-based rules or LLM-as-a-judge setups—practitioners can assess failure rates across thousands of outputs to distinguish occasional bugs from systematic problems.
- The Measure step specifically quantifies generalization errors where the prompt was clear but the LLM still failed.
- Relying on impressions from a small number of traces can lead to false conclusions about system reliability in both directions.
- Scaling measurement requires automated evaluators to score traces without human review.
- Evaluators can be implemented as rule-based code checks or using an LLM-as-a-judge approach.
- Measurement reveals the actual frequency of failure modes, determining whether an issue is an acceptable annoyance or a systematic blocker.
Improve
The Improve stage serves as the final step in the evaluation cycle, guiding system adjustments based on findings from the Analyze and Measure phases. Interventions depend on the underlying source of error, distinguishing between specification gaps that require prompt or logic revisions and generalization failures that demand stronger solutions. Potential fixes range from quick prompt refinements to adding training data, improving retrieval, fine-tuning, or altering application architecture. Repeating this cycle helps teams understand core system limitations and select the right level of evaluation rigor.
- The appropriate path in the Improve phase depends on whether system errors are caused by specification gaps or generalization failures.
- Specification gaps are generally resolved with lower-effort changes, such as tightening prompt phrasing or adjusting agent logic.
- Generalization failures require higher-effort interventions, including providing more examples, refining retrieval mechanisms, or fine-tuning models on labeled data.
- Persistent errors like entity confusion may require architectural solutions, such as parsing metadata directly instead of relying on an LLM.
- Iterating through the Analyze, Measure, and Improve loop helps determine the appropriate evaluation rigor needed for an application.
Putting It Together
When debugging a failing LLM application, failures can typically be classified into three distinct categories: Comprehension, Specification, and Generalization. A comprehension failure requires inspecting more traces to understand behavior, a specification failure requires clarifying prompts or agent logic, and a generalization failure requires interventions like additional examples, better retrieval, or fine-tuning. The Analyze-Measure-Improve lifecycle offers a systematic framework to identify failure modes, assess their prevalence, and iteratively implement fixes.
- LLM application failures fall into three core categories: Comprehension, Specification, and Generalization.
- Comprehension issues require examining more execution traces before modifying the system.
- Specification issues stem from imprecise requirements and are resolved by updating prompts or agent logic.
- Generalization issues occur when clear requirements still fail across inputs, requiring interventions like fine-tuning, more examples, or improved retrieval.
- The Analyze-Measure-Improve lifecycle structures LLM debugging into a continuous feedback loop of analyzing traces, measuring failure frequency, and applying fixes.