Evals for AI Engineers: Systematically Measuring and Improving AI Applications

Evals for AI Engineers: Systematically Measuring and Improving AI Applications

Sale price  Rs. 1,260.00 Regular price  Rs. 1,400.00
Skip to product information
Evals for AI Engineers: Systematically Measuring and Improving AI Applications

Evals for AI Engineers: Systematically Measuring and Improving AI Applications

By: Shreya Shankar, Hamel Husain |  Publisher: Shroff/O'Reilly |  Year: 2026

ISBN: 9789368083085

MRP: Rs. 1,400.00

You Pay: Rs. 1,260.00

You save: Rs. 140.00 ( 10% )

MRP: Rs. 1,400.00

You Pay: Rs. 1,260.00

You save: Rs. 140.00 ( 10% )

Usually ships in 2-3 days

Reward points: 12 points

⚠️ Ships only in Bangladesh, Bhutan, India, Maldives, Nepal, Sri Lanka, and the United Republic of Tanzania.

🌍 Available Worldwide

The E-Book is delivered digitally worldwide within 24 hours.

🌍 Ships Worldwide

The Combo includes the US imported edition, delivered worldwide.

Have a question about this book? Chat on WhatsApp or Email us

We usually reply within business hours.

Description

Evals for AI Engineers: Systematically Measuring and Improving AI Applications

Stop relying on guesswork to determine how well your AI applications perform. Evals for AI Engineers by Shreya Shankar and Hamel Husain provides a practical, systematic approach to testing, measuring, and improving AI applications, particularly those powered by Large Language Models (LLMs).

Drawing on their extensive experience working with more than 35 AI products and cutting-edge research, the authors explain how to build reliable, high-quality AI systems that perform consistently in real-world production environments.

This hands-on guide helps AI engineers, software developers, technical product managers, and technical leads establish effective evaluation processes that evolve alongside their applications.

What You Will Learn:

  • Identify and Prioritize Failures: Perform systematic error analysis, identify recurring issues, and create representative test sets to uncover weaknesses in AI applications.

  • Build Reliable Evaluations: Combine code-based checks, LLM-as-a-judge techniques, human feedback, and synthetic data to create trustworthy evaluation systems.

  • Improve AI Application Quality: Develop continuous evaluation processes to measure and improve the accuracy, reliability, and overall performance of AI applications.

  • Monitor Production Systems: Track regressions, identify performance issues, and maintain consistent quality as AI applications evolve.

  • Optimize Performance and Costs: Balance application quality, response latency, and operational costs when deploying AI systems at scale.

Who Should Read This Book?

  • AI Engineers and Machine Learning Engineers

  • Software Engineers and AI Developers

  • Generative AI and LLM Application Developers

  • Technical Product Managers

  • Technical Leads and Engineering Teams

Table of Contents


Table of Contents
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
Part I. Foundations
1. Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
What Is Evaluation? 5
Evaluation Throughout the Lifecycle of an LLM 6
Pretraining 6
Post-training 7
Application 7
Evaluation in Applications 8
The Three Gulfs of LLM Application Development 8
The Gulf of Comprehension (Between the Developer and Data) 9
The Gulf of Specification (Between the Developer and the LLM Agent) 10
The Gulf of Generalization (Between the Data and the LLM Agent) 10
Why LLM Agent Evaluation Is Challenging 11
The LLM Evaluation Lifecycle: Bridging the Gulfs with Evaluation 12
Analyze 13
Measure 13
Improve 14
Putting It Together 14
2. LLMs and Evaluation Basics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Components of LLM Agents 17
Single LLM Call 19
Conversations 20
Retrieval 21
v
Tools 23
Agent Loops 25
Fundamentals of Prompting 27
Prompts for Single LLM Calls 27
Retrieval Fundamentals 29
Tools and Agents 30
Evaluation Setups 32
Absolute Evaluation 33
Comparative Evaluation 34
Putting It Together 35
Part II. The Analyze Phase
3. Error Analysis. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Establishing Terminology 41
Creating a Starting Dataset of Traces 42
Defining Dimensions 43
Generating Tuples and Queries 44
Open Coding: Reading and Labeling Traces 46
Axial Coding: Structuring Failure Modes 48
Labeling Traces with Structured Failure Modes 50
Iteration and Refinement 51
Common Pitfalls 52
Putting It Together 53
4. Collaborative Evaluation Practices. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
When a Single Expert Is Enough 56
A Collaborative Annotation Workflow 57
Measuring Inter-Annotator Agreement 60
Percent Agreement: Simple but Misleading 60
Cohen’s Kappa: Adjusting for Chance 60
Interpreting Kappa Scores 62
Python Implementation 63
When to Use Other Metrics 64
Facilitating Alignment Sessions 66
Preparing for the Session 66
Running the Session 68
Techniques for Improving the Rubric 69
What to Avoid 70
Escalation 70
Save Everything 70
vi | Table of Contents
Common Pitfalls 71
Skipping Independent Annotation 71
Starting with a Vague Rubric 71
Using Only Percent Agreement 72
Ignoring Temporal Drift 72
Synthetic-Annotator Collusion 72
Focusing on Past Labels Instead of Future Consistency 72
Putting It Together 72
Part III. The Measure Phase
5. Implementing Automated Evaluators. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Defining the Right Metrics (What to Measure) 78
Implementing Metrics (How to Measure) 81
Writing LLM-as-Judge Prompts 82
Data Splits for Designing and Validating LLM-as-Judge 86
Iterative Prompt Refinement for the LLM-as-Judge 87
When to Stop Refining 88
If Alignment Stalls 89
Estimating True Success Rates with Imperfect Judges 89
Step 1: Measure Judge Accuracy 90
Step 2: Observe Raw Success Rate 90
Step 3: Correct the Observed Success Rate 91
Step 4: Quantify Uncertainty with a Bootstrap 91
Python Code for Estimating Success Rates 93
Optional: Group-wise Metrics for Evaluating Multiple Outputs 97
Common Pitfalls 99
Putting It Together 100
6. Evaluating Multi-Turn Conversations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
Evaluating at Different Levels 102
Session Level 102
Turn Level 103
Conversational Coherence and Memory 103
Practical Strategies for Multi-Turn Evaluation 105
Collecting Traces 105
Isolating Failures 105
Operationalizing Session-Level Success 107
User Simulators for Generating Test Conversations 107
Stratifying by Conversation Length 108
Perturbation Testing 108
Table of Contents | vii
Automated Evaluation of Multi-Turn Traces 109
Common Pitfalls 110
Putting It Together 110
7. Evaluating Retrieval-Augmented Generation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Overview 112
Synthetically Generating Query-Answer Pairs 114
Creating Harder Synthetic Queries 115
Filtering Synthetic Questions 116
Metrics for Retrieval Quality 117
Precision@k and Recall@k 117
Mean Reciprocal Rank 118
Normalized Discounted Cumulative Gain (NDCG@k) 118
Evaluating and Optimizing Chunking Strategies 120
Tuning Chunk Size and Overlap 121
Other Chunking Approaches 122
Evaluating Generation Quality 122
Common Pitfalls 123
Putting It Together 125
8. Evaluating Tool Use and Complex Agents. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
What Are Tools and Why Do LLMs Use Them? 127
The Spectrum of Agency 129
Evaluating Tool Calls 129
Stage 1: Tool Selection 130
Stage 2: Argument Generation 130
Stage 3: Tool Execution 131
Stage 4: Output Handling 132
Why Evaluate Each Stage Separately 132
Debugging Multi-Step Traces 134
Traceability 134
From Traces to Systemic Patterns 134
The Transition Failure Heatmap 135
Investigating Hotspots 136
Evolving the Heatmap over Time 137
Handling Complex Input Data 137
Images 137
Long Documents 138
PDF Documents 139
Adversarial and Security Evaluation 139
Common Pitfalls 140
Putting It Together 141
viii | Table of Contents
Part IV. Production and Improvement
9. Continuous Integration and Deployment for LLM Agents. . . . . . . . . . . . . . . . . . . . . . . 145
CI: Building a Safety Net Against Regressions 147
Common Mistakes with CI 149
Revisiting Prompts When Models Improve 149
CD and Online Monitoring 151
Observability 151
Running Automated Evaluators in Production 152
Guardrails 152
Judge Drift 154
The Continuous Improvement Flywheel 155
Common Pitfalls 156
Putting It Together 156
10. Interfaces for Human Review. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
The Case for Custom Review Interfaces 158
Essential Interface Elements 159
Features That Improve Review Speed and Quality 159
Case Study: EvalGen 161
Selecting Traces for Human Review 162
Random Sampling 162
Uncertainty Sampling 162
Failure-Driven Sampling 163
Navigating Trace Groups and Discovering Patterns 164
Clustering 164
Search and Similarity Tools 164
Integrating Human Review into Engineering Workflows 165
Example Walkthrough: Reviewing Real Estate Assistant Emails 165
Starting with a Spreadsheet 166
A Simple Custom UI 166
An Advanced Review Interface 168
Case Study: DocWrangler for Prompt Refinement 171
Common Pitfalls 173
Putting It Together 174
11. Data Analysis for Traces. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
EDA and Clustering to Surface Hypotheses 175
Clustering 176
Beyond Clustering 176
From Clusters to Confirmed Hypotheses 177
Semantic Search to Find Related Traces 178
Table of Contents | ix
Using AI Coding Assistants 179
Common Pitfalls 180
Putting It Together 180
12. Improving LLM Agents. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
Accuracy Optimization 181
Low Effort: Prompt Refinement 181
Medium Effort: Changing How the Agent Works 183
High Effort: Model-Level Changes 184
Cost Optimization 186
Match Model Size to Task Complexity 186
Cut Token Usage 186
Make Prompts Cache-Friendly 186
Batching 188
Distillation 188
Model Cascades 189
Routing 195
Closing: The Lifecycle Continues 195
Choosing an Improvement Strategy 196
Next Steps 196
Bibliography. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211


Book Details
Author Shreya Shankar, Hamel Husain
Publisher Shroff/O'Reilly
ISBN-13 9789368083085
Year 2026
Pages 240
Binding Paperback
Edition First
Country of Origin India

You may also like