
Early access · 0 of 12 chapters
Is It Really Better?
Honest statistics for evaluating LLMs and AI agents
Michel d. S. Mesquita, PhD & CStat
Most decisions about AI are made on single demos and first impressions: a new prompt looks better, a new model tops a leaderboard, an update feels worse. This book teaches how LLMs and AI agents really work by building and testing them on things people care about at work and at home, and gives you the skills to know, with evidence, when something is really better.
Who it is for. AI engineers and data scientists who build LLM apps or agents. You are comfortable in Python; statistics at A-level or first-year university level is enough.
Every chapter answers a question you might actually have.
You learn how LLMs and agents work by testing them yourself.
Each chapter has a result that surprises, a playground, and a result card you can share.
Statistics, including design of experiments and Bayesian methods, is learned when the project needs it.
You keep a checklist and a new function in the companion Python package, isitbetter.
Contents
One new chapter a month. Chapters not yet published are shown in grey.
Part A. How an LLM answers
1.Does "take a deep breath" make AI smarter?
Coming soonTest popular prompt tricks (saying please, offering a tip, "you are an expert", "take a deep breath") on recorded runs. Rerun them and most of the gains disappear.
AI: what a language model does when it answers
Skills: run-to-run variation, effect size versus noise, bootstrap and permutation tests, error bars
2.Why did it answer differently this time?
Coming soonBuild a tiny text generator in the browser and turn the temperature dial.
AI: tokens, next-token probabilities, sampling, temperature
Skills: probability distributions, expected value, the law of large numbers, "right at least once" (pass@k) versus "right every time" (pass^k)
3.Which chatbot should I trust with my money questions?
Coming soonTwo assistants answer the same everyday finance questions (budgets, interest, savings).
AI: system prompts and how assistants differ
Skills: confidence intervals for a success rate, paired comparisons on the same questions, building a representative test set (stratified sampling)
Part B. Building an assistant
4.An agent in 40 lines: a weekend-trip planner
Coming soonBuild an agent with a loop, tools and memory, driven by a scripted model in the browser.
AI: the agent loop, tools, memory, stopping
Skills: compounding probability (why 95% per step becomes about 60% over ten steps), Monte Carlo simulation
5.Prompt, model, tools or memory: what actually made it better?
Coming soonChange several things at once in one well-designed experiment instead of one at a time.
AI: which parts of an agent matter
Skills: design of experiments: randomisation, blocking, factorial and fractional factorial designs, interactions, analysed with (logistic) regression
6.How many test runs can I afford?
Coming soonA budget in pounds, a deadline and a decision to make.
AI: cost, latency and quality trade-offs
Skills: power and sample size, the smallest effect worth detecting, clustered tasks and effective sample size, decision analysis with costs
Part C. AI that decides about people
7.Did a human or an AI write this essay?
Coming soonAI text detectors, students and false accusations.
AI: how detectors guess
Skills: Bayes' theorem and base rates, sensitivity and specificity, thresholds and the ROC curve
8.Would the AI shortlist your CV?
Coming soonA name-swap audit of an AI screener on invented CVs.
AI: how bias can enter a model's judgement
Skills: randomised matched-pair audit designs, Bayesian estimation (beta-binomial, credible intervals, the probability of a disparity larger than a set size), hierarchical models with partial pooling across job types
9.Can I trust the AI marking the work?
Coming soonLLM judges for essays and support replies.
AI: LLM-as-judge and its habits (position, length, self-preference)
Skills: inter-rater agreement (Cohen's kappa), ordinal scores, measurement bias, correcting many judge labels with a few human ones (prediction-powered inference)
Part D. Trusting AI out in the world
10.Is the AI as sure as it sounds?
Coming soonWhat weather forecasters learned about "70% chance of rain", applied to chatbots.
AI: stated and token-level confidence
Skills: calibration, reliability diagrams, proper scoring rules (Brier and log score), recalibration
11.The leaderboard says it is the best. Is it?
Coming soonRead AI rankings and news critically.
AI: benchmarks, arenas and contamination
Skills: rankings with uncertainty (Bradley-Terry for pairwise votes, rank intervals), multiple comparisons (Holm, false discovery rate), item response theory for task difficulty, validity
12.It got worse after the update. Did it?
Coming soonYour own evaluation lab, and a capstone on the trip-planner agent.
AI: silent model updates and drift
Skills: control charts, sequential tests and the peeking problem, A/A tests, online A/B tests with real users, Bayesian decision rules, an evaluation card
Appendices (they grow with each chapter): The statistical toolkit · How LLMs and agents work · Running the code · The isitbetter package
Run every line, for free
In the page
Live Python cells run in your browser. Nothing to install.
In Google Colab
Every chapter opens in Colab and runs on its free CPU under your own account.
On your machine
Clone the repository, install the requirements and open the chapter notebook.
No paid API on the main path: recorded runs are labelled with model and date, simulated data is labelled as simulated.
New chapters by email
Tell me when the next chapter is out.
One short email when a chapter is published. Used only for that; unsubscribe any time.
Text and figures under CC BY 4.0; code under MIT. Comments and corrections are welcome on GitHub.
M2Lab is my independent, personal initiative, done in my own time. It is not affiliated with, endorsed by or speaking for any employer.