Mapping SHAP Outputs to Narrative Templates
This framework maps static SHAP feature importance into an And-But-Therefore text structure to improve interpretability.
Translating Weights into Narrative
Translating model outputs for non-technical stakeholders usually relies on bar charts, which force users to mentally bridge the gap between statistical coefficients and real-world outcomes. An automated narrative approach replaces these visuals with text. The system maps numerical SHAP values directly into an And-But-Therefore (ABT) structure, treating model output as a sequence of factors meant for human consumption rather than technical audit.
The system partitions features based on the sign and magnitude of their contribution. Features are sorted by their SHAP value, from highest positive to lowest negative. The process groups all positive contributors into the 'And' segment, providing an additive list of factors that increase the model's prediction baseline. The 'But' segment captures the set of negative contributors that counteract this trend, effectively framing them as a reversal or dampening force on the prediction.
The 'Therefore' segment aggregates these partitioned values into a final synthesis. The system calculates this by summing the net contribution of all identified factors, ensuring the final output matches the total delta from the model's base value. This provides a narrative hook that ties the individual feature-level explanations back to the aggregate result the model actually produced.
Privacy and Interpretation
To manage sensitive data, the system implements a desensitization layer before feature inputs reach the generation engine. Raw numerical values are mapped into categorical bins such as 'Low', 'Average', or 'High'. Sending these labels rather than precise floats prevents the leakage of sensitive data like exact salary or specific loan amounts, which are often embedded in raw SHAP contribution scores. The model acts strictly as a formatter, arranging pre-calculated categorical labels into the narrative template. This decoupling ensures that while the explanation remains grounded in the math, the generation process never sees the raw underlying data.
| Feature | Traditional SHAP Visualizations | Narrative Storytelling Approach |
|---|---|---|
| Primary Format | Charts, plots, heatmaps | Textual narratives (ABT structure) |
| Accessibility | Low (Domain expertise required) | High (Non-expert friendly) |
| Logic Type | Statistical attribution | Narrative interpretation |
| Data Privacy | Standard | Categorical anonymization |
| Comprehensibility | Baseline | 76.4% (What-if) / 74.3% (Why-not) |
Implementation Risks and Limitations
When implementing this, the primary risk involves the loss of precision during the desensitization phase. If categorical bins are too wide, the narrative loses fidelity to the model's decision logic. In a mortgage underwriting model, if the system rounds an interest rate of 6.2% and 6.4% both to 'High', the narrative fails to distinguish between marginal impacts. This leads to narrative drift where the explanation provided to the user diverges from the underlying statistical model output.
What remains unknown is the performance of this approach when applied to high-dimensional datasets where the number of features exceeds the limits of readable text. Current implementations focus on the most impactful features, but the threshold for truncation is not yet standardized across domains. Future iteration will likely focus on whether recursive summarization can maintain accuracy as the feature count increases, or if the narrative template inherently forces a loss of data that cannot be recovered through refined prompting alone.