Explainable AI (XAI) is the set of methods and design decisions that show why a model produced a particular result, in a form people can understand and verify. The goal is to check whether a model works correctly not only from its output but from its reasoning: which inputs pushed the decision in which direction, where the model is uncertain, and what would have changed the outcome. In decisions that directly affect people, such as credit, insurance, hiring and healthcare, this is no longer just good practice; it is a concrete requirement under the GDPR and the EU AI Act.
This article is written for technical leads, product owners and compliance teams planning a system that makes or recommends decisions with AI. It covers what each explanation method is good for, why large language models are a different case, and what the law actually asks for. It is not legal advice; confirm your own obligations with your legal counsel.
What is the difference between explainability and interpretability?
The two terms are often used interchangeably, but in engineering they point to different decisions. Interpretability means the model itself can be understood. In a logistic regression with a handful of variables, each coefficient tells you directly how much, and in which direction, that variable moves the result; in a shallow decision tree you can read which branches a decision went through. Here the model is the explanation.
Explainability means explaining, after the fact and with an additional method, the decisions of a model whose internals people cannot read, such as a deep neural network or an ensemble of hundreds of trees. These explanations are not the model; they are an approximation of its behaviour. The distinction matters: an approximate explanation can be wrong, while the coefficient of an interpretable model cannot be wrong, only misread.
That is why, for high-stakes decisions, the first question should not be "how do we explain the black box" but "is an interpretable model good enough for this problem". Cynthia Rudin's 2019 paper in Nature Machine Intelligence argues exactly this: for high-stakes decisions, use interpretable models from the start instead of trying to explain black boxes afterwards. On many tabular-data problems this advice costs less accuracy than teams expect.
Who needs an explanation, and why?
"The model should be explainable" is not a single requirement. Four audiences want four different explanations of the same decision:
- Developers and data scientists want to see whether the model learned the wrong thing. In the well-known example from the 2016 paper that introduced LIME, a classifier deliberately trained on flawed data to tell wolves from huskies turns out, thanks to the explanation, to be looking at the snow in the background rather than the animal. Accuracy metrics do not reveal this; the explanation does.
- Business owners and auditors want to know which factors the model relies on overall, and whether it contradicts business rules and policies.
- The person the decision is about wants to know why the decision came out the way it did and what they could change to get a different result. They expect a clear reason, not a technical chart.
- Regulators want to see which data and which process produced the decision, and that the person can contest it.
The US National Institute of Standards and Technology (NIST) set out four principles of explainable AI in NIST IR 8312, published in 2021: the system delivers an explanation for each output, the explanation is meaningful to its audience, the explanation accurately reflects the process the system used to produce the output, and the system operates only under the conditions it was designed for and with sufficient confidence (knowledge limits). The third principle is the one most projects skip: an explanation that sounds plausible but does not reflect what the model actually does is more dangerous than no explanation at all.
What are the main XAI methods?
Inherently interpretable models
Linear and logistic regression, shallow decision trees, rule lists and generalised additive models (GAMs) belong here. The Explainable Boosting Machine (EBM), a GAM variant in Microsoft's open-source InterpretML library, shows the effect of each variable as its own curve while aiming for accuracy close to ensemble models. These models need no separate explanation layer; you can show the auditor the model itself.
Global explanations
Global methods summarise the model's overall behaviour. Permutation importance measures how much accuracy drops when a variable's values are shuffled; partial dependence plots (PDPs) show how the average prediction changes as one variable changes. Global explanations answer "what does the model look at in general", but they do not explain the decision about one specific person.
Local explanations: LIME and SHAP
Local methods explain a single prediction. LIME (Ribeiro, Singh and Guestrin, 2016) perturbs the input around the example being explained, observes how the model reacts, and fits a simple model that mimics the behaviour in that neighbourhood. SHAP (Lundberg and Lee, 2017) is based on Shapley values from game theory: it gives each variable a fair share according to how far it moved the prediction away from the average. SHAP values added to the model's average prediction give exactly that example's prediction; this consistency makes SHAP a common tool for producing "the three factors that most influenced this decision" in areas such as credit scoring.
Both have weaknesses worth knowing. LIME depends on random sampling and can produce a different explanation for the same prediction when run again. When variables are strongly correlated, SHAP can end up computing over unrealistic combinations of data. Neither method shows causation inside the model; both show the relationship between input and output.
Methods for image and text models
Deep learning models use gradient-based methods. Grad-CAM (2017) shows, as a heat map, which regions of an image drove a classifier's decision; Integrated Gradients (2017) computes the contribution of each pixel or word by moving the input step by step from a neutral baseline to its actual value. These maps are valuable for diagnosis but should not be treated as proof on their own: whether a heat map reflects the model's real logic has to be tested separately.
Counterfactual explanations
A counterfactual explanation states the smallest change that would flip the result: "Your application would have been approved if your monthly income were above this amount and you had no late payments in the past six months." The advantage of this approach, proposed by Wachter, Mittelstadt and Russell in 2017, is that it gives the person an actionable reason without opening up the model. For the person the decision is about, it is usually the most meaningful kind of explanation. The suggested change must be realistic and within the person's control; an explanation that suggests changing their age or place of birth is useless and also raises a discrimination question.
How do you make large language models explainable?
Large language models (LLMs) do not fit the assumptions of classic XAI methods. The input is not a structured table but a context of thousands of words; the output is not a single number but free text. The models also contain billions of parameters and can give different answers to the same question.
The most common mistake is to treat the model's "chain of thought" as an explanation. Research published by Anthropic in 2025 showed that reasoning models often do not mention, in their chain of thought, the hints they actually used to reach an answer. The reasoning the model writes may not be the real cause of its decision. Mechanistic interpretability, which tries to trace a model's internal computation at the level of circuits, is advancing quickly, but it is not yet mature enough to explain a production system's decision to an auditor.
So in LLM-based systems, explainability comes from the architecture, not from the model:
- Source attribution: in RAG (retrieval-augmented generation) systems, every answer shows which document, and which section of it, the answer was generated from. Users can compare the answer with its source; an answer without a source cannot be used in a business process.
- Structured output and checks: instead of free text, the model produces defined fields; each field carries a source location and a confidence score, and records below a threshold go to human review.
- Audit trails for agents: which tool an AI agent called, with what input, what came back and at which step the decision was made are all logged step by step. The explanation is this record, readable after the fact.
- Measurement: a fixed question-and-answer set is re-run on every model and prompt change. The most solid way to show why a system works is to show, in numbers, where it fails.
In a critical process that decides about people, it is more defensible, both for explainability and for accountability, to have the LLM present its recommendation with its reasoning and sources to an authorised person than to use it as the final decision-maker.
What does the law require on explanations?
GDPR
Article 22 of the GDPR gives people the right not to be subject to decisions based solely on automated processing that produce legal or similarly significant effects; Article 15(1)(h) requires "meaningful information about the logic involved" in such decisions. In its judgment of 27 February 2025 in case C-203/22, Dun & Bradstreet Austria, the Court of Justice of the European Union clarified the scope of this duty: the controller must explain the procedure and principles actually applied, in a way that lets the person understand which of their personal data were used in the decision and how. According to the Court, simply handing over the algorithm is not a sufficiently concise and intelligible explanation; where trade secrets are claimed, the information goes to the supervisory authority or the court, which does the balancing.
The EU AI Act
The AI Act, Regulation (EU) 2024/1689, entered into force on 1 August 2024. Two of its articles stand out for explainability. Article 13 requires high-risk AI systems to be designed transparently enough for deployers to interpret the system's output and use it appropriately, and to come with instructions for use. Article 86 gives people affected by decisions that are based on the output of a high-risk system listed in Annex III, and that significantly affect them, the right to clear and meaningful explanations of the role of the AI system in the decision-making procedure and the main elements of the decision taken.
The timeline changed in 2026. Regulation (EU) 2026/1744 (the Digital Omnibus on AI), published in the Official Journal on 24 July 2026 and in force since 27 July 2026, postponed the application of the high-risk obligations to 2 December 2027 for systems listed in Annex III and to 2 August 2028 for systems embedded in products covered by Annex I. The delay buys preparation time; it does not remove the obligation. The Act also covers providers established outside the EU when their system's output is used in the EU, so a software company in Turkey or the UK offering decision-support systems to European clients is within scope.
Turkey's KVKK
For systems that also process data of people in Turkey, Article 11 of Turkey's Personal Data Protection Law (KVKK, Law No. 6698) gives the data subject the right to object to a result against them that arises from analysing their data exclusively through automated systems. As with the GDPR, the objection only works if the reasoning behind the decision has been recorded and a human process exists to review it.
How do you build explainability into an AI project?
Explainability is not a report added after training; it is a series of decisions made at the start of the project. This is the order we follow:
- Write down who the explanation is for. Define separate explanation formats for developers, auditors and the person the decision is about. For the latter, the target is usually a two- or three-sentence reason and one counterfactual suggestion.
- Start with an interpretable baseline. Measure the accuracy of a model such as logistic regression or an EBM first. Choose a more complex model only if it beats this baseline by a meaningful margin; if the gap is small, the gain in explainability is worth more.
- Test the explanation method too. Measure consistency (the same input gives the same explanation) and faithfulness (does the prediction actually change when the variables called most important are removed). An untested explanation is as risky as untested code.
- Put the explanation in the interface. Reason codes, the top three factors and the counterfactual belong on the screen where the decision is shown. Nobody reads an explanation that lives in a separate report file.
- Log every decision. Input, model version, output, explanation and any human approval should be stored together. If you cannot show six months later why a decision was made, the fact that it was explainable on the day means little.
- Build the objection and human review flow. Design who receives an objection, how many days the review takes and how the result is communicated. Under the GDPR and the KVKK, this is what the explanation is for.
- Monitor in production. If the ranking of feature importance shifts over time, you may have data drift. Monitoring explanations is one way to catch a problem before accuracy drops.
What are the limits of explainability?
Post-hoc explanations are approximations and can mislead. The "Fooling LIME and SHAP" study, presented at the AIES conference in 2020, showed that a model behaving in a discriminatory way can recognise the synthetic samples these methods use and answer them innocently, hiding its behaviour from LIME and SHAP explanations. An explanation method is not an audit tool on its own; it should be used together with fairness and error analyses run directly on the data.
Second, an explanation does not guarantee fairness. A model can explain its discriminatory decisions very clearly. Explanation makes the problem visible; it does not fix it. Third, there is information overload: showing the person a SHAP chart with a hundred variables is not transparency but handing responsibility to the reader. Finally, there is a real tension between trade secrets and the right to an explanation; the Court of Justice's judgment shows that the tension is resolved by balancing in front of a supervisory authority, not by telling the person nothing.
Explainable AI checklist
- You have established whether the system makes decisions about people and, if so, whether those decisions are fully automated.
- The system's classification under the GDPR, the AI Act and, where relevant, the KVKK has been confirmed with legal counsel.
- Explanation formats are defined separately for developers, auditors and the person the decision is about.
- An interpretable baseline model was measured; if a complex model was chosen, the reason is documented.
- The consistency and faithfulness of the explanation method have been tested.
- The person receives a clear reason and a realistic counterfactual suggestion.
- If an LLM is used, answers are shown with source attribution, and the chain of thought is not used as an explanation.
- The input, model version, output and explanation of every decision are logged together.
- The objection and human review flow has been designed and tested.
- Changes in explanations are monitored in production.
Frequently Asked Questions
Does every AI project need explainability? No. In systems that do not significantly affect people, such as film recommendations or content ranking, a detailed explanation layer is usually not worth its cost. In decisions with consequences for a person, such as credit, insurance, hiring, healthcare and public services, explainability is necessary both legally and for trust.
Is an explainable model less accurate? Not always. On many tabular-data problems the accuracy gap between interpretable and complex models is small. On images, audio and free text, deep learning models pull clearly ahead; in those cases post-hoc explanation methods and rigorous testing are used.
Should we use SHAP or LIME? On tabular data, especially with tree-based models, SHAP gives more consistent results and is preferred for reporting because, together with the average prediction, its values add up exactly to each prediction. LIME is easy to apply to different data types, but its results can change between runs. Whichever you choose, measure the consistency of the explanations on your own data.
Can we explain the decisions of a model like ChatGPT or Claude? Explaining the internal workings of such a model to a standard an auditor would accept is not possible today. Explainability comes from the system's architecture: showing the sources an answer relies on, structured output, step-by-step audit trails for agents and human approval for critical decisions. The reasoning the model writes about itself should not be accepted as the real cause of a decision.
Does the GDPR ban automated decisions? Not outright. Article 22 gives people the right not to be subject to solely automated decisions with legal or similarly significant effects, with exceptions such as explicit consent or necessity for a contract; even then, the person must be able to obtain human intervention, express their view and contest the decision. That only works if the reasoning is recorded and a human review process exists.
Does the EU AI Act apply to companies outside the EU? Yes, if the output of your system is used in the EU. The obligations for high-risk systems were postponed by Regulation (EU) 2026/1744 to 2 December 2027 for Annex III systems; the remaining time is enough to build explainability into the architecture, but it is not unlimited.
Will giving explanations expose our trade secrets? An explanation does not mean sharing the algorithm or the model weights. Under the Court of Justice's judgment in C-203/22, what is expected is an explanation that lets the person understand which of their data were used in the decision and how; information that needs protection goes to the supervisory authority or the court, which does the balancing.
If you are planning an AI system that makes or recommends decisions about people, we can design the explanation and logging layer together at the start of the project. Our AI solutions service describes how we handle source attribution, measurement and audit trails; our guide to GDPR-compliant AI covers how to draw data boundaries, and our article on taking AI agents to production covers agent permissions. To have an existing agent system reviewed, see our AI agent readiness audit; to discuss your project, simply fill in the quick quote form.
Related Services