Add explanation faithfulness notebook (#155)#156
Open
ilonae wants to merge 1 commit into
Open
Conversation
Adds a new notebook covering practical techniques for evaluating whether LLM explanation traces are faithful to the model's actual reasoning. Directly inspired by Anthropic's 2025 mechanistic interpretability research (circuit tracing / attribution graphs). Techniques covered: - Counterfactual probing (remove claimed features, measure output change) - Motivated reasoning detection (misleading hint experiment) - SHAP attribution comparison (local DistilBERT as reference model) - Model-graded reasoning evaluation (second-Claude-as-judge) - Combined faithfulness scorecard Handles anthropics#155
2000ee3 to
6bb3706
Compare
Silviupreda
approved these changes
May 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a new notebook to the
prompt_evaluations/directory exploring a question the existing course doesn't cover: can you trust why Claude says what it says?Adresses #155
What the notebook covers
Four techniques, all using only the standard API + a small local model:
The techniques are combined into a reusable
FaithfulnessScoredataclass / scorecard, following the eval harness pattern from Lesson 8.Why this matters
Faithfulness is orthogonal to accuracy — a model can produce correct outputs with explanations that don't reflect its actual reasoning. This matters most in high-stakes contexts (medical, legal, financial) where practitioners rely on the explanation, not just the answer.
Prerequisites assumed
prompt_evaluations/(Lessons 1–8),real_world_prompting/Technical requirements
anthropic,shap,transformers,torch— all installable via pip. The local model (DistilBERT, ~260MB) downloads and caches on first run.Directly inspired by:
Circuit Tracing: Revealing Computational Graphs in Language Models
On the Biology of a Large Language Model