Papers › Discretized Integrated Gradients for Explaining Language Models

Discretized Integrated Gradients for Explaining Language Models

31 Aug 2021EMNLP 2021 11arXiv:2108.13654archive 2025-07-28

Soumya Sanyal, Xiang Ren

As a prominent attribution-based explanation algorithm, Integrated Gradients (IG) is widely adopted due to its desirable explanation axioms and the ease of gradient computation. It measures feature importance by averaging the model's output gradient interpolated along a straight-line path in the input data space. However, such straight-line interpolated points are not representative of text data due to the inherent discreteness of the word embedding space. This questions the faithfulness of the gradients computed at the interpolated points and consequently, the quality of the generated explanations. Here we propose Discretized Integrated Gradients (DIG), which allows effective attribution along non-linear interpolation paths. We develop two interpolation strategies for the discrete word embedding space that generates interpolation points that lie close to actual words in the embedding space, yielding more faithful gradient computation. We demonstrate the effectiveness of DIG over IG through experimental and human evaluations on multiple sentiment classification datasets. We provide the source code of DIG to encourage reproducible research.

PaperPDFConference PDFCodeCode 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="2108.13654")

Code

Syntology Ran 5 of 22 code samples harvested from 2 repositories linked to this paper; 17 have no recorded run. Of those that ran: 5 ran with no contract checked.

By repository: official repository: 13 samples from 1 repository, 0 ran; community (archive-listed): 9 samples from 1 repository, 5 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

ink-usc/dig officialmentioned in papermentioned on GitHubpytorchMIT report
g8a9/ferret mentioned on GitHubpytorch 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

22 samples harvested; 5 ran; 0 honoured the contract we drafted; 17 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.

5ran
17unverified

Licence: 0 of the 22 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 2 repositories linked to this paper, official or community; each sample names its own and says which. “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.

distance ink-usc/dig/monotonic_paths.py official repository unverified MIT (permissive) · 83a6815c4f83e018 · report
eval_comprehensiveness ink-usc/dig/metrics.py official repository unverified MIT (permissive) · 12923c362c99f77c · report
eval_log_odds ink-usc/dig/metrics.py official repository unverified MIT (permissive) · ec63ecec627f3fac · report
eval_sufficiency ink-usc/dig/metrics.py official repository unverified MIT (permissive) · 8e63950975ae0d89 · report
make_monotonic_vec ink-usc/dig/monotonic_paths.py official repository unverified MIT (permissive) · f8bf80d1cf1649e5 · report
monotonic ink-usc/dig/monotonic_paths.py official repository unverified MIT (permissive) · 694effceefaf2cd4 · report
nn_forward_func ink-usc/dig/bert_helper.py official repository unverified MIT (permissive) · 74f3fd36cd31110f · report
nn_forward_func ink-usc/dig/distilbert_helper.py official repository unverified MIT (permissive) · c73850601b4bfca6 · report
nn_init ink-usc/dig/bert_helper.py official repository unverified MIT (permissive) · 1e9c64aa330afd59 · report
nn_init ink-usc/dig/distilbert_helper.py official repository unverified MIT (permissive) · 2301db8848f0fa1f · report
predict ink-usc/dig/bert_helper.py official repository unverified MIT (permissive) · f4c1f89220f52256 · report
run_dig_explanation ink-usc/dig/attributions.py official repository unverified MIT (permissive) · 0f56782c71796ff7 · report
summarize_attributions ink-usc/dig/attributions.py official repository unverified MIT (permissive) · 6fbd77010ba96ecf · report
BaseTextTaskHelper g8a9/ferret/ferret/explainers/gradient.py community (archive-listed) ran MIT (permissive) · f815bed681b134dc · report
Explanation g8a9/ferret/ferret/explainers/gradient.py community (archive-listed) ran MIT (permissive) · 7be99d7ee78f65a2 · report
SequenceClassificationHelper g8a9/ferret/ferret/explainers/gradient.py community (archive-listed) ran MIT (permissive) · 6d7956d91e40f00a · report
TokenClassificationHelper g8a9/ferret/ferret/explainers/gradient.py community (archive-listed) ran MIT (permissive) · 51a529a9451f6518 · report
ZeroShotTextClassificationHelper g8a9/ferret/ferret/explainers/gradient.py community (archive-listed) ran MIT (permissive) · 6ee6b2a8a337c1f7 · report
BaseExplainer g8a9/ferret/ferret/explainers/gradient.py community (archive-listed) unverified MIT (permissive) · 350432c068907cfc · report
BaseTaskHelper g8a9/ferret/ferret/explainers/gradient.py community (archive-listed) unverified MIT (permissive) · d15101324a574447 · report
IntegratedGradientExplainer g8a9/ferret/ferret/explainers/gradient.py community (archive-listed) unverified MIT (permissive) · 3a39393f1428fdef · report
create_helper g8a9/ferret/ferret/explainers/gradient.py community (archive-listed) unverified MIT (permissive) · f966d0a57a94d578 · report

Tasks

Feature ImportanceSentiment AnalysisSentiment Classification

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