Papers › SyntaxShap: Syntax-aware Explainability Method for Text Generation

SyntaxShap: Syntax-aware Explainability Method for Text Generation

14 Feb 2024arXiv:2402.09259archive 2025-07-28

Kenza Amara, Rita Sevastjanova, Mennatallah El-Assady

To harness the power of large language models in safety-critical domains, we need to ensure the explainability of their predictions. However, despite the significant attention to model interpretability, there remains an unexplored domain in explaining sequence-to-sequence tasks using methods tailored for textual data. This paper introduces SyntaxShap, a local, model-agnostic explainability method for text generation that takes into consideration the syntax in the text data. The presented work extends Shapley values to account for parsing-based syntactic dependencies. Taking a game theoric approach, SyntaxShap only considers coalitions constraint by the dependency tree. We adopt a model-based evaluation to compare SyntaxShap and its weighted form to state-of-the-art explainability methods adapted to text generation tasks, using diverse metrics including faithfulness, coherency, and semantic alignment of the explanations to the model. We show that our syntax-aware method produces explanations that help build more faithful and coherent explanations for predictions by autoregressive models. Confronted with the misalignment of human and AI model reasoning, this paper also highlights the need for cautious evaluation strategies in explainable AI.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2402.09259")

Code

Syntology Ran 8 of 13 code samples harvested from 1 repository linked to this paper; 5 have no recorded run. Of those that ran: 8 ran with no contract checked.

By repository: official repository: 13 samples from 1 repository, 8 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

k-amara/syntax-shap officialmentioned in paperpytorchMIT report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

13 samples harvested; 8 ran; 0 honoured the contract we drafted; 5 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

8ran
5unverified

Licence: 0 of the 13 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from k-amara/syntax-shap. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

compute_output_dims k-amara/syntax-shap/syntaxshap/_explanation.py official repository ran MIT (permissive) · ede50da320fa78ec · report
convert_feat_to_mask k-amara/syntax-shap/syntaxshap/explainers/_syntax.py official repository ran MIT (permissive) · df7238e59087c763 · report
generate_explanatory_masks k-amara/syntax-shap/syntaxshap/metrics.py official repository ran MIT (permissive) · fabf25aaf5b6c859 · report
identity k-amara/syntax-shap/syntaxshap/links.py official repository ran fingerprinted MIT (permissive) · 2553ac83ca78410e · report
is_1d k-amara/syntax-shap/syntaxshap/_explanation.py official repository ran fingerprinted MIT (permissive) · e3c7e31f2f094463 · report
logit k-amara/syntax-shap/syntaxshap/links.py official repository ran fingerprinted MIT (permissive) · fecc5a713db5e4c9 · report
padleft_mask k-amara/syntax-shap/syntaxshap/metrics.py official repository ran MIT (permissive) · 5d10648588a144ac · report
save_path k-amara/syntax-shap/syntaxshap/explain.py official repository ran MIT (permissive) · 6bd33d5cb64c00c4 · report
california k-amara/syntax-shap/syntaxshap/datasets.py official repository unverified MIT (permissive) · 2a27f190c3200160 · report
imagenet50 k-amara/syntax-shap/syntaxshap/datasets.py official repository unverified MIT (permissive) · 120b0748cd14efa4 · report
load_model k-amara/syntax-shap/syntaxshap/model.py official repository unverified MIT (permissive) · 473e8cfc361163dc · report
weight_matrix k-amara/syntax-shap/syntaxshap/explainers/_syntax.py official repository unverified MIT (permissive) · eda4531c0d51f914 · report
weight_matrix_subset k-amara/syntax-shap/syntaxshap/explainers/_syntax.py official repository unverified MIT (permissive) · 725b5bebc44ac43b · report

Tasks

Text Generation

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections