Hands-On Explainable AI
Interpreting, Evaluating, and Trusting Large Language Models
A lab-first book about opening language models up: feature attribution, attention, probing, chain-of-thought faithfulness, mechanistic interpretability, behavioral audits, and what it takes to run all of that in production. Every number in the text comes from a notebook you can run yourself.
Chapters with executed labs
Each chapter is written from a notebook that actually ran. The labs fit a free Colab GPU, and the book quotes their real outputs, including the messy ones.
Honest results, kept in
Chapter 1 ships a model at 95% accuracy that collapses to coin-flipping after deployment. The ten-line explanation that would have caught it is the point of the book.
Audit your judges
Our LLM judge preferred whichever answer came first, in all 32 trials. Chapter 8 shows how to catch that before a leaderboard quietly inherits it.
Read the draft
The manuscript itself is private. Enter the access key to decrypt and read it here.
AES-256-GCM · decrypted only in your browser · nothing is sent anywhere
If the preview stays blank on your device, use Download or Open in new tab.
What’s inside
The Lay of the Land
Why accuracy is not understanding, a working map of every method family, and a tour of the transformer with the places explanations attach.
The Explanation Toolkit
SHAP, LIME, and gradients on one shared model; attention read honestly; probes and counterfactuals; then a case study that breaks its own pipeline, and the chapter that scores the explanations themselves.
Explaining the Model Itself
Whether chain-of-thought reasoning is faithful, what circuits and sparse autoencoders actually recover, and how to audit model values against real survey data.
Building Explainable LLM Systems
Training for faithfulness with DPO, then production: RAG with citation audits, drift monitors that fire before accuracy falls, and the EU AI Act mapped to the tools you now have.
About the author
© 2026 Hadi Mohammadi · all rights reserved · manuscript in progress